X2Go dev team | 17 Nov 02:25 2012

pyhoca-gui.git - master (branch) updated: 0.2.0.4-98-gfc28981

The branch, master has been updated
       via  fc28981a118db41c298d648ec4693d293c45d207 (commit)
      from  0f5614896481ff3423b911b550e39af9b394e2a9 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit fc28981a118db41c298d648ec4693d293c45d207
Author: Mike Gabriel <mike.gabriel@...>
Date:   Sat Nov 17 02:24:15 2012 +0100

    code cleanup with pyflakes

-----------------------------------------------------------------------

Summary of changes:
 pyhoca/wxgui/frontend.py       |   71 ++++++++++++++++++----------------------
 pyhoca/wxgui/logon.py          |    6 ----
 pyhoca/wxgui/menus_taskbar.py  |   35 ++++++++++----------
 pyhoca/wxgui/messages.py       |    1 -
 pyhoca/wxgui/profilemanager.py |    8 ++---
 pyhoca/wxgui/taskbar.py        |    3 --
 6 files changed, 50 insertions(+), 74 deletions(-)

The diff of changes is:
diff --git a/pyhoca/wxgui/frontend.py b/pyhoca/wxgui/frontend.py
index bb6cabe..a7800fc 100644
--- a/pyhoca/wxgui/frontend.py
+++ b/pyhoca/wxgui/frontend.py
 <at>  <at>  -35,7 +35,6  <at>  <at>  try:
 except: pass

 import os
-import re

 # Python X2go
 import x2go
 <at>  <at>  -45,10 +44,6  <at>  <at>  gevent.monkey.patch_all()

 import wx

-import time
-import sys
-import platform
-import types
 import copy
 import threading
 import locale
 <at>  <at>  -57,7 +52,6  <at>  <at>  import locale
 import about
 import logon
 import taskbar
-import menus_taskbar
 import profilemanager
 import printingprefs
 import notify
 <at>  <at>  -69,31 +63,31  <at>  <at>  import sessiontitle
 wx.SetDefaultPyEncoding("utf-8")
 wx.InitAllImageHandlers()

