[X2Go-Commits] [pyhoca-gui] 01/01: fix icon location detection
git-admin at x2go.org
git-admin at x2go.org
Wed Mar 5 11:44:07 CET 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository pyhoca-gui.
commit c408e427028ccf63e83f82e0e98e4428a7381ad0
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Wed Mar 5 11:43:33 2014 +0100
fix icon location detection
---
pyhoca/wxgui/basepath.py | 56 +++++++++++++++++++++++-----------------
pyhoca/wxgui/launcher.py | 3 +--
pyhoca/wxgui/profilemanager.py | 15 ++++++-----
pyhoca/wxgui/taskbar.py | 3 ++-
4 files changed, 43 insertions(+), 34 deletions(-)
diff --git a/pyhoca/wxgui/basepath.py b/pyhoca/wxgui/basepath.py
index c324c9b..f259476 100644
--- a/pyhoca/wxgui/basepath.py
+++ b/pyhoca/wxgui/basepath.py
@@ -21,32 +21,40 @@
import os
from x2go import X2GOCLIENT_OS as _X2GOCLIENT_OS
-if os.environ.has_key('PYHOCAGUI_DEVELOPMENT') and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1':
- _base_location = os.path.abspath(os.path.curdir)
- _icons_location = os.path.join(_base_location, 'icons')
- _images_location = os.path.join(_base_location, 'img')
- if _X2GOCLIENT_OS != 'Windows':
- _locale_location = os.path.join(_base_location, 'locale')
- else:
- _locale_location = os.path.join(_base_location, 'build', 'mo')
- _nxproxy_location = os.path.join(_base_location, '..', 'pyhoca-contrib', 'mswin', 'nxproxy-mswin', 'nxproxy.exe')
- _pulseaudio_location = os.path.join(_base_location, '..', 'pyhoca-contrib', 'mswin', 'pulseaudio-mswin', 'pulseaudio-1.1', 'pulseaudio.exe')
-else:
- if _X2GOCLIENT_OS == 'Windows':
+def reload_base_paths():
+ if os.environ.has_key('PYHOCAGUI_DEVELOPMENT') and os.environ['PYHOCAGUI_DEVELOPMENT'] == '1':
_base_location = os.path.abspath(os.path.curdir)
_icons_location = os.path.join(_base_location, 'icons')
_images_location = os.path.join(_base_location, 'img')
- _locale_location = os.path.join(_base_location, 'mo')
- _nxproxy_location = os.path.join(_base_location, 'nxproxy', 'nxproxy.exe')
- _pulseaudio_location = os.path.join(_base_location, 'pulseaudio', 'pulseaudio.exe')
+ if _X2GOCLIENT_OS != 'Windows':
+ _locale_location = os.path.join(_base_location, 'locale')
+ else:
+ _locale_location = os.path.join(_base_location, 'build', 'mo')
+ _nxproxy_location = os.path.join(_base_location, '..', 'pyhoca-contrib', 'mswin', 'nxproxy-mswin', 'nxproxy.exe')
+ _pulseaudio_location = os.path.join(_base_location, '..', 'pyhoca-contrib', 'mswin', 'pulseaudio-mswin', 'pulseaudio-1.1', 'pulseaudio.exe')
else:
- _icons_location = '/usr/share/icons'
- _images_location = '/usr/share/pyhoca/img'
- _locale_location = '/usr/share/locale'
+ if _X2GOCLIENT_OS == 'Windows':
+ _base_location = os.path.abspath(os.path.curdir)
+ _icons_location = os.path.join(_base_location, 'icons')
+ _images_location = os.path.join(_base_location, 'img')
+ _locale_location = os.path.join(_base_location, 'mo')
+ _nxproxy_location = os.path.join(_base_location, 'nxproxy', 'nxproxy.exe')
+ _pulseaudio_location = os.path.join(_base_location, 'pulseaudio', 'pulseaudio.exe')
+ else:
+ _icons_location = '/usr/share/icons'
+ _images_location = '/usr/share/pyhoca/img'
+ _locale_location = '/usr/share/locale'
+
+ global icons_basepath
+ global images_basepath
+ icons_basepath = _icons_location
+ images_basepath = _images_location
+ if _X2GOCLIENT_OS == 'Windows':
+ global nxproxy_binary
+ nxproxy_binary = _nxproxy_location
+ global pulseaudio_binary
+ pulseaudio_binary = _pulseaudio_location
+ global locale_basepath
+ locale_basepath = _locale_location
-icons_basepath = _icons_location
-images_basepath = _images_location
-if _X2GOCLIENT_OS == 'Windows':
- nxproxy_binary = _nxproxy_location
- pulseaudio_binary = _pulseaudio_location
-locale_basepath = _locale_location
+reload_base_paths()
\ No newline at end of file
diff --git a/pyhoca/wxgui/launcher.py b/pyhoca/wxgui/launcher.py
index af703e9..fc3299c 100644
--- a/pyhoca/wxgui/launcher.py
+++ b/pyhoca/wxgui/launcher.py
@@ -104,8 +104,7 @@ VERSION: %s
sys.path.insert(0, os.getcwd())
os.environ['PYHOCAGUI_DEVELOPMENT'] = '1'
print '### %s running in development mode ###' % self.PROG_NAME
- reload(basepath)
- reload(taskbar)
+ basepath.reload_base_paths()
def check_running(self):
if X2GOCLIENT_OS in ('Linux', 'Mac'):
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index faea0cf..071b413 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
@@ -32,7 +32,6 @@ from x2go import X2GOCLIENT_OS
from x2go._paramiko import PARAMIKO_FEATURE
import basepath
-_icons_location = basepath.icons_basepath
_known_encodings = utils.known_encodings()
from wx.lib.mixins.listctrl import CheckListCtrlMixin
@@ -63,6 +62,8 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
@type profile_name: C{str}
"""
+ self._icons_location = basepath.icons_basepath
+
self._PyHocaGUI = _PyHocaGUI
self._pyhoca_logger = self._PyHocaGUI._pyhoca_logger
@@ -213,7 +214,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.UseDefaultSessionWindowTitle = wx.CheckBox(self.tab_Profile, -1, _(u"Use a default session window title"))
self.CustomSessionWindowTitleLabel = wx.StaticText(self.tab_Profile, -1, _(u"Custom session window title") + ": ")
self.CustomSessionWindowTitle = wx.TextCtrl(self.tab_Profile, -1, "")
- path_to_icon = os.path.normpath('%s/%s/128x128/%s_sessionicon.png' % (_icons_location, self._PyHocaGUI.appname, self._PyHocaGUI.appname))
+ path_to_icon = os.path.normpath('%s/%s/128x128/%s_sessionicon.png' % (self._icons_location, self._PyHocaGUI.appname, self._PyHocaGUI.appname))
self.default_icon = True
if 'icon' in self.profile_config and self.profile_config['icon'] == ':icons/128x128/x2gosession.png':
# interpret the default x2gosession.png icon entry in session profile config as the PyHoca icon...
@@ -227,7 +228,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
path_to_icon = os.path.normpath(path_to_icon)
self.default_icon = False
if not os.path.exists(os.path.expanduser(path_to_icon)):
- path_to_icon = os.path.normpath('%s/PyHoca/128x128/PyHoca-GUI_sessionicon.png' % _icons_location)
+ path_to_icon = os.path.normpath('%s/PyHoca/128x128/PyHoca-GUI_sessionicon.png' % self._icons_location)
self.default_icon = True
self.IconPath = path_to_icon
self.IconButtonLabel = wx.StaticText(self.tab_Profile, -1, _(u"Window Icon")+": ")
@@ -266,7 +267,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SSHPort = wx.SpinCtrl(self.tab_Connection, -1, "22", min=1, max=65534)
self.SSHKeyFileLabel = wx.StaticText(self.tab_Connection, -1, _(u"Key")+": ")
self.SSHKeyFile = wx.TextCtrl(self.tab_Connection, -1, style=wx.TE_PROCESS_ENTER)
- self.SSHKeyFileBrowseButton = wx.BitmapButton(self.tab_Connection, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), )
+ self.SSHKeyFileBrowseButton = wx.BitmapButton(self.tab_Connection, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % self._icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), )
self.SSHAutoLogin = wx.CheckBox(self.tab_Connection, -1, _(u"Discover SSH keys or use SSH agent for X2Go authentication"))
if PARAMIKO_FEATURE['forward-ssh-agent']:
self.SSHForwardAuthAgent = wx.CheckBox(self.tab_Connection, -1, _(u"Enable forwarding of SSH authentication agent connections"))
@@ -278,7 +279,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.SSHProxySamePassword = wx.CheckBox(self.tab_Connection, -1, _(u"Use same authentication for X2Go and proxy host"))
self.SSHProxyKeyFileLabel = wx.StaticText(self.tab_Connection, -1, _(u"Key file")+": ")
self.SSHProxyKeyFile = wx.TextCtrl(self.tab_Connection, -1, style=wx.TE_PROCESS_ENTER)
- self.SSHProxyKeyFileBrowseButton = wx.BitmapButton(self.tab_Connection, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), )
+ self.SSHProxyKeyFileBrowseButton = wx.BitmapButton(self.tab_Connection, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % self._icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), )
self.SSHProxyHostLabel = wx.StaticText(self.tab_Connection, -1, _(u"Host")+": ")
self.SSHProxyHost = wx.TextCtrl(self.tab_Connection, -1, "", size=wx.Size(80,20))
self.SSHProxyPortLabel = wx.StaticText(self.tab_Connection, -1, _(u"Port")+": ")
@@ -345,7 +346,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
self.RestoreSharedLocalFolders = wx.CheckBox(self.tab_SharedResources, -1, _(u"Store share list at end of session"))
self.SharedFolderPathLabel = wx.StaticText(self.tab_SharedResources, -1, _(u"Path")+": ")
self.SharedFolderPath = wx.TextCtrl(self.tab_SharedResources, -1, "", style=wx.TE_PROCESS_ENTER)
- self.SharedFolderPathBrowseButton = wx.BitmapButton(self.tab_SharedResources, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % _icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), )
+ self.SharedFolderPathBrowseButton = wx.BitmapButton(self.tab_SharedResources, -1, wx.Bitmap('%s/PyHoca/16x16/system-search.png' % self._icons_location, wx.BITMAP_TYPE_ANY), size=wx.Size(self._textfield_height,self._textfield_height), )
self.AddSharedFolderPathButton = wx.Button(self.tab_SharedResources, -1, _(u"Add"))
self.SharedFoldersList = CheckListCtrl(self.tab_SharedResources)
self.SharedFoldersList.InsertColumn(0, _("Local Path"), wx.LIST_FORMAT_LEFT)
@@ -1452,7 +1453,7 @@ class PyHocaGUI_ProfileManager(wx.Dialog):
@type event: C{obj}
"""
- iconsdir = _icons_location
+ iconsdir = self._icons_location
if not os.path.exists(iconsdir):
iconsdir = os.getcwd()
wildcard = _(u"Icon Files (*.png)|*.png|" \
diff --git a/pyhoca/wxgui/taskbar.py b/pyhoca/wxgui/taskbar.py
index a1f1d9f..ddd2104 100644
--- a/pyhoca/wxgui/taskbar.py
+++ b/pyhoca/wxgui/taskbar.py
@@ -48,7 +48,6 @@ import os
import menus_taskbar
import basepath
-_icons_location = basepath.icons_basepath
def MakeIcon(icon_name, fallback_name='PyHoca-GUI_trayicon.png', appname="PyHoca-GUI"):
"""\
@@ -73,6 +72,8 @@ def MakeIcon(icon_name, fallback_name='PyHoca-GUI_trayicon.png', appname="PyHoca
if icon_name is None:
icon_name = '{appname}_trayicon'.format(appname=appname)
+ _icons_location = basepath.icons_basepath
+
icon_name = os.path.expanduser(icon_name)
if not icon_name.lower().endswith('.png'):
icon_name = '%s.png' % icon_name
--
Alioth's /srv/git/_hooks_/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git
More information about the x2go-commits
mailing list