SF.net SVN: fclient:[766] trunk/fclient/src/fclient
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-27 11:27:13
|
Revision: 766
http://fclient.svn.sourceforge.net/fclient/?rev=766&view=rev
Author: jUrner
Date: 2008-07-27 11:27:22 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
naming
Modified Paths:
--------------
trunk/fclient/src/fclient/fclient.py
trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py
trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
Added Paths:
-----------
trunk/fclient/src/fclient/impl/MainWindow.py
Modified: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py 2008-07-27 11:23:45 UTC (rev 765)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-27 11:27:22 UTC (rev 766)
@@ -6,7 +6,7 @@
import sys
from PyQt4 import QtGui
-from .impl.Ui_MainWindow import MainWindow
+from .impl.MainWindow import MainWindow
from .impl.Ui_View import ViewWidget
from .impl.Ui_ViewBrowser import ViewBrowserWidget
from .impl.Ui_ViewConnection import ViewConnectionWidget
Added: trunk/fclient/src/fclient/impl/MainWindow.py
===================================================================
--- trunk/fclient/src/fclient/impl/MainWindow.py (rev 0)
+++ trunk/fclient/src/fclient/impl/MainWindow.py 2008-07-27 11:27:22 UTC (rev 766)
@@ -0,0 +1,160 @@
+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 logging
+import sys
+logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
+
+from PyQt4 import QtCore, QtGui
+
+from . import config
+from . import Ui_Prefs
+from . import Ui_View
+from .lib.qt4ex import dlgabout
+
+from .tpls.Ui_MainWindowTpl import Ui_MainWindow
+#**********************************************************************************
+#
+#**********************************************************************************
+class Settings(config.SettingsBase):
+
+ _key_ = config.IdMainWindow
+ _settings_ = (
+ ('Geometry', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate),
+ )
+
+
+class Actions(config.ActionsBase):
+
+ def __init__(self, parent):
+ config.ActionsBase.__init__(self, parent)
+
+ self.action(
+ name='ActionPreferences',
+ text=self.trUtf8('&Preferences...'),
+ trigger=parent.onActPreferencesTriggered,
+ )
+ self.action(
+ name='ActionExit',
+ text=self.trUtf8('E&xit'),
+ trigger=parent.onActExitTriggered,
+ )
+ self.action(
+ name='ActionAbout',
+ text=self.trUtf8('A&bout...'),
+ trigger=parent.onActAboutTriggered,
+ )
+ self.action(
+ name='ActionHelp',
+ text=self.trUtf8('&Help...'),
+ trigger=parent.onActHelpTriggered,
+ )
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class MenuBar(QtGui.QMenuBar):
+
+ def __init__(self, parent):
+ QtGui.QMenuBar.__init__(self, parent)
+ self.setObjectName('MenuBar')
+ #config.ObjectRegistry.register(self)
+
+ self.menuApplication = QtGui.QMenu(self.trUtf8('&Application'), self)
+ self.addMenu(self.menuApplication)
+ self.menuApplication.addAction(parent.fclientActions['ActionPreferences'])
+ self.menuApplication.addAction(parent.fclientActions['ActionExit'])
+
+ self.menuHelp = QtGui.QMenu(self.trUtf8('&Help'), self)
+ self.addMenu(self.menuHelp)
+ self.menuHelp.addAction(parent.fclientActions['ActionAbout'])
+ self.menuHelp.addAction(parent.fclientActions['ActionHelp'])
+
+
+ def addViewMenu(self, menu):
+ self.insertMenu(self.menuHelp.children()[0], menu)
+ return menu
+
+
+
+class StatusBar(QtGui.QStatusBar):
+
+ def __init__(self, parent):
+ QtGui.QStatusBar.__init__(self, parent)
+ self.setObjectName('StatusBar')
+ #config.ObjectRegistry.register(self)
+ parent.setStatusBar(self)
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
+
+ def __init__(self, parent=None):
+ QtGui.QMainWindow.__init__(self, parent)
+ self._isCreated = False
+
+ self.setupUi(self)
+ config.ObjectRegistry.register(self)
+
+ self.fclientSettings = Settings().restore()
+ self.fclientActions = Actions(self)
+ self.setMenuBar(MenuBar(self))
+ self.setStatusBar(StatusBar(self))
+
+ self.restoreGeometry(self.fclientSettings.value('Geometry'))
+
+ ##################################################
+ ## events
+ ##################################################
+ def closeEvent(self, event):
+ self.fclientSettings.setValues(Geometry=self.saveGeometry())
+
+
+ def showEvent(self, event):
+ if self._isCreated:
+ return
+ self._isCreated = True
+
+ ##################################################
+ ## event onrs
+ ##################################################
+ def onActPreferencesTriggered(self):
+ dlg = Ui_Prefs.PrefsDlg(self)
+ if dlg.exec_() == dlg.Accepted:
+ pass
+
+ def onActExitTriggered(self):
+ self.close()
+
+ def onActHelpTriggered(self):
+ pass
+
+ def onActAboutTriggered(self):
+ dlg = dlgabout.DlgAbout(
+ self,
+ ##state=self.guiSettings['DlgAboutState'],
+ caption=config.FclientAppName + ' - ' + self.trUtf8('About'),
+ appName=config.FclientAppName,
+ description=self.trUtf8('a freenet client written in python and Qt4'),
+ version=config.FclientVersion,
+ author=config.FclientAuthor,
+ licence=config.FclientLicence,
+ copyright=config.FclientCopyright,
+ homepage=config.FclientHomepage
+ )
+ dlg.exec_()
+ #self.guiSettings['DlgAboutState'] = dlg.saveState()
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+
+ app = QtGui.QApplication(sys.argv)
+ w = MainWindow(None)
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
\ No newline at end of file
Modified: trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py 2008-07-27 11:23:45 UTC (rev 765)
+++ trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py 2008-07-27 11:27:22 UTC (rev 766)
@@ -975,7 +975,7 @@
if __name__ == '__main__':
import sys
from .Ui_ViewLogger import ViewLoggerWidget
- from .Ui_MainWindow import MainWindow
+ from .MainWindow import MainWindow
from .Ui_View import ViewWidget
from .Ui_ViewConnection import ViewConnectionWidget
from .Ui_ViewDownloads import ViewDownloadsWidget
Modified: trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py 2008-07-27 11:23:45 UTC (rev 765)
+++ trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py 2008-07-27 11:27:22 UTC (rev 766)
@@ -256,7 +256,7 @@
from . import Ui_View
from . import Ui_ViewConnection
from . import Ui_ViewLogger
- from . import Ui_MainWindow
+ from . import MainWindow
app = QtGui.QApplication(sys.argv)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|