wxPython 4 and the Linux "XDG" paths

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

wxPython 4 and the Linux "XDG" paths

Donn Ingle
Hello list,

According to the freedesktop spec, see link at end, typical user data and config paths should be:

XDG_DATA_HOME = ~/.local/share/
XDG_CONFIG_HOME = ~/.config/

I am testing wxPython 4 in a "venv" (python3 -m venv etc.) wherein I used pip to install wxPython on Ubuntu 16.04. (This is all new to me!)

Looking into wx.StandardPaths, I find:

(test1) donn@ddm:~/.../test1/bin$ python
Python 3.5.2 (default, Nov 23 2017, 16:37:01)

>>> import wx
>>> app=wx.App()
>>> sp=wx.StandardPaths.Get()
>>> sp.GetUserDataDir()
'/home/donn/.python'
>>> sp.GetConfigDir()
'/etc'
>>> sp.GetUserLocalDataDir()
'/home/donn/.python'
>>> sp.GetUserConfigDir()
'/home/donn'
>>> sp.GetLocalDataDir()
'/etc/python'

I cannot seem to find the strings that agree with the spec paths.

I tried wxPython's StandardPaths demo, with no better results.

Is this because I am in this "venv" thing? (I'm a total newb to this.)

It's rather NB for my app to get the Linux paths right. I need to reach into the ~/.config/fontconfig/ directory -- which can't be a hard-coded string.

Currently, I'm using GLib (the "python-gi" package) to fetch the XDG paths, but that's another depenency on top of wx.

That's the story, really. Is there something dumb I'm doing, or neglecting, in order to get correct XDG paths in wxPython?

Thanks!
/d

* Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Chris Barker - NOAA Federal
This is a big report/question for the wxWidgets project. WxPython is simply wrapping wxStandardPaths.

In the meantime, it’s trivial in python to access the user’s home for, so you can latch ina solution.

Or look for (or write!) a pure python “StandardPath” package that supports that standard.

-CHB

Sent from my iPhone

On Jan 25, 2018, at 3:03 AM, Donn Ingle <[hidden email]> wrote:

Hello list,

According to the freedesktop spec, see link at end, typical user data and config paths should be:

XDG_DATA_HOME = ~/.local/share/
XDG_CONFIG_HOME = ~/.config/

I am testing wxPython 4 in a "venv" (python3 -m venv etc.) wherein I used pip to install wxPython on Ubuntu 16.04. (This is all new to me!)

Looking into wx.StandardPaths, I find:

(test1) donn@ddm:~/.../test1/bin$ python
Python 3.5.2 (default, Nov 23 2017, 16:37:01)

>>> import wx
>>> app=wx.App()
>>> sp=wx.StandardPaths.Get()
>>> sp.GetUserDataDir()
'/home/donn/.python'
>>> sp.GetConfigDir()
'/etc'
>>> sp.GetUserLocalDataDir()
'/home/donn/.python'
>>> sp.GetUserConfigDir()
'/home/donn'
>>> sp.GetLocalDataDir()
'/etc/python'

I cannot seem to find the strings that agree with the spec paths.

I tried wxPython's StandardPaths demo, with no better results.

Is this because I am in this "venv" thing? (I'm a total newb to this.)

It's rather NB for my app to get the Linux paths right. I need to reach into the ~/.config/fontconfig/ directory -- which can't be a hard-coded string.

Currently, I'm using GLib (the "python-gi" package) to fetch the XDG paths, but that's another depenency on top of wx.

That's the story, really. Is there something dumb I'm doing, or neglecting, in order to get correct XDG paths in wxPython?

Thanks!
/d

* Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Tim Roberts
In reply to this post by Donn Ingle
Donn Ingle wrote:
>
> According to the freedesktop spec, see link at end, typical user data
> and config paths should be:
>
> XDG_DATA_HOME = ~/.local/share/
> XDG_CONFIG_HOME = ~/.config/

Do you see those values in your environment, if you type "env"?  If so,
then why not just use sys.environ['XDG_CONFIG_HOME']?    That's what the
base wxWidgets code does:

        wxString homeDir = wxFileName::GetHomeDir();
        wxString configPath;
        if (wxGetenv(wxT("XDG_CONFIG_HOME")))
            configPath = wxGetenv(wxT("XDG_CONFIG_HOME"));
        else
            configPath = homeDir + wxT("/.config");

There are several things to remember here.

1. This "spec" is just a recommendation.
2. It is a recommendation of the X Desktop Group, who created X
Windows.  It is unrelated to either Linux or to wx.
3. There are lots of recommendations in the Linux world.
4. Those values are only the "typical" values.
5. This recommendation was created long after wxWidgets, which was doing
its own thing before it came out.


> I cannot seem to find the strings that agree with the spec paths.
> I tried wxPython's StandardPaths demo, with no better results.
> Is this because I am in this "venv" thing? (I'm a total newb to this.)

No.  It's a "mists of antiquity" thing.


> It's rather NB for my app to get the Linux paths right. I need to
> reach into the ~/.config/fontconfig/ directory -- which can't be a
> hard-coded string.

Why not?  That's not really hard-coded, in the sense that it will adapt
itself to the local user because of the "~".


> Currently, I'm using GLib (the "python-gi" package) to fetch the XDG
> paths, but that's another depenency on top of wx.
>
> That's the story, really. Is there something dumb I'm doing, or
> neglecting, in order to get correct XDG paths in wxPython?

No.  Your flaw is in thinking that the XDG paths are somehow uniformly
"correct".

The XDG layouts were added to wxWidgets about a year ago.  It now
includes an wxStandardPaths::SetFileLayout function to select either the
default file layout or the XDG file layout.  I don't know whether that's
been exposed through wxPython or not.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Donn Ingle
In reply to this post by Donn Ingle
Small bump to ask whether I should post this StandardPaths question to the dev mailing list rather than users?

/d

On 25 January 2018 at 13:03, Donn Ingle <[hidden email]> wrote:
Hello list,

According to the freedesktop spec, see link at end, typical user data and config paths should be:

XDG_DATA_HOME = ~/.local/share/
XDG_CONFIG_HOME = ~/.config/

I am testing wxPython 4 in a "venv" (python3 -m venv etc.) wherein I used pip to install wxPython on Ubuntu 16.04. (This is all new to me!)

Looking into wx.StandardPaths, I find:

(test1) donn@ddm:~/.../test1/bin$ python
Python 3.5.2 (default, Nov 23 2017, 16:37:01)

>>> import wx
>>> app=wx.App()
>>> sp=wx.StandardPaths.Get()
>>> sp.GetUserDataDir()
'/home/donn/.python'
>>> sp.GetConfigDir()
'/etc'
>>> sp.GetUserLocalDataDir()
'/home/donn/.python'
>>> sp.GetUserConfigDir()
'/home/donn'
>>> sp.GetLocalDataDir()
'/etc/python'

I cannot seem to find the strings that agree with the spec paths.

I tried wxPython's StandardPaths demo, with no better results.

Is this because I am in this "venv" thing? (I'm a total newb to this.)

It's rather NB for my app to get the Linux paths right. I need to reach into the ~/.config/fontconfig/ directory -- which can't be a hard-coded string.

Currently, I'm using GLib (the "python-gi" package) to fetch the XDG paths, but that's another depenency on top of wx.

That's the story, really. Is there something dumb I'm doing, or neglecting, in order to get correct XDG paths in wxPython?

Thanks!
/d

* Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Robin Dunn
In reply to this post by Tim Roberts
On Thursday, January 25, 2018 at 10:49:09 AM UTC-8, Tim Roberts wrote:
Donn Ingle wrote:
>
> According to the freedesktop spec, see link at end, typical user data
> and config paths should be:
>
> XDG_DATA_HOME = ~/.local/share/
> XDG_CONFIG_HOME = ~/.config/

 
The XDG layouts were added to wxWidgets about a year ago.  It now
includes an wxStandardPaths::SetFileLayout function to select either the
default file layout or the XDG file layout.  I don't know whether that's
been exposed through wxPython or not.


Looks like it was added in wx 3.1, so it will need to wait until wxPython 4.1 before it's available.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org

 

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Robin Dunn
In reply to this post by Donn Ingle
On Monday, January 29, 2018 at 12:55:32 AM UTC-8, /d wrote:
Small bump to ask whether I should post this StandardPaths question to the dev mailing list rather than users?


No need. XDG paths will automatically be supported in 4.1 in wx.StandardPaths. In the meantime you may want to look for (or create) a python module that gives you the standard paths you need. When you switch to wxPython 4.1 you can then rewrite that module to use wx.StandardPaths instead.

-- 
Robin Dunn
Software Craftsman
http://wxPython.org


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Karsten Hilbert
On Mon, Jan 29, 2018 at 09:28:08AM -0800, Robin Dunn wrote:

> > Small bump to ask whether I should post this StandardPaths question to the
> > dev mailing list rather than users?
> >
> No need. XDG paths will automatically be supported in 4.1 in
> wx.StandardPaths. In the meantime you may want to look for (or create) a
> python module that gives you the standard paths you need. When you switch
> to wxPython 4.1 you can then rewrite that module to use wx.StandardPaths
> instead.


        $> pip install xdg

Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Donn Ingle
In reply to this post by Donn Ingle
I was thinking that this is a GTK/Gnome thing (The XDG standards) and this would make it a wx problem, not so much wxPython.

Should I wait for a reply here, take it to the wxPython-dev list or go to wxWidgets themselves?

/d

On 29 January 2018 at 10:54, Donn Ingle <[hidden email]> wrote:
Small bump to ask whether I should post this StandardPaths question to the dev mailing list rather than users?

/d


On 25 January 2018 at 13:03, Donn Ingle <[hidden email]> wrote:
Hello list,

According to the freedesktop spec, see link at end, typical user data and config paths should be:

XDG_DATA_HOME = ~/.local/share/
XDG_CONFIG_HOME = ~/.config/

I am testing wxPython 4 in a "venv" (python3 -m venv etc.) wherein I used pip to install wxPython on Ubuntu 16.04. (This is all new to me!)

Looking into wx.StandardPaths, I find:

(test1) donn@ddm:~/.../test1/bin$ python
Python 3.5.2 (default, Nov 23 2017, 16:37:01)

>>> import wx
>>> app=wx.App()
>>> sp=wx.StandardPaths.Get()
>>> sp.GetUserDataDir()
'/home/donn/.python'
>>> sp.GetConfigDir()
'/etc'
>>> sp.GetUserLocalDataDir()
'/home/donn/.python'
>>> sp.GetUserConfigDir()
'/home/donn'
>>> sp.GetLocalDataDir()
'/etc/python'

I cannot seem to find the strings that agree with the spec paths.

I tried wxPython's StandardPaths demo, with no better results.

Is this because I am in this "venv" thing? (I'm a total newb to this.)

It's rather NB for my app to get the Linux paths right. I need to reach into the ~/.config/fontconfig/ directory -- which can't be a hard-coded string.

Currently, I'm using GLib (the "python-gi" package) to fetch the XDG paths, but that's another depenency on top of wx.

That's the story, really. Is there something dumb I'm doing, or neglecting, in order to get correct XDG paths in wxPython?

Thanks!
/d

* Spec: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html


--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Tim Roberts
Donn Ingle wrote:
> I was thinking that this is a GTK/Gnome thing (The XDG standards) and
> this would make it a wx problem, not so much wxPython.
>
> Should I wait for a reply here, take it to the wxPython-dev list or go
> to wxWidgets themselves?

Are you not reading Robin's replies?  Robin is the author of wxPython. 
His word is golden.  The XDG stuff was all added in wxWidgets 3.1, which
is more recent than the current wxPython 4.0.  It will be exposed in
wxPython 4.1.

In the meantime, just hardcode it, using some of the examples presented
earlier in the thread.

--
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython 4 and the Linux "XDG" paths

Donn Ingle
In reply to this post by Donn Ingle
Apologies all! For some reason I was not getting notices of replies in my email. I've just read all the replies via the Google Groups web page.

I am happy to hear that the XDG stuff is incoming as it's being urged by projects like Gnome.

I'll read all the replies again when I can brain. Thanks all.
/d

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.