SF.net SVN: fclient: [539] trunk/fclient/src/fclient
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-07 21:33:37
|
Revision: 539
http://fclient.svn.sourceforge.net/fclient/?rev=539&view=rev
Author: jUrner
Date: 2008-07-07 14:33:45 -0700 (Mon, 07 Jul 2008)
Log Message:
-----------
sarted working on fclient again
Added Paths:
-----------
trunk/fclient/src/fclient/PrefsGlobalTpl.ui
trunk/fclient/src/fclient/Ui_Prefs.py
trunk/fclient/src/fclient/Ui_PrefsGlobal.py
trunk/fclient/src/fclient/Ui_PrefsGlobalTpl.py
trunk/fclient/src/fclient/__init__.py
trunk/fclient/src/fclient/config.py
trunk/fclient/src/fclient/fclient.py
Added: trunk/fclient/src/fclient/PrefsGlobalTpl.ui
===================================================================
--- trunk/fclient/src/fclient/PrefsGlobalTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/PrefsGlobalTpl.ui 2008-07-07 21:33:45 UTC (rev 539)
@@ -0,0 +1,64 @@
+<ui version="4.0" >
+ <class>PrefsGlobalTpl</class>
+ <widget class="QWidget" name="PrefsGlobalTpl" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>465</width>
+ <height>247</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Specify directory to store settings to. If unchecked, settings are stored in an os dependend location.</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <layout class="QHBoxLayout" >
+ <item>
+ <widget class="QCheckBox" name="ckStoreSettingsLocally" >
+ <property name="text" >
+ <string/>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="edStoreSettingsLocally" />
+ </item>
+ <item>
+ <widget class="QPushButton" name="btStoreSettingsLocally" >
+ <property name="text" >
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Added: trunk/fclient/src/fclient/Ui_Prefs.py
===================================================================
--- trunk/fclient/src/fclient/Ui_Prefs.py (rev 0)
+++ trunk/fclient/src/fclient/Ui_Prefs.py 2008-07-07 21:33:45 UTC (rev 539)
@@ -0,0 +1,69 @@
+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__)]
+
+
+from PyQt4 import QtGui
+
+from .lib.qt4ex.dlgs import dlgpreferences
+from .Ui_PrefsGlobal import PrefsPageGlobal
+#**********************************************************************************
+#
+#**********************************************************************************
+#***********************************************************************
+#
+#***********************************************************************
+class PrefsPageRoot(dlgpreferences.Page):
+
+ UUID = '{a61e2758-4c66-11dd-a3e6-8814a37cbeed}'
+
+ def __init__(self):
+ dlgpreferences.Page.__init__(self, self.UUID)
+ self._widget = None
+ self.setDirty(True)
+
+ def displayName(self):
+ return QtGui.QApplication.translate("PreferencesGlobal", 'All', None, QtGui.QApplication.UnicodeUTF8)
+
+ def canApply(self): return False
+ def canHelp(self): return False
+
+ def setVisible(self, parent, flag):
+ createdNew = False
+ if flag and self._widget is None:
+ createdNew = True
+ self._widget = QtGui.QWidget(parent)
+ self._widget.setVisible(flag)
+ return (createdNew, self._widget)
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class DlgPrefs(dlgpreferences.DlgPreferencesFlatTree):
+
+ def __init__(self, parent):
+
+ pages = PrefsPageRoot()(
+ PrefsPageGlobal()
+ )
+
+ dlgpreferences.DlgPreferencesFlatTree.__init__(self,
+ parent,
+ pages=pages,
+ startPage=PrefsPageGlobal.UUID,
+ )
+
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+
+ app = QtGui.QApplication(sys.argv)
+ w = DlgPrefs(None)
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
+
Added: trunk/fclient/src/fclient/Ui_PrefsGlobal.py
===================================================================
--- trunk/fclient/src/fclient/Ui_PrefsGlobal.py (rev 0)
+++ trunk/fclient/src/fclient/Ui_PrefsGlobal.py 2008-07-07 21:33:45 UTC (rev 539)
@@ -0,0 +1,66 @@
+
+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__)]
+
+
+from PyQt4 import QtGui
+
+from . import config
+from .lib.qt4ex.dlgs import dlgpreferences
+
+from .Ui_PrefsGlobalTpl import Ui_PrefsGlobalTpl
+#**********************************************************************************
+#
+#**********************************************************************************
+class PrefsWidgetGlobal(QtGui.QWidget, Ui_PrefsGlobalTpl):
+
+ def __init__(self, parent, cfg=None):
+ QtGui.QWidget.__init__(self, parent)
+
+
+ self.cfg = config.Config(self) if cfg is None else cfg
+
+
+ self.setupUi(self)
+#***********************************************************************
+#
+#***********************************************************************
+class PrefsPageGlobal(dlgpreferences.Page):
+
+ UUID = '{ba654bd8-4c63-11dd-b8b1-a11c9b5c3981}'
+
+ def __init__(self):
+ dlgpreferences.Page.__init__(self, self.UUID)
+ self._widget = None
+ self.setDirty(True)
+
+ def displayName(self):
+ return QtGui.QApplication.translate("PreferencesGlobal", 'Global', None, QtGui.QApplication.UnicodeUTF8)
+
+ def canApply(self): return True
+ def canHelp(self): return True
+
+ def setVisible(self, parent, flag):
+ createdNew = False
+ if flag and self._widget is None:
+ createdNew = True
+ self._widget = PrefsWidgetGlobal(parent)
+ self._widget.setVisible(flag)
+ return (createdNew, self._widget)
+
+
+
+#***********************************************************************
+#
+#***********************************************************************
+if __name__ == '__main__':
+ from PyQt4 import QtGui
+ import sys
+
+ app = QtGui.QApplication(sys.argv)
+ w = PrefsWidgetGlobal(None)
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
Added: trunk/fclient/src/fclient/Ui_PrefsGlobalTpl.py
===================================================================
--- trunk/fclient/src/fclient/Ui_PrefsGlobalTpl.py (rev 0)
+++ trunk/fclient/src/fclient/Ui_PrefsGlobalTpl.py 2008-07-07 21:33:45 UTC (rev 539)
@@ -0,0 +1,61 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/PrefsGlobalTpl.ui'
+#
+# Created: Mon Jul 7 23:23:43 2008
+# by: PyQt4 UI code generator 4.3.3
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_PrefsGlobalTpl(object):
+ def setupUi(self, PrefsGlobalTpl):
+ PrefsGlobalTpl.setObjectName("PrefsGlobalTpl")
+ PrefsGlobalTpl.resize(QtCore.QSize(QtCore.QRect(0,0,465,247).size()).expandedTo(PrefsGlobalTpl.minimumSizeHint()))
+
+ self.gridlayout = QtGui.QGridLayout(PrefsGlobalTpl)
+ self.gridlayout.setObjectName("gridlayout")
+
+ self.label = QtGui.QLabel(PrefsGlobalTpl)
+ self.label.setWordWrap(True)
+ self.label.setObjectName("label")
+ self.gridlayout.addWidget(self.label,0,0,1,1)
+
+ self.hboxlayout = QtGui.QHBoxLayout()
+ self.hboxlayout.setObjectName("hboxlayout")
+
+ self.ckStoreSettingsLocally = QtGui.QCheckBox(PrefsGlobalTpl)
+ self.ckStoreSettingsLocally.setObjectName("ckStoreSettingsLocally")
+ self.hboxlayout.addWidget(self.ckStoreSettingsLocally)
+
+ self.edStoreSettingsLocally = QtGui.QLineEdit(PrefsGlobalTpl)
+ self.edStoreSettingsLocally.setObjectName("edStoreSettingsLocally")
+ self.hboxlayout.addWidget(self.edStoreSettingsLocally)
+
+ self.btStoreSettingsLocally = QtGui.QPushButton(PrefsGlobalTpl)
+ self.btStoreSettingsLocally.setObjectName("btStoreSettingsLocally")
+ self.hboxlayout.addWidget(self.btStoreSettingsLocally)
+ self.gridlayout.addLayout(self.hboxlayout,1,0,1,1)
+
+ spacerItem = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem,2,0,1,1)
+
+ self.retranslateUi(PrefsGlobalTpl)
+ QtCore.QMetaObject.connectSlotsByName(PrefsGlobalTpl)
+
+ def retranslateUi(self, PrefsGlobalTpl):
+ PrefsGlobalTpl.setWindowTitle(QtGui.QApplication.translate("PrefsGlobalTpl", "Form", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("PrefsGlobalTpl", "Specify directory to store settings to. If unchecked, settings are stored in an os dependend location.", None, QtGui.QApplication.UnicodeUTF8))
+ self.btStoreSettingsLocally.setText(QtGui.QApplication.translate("PrefsGlobalTpl", "...", None, QtGui.QApplication.UnicodeUTF8))
+
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ PrefsGlobalTpl = QtGui.QWidget()
+ ui = Ui_PrefsGlobalTpl()
+ ui.setupUi(PrefsGlobalTpl)
+ PrefsGlobalTpl.show()
+ sys.exit(app.exec_())
Added: trunk/fclient/src/fclient/__init__.py
===================================================================
--- trunk/fclient/src/fclient/__init__.py (rev 0)
+++ trunk/fclient/src/fclient/__init__.py 2008-07-07 21:33:45 UTC (rev 539)
@@ -0,0 +1,9 @@
+
+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__)]
+
+
+
+from . import config
+from .ui import connection
\ No newline at end of file
Added: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py (rev 0)
+++ trunk/fclient/src/fclient/config.py 2008-07-07 21:33:45 UTC (rev 539)
@@ -0,0 +1,93 @@
+""""""
+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 atexit
+import os
+from PyQt4 import QtCore
+
+from .lib import fcp2
+from .lib.qt4ex import settingsbase
+#**********************************************************************************
+#
+#**********************************************************************************
+FclientOrgName = 'fclient'
+FclientAppName = 'fclient'
+
+SettingsDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'settings')
+#**********************************************************************************
+#
+#**********************************************************************************
+class ConfigSettings(settingsbase.SettingsBase):
+
+ KEY_SETTINGS = 'ConfigSettings'
+ SETTINGS = [
+ ('StoreSettingsLocally', ['UPyString', SettingsDir]), # if not None, settings are stored locally in the app folder
+ ]
+
+
+
+class Settings(settingsbase.Settings):
+ """customized settings class to allow to store settings locally"""
+
+ def __init__(self):
+ settingsbase.Settings.__init__(self, FclientOrgName, FclientAppName)
+ self.format = QtCore.QSettings.IniFormat
+ self.scope = QtCore.QSettings.UserScope
+ self.directory = None
+
+ self.setStoreLocal(SettingsDir)
+
+
+ def setStoreLocal(self, directory=None):
+ """should the settings be stored locally?
+
+ @param directory: (str) if None, the default location of the os is used to store settings, if a directory
+ setings are stored there
+ """
+ if directory is None:
+ self.format = QtCore.QSettings.NativeFormat
+ self.scope = QtCore.QSettings.UserScope
+ else:
+ self.format = QtCore.QSettings.IniFormat
+ self.scope = QtCore.QSettings.UserScope
+ QtCore.QSettings.setPath(self.format, self.scope, directory)
+ self.directory = directory
+
+
+ def getObject(self, parent):
+ o = QtCore.QSettings(self.format, self.scope, self.orgName, self.appName, parent)
+ o.setFallbacksEnabled(False)
+ #print o.fileName()
+ return o
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class Config(object):
+
+ def __init__(self, parent):
+
+ self.fcpClient = fcp2.Client() # global fcp client
+ self.settings = Settings() # global settings class
+ self.configSettings = ConfigSettings() # settings of the config
+
+
+ self.settings.readSettings(None, self.configSettings)
+ self.settings.setStoreLocal(directory=self.configSettings['StoreSettingsLocally'])
+
+ atexit.register(self.close)
+
+
+ def close(self):
+ self.settings.dumpSettings(None, self.configSettings)
+
+
+
+
+s = Config(None)
+
+
+
+
Added: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py (rev 0)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-07 21:33:45 UTC (rev 539)
@@ -0,0 +1 @@
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|