[X2Go-Commits] [pyhoca-gui] 09/18: try moving setup_consolelog out of the PyHocaGUI_Launcher class
git-admin at x2go.org
git-admin at x2go.org
Fri Feb 7 13:26:25 CET 2014
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch brokerclient
in repository pyhoca-gui.
commit a0a4c3a9a3cdc1e512c33b3b836994fd755c2394
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Thu Feb 6 01:14:05 2014 +0100
try moving setup_consolelog out of the PyHocaGUI_Launcher class
---
pyhoca-gui | 5 ++--
pyhoca/wxgui/launcher.py | 72 +++++++++++++++++++++++-----------------------
2 files changed, 39 insertions(+), 38 deletions(-)
diff --git a/pyhoca-gui b/pyhoca-gui
index 93c2c1e..390ec14 100755
--- a/pyhoca-gui
+++ b/pyhoca-gui
@@ -25,14 +25,15 @@ import sys
from pyhoca.wxgui import *
from pyhoca.wxgui import __VERSION__
+from pyhoca.wxgui.launcher import setup_consolelog, PyHocaGUI_Launcher
+
__author__ = "Mike Gabriel, Dick Kniep"
__version__ = __VERSION__
+setup_consolelog()
if __name__ == '__main__':
app = PyHocaGUI_Launcher()
- #app.setup_progname('MyProgramme')
- app.setup_consolelog()
app.setup_process()
app.setup_devmode()
args, logger, liblogger = app.parseargs()
diff --git a/pyhoca/wxgui/launcher.py b/pyhoca/wxgui/launcher.py
index 58d48dc..845aaf5 100644
--- a/pyhoca/wxgui/launcher.py
+++ b/pyhoca/wxgui/launcher.py
@@ -56,6 +56,42 @@ import defaults
import basepath
import taskbar
+def setup_consolelog(self):
+ if hasattr(sys, 'frozen') and str(sys.frozen) in ("windows_exe", "console_exe", "1", ):
+ class Win32_Logging(object):
+
+ softspace = 0
+ _fname = os.path.join(os.environ['AppData'], self.PROG_NAME, '%s.log' % self.PROG_NAME)
+ _file = None
+
+ def __init__(self, filemode='a'):
+ self._filemode = filemode
+ if os.path.isfile(self._fname) and self._filemode == "w+":
+ os.remove(self._fname)
+
+ def write(self, text, **kwargs):
+ if self._file is None:
+ try:
+ try:
+ os.mkdir(os.path.dirname(self._fname))
+ except:
+ pass
+ self._file = open(self._fname, self._filemode)
+ except:
+ pass
+ else:
+ self._file.write(text)
+ self._file.flush()
+
+ def flush(self):
+ if self._file is not None:
+ self._file.flush()
+
+ sys.stdout = Win32_Logging(filemode='w+')
+ sys.stderr = Win32_Logging(filemode='a')
+ del Win32_Logging
+
+
class PyHocaGUI_Launcher(object):
def __init__(self):
@@ -105,42 +141,6 @@ VERSION: %s
reload(basepath)
reload(taskbar)
- def setup_consolelog(self):
- if hasattr(sys, 'frozen') and str(sys.frozen) in ("windows_exe", "console_exe", "1", ):
- class Win32_Logging(object):
-
- softspace = 0
- _fname = os.path.join(os.environ['AppData'], self.PROG_NAME, '%s.log' % self.PROG_NAME)
- _file = None
-
- def __init__(self, filemode='a'):
- self._filemode = filemode
- if os.path.isfile(self._fname) and self._filemode == "w+":
- os.remove(self._fname)
-
- def write(self, text, **kwargs):
- if self._file is None:
- try:
- try:
- os.mkdir(os.path.dirname(self._fname))
- except:
- pass
- self._file = open(self._fname, self._filemode)
- except:
- pass
- else:
- self._file.write(text)
- self._file.flush()
-
- def flush(self):
- if self._file is not None:
- self._file.flush()
-
- sys.stdout = Win32_Logging(filemode='w+')
- sys.stderr = Win32_Logging(filemode='a')
- del Win32_Logging
-
-
def check_running(self):
if X2GOCLIENT_OS in ('Linux', 'Mac'):
--
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