-def SetExitHandler(func):
-    """\
-    An exit handler function for MS Windows / Unix. Currently unused.
-
-     <at> param func: function that shall get registered with win32api as exit handler.
-     <at> type func: C{func}
-
-    """
-    if os.name == 'nt' :
-        try :
-            import win32api
-            result = win32api.SetConsoleCtrlHandler( func, True )
-            if result == 0:
-                print '\nCould not SetConsoleCtrlHandler (error %r)\n' % win32api
-            else :
-                print '\nSetConsoleCtrlHandler SUCCESS\n'
-
-        except ImportError :
-            version = '.'.join( map( str, sys.version_info[ :2] ) )
-            raise Exception( 'PyWin32 (win32api) is not installed.' )
-
-    else :
-        import signal
-        signal.signal( signal.SIGTERM, func )
-        signal.signal( signal.SIGINT, func )
+#def SetExitHandler(func):
+#    """\
+#    An exit handler function for MS Windows / Unix. Currently unused.
+#
+#     <at> param func: function that shall get registered with win32api as exit handler.
+#     <at> type func: C{func}
+#
+#    """
+#    if os.name == 'nt' :
+#        try :
+#            import win32api
+#            result = win32api.SetConsoleCtrlHandler( func, True )
+#            if result == 0:
+#                print '\nCould not SetConsoleCtrlHandler (error %r)\n' % win32api
+#            else :
+#                print '\nSetConsoleCtrlHandler SUCCESS\n'
+#
+#        except ImportError :
+#            #version = '.'.join( map( str, sys.version_info[ :2] ) )
+#            raise Exception( 'PyWin32 (win32api) is not installed.' )
+#
+#    else :
+#        import signal
+#        signal.signal( signal.SIGTERM, func )
+#        signal.signal( signal.SIGINT, func )

 
 class PyHocaGUI(wx.App, x2go.X2goClient):
 <at>  <at>  -616,7 +610,7  <at>  <at>  class PyHocaGUI(wx.App, x2go.X2goClient):
                         pass
                 else:
                     self.notifier.send(_(u'%s - connect') % profile_name, _(u'Public SSH key authentication has been
successful.'), icon='auth_success', timeout=4000)
-                    _dummy = self._X2goClient__list_sessions(session_uuid, refresh_cache=True, update_sessionregistry=True)
+                    self._X2goClient__list_sessions(session_uuid, refresh_cache=True, update_sessionregistry=True)
                     self._post_authenticate(evt, session_uuid)
                     try:
                         self._temp_disabled_profile_names.remove(profile_name)
 <at>  <at>  -755,11 +749,10  <at>  <at>  class PyHocaGUI(wx.App, x2go.X2goClient):

         """
         profile_name = self._eventid_profilenames_map[evt.GetId()]
-        _query_session = self._X2goClient__client_registered_sessions_of_profile_name(profile_name)[0]
         session_uuid = self._X2goClient__register_session(profile_name=profile_name, published_applications=False)
         if self._X2goClient__server_is_alive(session_uuid):
             gevent.spawn(self._X2goClient__start_session, session_uuid)
-            _dummy = self._X2goClient__list_sessions(session_uuid, refresh_cache=True)
+            self._X2goClient__list_sessions(session_uuid, refresh_cache=True)

     def OnPubAppSessionStart(self, evt):
         """\
 <at>  <at>  -799,7 +792,7  <at>  <at>  class PyHocaGUI(wx.App, x2go.X2goClient):
             if _s is not None and _s.is_alive():
                 try:
                     _s._X2goSession__exec_published_application(exec_name=_exec, timeout=40)
-                except x2go.x2go_exceptions.X2goControlSessionException, e:
+                except x2go.x2go_exceptions.X2goControlSessionException:
                     self.notifier.send(_(u'%s - session warning') % profile_name, _(u'Execution of command ,,%s\'\'
failed.') % _exec, icon='session_warning', timeout=10000)
         except KeyError:
             pass
 <at>  <at>  -814,11 +807,10  <at>  <at>  class PyHocaGUI(wx.App, x2go.X2goClient):
         """
         profile_name = self._eventid_profilenames_map[evt.GetId()]
         _application = self._eventid_applications_map[evt.GetId()]
-        _query_session = self._X2goClient__client_registered_sessions_of_profile_name(profile_name)[0]
         session_uuid = self._X2goClient__register_session(profile_name=profile_name,
cmd=_application, session_type="application")
         if self._X2goClient__server_is_alive(session_uuid):
             gevent.spawn(self._X2goClient__start_session, session_uuid)
-            _dummy = self._X2goClient__list_sessions(session_uuid, refresh_cache=True)
+            self._X2goClient__list_sessions(session_uuid, refresh_cache=True)

     def _disable_session_name(self, profile_name, session_name):
         """\
 <at>  <at>  -892,7 +884,7  <at>  <at>  class PyHocaGUI(wx.App, x2go.X2goClient):
         self._disable_session_name(profile_name, session_name)
         if self._X2goClient__server_is_alive(session_uuid):
             gevent.spawn(self._X2goClient__resume_session, session_name=session_name)
-            _dummy = self._X2goClient__list_sessions(session_uuid, refresh_cache=True)
+            self._X2goClient__list_sessions(session_uuid, refresh_cache=True)
         self._eventid_sessionnames_map = {}

     def OnSessionSuspend(self, evt):
 <at>  <at>  -1141,7 +1133,6  <at>  <at>  class PyHocaGUI(wx.App, x2go.X2goClient):
          <at> type evt: C{obj}

         """
-        profile_name = self._eventid_profilenames_map[evt.GetId()]
         session_name = self._eventid_sessionnames_map[evt.GetId()]
         _s = self._X2goClient__get_session_of_session_name(session_name, return_object=True)
         _s.raise_session_window()
 <at>  <at>  -1176,7 +1167,7  <at>  <at>  class PyHocaGUI(wx.App, x2go.X2goClient):

         """
         self._pyhoca_logger('opening the printing preferences window', loglevel=x2go.log.loglevel_INFO, )
-        _pp_dialog = printingprefs.PyHocaGUI_PrintingPreferences(self)
+        printingprefs.PyHocaGUI_PrintingPreferences(self)

     def OnClose(self, evt):
         """\
diff --git a/pyhoca/wxgui/logon.py b/pyhoca/wxgui/logon.py
index 95ea87f..aa6cede 100644
--- a/pyhoca/wxgui/logon.py
+++ b/pyhoca/wxgui/logon.py
 <at>  <at>  -39,13 +39,7  <at>  <at>  import gevent.monkey
 gevent.monkey.patch_all()

 import wx
-import time
 import os
-import sys
-import platform
-import types
-import copy
-import threading

 # PyHoca-GUI modules
 # ... NONE ...
diff --git a/pyhoca/wxgui/menus_taskbar.py b/pyhoca/wxgui/menus_taskbar.py
index 304e807..39632c4 100644
--- a/pyhoca/wxgui/menus_taskbar.py
+++ b/pyhoca/wxgui/menus_taskbar.py
 <at>  <at>  -31,7 +31,6  <at>  <at>  except: pass
 import os.path
 import wx
 import re
-import copy
 import StringIO
 import base64

 <at>  <at>  -225,7 +224,7  <at>  <at>  class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):
            _session_status == 'R' and \
            not _s.is_published_applications_provider():

-            _title = self.Append(text=_("Window title") + ": " + _s.get_session_title(), id=wx.NewId())
+            self.Append(text=_("Window title") + ": " + _s.get_session_title(), id=wx.NewId())
             self.AppendSeparator()

         if _session_status == 'S':
 <at>  <at>  -268,7 +267,7  <at>  <at>  class PyHocaGUI_Menu_TaskbarSessionActions(wx.Menu):

         if _s is not None and _s.is_published_applications_provider() and self._PyHocaGUI.get_profile_config(profile_name)['published']:
             self.AppendSeparator()
-            _rmi = self.Append(text=_(u"Refresh menu tree"), id=ID_REFRESHMENU)
+            self.Append(text=_(u"Refresh menu tree"), id=ID_REFRESHMENU)

         if _s is not None and \
            _s.get_session_type() in ('D', 'S') and \
 <at>  <at>  -318,7 +317,7  <at>  <at>  class PyHocaGUI_Menu_TaskbarProfileSharedFolders(wx.Menu):
         self._PyHocaGUI._eventid_profilenames_map[ID_SHARECUSTOMLOCALFOLDER] = \
             self._PyHocaGUI._eventid_profilenames_map[ID_UNSHAREALLLOCALFOLDERS] = profile_name

-        _share_folder = self.Append(id=ID_SHARECUSTOMLOCALFOLDER, text=_(u"&Share custom local folder"))
+        self.Append(id=ID_SHARECUSTOMLOCALFOLDER, text=_(u"&Share custom local folder"))

         self.AppendSeparator()

 <at>  <at>  -344,7 +343,7  <at>  <at>  class PyHocaGUI_Menu_TaskbarProfileSharedFolders(wx.Menu):
             self.Append(id=wx.NewId(), text=_(u'Share:'))
             for _unshared_folder in _unshared_folders:
                 ID_THISFOLDER = wx.NewId()
-                _unshared_folder_item = self.Append(id=ID_THISFOLDER, text="      %s" % _unshared_folder)
+                self.Append(id=ID_THISFOLDER, text="      %s" % _unshared_folder)
                 self._PyHocaGUI._eventid_profilenames_map[ID_THISFOLDER] = profile_name
                 self._PyHocaGUI._eventid_unshared_folders_map[ID_THISFOLDER] = _unshared_folder
                 self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnShareLocalFolder, id=ID_THISFOLDER)
 <at>  <at>  -355,7 +354,7  <at>  <at>  class PyHocaGUI_Menu_TaskbarProfileSharedFolders(wx.Menu):
             self.Append(id=wx.NewId(), text=_(u'Unshare:'))
             for _shared_folder in _shared_folders:
                 ID_THISFOLDER = wx.NewId()
-                _shared_folder_item = self.Append(id=ID_THISFOLDER, text="      %s" % _shared_folder)
+                self.Append(id=ID_THISFOLDER, text="      %s" % _shared_folder)
                 self._PyHocaGUI._eventid_profilenames_map[ID_THISFOLDER] = profile_name
                 self._PyHocaGUI._eventid_shared_folders_map[ID_THISFOLDER] = _shared_folder
                 self._PyHocaGUI.Bind(wx.EVT_MENU, self._PyHocaGUI.OnUnshareLocalFolder, id=ID_THISFOLDER)
 <at>  <at>  -865,18 +864,18  <at>  <at>  class PyHocaGUI_Menu_TaskbarProfileNames(wx.Menu):
                     filter_profiles.append(profile_name)

                 _this_id = wx.NewId()
-                _group = self.AppendMenu(text=profile_group, id=_this_id,
-                                         submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI, 
-                                                                                    caller=self,
-                                                                                    sub_profile_items=_sub_profile_items,
-                                                                                    filter_profiles=[],
-                                                                                    disabled_profiles=disabled_profiles,
-                                                                                    submenu=submenu,
-                                                                                    bind_method=bind_method,
-                                                                                    group_name=profile_group,
-                                                                                    parent_group=_parent_group,
-                                                                                    group_menus=True)
-                                        )
+                self.AppendMenu(text=profile_group, id=_this_id,
+                                     submenu=PyHocaGUI_Menu_TaskbarProfileNames(self._PyHocaGUI, 
+                                                                                caller=self,
+                                                                                sub_profile_items=_sub_profile_items,
+                                                                                filter_profiles=[],
+                                                                                disabled_profiles=disabled_profiles,
+                                                                                submenu=submenu,
+                                                                                bind_method=bind_method,
+                                                                                group_name=profile_group,
+                                                                                parent_group=_parent_group,
+                                                                                group_menus=True)
+                                    )

         if filter_profiles:
             _profile_names = [ p for p in _profile_names if p not in filter_profiles ]
diff --git a/pyhoca/wxgui/messages.py b/pyhoca/wxgui/messages.py
index 1829688..2fe0a10 100644
--- a/pyhoca/wxgui/messages.py
+++ b/pyhoca/wxgui/messages.py
 <at>  <at>  -24,7 +24,6  <at>  <at> 

 import wx
 import os
-import gevent

 # PyHoca-GUI modules
 import basepath
diff --git a/pyhoca/wxgui/profilemanager.py b/pyhoca/wxgui/profilemanager.py
index 46a8412..049065a 100644
--- a/pyhoca/wxgui/profilemanager.py
+++ b/pyhoca/wxgui/profilemanager.py
 <at>  <at>  -22,8 +22,6  <at>  <at>  import wx
 import os 
 import copy

-import sys
-import locale
 import re

 import x2go.log as log
 <at>  <at>  -31,9 +29,7  <at>  <at>  import x2go.utils as utils
 import x2go.defaults as defaults
 from x2go import X2GOCLIENT_OS

-from x2go import defaults
 from x2go._paramiko import PARAMIKO_FEATURE
-import notify
 import basepath

 _icons_location = basepath.icons_basepath
 <at>  <at>  -418,7 +414,7  <at>  <at>  class PyHocaGUI_ProfileManager(wx.Dialog):
         else:
             self.SetTitle(_(u"PyHoca-GUI Profile Manager - %s") % self.profile_config['name'])
         self.SetFont(wx.Font(9, wx.DEFAULT, wx.NORMAL, wx.NORMAL, 0, ""))
-        _textfield_height = 30
+        self._textfield_height = 30

         self.ProfileNameLabel.SetMinSize((160, 16))
         self.ProfileName.SetMinSize((320, self._textfield_height))
 <at>  <at>  -1453,7 +1449,7  <at>  <at>  class PyHocaGUI_ProfileManager(wx.Dialog):
             path_to_icon = dlg.GetPath()
             self.IconButton.SetBitmapLabel(wx.Bitmap(path_to_icon, wx.BITMAP_TYPE_ANY))
             self.IconPath = path_to_icon
-            default_icon = False
+            self.default_icon = False

     def OnSetSessionWindowTitle(self, event):
         """\
diff --git a/pyhoca/wxgui/taskbar.py b/pyhoca/wxgui/taskbar.py
index 7fbdd3b..f79feca 100644
--- a/pyhoca/wxgui/taskbar.py
+++ b/pyhoca/wxgui/taskbar.py
 <at>  <at>  -43,12 +43,9  <at>  <at>  if x2go.X2GOCLIENT_OS == 'Windows':
     import win32gui

 import os
-import sys
-import copy

 # PyHoca-GUI modules
 import menus_taskbar
-import profilemanager
 import basepath

 _icons_location = basepath.icons_basepath

hooks/post-receive

Gmane