SF.net SVN: fclient:[838] trunk/fclient
Status: Pre-Alpha
Brought to you by:
jurner
From: <jU...@us...> - 2008-07-31 17:05:38
|
Revision: 838 http://fclient.svn.sourceforge.net/fclient/?rev=838&view=rev Author: jUrner Date: 2008-07-31 17:05:46 +0000 (Thu, 31 Jul 2008) Log Message: ----------- ... Added Paths: ----------- trunk/fclient/fclient/ trunk/fclient/fclient/doc/ trunk/fclient/fclient/downloads/ trunk/fclient/fclient/fclient.py trunk/fclient/fclient/impl/ trunk/fclient/fclient/settings/ Removed Paths: ------------- trunk/fclient/fclient/doc/ trunk/fclient/fclient/downloads/ trunk/fclient/fclient/fclient.py trunk/fclient/fclient/impl/ trunk/fclient/fclient/settings/ trunk/fclient/src/fclient/ Deleted: trunk/fclient/fclient/fclient.py =================================================================== --- trunk/fclient/src/fclient/fclient.py 2008-07-31 16:50:50 UTC (rev 836) +++ trunk/fclient/fclient/fclient.py 2008-07-31 17:05:46 UTC (rev 838) @@ -1,88 +0,0 @@ - -from __future__ import absolute_import -if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below - import os; __path__ = [os.path.dirname(__file__)] - -import sys -from PyQt4 import QtGui - -from .impl import config -from .impl.lib.qt4ex import singleapp - -from .impl.MainWindow import MainWindow -from .impl.View import ViewWidget -from .impl.ViewBrowser import ViewBrowserWidget -from .impl.ViewConnection import ViewConnectionWidget -from .impl.ViewDownloads import ViewDownloadsWidget -from .impl.ViewLogger import ViewLoggerWidget - -from .impl.DlgSingleAppError import DlgSingleAppError -#************************************************************* -# -#************************************************************* -class SingleApp(singleapp.SingleApp): - - def onOtherAppIsStarting(self): - #TODO: looks like no way to bring the window to the foreground - # the calls do not work on x11. may work on windows though - # - ##QtGui.QApplication.instance().setActiveWindow(self.userData) - ##self.userData.activateWindow() - pass - -def main(): - - # parse commandline options - userHasStyleSheet = False - for arg in sys.argv: - arg = arg.lower() - if arg.startswith('-stylesheet=') or arg.startswith('-stylesheet '): - userHasStyleSheet = True - if not userHasStyleSheet: # use our own - sys.argv.append('-stylesheet=%s' % config.FcDefaultStyleSheet) - - # start single application server - singleApp = SingleApp( - host=config.fcSettings.value('SingleAppHost'), - port=config.fcSettings.value('SingleAppPort'), - magicToSend='{80a21244-c2ff-4afd-b8a2-c3b93b99332f}', - magicToRespond='{2e86f6f1-0707-415d-bfe6-6d485603a98c}' - ) - try: - singleApp.start() - except singleapp.ErrorOtherAppIsRunning: - print 'looks like another %s application is already running' % config.FcAppName - print 'exit' - sys.exit(5) - except singleapp.ErrorCanNotConnect: - app = QtGui.QApplication(sys.argv) - dlg = DlgSingleAppError() - dlg.exec_() - - else: - # start gui - app = QtGui.QApplication(sys.argv) - mainWindow = MainWindow() - singleApp.userData = mainWindow - - viewWidget = ViewWidget(mainWindow) - mainWindow.setCentralWidget(viewWidget) - viewWidget.addBottomViews(ViewLoggerWidget(mainWindow)) - viewWidget.addTopViews( - ViewConnectionWidget(mainWindow), - ViewBrowserWidget(mainWindow), - ViewDownloadsWidget(mainWindow), - ) - - mainWindow.show() - res = app.exec_() - sys.exit(res) - -#********************************************************************************** -# -#********************************************************************************** -if __name__ == '__main__': - main() - - - Copied: trunk/fclient/fclient/fclient.py (from rev 837, trunk/fclient/src/fclient/fclient.py) =================================================================== --- trunk/fclient/fclient/fclient.py (rev 0) +++ trunk/fclient/fclient/fclient.py 2008-07-31 17:05:46 UTC (rev 838) @@ -0,0 +1,88 @@ + +from __future__ import absolute_import +if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below + import os; __path__ = [os.path.dirname(__file__)] + +import sys +from PyQt4 import QtGui + +from .impl import config +from .impl.lib.qt4ex import singleapp + +from .impl.MainWindow import MainWindow +from .impl.View import ViewWidget +from .impl.ViewBrowser import ViewBrowserWidget +from .impl.ViewConnection import ViewConnectionWidget +from .impl.ViewDownloads import ViewDownloadsWidget +from .impl.ViewLogger import ViewLoggerWidget + +from .impl.DlgSingleAppError import DlgSingleAppError +#************************************************************* +# +#************************************************************* +class SingleApp(singleapp.SingleApp): + + def onOtherAppIsStarting(self): + #TODO: looks like no way to bring the window to the foreground + # the calls do not work on x11. may work on windows though + # + ##QtGui.QApplication.instance().setActiveWindow(self.userData) + ##self.userData.activateWindow() + pass + +def main(): + + # parse commandline options + userHasStyleSheet = False + for arg in sys.argv: + arg = arg.lower() + if arg.startswith('-stylesheet=') or arg.startswith('-stylesheet '): + userHasStyleSheet = True + if not userHasStyleSheet: # use our own + sys.argv.append('-stylesheet=%s' % config.FcDefaultStyleSheet) + + # start single application server + singleApp = SingleApp( + host=config.fcSettings.value('SingleAppHost'), + port=config.fcSettings.value('SingleAppPort'), + magicToSend='{80a21244-c2ff-4afd-b8a2-c3b93b99332f}', + magicToRespond='{2e86f6f1-0707-415d-bfe6-6d485603a98c}' + ) + try: + singleApp.start() + except singleapp.ErrorOtherAppIsRunning: + print 'looks like another %s application is already running' % config.FcAppName + print 'exit' + sys.exit(5) + except singleapp.ErrorCanNotConnect: + app = QtGui.QApplication(sys.argv) + dlg = DlgSingleAppError() + dlg.exec_() + + else: + # start gui + app = QtGui.QApplication(sys.argv) + mainWindow = MainWindow() + singleApp.userData = mainWindow + + viewWidget = ViewWidget(mainWindow) + mainWindow.setCentralWidget(viewWidget) + viewWidget.addBottomViews(ViewLoggerWidget(mainWindow)) + viewWidget.addTopViews( + ViewConnectionWidget(mainWindow), + ViewBrowserWidget(mainWindow), + ViewDownloadsWidget(mainWindow), + ) + + mainWindow.show() + res = app.exec_() + sys.exit(res) + +#********************************************************************************** +# +#********************************************************************************** +if __name__ == '__main__': + main() + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |