SF.net SVN: fclient:[805] trunk/fclient/src/fclient/impl
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-28 19:26:39
|
Revision: 805
http://fclient.svn.sourceforge.net/fclient/?rev=805&view=rev
Author: jUrner
Date: 2008-07-28 19:26:47 +0000 (Mon, 28 Jul 2008)
Log Message:
-----------
combed over prefs dialog. most settings are now present (untested)
Modified Paths:
--------------
trunk/fclient/src/fclient/impl/PrefsGlobal.py
trunk/fclient/src/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/Ui_PrefsGlobalWidgetTpl.py
Modified: trunk/fclient/src/fclient/impl/PrefsGlobal.py
===================================================================
--- trunk/fclient/src/fclient/impl/PrefsGlobal.py 2008-07-28 19:25:47 UTC (rev 804)
+++ trunk/fclient/src/fclient/impl/PrefsGlobal.py 2008-07-28 19:26:47 UTC (rev 805)
@@ -4,10 +4,11 @@
import os; __path__ = [os.path.dirname(__file__)]
-from PyQt4 import QtGui
+from PyQt4 import QtCore, QtGui
from . import config
from .lib.qt4ex import dlgpreferences
+from .lib.qt4ex.lib import settings
from .tpls.Ui_PrefsGlobalWidgetTpl import Ui_PrefsGlobalWidget
#**********************************************************************************
@@ -15,10 +16,79 @@
#**********************************************************************************
class PrefsGlobalWidget(QtGui.QWidget, Ui_PrefsGlobalWidget):
- def __init__(self, parent):
+ IdEdSettingsDir = 'edSettingsDir'
+ IdBtSelectSettingsDir = 'btSelectSettingsDir'
+
+ IdCkSettingsAllUsers = 'ckSettingsAllUsers'
+
+ IdEdDownloadDir = 'edDownloadDir'
+ IdBtSelectDownloadDir = 'btSelectDownloadDir'
+
+
+ def __init__(self, parent=None, page=None):
QtGui.QWidget.__init__(self, parent)
+
self.setupUi(self)
+ self.fcSettingsControler = settings.SettingsControler(config.settings, parent=self)
+ if page is not None:
+ page.connect(self.fcSettingsControler, QtCore.SIGNAL('isDirty(bool)'), page.setDirty)
+
+ self.fcSettingsControler.addLineEdit(
+ self.controlById(self.IdEdSettingsDir),
+ 'SettingsDir',
+ )
+ self.fcSettingsControler.addCheckBox(
+ self.controlById(self.IdCkSettingsAllUsers),
+ 'SettingsAllUsers',
+ )
+ self.fcSettingsControler.addLineEdit(
+ self.controlById(self.IdEdDownloadDir),
+ 'DownloadDir',
+ )
+
+ bt = self.controlById(self.IdBtSelectSettingsDir)
+ self.connect(bt, QtCore.SIGNAL('clicked()'), self.onBtSelectSettingsDirClicked)
+ bt = self.controlById(self.IdBtSelectDownloadDir)
+ self.connect(bt, QtCore.SIGNAL('clicked()'), self.onBtSelectDownloadDirClicked)
+
+
+ def controlById(self, idControl):
+ return getattr(self, idControl)
+
+ def doApply(self):
+ if self.fcSettingsControler is not None:
+ return self.fcSettingsControler.apply()
+ return False
+
+ def doRestoreDefaults(self):
+ if self.fcSettingsControler is not None:
+ return self.fcSettingsControler.restoreDefaults()
+ return False
+
+ #####################
+ ## event handlers
+ #####################
+ def onBtSelectSettingsDirClicked(self):
+ ed = self.controlById(self.IdEdSettingsDir)
+ directory = QtGui.QFileDialog.getExistingDirectory(
+ self,
+ config.FclientAppName + self.trUtf8(' - Select settings directory..'),
+ ed.text(),
+ )
+ if directory:
+ ed.setText(directory)
+
+ def onBtSelectDownloadDirClicked(self):
+ ed = self.controlById(self.IdEdDownloadDir)
+ directory = QtGui.QFileDialog.getExistingDirectory(
+ self,
+ config.FclientAppName + self.trUtf8(' - Select download directory..'),
+ ed.text(),
+ )
+ if directory:
+ ed.setText(directory)
+
#***********************************************************************
#
#***********************************************************************
@@ -29,24 +99,22 @@
def __init__(self):
dlgpreferences.Page.__init__(self, self.UUID)
self._widget = None
- self.setDirty(True)
-
+
def displayName(self):
return self.trUtf8('Global')
def canApply(self): return True
- def canHelp(self): return True
+ def canHelp(self): return False
+ def canRestoreDefaults(self): return True
def setVisible(self, parent, flag):
createdNew = False
if flag and self._widget is None:
createdNew = True
- self._widget = PrefsGlobalWidget(parent)
+ self._widget = PrefsGlobalWidget(parent=parent, page=self)
self._widget.setVisible(flag)
return (createdNew, self._widget)
-
-
#***********************************************************************
#
#***********************************************************************
Modified: trunk/fclient/src/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui 2008-07-28 19:25:47 UTC (rev 804)
+++ trunk/fclient/src/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui 2008-07-28 19:26:47 UTC (rev 805)
@@ -6,37 +6,80 @@
<x>0</x>
<y>0</y>
<width>465</width>
- <height>247</height>
+ <height>269</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
- <layout class="QGridLayout" >
+ <layout class="QGridLayout" name="gridLayout" >
<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>
+ <string>Specify directory to store settings to.Leave empty to store settings in a location your os feels best with</string>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
+ <property name="textInteractionFlags" >
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set>
+ </property>
</widget>
</item>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<item>
- <widget class="QCheckBox" name="ckStoreSettingsLocally" >
+ <widget class="QLineEdit" name="edSettingsDir" />
+ </item>
+ <item>
+ <widget class="QPushButton" name="btSelectSettingsDir" >
<property name="text" >
- <string/>
+ <string>...</string>
</property>
</widget>
</item>
+ </layout>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string>If no path for settings is specified, store settings only for the the current user or for all users?</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QCheckBox" name="ckSettingsAllUsers" >
+ <property name="text" >
+ <string>Store settings for all users</string>
+ </property>
+ </widget>
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string>Default directory to store downloads to </string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="5" column="0" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
<item>
- <widget class="QLineEdit" name="edStoreSettingsLocally" />
+ <widget class="QLineEdit" name="edDownloadDir" />
</item>
<item>
- <widget class="QPushButton" name="btStoreSettingsLocally" >
+ <widget class="QPushButton" name="btSelectDownloadDir" >
<property name="text" >
<string>...</string>
</property>
@@ -44,15 +87,15 @@
</item>
</layout>
</item>
- <item row="2" column="0" >
- <spacer>
+ <item row="6" column="0" >
+ <spacer name="verticalSpacer" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>20</width>
- <height>40</height>
+ <height>38</height>
</size>
</property>
</spacer>
Modified: trunk/fclient/src/fclient/impl/tpls/Ui_PrefsGlobalWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/impl/tpls/Ui_PrefsGlobalWidgetTpl.py 2008-07-28 19:25:47 UTC (rev 804)
+++ trunk/fclient/src/fclient/impl/tpls/Ui_PrefsGlobalWidgetTpl.py 2008-07-28 19:26:47 UTC (rev 805)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui'
#
-# Created: Sun Jul 27 13:41:35 2008
+# Created: Mon Jul 28 21:19:19 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
@@ -12,35 +12,59 @@
class Ui_PrefsGlobalWidget(object):
def setupUi(self, PrefsGlobalWidget):
PrefsGlobalWidget.setObjectName("PrefsGlobalWidget")
- PrefsGlobalWidget.resize(465, 247)
- self.gridlayout = QtGui.QGridLayout(PrefsGlobalWidget)
- self.gridlayout.setObjectName("gridlayout")
+ PrefsGlobalWidget.resize(465, 269)
+ self.gridLayout = QtGui.QGridLayout(PrefsGlobalWidget)
+ self.gridLayout.setObjectName("gridLayout")
self.label = QtGui.QLabel(PrefsGlobalWidget)
self.label.setWordWrap(True)
+ self.label.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard)
self.label.setObjectName("label")
- self.gridlayout.addWidget(self.label, 0, 0, 1, 1)
+ self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
self.hboxlayout = QtGui.QHBoxLayout()
self.hboxlayout.setObjectName("hboxlayout")
- self.ckStoreSettingsLocally = QtGui.QCheckBox(PrefsGlobalWidget)
- self.ckStoreSettingsLocally.setObjectName("ckStoreSettingsLocally")
- self.hboxlayout.addWidget(self.ckStoreSettingsLocally)
- self.edStoreSettingsLocally = QtGui.QLineEdit(PrefsGlobalWidget)
- self.edStoreSettingsLocally.setObjectName("edStoreSettingsLocally")
- self.hboxlayout.addWidget(self.edStoreSettingsLocally)
- self.btStoreSettingsLocally = QtGui.QPushButton(PrefsGlobalWidget)
- 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.edSettingsDir = QtGui.QLineEdit(PrefsGlobalWidget)
+ self.edSettingsDir.setObjectName("edSettingsDir")
+ self.hboxlayout.addWidget(self.edSettingsDir)
+ self.btSelectSettingsDir = QtGui.QPushButton(PrefsGlobalWidget)
+ self.btSelectSettingsDir.setObjectName("btSelectSettingsDir")
+ self.hboxlayout.addWidget(self.btSelectSettingsDir)
+ self.gridLayout.addLayout(self.hboxlayout, 1, 0, 1, 1)
+ self.label_2 = QtGui.QLabel(PrefsGlobalWidget)
+ self.label_2.setWordWrap(True)
+ self.label_2.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
+ self.label_2.setObjectName("label_2")
+ self.gridLayout.addWidget(self.label_2, 2, 0, 1, 1)
+ self.ckSettingsAllUsers = QtGui.QCheckBox(PrefsGlobalWidget)
+ self.ckSettingsAllUsers.setObjectName("ckSettingsAllUsers")
+ self.gridLayout.addWidget(self.ckSettingsAllUsers, 3, 0, 1, 1)
+ self.label_3 = QtGui.QLabel(PrefsGlobalWidget)
+ self.label_3.setWordWrap(True)
+ self.label_3.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
+ self.label_3.setObjectName("label_3")
+ self.gridLayout.addWidget(self.label_3, 4, 0, 1, 1)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.edDownloadDir = QtGui.QLineEdit(PrefsGlobalWidget)
+ self.edDownloadDir.setObjectName("edDownloadDir")
+ self.horizontalLayout.addWidget(self.edDownloadDir)
+ self.btSelectDownloadDir = QtGui.QPushButton(PrefsGlobalWidget)
+ self.btSelectDownloadDir.setObjectName("btSelectDownloadDir")
+ self.horizontalLayout.addWidget(self.btSelectDownloadDir)
+ self.gridLayout.addLayout(self.horizontalLayout, 5, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(20, 38, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridLayout.addItem(spacerItem, 6, 0, 1, 1)
self.retranslateUi(PrefsGlobalWidget)
QtCore.QMetaObject.connectSlotsByName(PrefsGlobalWidget)
def retranslateUi(self, PrefsGlobalWidget):
PrefsGlobalWidget.setWindowTitle(QtGui.QApplication.translate("PrefsGlobalWidget", "Form", None, QtGui.QApplication.UnicodeUTF8))
- self.label.setText(QtGui.QApplication.translate("PrefsGlobalWidget", "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("PrefsGlobalWidget", "...", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("PrefsGlobalWidget", "Specify directory to store settings to.Leave empty to store settings in a location your os feels best with", None, QtGui.QApplication.UnicodeUTF8))
+ self.btSelectSettingsDir.setText(QtGui.QApplication.translate("PrefsGlobalWidget", "...", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("PrefsGlobalWidget", "If no path for settings is specified, store settings only for the the current user or for all users?", None, QtGui.QApplication.UnicodeUTF8))
+ self.ckSettingsAllUsers.setText(QtGui.QApplication.translate("PrefsGlobalWidget", "Store settings for all users", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("PrefsGlobalWidget", "Default directory to store downloads to ", None, QtGui.QApplication.UnicodeUTF8))
+ self.btSelectDownloadDir.setText(QtGui.QApplication.translate("PrefsGlobalWidget", "...", None, QtGui.QApplication.UnicodeUTF8))
if __name__ == "__main__":
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|