[X2Go-Commits] pyhoca-gui.git - twofactorauth (branch) updated: 01a93b762fa3bc7a7fd8ba96284663f79614e0d4

X2Go dev team git-admin at x2go.org
Sat Sep 14 15:54:22 CEST 2013


The branch, twofactorauth has been updated
       via  01a93b762fa3bc7a7fd8ba96284663f79614e0d4 (commit)
      from  5691ba40755a1012db3ba44627c3519e5ea4f13f (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 -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 debian/control           |    2 +-
 pyhoca-gui               |  120 +++++++++++++++++++++++++++-------------------
 pyhoca/wxgui/__init__.py |    2 +-
 3 files changed, 74 insertions(+), 50 deletions(-)

The diff of changes is:
diff --git a/debian/control b/debian/control
index 5b240ac..e7d34c2 100644
--- a/debian/control
+++ b/debian/control
@@ -9,7 +9,7 @@ XS-Python-Version: >= 2.6
 
 Package: pyhoca-gui
 Architecture: all
-Depends: ${misc:Depends}, python, python-x2go (>=0.0.24-0~nwt1), python-argparse, python-notify, 
+Depends: ${misc:Depends}, python, python-x2go (>=0.0.24-0~nwt1), python-argparse, python-notify, python-setproctitle (>=1.0.1-1)
     wx-common(>=2.8.10.0), python-wxtools (>=2.8.10.0)
 Description: An graphical X2go client written in (wx)Python
  A graphical X2go client implementation written in (wx)Python.
diff --git a/pyhoca-gui b/pyhoca-gui
index badedff..baea2d1 100755
--- a/pyhoca-gui
+++ b/pyhoca-gui
@@ -38,35 +38,30 @@ except: pass
 
 import argparse
 import os
-import os.path
 import sys
 import exceptions
+import setproctitle
 
-app = sys.argv[0]
-if app.startswith('./') or os.path.dirname(__file__).endswith('trunk'):
-    sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
-    os.environ['PYHOCAGUI_DEVELOPMENT'] = '1'
-    print '### PyHoca-GUI running in development mode ###'
+PROG_NAME = os.path.basename(__file__)
+PROG_PID  = os.getpid()
+setproctitle.setproctitle(PROG_NAME)
 
 # Python X2go modules
-import x2go
+from x2go import X2GOCLIENT_OS as _X2GOCLIENT_OS
+from x2go import CURRENT_LOCAL_USER as _CURRENT_LOCAL_USER
+if _X2GOCLIENT_OS == 'Windows':
+    from x2go import X2goClientXConfig as _X2goClientXConfig
+from x2go import X2goLogger as _X2goLogger
+from x2go import x2go_cleanup as _x2go_cleanup
 
+from pyhoca.wxgui import __VERSION__ as _version
 from pyhoca.wxgui import PyHocaGUI
 
-# sometimes we have to fail...
-def runtime_error(m, parser=None, exitcode=-1):
-    """\
-    STILL UNDOCUMENTED
-    """
-    if parser is not None:
-        parser.print_usage()
-    sys.stderr.write ("%s: error: %s\n" % (os.path.basename(sys.argv[0]), m))
-    sys.exit(exitcode)
+
+__author__ = "Dick J. Kniep, Mike Gabriel"
+__version__ = _version
 
 # version information
-PROG_NAME = os.path.basename(sys.argv[0])
-PROG_PID  = os.getpid()
-from pyhoca.wxgui import __VERSION__ as _version
 VERSION=_version
 VERSION_TEXT="""
 %s[%s] - an X2go GUI client written in Python
@@ -78,14 +73,56 @@ VERSION: %s
 
 """ % (PROG_NAME, PROG_PID, VERSION)
 
-__author__ = "Dick J. Kniep, Mike Gabriel"
-__version__ = _version
 
-if x2go.X2GOCLIENT_OS == 'Windows':
-    _x = x2go.xserver.X2goClientXConfig()
+def check_running():
+    if _X2GOCLIENT_OS  in ('Linux', 'Mac'):
+        p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
+        psA_out = p.communicate()
+        return psA_out[0].count(PROG_NAME) > 1
+    elif X2GOCLIENT_OS == 'Windows':
+        import wmi
+        w = wmi.WMI()
+        _p_names = []
+        for process in _wmi.Win32_Process():
+            _p_names.append(process.Name)
+        return len([ _p_name for _p_name in _p_names if _p_name == PROG_NAME) > 1
+
+
+def version():
+    # print version text and exit
+    sys.stderr.write ("%s\n" % VERSION_TEXT)
+    sys.exit(0)
+
+
+# sometimes we have to fail...
+def runtime_error(m, parser=None, exitcode=-1):
+    """\
+    STILL UNDOCUMENTED
+    """
+    if parser is not None:
+        parser.print_usage()
+    sys.stderr.write ("%s: error: %s\n" % (PROG_NAME, m))
+    sys.exit(exitcode)
+
+
+if check_running(): 
+    sys.stderr.write("\n###############################\n### %s: already running for user %s\n###############################\n" % (PROG_NAME, _CURRENT_LOCAL_USER))
+    version()
+
+
+app = sys.argv[0]
+if app.startswith('./') or os.path.dirname(__file__).endswith('trunk'):
+    sys.path.insert(0, os.path.join(os.path.dirname(__file__)))
+    os.environ['PYHOCAGUI_DEVELOPMENT'] = '1'
+    print '### PyHoca-GUI running in development mode ###'
+
+
+if _X2GOCLIENT_OS == 'Windows':
+    _x = _X2goClientXConfig()
     _known_xservers = _x.known_xservers
     _installed_xservers = _x.installed_xservers
 
+
 # debug options...
 debug_options =  [
                    {'args':['-d','--debug'], 'default': False, 'action': 'store_true', 'help': 'enable application debugging code', },
@@ -105,12 +142,13 @@ x2go_gui_options = [
                    {'args':['--disable-options'], 'default': False, 'action': 'store_true', 'help': 'disable the client options configuration window', },
                    {'args':['--disable-profilemanager'], 'default': False, 'action': 'store_true', 'help': 'disable the session profile manager window', },
                  ]
-if x2go.X2GOCLIENT_OS == 'Windows':
+if _X2GOCLIENT_OS == 'Windows':
     xserver_options = [
                        {'args':['--start-xserver'], 'default': False, 'action': 'store_true', 'help': 'start the XServer before starting PyHoca-GUI, detect best XServer automatically, if more than one XServer is installed on your system', },
                        {'args':['-X', '--preferred-xserver'], 'default': None, 'metavar': 'XSERVER', 'choices': _known_xservers, 'help': 'start either of the currently supported XServers: %s -- make sure your preferred XServer is installed on your system' % _known_xservers, },
                       ]
 
+
 def parseargs():
 
     global DEBUG
@@ -123,7 +161,7 @@ def parseargs():
     p_guiopts = p.add_argument_group('PyHoca GUI options')
     p_xserveropts = p.add_argument_group('XServer options (MS Windows only)')
 
-    if x2go.X2GOCLIENT_OS == 'Windows':
+    if _X2GOCLIENT_OS == 'Windows':
         _option_groups = ((p_guiopts, x2go_gui_options), (p_debugopts, debug_options), (p_xserveropts, xserver_options))
     else:
         _option_groups = ((p_guiopts, x2go_gui_options), (p_debugopts, debug_options))
@@ -137,8 +175,8 @@ def parseargs():
 
     a = p.parse_args()
 
-    logger = x2go.X2goLogger(tag='PyHoca-GUI')
-    liblogger = x2go.X2goLogger()
+    logger = _X2goLogger(tag='PyHoca-GUI')
+    liblogger = _X2goLogger()
 
     if a.debug:
         logger.set_loglevel_debug()
@@ -153,36 +191,22 @@ def parseargs():
         version()
 
     if a.username is None:
-        a.username = x2go.CURRENT_LOCAL_USER
+        a.username = _CURRENT_LOCAL_USER
 
-    if x2go.X2GOCLIENT_OS == 'Windows' and a.preferred_xserver:
+    if _X2GOCLIENT_OS == 'Windows' and a.preferred_xserver:
         if a.preferred_xserver not in _installed_xservers:
             runtime_error('Xserver ,,%s\'\' is not installed on your Windows system' % a.preferred_xserver, parser=p)
         a.start_xserver = a.preferred_xserver
 
     return a, logger, liblogger
 
-# print version text and exit
-def version():
-
-    sys.stderr.write ("%s\n" % VERSION_TEXT)
-    sys.exit(0)
-
-def check_running(logger):
-    if x2go.X2GOCLIENT_OS  in ('Linux', 'Mac'):
-        p = subprocess.Popen(['ps', '-A'], stdout=subprocess.PIPE)
-        psA_out = p.communicate()
-        #logger('psa_out %s' % (psA_out,), x2go.loglevel_DEBUG )
-        return psA_out[0].count(PROG_NAME) > 1
-    elif x2go.X2GOCLIENT_OS == 'Windows':
-        # TODO!!!
-        return False
-
 def main():
     args, logger, liblogger = parseargs()
-    if check_running(logger): sys.exit(0)
-    thisPyHocaGUI = PyHocaGUI(args, logger, liblogger)
-    thisPyHocaGUI.MainLoop()
+    try:
+        thisPyHocaGUI = PyHocaGUI(args, logger, liblogger)
+        thisPyHocaGUI.MainLoop()
+    except KeyboardInterrupt:
+        _x2go_cleanup()
 
 if __name__ == '__main__':
     main()
diff --git a/pyhoca/wxgui/__init__.py b/pyhoca/wxgui/__init__.py
index e078a4d..1234adb 100644
--- a/pyhoca/wxgui/__init__.py
+++ b/pyhoca/wxgui/__init__.py
@@ -18,6 +18,6 @@
 # Free Software Foundation, Inc.,
 # 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
 
-__VERSION__ = '0.0.14'
+__VERSION__ = '0.0.15'
 
 from frontend import *
\ No newline at end of file


hooks/post-receive
-- 
pyhoca-gui.git (Python X2Go Client (wxPython GUI))

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "pyhoca-gui.git" (Python X2Go Client (wxPython GUI)).




More information about the x2go-commits mailing list