Thread: SF.net SVN: fclient:[680] trunk/fclient/src/fclient
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-19 09:02:14
|
Revision: 680
http://fclient.svn.sourceforge.net/fclient/?rev=680&view=rev
Author: jUrner
Date: 2008-07-19 09:02:08 +0000 (Sat, 19 Jul 2008)
Log Message:
-----------
some nice icons
Added Paths:
-----------
trunk/fclient/src/fclient/res/
trunk/fclient/src/fclient/res/icons/
trunk/fclient/src/fclient/res/icons/crystal/
trunk/fclient/src/fclient/res/icons/crystal/16x16/
trunk/fclient/src/fclient/res/icons/crystal/16x16/back.png
trunk/fclient/src/fclient/res/icons/crystal/16x16/back2.png
trunk/fclient/src/fclient/res/icons/crystal/16x16/forward.png
trunk/fclient/src/fclient/res/icons/crystal/16x16/reload_page.png
trunk/fclient/src/fclient/res/icons/crystal/16x16/stop.png
trunk/fclient/src/fclient/res/icons/crystal/32x32/
trunk/fclient/src/fclient/res/icons/crystal/32x32/back.png
trunk/fclient/src/fclient/res/icons/crystal/32x32/back2.png
trunk/fclient/src/fclient/res/icons/crystal/32x32/forward.png
trunk/fclient/src/fclient/res/icons/crystal/32x32/reload_page.png
trunk/fclient/src/fclient/res/icons/crystal/32x32/stop.png
trunk/fclient/src/fclient/res/icons/crystal/48x48/
trunk/fclient/src/fclient/res/icons/crystal/48x48/back.png
trunk/fclient/src/fclient/res/icons/crystal/48x48/back2.png
trunk/fclient/src/fclient/res/icons/crystal/48x48/forward.png
trunk/fclient/src/fclient/res/icons/crystal/48x48/reload_page.png
trunk/fclient/src/fclient/res/icons/crystal/48x48/stop.png
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/16x16/back.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/16x16/back2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/16x16/forward.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/16x16/reload_page.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/16x16/stop.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/32x32/back.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/32x32/back2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/32x32/forward.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/32x32/reload_page.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/32x32/stop.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/48x48/back.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/48x48/back2.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/48x48/forward.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/48x48/reload_page.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Property changes on: trunk/fclient/src/fclient/res/icons/crystal/48x48/stop.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-19 10:56:57
|
Revision: 685
http://fclient.svn.sourceforge.net/fclient/?rev=685&view=rev
Author: jUrner
Date: 2008-07-19 10:57:04 +0000 (Sat, 19 Jul 2008)
Log Message:
-----------
add basic code for downloads widget to the gui
Modified Paths:
--------------
trunk/fclient/src/fclient/config.py
trunk/fclient/src/fclient/fclient.py
Added Paths:
-----------
trunk/fclient/src/fclient/Ui_ViewDownloads.py
trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py
trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui
Added: trunk/fclient/src/fclient/Ui_ViewDownloads.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewDownloads.py (rev 0)
+++ trunk/fclient/src/fclient/Ui_ViewDownloads.py 2008-07-19 10:57:04 UTC (rev 685)
@@ -0,0 +1,96 @@
+""""""
+
+#**************************************************************************************************************
+#TODO:
+#
+# x. prtty tricky to get dls right when the node or client may disconnect unexpectedly
+# problem: dls that we send and that have not reached the node
+# problem: what to do when the user wants to quit and we still have dls to push to the node
+#
+# solution would require keeping track of all requests
+# a. keep identifiers of requests that reached the node (have to do it anyways)
+# b. keep track of requests ahead of sending them to the node (feels not too good doubeling downloads.dat.gz)
+#
+# best idea seems to be to ignore the problem
+# 1. wait till (if ever) freenet devels fdrop node keeping track of client requests
+#
+# 2. a box thrown to the user (x. do not show this message again) to inform him about pendings
+# should be enough. maybe along with a separate widget or some separate color code for pendings
+#
+# x. performance
+# start with a standard model and improve it over time. no need to set any hard
+# limits. the user will find out by himself how many dls his machine can handle.
+# have to be carefrul though when adding dls, like from a *.frdx to provide appropriate
+# warnings
+#**************************************************************************************************************
+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 QtCore, QtGui
+
+from . import config
+from .lib import fcp2
+
+from .tpls.Ui_ViewDownloadsWidgetTpl import Ui_ViewDownloadsWidget
+#**********************************************************************************
+#
+#**********************************************************************************
+class DownloadsViewObject(config.ViewObject):
+
+ def __init__(self, parent):
+ config.ViewObject. __init__(self, parent)
+
+ self.name=parent.objectName()
+ self.displayName=self.trUtf8('Downloads')
+ self.icon=QtGui.QIcon()
+
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class Model(QtGui.QStandardItemModel):
+
+ def __init__(self, parent=None):
+ pass
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class ViewDownloadsWidget(QtGui.QWidget, Ui_ViewDownloadsWidget):
+
+ IdTreeView = 'treeView'
+
+
+ def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
+ QtGui.QWidget.__init__(self, parent)
+ self._isCreated = False
+
+ self.setupUi(self)
+
+ self.fcViewObject = DownloadsViewObject(self)
+
+ def viewClose(self):
+ pass
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+ from . import Ui_View
+ from . import Ui_ViewConnection
+ from . import Ui_ViewLogger
+
+
+ app = QtGui.QApplication(sys.argv)
+ w = Ui_View.ViewWidget(None)
+ w.addTopViews(
+ Ui_ViewConnection.ViewConnectionWidget(None),
+ ViewDownloadsWidget(None),
+ )
+ w.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
+
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
\ No newline at end of file
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-19 10:55:05 UTC (rev 684)
+++ trunk/fclient/src/fclient/config.py 2008-07-19 10:57:04 UTC (rev 685)
@@ -35,6 +35,7 @@
IdViewWidget = 'ViewWidget'
IdViewBrowserWidget = 'ViewBrowserWidget'
IdViewConnectionWidget = 'ViewConnectionWidget'
+IdViewLoggerWidget = 'ViewDownloadsWidget'
IdViewLoggerWidget = 'ViewLoggerWidget'
Modified: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py 2008-07-19 10:55:05 UTC (rev 684)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-19 10:57:04 UTC (rev 685)
@@ -10,6 +10,7 @@
from .Ui_View import ViewWidget
from .Ui_ViewBrowser import ViewBrowserWidget
from .Ui_ViewConnection import ViewConnectionWidget
+from .Ui_ViewDownloads import ViewDownloadsWidget
from .Ui_ViewLogger import ViewLoggerWidget
#*************************************************************
#
@@ -25,6 +26,7 @@
viewWidget.addTopViews(
ViewConnectionWidget(mainWindow),
ViewBrowserWidget(mainWindow),
+ ViewDownloadsWidget(mainWindow),
)
viewWidget.addBottomViews(ViewLoggerWidget(mainWindow))
Added: trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py (rev 0)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py 2008-07-19 10:57:04 UTC (rev 685)
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui'
+#
+# Created: Sat Jul 19 12:46:32 2008
+# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_ViewDownloadsWidget(object):
+ def setupUi(self, ViewDownloadsWidget):
+ ViewDownloadsWidget.setObjectName("ViewDownloadsWidget")
+ ViewDownloadsWidget.resize(400, 300)
+ self.gridLayout = QtGui.QGridLayout(ViewDownloadsWidget)
+ self.gridLayout.setObjectName("gridLayout")
+ self.treeView = QtGui.QTreeView(ViewDownloadsWidget)
+ self.treeView.setObjectName("treeView")
+ self.gridLayout.addWidget(self.treeView, 0, 0, 1, 1)
+
+ self.retranslateUi(ViewDownloadsWidget)
+ QtCore.QMetaObject.connectSlotsByName(ViewDownloadsWidget)
+
+ def retranslateUi(self, ViewDownloadsWidget):
+ ViewDownloadsWidget.setWindowTitle(QtGui.QApplication.translate("ViewDownloadsWidget", "Form", None, QtGui.QApplication.UnicodeUTF8))
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ ViewDownloadsWidget = QtGui.QWidget()
+ ui = Ui_ViewDownloadsWidget()
+ ui.setupUi(ViewDownloadsWidget)
+ ViewDownloadsWidget.show()
+ sys.exit(app.exec_())
+
Added: trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui 2008-07-19 10:57:04 UTC (rev 685)
@@ -0,0 +1,23 @@
+<ui version="4.0" >
+ <class>ViewDownloadsWidget</class>
+ <widget class="QWidget" name="ViewDownloadsWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>400</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <widget class="QTreeView" name="treeView" />
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-21 10:40:37
|
Revision: 707
http://fclient.svn.sourceforge.net/fclient/?rev=707&view=rev
Author: jUrner
Date: 2008-07-21 10:39:54 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
add default downloads dir
Modified Paths:
--------------
trunk/fclient/src/fclient/config.py
Added Paths:
-----------
trunk/fclient/src/fclient/downloads/
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-21 10:36:11 UTC (rev 706)
+++ trunk/fclient/src/fclient/config.py 2008-07-21 10:39:54 UTC (rev 707)
@@ -24,6 +24,7 @@
FclientDir = os.path.dirname(os.path.abspath(__file__))
FclientDocDir = os.path.join(FclientDir, 'doc')
+FclientDownloadsDir = os.path.join(FclientDir, 'downloads')
FclientResDir = os.path.join(FclientDir, 'res')
FclientSettingsDir = os.path.join(FclientDir, 'settings')
#**********************************************************************************
@@ -35,6 +36,7 @@
IdViewWidget = 'ViewWidget'
IdViewBrowserWidget = 'ViewBrowserWidget'
IdViewConnectionWidget = 'ViewConnectionWidget'
+IdViewCDownloadsWidget = 'ViewDownloadsWidget'
IdViewLoggerWidget = 'ViewDownloadsWidget'
IdViewLoggerWidget = 'ViewLoggerWidget'
@@ -55,8 +57,11 @@
if ido in self:
raise ValueError('ui object already registered: %s' % ido)
self[ido] = obj
-
-
+
+ def unregister(self, obj):
+ del self[str(obj.objectName())]
+
+
ObjectRegistry = ObjectRegistry()
#**********************************************************************************
#
@@ -95,6 +100,7 @@
('SettingsDir', 'String', QtCore.QString(FclientSettingsDir), SettingScopeUser), # if not None, settings are stored locally in the app folder
('SettingsAllUsers', 'Bool', False, SettingScopeUser), # store settings for all users?
('IconTheme', 'String', 'crystal', SettingScopeUser),
+ ('DownloadsDir', 'String', FclientDownloadsDir, SettingScopeUser),
)
SettingsBase._config_settings_ = Settings()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-25 08:06:47
|
Revision: 740
http://fclient.svn.sourceforge.net/fclient/?rev=740&view=rev
Author: jUrner
Date: 2008-07-25 08:06:56 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
add AutoLoadImages browser setting
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py
trunk/fclient/src/fclient/Ui_ViewBrowser.py
trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui
trunk/fclient/src/fclient/tpls/Ui_PrefsBrowserWidgetTpl.py
Modified: trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py
===================================================================
--- trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py 2008-07-25 08:06:22 UTC (rev 739)
+++ trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py 2008-07-25 08:06:56 UTC (rev 740)
@@ -21,6 +21,7 @@
IdCkOpenLinksInNewTab = 'ckOpenLinksInNewTab'
IdCkOpenHomePageOnNewTabCreated = 'ckOpenHomePageOnNewTabCreated'
IdCkBackIsClose = 'ckBackIsClose'
+ IdCkAutoLoadImages = 'ckAutoLoadImages'
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
@@ -40,6 +41,8 @@
ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('OpenHomePageOnNewTabCreated') else QtCore.Qt.Unchecked)
ck = self.controlById(self.IdCkBackIsClose)
ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('BackIsClose') else QtCore.Qt.Unchecked)
+ ck = self.controlById(self.IdCkAutoLoadImages)
+ ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('AutoLoadImages') else QtCore.Qt.Unchecked)
def controlById(self, idControl):
return getattr(self, idControl)
@@ -56,6 +59,7 @@
OpenLinksInNewTab=self.controlById(self.IdCkOpenLinksInNewTab).checkState() == QtCore.Qt.Checked,
OpenHomePageOnNewTabCreated=self.controlById(self.IdCkOpenHomePageOnNewTabCreated).checkState() == QtCore.Qt.Checked,
BackIsClose=self.controlById(self.IdCkBackIsClose).checkState() == QtCore.Qt.Checked,
+ AutoLoadImages=self.controlById(self.IdCkAutoLoadImages).checkState() == QtCore.Qt.Checked,
)
@@ -88,9 +92,10 @@
def doApply(self):
self._widget.apply()
+ return True
def doOk(self):
- self._widget.apply()
+ return True
#***********************************************************************
Modified: trunk/fclient/src/fclient/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-25 08:06:22 UTC (rev 739)
+++ trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-25 08:06:56 UTC (rev 740)
@@ -15,6 +15,7 @@
# x. zoom in/out
# x. page actions: CopyImageToClipboard,
# x. when mouse pointer is over an opend image a magnifier cursor appears. no idea how this is handled
+# x. open new tab on tab bar double click
#******************************************************************************************
"""
@@ -222,10 +223,24 @@
('BackIsClose', 'Bool', False, config.SettingScopeUser), #TODO: not implemented
('HomePage', 'String', QtCore.QString(), config.SettingScopeUser),
('IconSize', 'UInt', 32, config.SettingScopeUser),
- ('LoadImages', 'Bool', True, config.SettingScopeUser), #TODO: not yet implemented
+ ('AutoLoadImages', 'Bool', True, config.SettingScopeUser), #TODO: not yet implemented
('MaxTabText', 'UInt', 20, config.SettingScopeUser), #NOTE: make shure Max >= Min and Max and Min > 0
('MinTabText', 'UInt', 7, config.SettingScopeUser),
)
+
+ def setValues(self, **kws):
+ autoLoadImages = kws.get('AutoLoadImages', None)
+ if autoLoadImages is not None:
+ browserWidget = self.parent()
+ tabWidget = browserWidget.controlById(browserWidget.IdTabBrowsers)
+ for i in xrange(tabWidget.count()):
+ browser = tabWidget.widget(i)
+ settings = browser.settings()
+ settings.setAttribute(settings.AutoLoadImages, autoLoadImages)
+ config.SettingsBase.setValues(self, **kws)
+
+
+
class BrowserWidgetActions(config.ActionsBase):
@@ -322,10 +337,6 @@
self._initialConfigDataArrived = False
- #XXX ?
- #self.fproxyHost = None
- #self.fproxyPort = None
-
self.fcActions = BrowserWidgetActions(self)
self.fcSettings = BrowserWidgetSettings(self).restore()
self.fcViewObject = BrowserWidgetViewObject(self)
@@ -474,6 +485,7 @@
settings.setAttribute(settings.JavascriptCanOpenWindows, False)
settings.setAttribute(settings.JavascriptCanAccessClipboard, False)
settings.setAttribute(settings.PluginsEnabled, False)
+ settings.setAttribute(settings.AutoLoadImages, self.fcSettings.value('AutoLoadImages'))
# connect browser signals
self.connect(browser, QtCore.SIGNAL('loadStarted()'), self.onBrowserLoadStarted)
Modified: trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui 2008-07-25 08:06:22 UTC (rev 739)
+++ trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui 2008-07-25 08:06:56 UTC (rev 740)
@@ -67,10 +67,6 @@
</widget>
</item>
</layout>
- <zorder>ckOpenLinksInNewTab</zorder>
- <zorder>ckOpenBookmarksInNewTab</zorder>
- <zorder>ckOpenAddressBarInNewTab</zorder>
- <zorder>groupBox_2</zorder>
</widget>
</item>
<item>
@@ -99,6 +95,13 @@
</property>
</widget>
</item>
+ <item row="2" column="0" >
+ <widget class="QCheckBox" name="ckAutoLoadImages" >
+ <property name="text" >
+ <string>Auto load images</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
Modified: trunk/fclient/src/fclient/tpls/Ui_PrefsBrowserWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_PrefsBrowserWidgetTpl.py 2008-07-25 08:06:22 UTC (rev 739)
+++ trunk/fclient/src/fclient/tpls/Ui_PrefsBrowserWidgetTpl.py 2008-07-25 08:06:56 UTC (rev 740)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui'
#
-# Created: Thu Jul 24 12:03:27 2008
+# Created: Fri Jul 25 10:02:49 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
@@ -61,6 +61,9 @@
self.ckBackIsClose = QtGui.QCheckBox(self.groupBox_2)
self.ckBackIsClose.setObjectName("ckBackIsClose")
self.gridLayout_2.addWidget(self.ckBackIsClose, 1, 0, 1, 1)
+ self.ckAutoLoadImages = QtGui.QCheckBox(self.groupBox_2)
+ self.ckAutoLoadImages.setObjectName("ckAutoLoadImages")
+ self.gridLayout_2.addWidget(self.ckAutoLoadImages, 2, 0, 1, 1)
self.horizontalLayout.addWidget(self.groupBox_2)
self.gridLayout_3.addLayout(self.horizontalLayout, 1, 0, 1, 1)
spacerItem = QtGui.QSpacerItem(20, 297, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
@@ -79,6 +82,7 @@
self.groupBox_2.setTitle(QtGui.QApplication.translate("PrefsBrowserWidget", "Others", None, QtGui.QApplication.UnicodeUTF8))
self.ckOpenHomePageOnNewTabCreated.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Open home page when a new tab is created", None, QtGui.QApplication.UnicodeUTF8))
self.ckBackIsClose.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Back is close", None, QtGui.QApplication.UnicodeUTF8))
+ self.ckAutoLoadImages.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Auto load images", 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.
|
|
From: <jU...@us...> - 2008-07-25 22:40:36
|
Revision: 748
http://fclient.svn.sourceforge.net/fclient/?rev=748&view=rev
Author: jUrner
Date: 2008-07-25 22:40:45 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
truncates text
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py
trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui
trunk/fclient/src/fclient/tpls/Ui_DlgPropsBrowserObjectTpl.py
Modified: trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py
===================================================================
--- trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py 2008-07-25 22:39:39 UTC (rev 747)
+++ trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py 2008-07-25 22:40:45 UTC (rev 748)
@@ -2,8 +2,7 @@
#TODO:
# just a sketch so far
#
-# x. layout labels
-# x. limits! compact urls, truncate text (...)
+# x. link and image url are not selectable
#
#
#**********************************************************************
@@ -11,11 +10,12 @@
if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below
import os; __path__ = [os.path.dirname(__file__)]
-
+import posixpath
from PyQt4 import QtGui
from . import config
from .lib.compactpath.qt4 import pathlabelwrap
+from .lib.qt4ex.lib import tools as qtools
from .tpls.Ui_DlgPropsBrowserObjectTpl import Ui_DlgPropsBrowserObject
#**********************************************************************************
@@ -29,6 +29,7 @@
IdLabelLinkUrl = 'labelLinkUrl'
IdLabelImageUrl = 'labelImageUrl'
+ MaxText = 80
def __init__(self, parent, browser=None, hitTestResult=None):
QtGui.QDialog.__init__(self, parent)
@@ -36,16 +37,28 @@
self.setupUi(self)
self.setWindowTitle(config.FclientAppName + self.trUtf8(' - Properties'))
+
+
+
+
if hitTestResult is not None:
- self.labelTitle.setText(hitTestResult.linkTitle().toString())
- self.labelName.setText(hitTestResult.linkText())
-
+
if not hitTestResult.linkUrl().isEmpty():
- self.labelLinkUrl.setText(hitTestResult.linkUrl().toString())
+ labelLinkUrl = self.controlById(self.IdLabelLinkUrl)
+ self.wrapLinkUrl = pathlabelwrap.PathLabelWrap(labelLinkUrl, path_module=posixpath)
+ self.wrapLinkUrl.setPath(unicode(hitTestResult.linkUrl().toString()))
if not hitTestResult.imageUrl().isEmpty():
- self.labelImageUrl.setText(hitTestResult.imageUrl().toString())
-
-
+ labelImageUrl = self.controlById(self.IdLabelImageUrl)
+ self.wrapImageUrl = pathlabelwrap.PathLabelWrap(labelImageUrl, path_module=posixpath)
+ self.wrapImageUrl.setPath(unicode(hitTestResult.imageUrl().toString()))
+
+ ellipsis = self.trUtf8('..')
+ print hitTestResult.linkTitle(), hitTestResult.linkText()
+ self.labelTitle.setText(qtools.truncateString(self.MaxText, hitTestResult.linkTitle().toString(), ellipsis))
+ self.labelTitle.setText(qtools.truncateString(self.MaxText, hitTestResult.linkText(), ellipsis))
+
+
+
def controlById(self, idControl):
return getattr(self, idControl)
Modified: trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui 2008-07-25 22:39:39 UTC (rev 747)
+++ trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui 2008-07-25 22:40:45 UTC (rev 748)
@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>420</width>
- <height>189</height>
+ <height>307</height>
</rect>
</property>
<property name="windowTitle" >
@@ -14,160 +14,167 @@
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
- <layout class="QHBoxLayout" name="horizontalLayout" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
<item>
- <layout class="QVBoxLayout" name="verticalLayout_2" >
- <item>
- <widget class="QLabel" name="label" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Type:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Title:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_99" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>Name:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_4" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>LinkUrl:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_5" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>ImageUrl:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- </layout>
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string><b>Type:</b></string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
</item>
<item>
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QLabel" name="labeType" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelTitle" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelName" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelLinkUrl" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelImageUrl" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- </widget>
- </item>
- </layout>
+ <widget class="QLabel" name="labeType" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>unknown</string>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
</item>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string><b>Title:</b></string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelTitle" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>unknown</string>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_99" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string><b>Name:</b></string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelName" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>unknown</string>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string><b>LinkUrl:</b></string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelLinkUrl" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>unknown</string>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_5" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string><b>ImageUrl:</b></string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelImageUrl" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>unknown</string>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
</layout>
</item>
<item row="1" column="0" >
Modified: trunk/fclient/src/fclient/tpls/Ui_DlgPropsBrowserObjectTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_DlgPropsBrowserObjectTpl.py 2008-07-25 22:39:39 UTC (rev 747)
+++ trunk/fclient/src/fclient/tpls/Ui_DlgPropsBrowserObjectTpl.py 2008-07-25 22:40:45 UTC (rev 748)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui'
#
-# Created: Mon Jul 21 12:08:23 2008
+# Created: Fri Jul 25 21:08:39 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
@@ -12,13 +12,11 @@
class Ui_DlgPropsBrowserObject(object):
def setupUi(self, DlgPropsBrowserObject):
DlgPropsBrowserObject.setObjectName("DlgPropsBrowserObject")
- DlgPropsBrowserObject.resize(420, 189)
+ DlgPropsBrowserObject.resize(420, 307)
self.gridLayout = QtGui.QGridLayout(DlgPropsBrowserObject)
self.gridLayout.setObjectName("gridLayout")
- self.horizontalLayout = QtGui.QHBoxLayout()
- self.horizontalLayout.setObjectName("horizontalLayout")
- self.verticalLayout_2 = QtGui.QVBoxLayout()
- self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
self.label = QtGui.QLabel(DlgPropsBrowserObject)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
@@ -27,88 +25,89 @@
self.label.setSizePolicy(sizePolicy)
self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
self.label.setObjectName("label")
- self.verticalLayout_2.addWidget(self.label)
- self.label_2 = QtGui.QLabel(DlgPropsBrowserObject)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
- self.label_2.setSizePolicy(sizePolicy)
- self.label_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
- self.label_2.setObjectName("label_2")
- self.verticalLayout_2.addWidget(self.label_2)
- self.label_99 = QtGui.QLabel(DlgPropsBrowserObject)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_99.sizePolicy().hasHeightForWidth())
- self.label_99.setSizePolicy(sizePolicy)
- self.label_99.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
- self.label_99.setObjectName("label_99")
- self.verticalLayout_2.addWidget(self.label_99)
- self.label_4 = QtGui.QLabel(DlgPropsBrowserObject)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
- self.label_4.setSizePolicy(sizePolicy)
- self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
- self.label_4.setObjectName("label_4")
- self.verticalLayout_2.addWidget(self.label_4)
- self.label_5 = QtGui.QLabel(DlgPropsBrowserObject)
- sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
- sizePolicy.setHorizontalStretch(0)
- sizePolicy.setVerticalStretch(0)
- sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth())
- self.label_5.setSizePolicy(sizePolicy)
- self.label_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
- self.label_5.setObjectName("label_5")
- self.verticalLayout_2.addWidget(self.label_5)
- self.horizontalLayout.addLayout(self.verticalLayout_2)
- self.verticalLayout = QtGui.QVBoxLayout()
- self.verticalLayout.setObjectName("verticalLayout")
+ self.verticalLayout.addWidget(self.label)
self.labeType = QtGui.QLabel(DlgPropsBrowserObject)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.labeType.sizePolicy().hasHeightForWidth())
self.labeType.setSizePolicy(sizePolicy)
+ self.labeType.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.labeType.setObjectName("labeType")
self.verticalLayout.addWidget(self.labeType)
+ self.label_2 = QtGui.QLabel(DlgPropsBrowserObject)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
+ self.label_2.setSizePolicy(sizePolicy)
+ self.label_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.label_2.setObjectName("label_2")
+ self.verticalLayout.addWidget(self.label_2)
self.labelTitle = QtGui.QLabel(DlgPropsBrowserObject)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.labelTitle.sizePolicy().hasHeightForWidth())
self.labelTitle.setSizePolicy(sizePolicy)
+ self.labelTitle.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.labelTitle.setObjectName("labelTitle")
self.verticalLayout.addWidget(self.labelTitle)
+ self.label_99 = QtGui.QLabel(DlgPropsBrowserObject)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_99.sizePolicy().hasHeightForWidth())
+ self.label_99.setSizePolicy(sizePolicy)
+ self.label_99.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.label_99.setObjectName("label_99")
+ self.verticalLayout.addWidget(self.label_99)
self.labelName = QtGui.QLabel(DlgPropsBrowserObject)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.labelName.sizePolicy().hasHeightForWidth())
self.labelName.setSizePolicy(sizePolicy)
+ self.labelName.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.labelName.setObjectName("labelName")
self.verticalLayout.addWidget(self.labelName)
+ self.label_4 = QtGui.QLabel(DlgPropsBrowserObject)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
+ self.label_4.setSizePolicy(sizePolicy)
+ self.label_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.label_4.setObjectName("label_4")
+ self.verticalLayout.addWidget(self.label_4)
self.labelLinkUrl = QtGui.QLabel(DlgPropsBrowserObject)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.labelLinkUrl.sizePolicy().hasHeightForWidth())
self.labelLinkUrl.setSizePolicy(sizePolicy)
+ self.labelLinkUrl.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.labelLinkUrl.setObjectName("labelLinkUrl")
self.verticalLayout.addWidget(self.labelLinkUrl)
+ self.label_5 = QtGui.QLabel(DlgPropsBrowserObject)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth())
+ self.label_5.setSizePolicy(sizePolicy)
+ self.label_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.label_5.setObjectName("label_5")
+ self.verticalLayout.addWidget(self.label_5)
self.labelImageUrl = QtGui.QLabel(DlgPropsBrowserObject)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.labelImageUrl.sizePolicy().hasHeightForWidth())
self.labelImageUrl.setSizePolicy(sizePolicy)
+ self.labelImageUrl.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
self.labelImageUrl.setObjectName("labelImageUrl")
self.verticalLayout.addWidget(self.labelImageUrl)
- self.horizontalLayout.addLayout(self.verticalLayout)
- self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
+ self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
spacerItem = QtGui.QSpacerItem(397, 17, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 1, 0, 1, 1)
self.line = QtGui.QFrame(DlgPropsBrowserObject)
@@ -129,15 +128,15 @@
def retranslateUi(self, DlgPropsBrowserObject):
DlgPropsBrowserObject.setWindowTitle(QtGui.QApplication.translate("DlgPropsBrowserObject", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
- self.label.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Type:", None, QtGui.QApplication.UnicodeUTF8))
- self.label_2.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Title:", None, QtGui.QApplication.UnicodeUTF8))
- self.label_99.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Name:", None, QtGui.QApplication.UnicodeUTF8))
- self.label_4.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "LinkUrl:", None, QtGui.QApplication.UnicodeUTF8))
- self.label_5.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "ImageUrl:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "<b>Type:</b>", None, QtGui.QApplication.UnicodeUTF8))
self.labeType.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "<b>Title:</b>", None, QtGui.QApplication.UnicodeUTF8))
self.labelTitle.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_99.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "<b>Name:</b>", None, QtGui.QApplication.UnicodeUTF8))
self.labelName.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "<b>LinkUrl:</b>", None, QtGui.QApplication.UnicodeUTF8))
self.labelLinkUrl.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "<b>ImageUrl:</b>", None, QtGui.QApplication.UnicodeUTF8))
self.labelImageUrl.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-25 22:41:15
|
Revision: 749
http://fclient.svn.sourceforge.net/fclient/?rev=749&view=rev
Author: jUrner
Date: 2008-07-25 22:41:24 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
add a basic search bar
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewBrowser.py
trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py
trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui
Modified: trunk/fclient/src/fclient/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-25 22:40:45 UTC (rev 748)
+++ trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-25 22:41:24 UTC (rev 749)
@@ -300,7 +300,7 @@
trigger=parent.onZoomOut,
)
- # dummy actions to replace default browser actions
+ # default browser actions
self.action(
name='ActionBack',
text=self.trUtf8('Back'),
@@ -340,6 +340,15 @@
icon=config.resources.getIcon('button_cancel', iconSize, iconTheme=iconTheme),
trigger=None,
)
+
+ # search actions
+ self.action(
+ parent=parent,
+ name='ActionSearch',
+ text=self.trUtf8('Search'),
+ shortcut=QtGui.QKeySequence(self.trUtf8('Ctrl+F')),
+ trigger=parent.onSearch,
+ )
def intertwineBrowserActions(self, browser=None):
"""intertwines Browser actions with BrowserWidget actions
@@ -407,6 +416,12 @@
IdBtReload = 'btReload'
IdBtStop = 'btStop'
+ IdFrameSearch = 'frameSearch'
+ IdEdSearch = 'edSearch'
+ IdBtSearchUpwards = 'btSearchUpwards'
+ IdBtSearchDownwards = 'btSearchDownwards'
+ IdCkSearchCaseSensitive = 'ckSearchCaseSensitive'
+
ForcedMinBrowserTabText = 5 # forced minimum number of chars on browser tabBar
def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
@@ -439,6 +454,16 @@
self.controlById(self.IdBtReload).setDefaultAction(self.fcActions['ActionReload'])
self.controlById(self.IdBtStop).setDefaultAction(self.fcActions['ActionStop'])
+ # setupp search bar
+ bt = self.controlById(self.IdBtSearchUpwards)
+ self.connect(bt, QtCore.SIGNAL('clicked()'), self.onSearchUpwards)
+ bt = self.controlById(self.IdBtSearchDownwards)
+ self.connect(bt, QtCore.SIGNAL('clicked()'), self.onSearchDownwards)
+ ed = self.controlById(self.IdEdSearch)
+ self.connect(ed, QtCore.SIGNAL('returnPressed()'), self.onSearchDownwards)
+ frameSearch = self.controlById(self.IdFrameSearch)
+ frameSearch.setVisible(False)
+
# fire up a new broser to make a start
self.newBrowser(title=self.trUtf8('Waiting for fproxy'))
self.fcActions['ActionGoToHomePage'].trigger()
@@ -632,6 +657,7 @@
menu.addAction(self.fcActions['ActionOpenNewTab'])
menu.addAction(self.fcActions['ActionZoomIn'])
menu.addAction(self.fcActions['ActionZoomOut'])
+ menu.addAction(self.fcActions['ActionSearch'])
return menu
#########################################
@@ -863,6 +889,32 @@
if browser is not None and act is browser.pageAction(browser.page().Back):
self._adjustBackIsClose()
+ def onSearch(self, action):
+ frameSearch = self.controlById(self.IdFrameSearch)
+ frameSearch.setVisible(not frameSearch.isVisible())
+
+ def onSearchDownwards(self):
+ browser = self.currentBrowser()
+ if browser is not None:
+ page = browser.page()
+ ed = self.controlById(self.IdEdSearch)
+ ck = self.controlById(self.IdCkSearchCaseSensitive)
+ flags = page.FindWrapsAroundDocument
+ if ck.checkState() == QtCore.Qt.Checked:
+ flags |= page.FindCaseSensitively
+ browser.findText(ed.text(), flags)
+
+ def onSearchUpwards(self):
+ browser = self.currentBrowser()
+ if browser is not None:
+ page = browser.page()
+ ed = self.controlById(self.IdEdSearch)
+ ck = self.controlById(self.IdCkSearchCaseSensitive)
+ flags = page.FindWrapsAroundDocument | page.FindBackward
+ if ck.checkState() == QtCore.Qt.Checked:
+ flags |= page.FindCaseSensitively
+ browser.findText(ed.text(), flags)
+
def onTabContextMenuEvent(self, pt):
menu = QtGui.QMenu()
tabWidget = self.controlById(self.IdTabBrowsers)
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py 2008-07-25 22:40:45 UTC (rev 748)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py 2008-07-25 22:41:24 UTC (rev 749)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui'
#
-# Created: Fri Jul 25 19:05:55 2008
+# Created: Sat Jul 26 00:36:50 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
@@ -12,11 +12,9 @@
class Ui_ViewBrowserWidget(object):
def setupUi(self, ViewBrowserWidget):
ViewBrowserWidget.setObjectName("ViewBrowserWidget")
- ViewBrowserWidget.resize(570, 516)
- self.gridLayout_3 = QtGui.QGridLayout(ViewBrowserWidget)
- self.gridLayout_3.setMargin(0)
- self.gridLayout_3.setSpacing(0)
- self.gridLayout_3.setObjectName("gridLayout_3")
+ ViewBrowserWidget.resize(710, 794)
+ self.gridLayout_4 = QtGui.QGridLayout(ViewBrowserWidget)
+ self.gridLayout_4.setObjectName("gridLayout_4")
self.horizontalLayout = QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
@@ -59,14 +57,42 @@
self.edAddressBar.setObjectName("edAddressBar")
self.gridLayout.addWidget(self.edAddressBar, 0, 0, 1, 1)
self.horizontalLayout.addWidget(self.frameAddressBar)
- self.gridLayout_3.addLayout(self.horizontalLayout, 0, 0, 1, 1)
+ self.gridLayout_4.addLayout(self.horizontalLayout, 0, 0, 1, 1)
self.tabBrowsers = QtGui.QTabWidget(ViewBrowserWidget)
self.tabBrowsers.setObjectName("tabBrowsers")
self.tab = QtGui.QWidget()
- self.tab.setGeometry(QtCore.QRect(0, 0, 566, 458))
+ self.tab.setGeometry(QtCore.QRect(0, 0, 688, 654))
self.tab.setObjectName("tab")
self.tabBrowsers.addTab(self.tab, "")
- self.gridLayout_3.addWidget(self.tabBrowsers, 1, 0, 1, 1)
+ self.gridLayout_4.addWidget(self.tabBrowsers, 1, 0, 1, 1)
+ self.frameSearch = QtGui.QFrame(ViewBrowserWidget)
+ self.frameSearch.setFrameShape(QtGui.QFrame.StyledPanel)
+ self.frameSearch.setFrameShadow(QtGui.QFrame.Raised)
+ self.frameSearch.setObjectName("frameSearch")
+ self.gridLayout_3 = QtGui.QGridLayout(self.frameSearch)
+ self.gridLayout_3.setObjectName("gridLayout_3")
+ self.horizontalLayout_2 = QtGui.QHBoxLayout()
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.label = QtGui.QLabel(self.frameSearch)
+ self.label.setObjectName("label")
+ self.horizontalLayout_2.addWidget(self.label)
+ self.edSearch = QtGui.QLineEdit(self.frameSearch)
+ self.edSearch.setDragEnabled(True)
+ self.edSearch.setObjectName("edSearch")
+ self.horizontalLayout_2.addWidget(self.edSearch)
+ self.btSearchDownwards = QtGui.QPushButton(self.frameSearch)
+ self.btSearchDownwards.setObjectName("btSearchDownwards")
+ self.horizontalLayout_2.addWidget(self.btSearchDownwards)
+ self.btSearchUpwards = QtGui.QPushButton(self.frameSearch)
+ self.btSearchUpwards.setObjectName("btSearchUpwards")
+ self.horizontalLayout_2.addWidget(self.btSearchUpwards)
+ self.ckSearchCaseSensitive = QtGui.QCheckBox(self.frameSearch)
+ self.ckSearchCaseSensitive.setObjectName("ckSearchCaseSensitive")
+ self.horizontalLayout_2.addWidget(self.ckSearchCaseSensitive)
+ spacerItem = QtGui.QSpacerItem(48, 25, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.horizontalLayout_2.addItem(spacerItem)
+ self.gridLayout_3.addLayout(self.horizontalLayout_2, 0, 0, 1, 1)
+ self.gridLayout_4.addWidget(self.frameSearch, 2, 0, 1, 1)
self.retranslateUi(ViewBrowserWidget)
self.tabBrowsers.setCurrentIndex(0)
@@ -79,6 +105,10 @@
self.btReload.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Reload", None, QtGui.QApplication.UnicodeUTF8))
self.btStop.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Stop", None, QtGui.QApplication.UnicodeUTF8))
self.tabBrowsers.setTabText(self.tabBrowsers.indexOf(self.tab), QtGui.QApplication.translate("ViewBrowserWidget", "Tab 1", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Search:", None, QtGui.QApplication.UnicodeUTF8))
+ self.btSearchDownwards.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Down", None, QtGui.QApplication.UnicodeUTF8))
+ self.btSearchUpwards.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Up", None, QtGui.QApplication.UnicodeUTF8))
+ self.ckSearchCaseSensitive.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Case sensitive", None, QtGui.QApplication.UnicodeUTF8))
if __name__ == "__main__":
Modified: trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui 2008-07-25 22:40:45 UTC (rev 748)
+++ trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui 2008-07-25 22:41:24 UTC (rev 749)
@@ -5,20 +5,14 @@
<rect>
<x>0</x>
<y>0</y>
- <width>570</width>
- <height>516</height>
+ <width>710</width>
+ <height>794</height>
</rect>
</property>
<property name="windowTitle" >
<string>Form</string>
</property>
- <layout class="QGridLayout" name="gridLayout_3" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>0</number>
- </property>
+ <layout class="QGridLayout" name="gridLayout_4" >
<item row="0" column="0" >
<layout class="QHBoxLayout" name="horizontalLayout" >
<property name="spacing" >
@@ -120,8 +114,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>566</width>
- <height>458</height>
+ <width>688</width>
+ <height>654</height>
</rect>
</property>
<attribute name="title" >
@@ -130,6 +124,70 @@
</widget>
</widget>
</item>
+ <item row="2" column="0" >
+ <widget class="QFrame" name="frameSearch" >
+ <property name="frameShape" >
+ <enum>QFrame::StyledPanel</enum>
+ </property>
+ <property name="frameShadow" >
+ <enum>QFrame::Raised</enum>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_3" >
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Search:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="edSearch" >
+ <property name="dragEnabled" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btSearchDownwards" >
+ <property name="text" >
+ <string>Down</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btSearchUpwards" >
+ <property name="text" >
+ <string>Up</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QCheckBox" name="ckSearchCaseSensitive" >
+ <property name="text" >
+ <string>Case sensitive</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <spacer name="horizontalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>48</width>
+ <height>25</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </item>
</layout>
</widget>
<resources/>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-26 09:15:18
|
Revision: 751
http://fclient.svn.sourceforge.net/fclient/?rev=751&view=rev
Author: jUrner
Date: 2008-07-26 09:15:26 +0000 (Sat, 26 Jul 2008)
Log Message:
-----------
better compacting of freenet keys
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py
trunk/fclient/src/fclient/Ui_ViewBrowser.py
trunk/fclient/src/fclient/config.py
Modified: trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py
===================================================================
--- trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py 2008-07-26 09:14:50 UTC (rev 750)
+++ trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py 2008-07-26 09:15:26 UTC (rev 751)
@@ -37,34 +37,24 @@
self.setupUi(self)
self.setWindowTitle(config.FclientAppName + self.trUtf8(' - Properties'))
-
-
-
-
if hitTestResult is not None:
if not hitTestResult.linkUrl().isEmpty():
labelLinkUrl = self.controlById(self.IdLabelLinkUrl)
- self.wrapLinkUrl = pathlabelwrap.PathLabelWrap(labelLinkUrl, path_module=posixpath)
+ self.wrapLinkUrl = pathlabelwrap.PathLabelWrap(labelLinkUrl, path_module=config.CompactPathFcpKeyModule)
self.wrapLinkUrl.setPath(unicode(hitTestResult.linkUrl().toString()))
if not hitTestResult.imageUrl().isEmpty():
labelImageUrl = self.controlById(self.IdLabelImageUrl)
- self.wrapImageUrl = pathlabelwrap.PathLabelWrap(labelImageUrl, path_module=posixpath)
+ self.wrapImageUrl = pathlabelwrap.PathLabelWrap(labelImageUrl, path_module=config.CompactPathFcpKeyModule)
self.wrapImageUrl.setPath(unicode(hitTestResult.imageUrl().toString()))
ellipsis = self.trUtf8('..')
- print hitTestResult.linkTitle(), hitTestResult.linkText()
self.labelTitle.setText(qtools.truncateString(self.MaxText, hitTestResult.linkTitle().toString(), ellipsis))
self.labelTitle.setText(qtools.truncateString(self.MaxText, hitTestResult.linkText(), ellipsis))
-
-
-
-
+
def controlById(self, idControl):
return getattr(self, idControl)
-
-
#**********************************************************************************
#
#**********************************************************************************
Modified: trunk/fclient/src/fclient/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-26 09:14:50 UTC (rev 750)
+++ trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-26 09:15:26 UTC (rev 751)
@@ -12,10 +12,17 @@
# x. fProxy is a bit tight-lipped when it comes to feedback. no idea
# x. give feedback on tabs about load / finisched / error. maybe some color code. wait for new QTabWidget features (qt4.5)
# x. close button on tabs. wait for new QTabWidget features (qt4.5)
-# x. zoom in/out
# x. page actions: CopyImageToClipboard,
# x. when mouse pointer is over an opend image a magnifier cursor appears. no idea how this is handled
-# x. open new tab on tab bar double click
+# x. open new tab on tab bar double click. IIRC looks like no way before qt4.5. tabBars are not stretched to fit in qt4.4
+# x. global feedback on statusbar flickers. reason: first label is holds arbitrary length text
+# x. save link to disk
+# x. fproxy. "force browser to dl" should we dl it in downloads or store emidiately? no idea
+# x. visiting plugins via fproxy does not work
+# real toolbars
+# x. remove host/port from urls?
+# x. browser settings - QWebSettings
+# x. shortcuts
#******************************************************************************************
"""
@@ -25,7 +32,6 @@
if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below
import os; __path__ = [os.path.dirname(__file__)]
-import posixpath
from PyQt4 import QtCore, QtGui, QtWebKit
from . import config
@@ -176,7 +182,7 @@
label.setFrameStyle(QtGui.QLabel.Sunken | QtGui.QLabel.Box)
self.labelFeedbackWrap = pathlabelwrap.PathLabelWrap(
label,
- path_module=posixpath,
+ path_module=config.CompactPathFcpKeyModule,
)
self.statusBar.addWidget(self.labelFeedbackWrap.label, 1)
@@ -609,7 +615,6 @@
# customize browser
browser.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
- ##settings.setAttribute(settings.AutoLoadImages, False)
settings.setAttribute(settings.DeveloperExtrasEnabled, False)
settings.setAttribute(settings.JavaEnabled, False)
settings.setAttribute(settings.JavascriptEnabled, False)
@@ -959,7 +964,6 @@
if browser is not None:
oldMultiplier = browser.textSizeMultiplier()
browser.setTextSizeMultiplier(browser.textSizeMultiplier() - 0.2)
- print browser.textSizeMultiplier()
if browser.textSizeMultiplier() >= oldMultiplier:
menu.addAction(self.fcActions['ActionZoomOut']).setEnabled(False)
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-26 09:14:50 UTC (rev 750)
+++ trunk/fclient/src/fclient/config.py 2008-07-26 09:15:26 UTC (rev 751)
@@ -197,3 +197,20 @@
return QtCore.QString(filename)
return default
+
+class CompactPathFcpKeyModule(object):
+ """path module for lib.compactpath to split and join fcp keys"""
+
+ import re
+ KeyPattern = re.compile('(.*? (?: CSK@ | SSK@ | KSK@ | USK@) [^\/]*)(.*)\Z', re.I | re.X)
+
+ @classmethod
+ def join(clss, *components):
+ return ''.join(components)
+
+ @classmethod
+ def split(clss, key):
+ r = clss.KeyPattern.match(key)
+ if r is None:
+ return key, ''
+ return r.group(1), r.group(2)
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-27 11:13:28
|
Revision: 761
http://fclient.svn.sourceforge.net/fclient/?rev=761&view=rev
Author: jUrner
Date: 2008-07-27 11:13:36 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
add expert settings (not complete yet)
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewConnection.py
trunk/fclient/src/fclient/tpls/Ui_ViewConnectionWidgetTpl.py
trunk/fclient/src/fclient/tpls/ViewConnectionWidgetTpl.ui
Added Paths:
-----------
trunk/fclient/src/fclient/Ui_DlgConnectionExpertSettings.py
trunk/fclient/src/fclient/tpls/DlgConnectionExpertSettingsTpl.ui
trunk/fclient/src/fclient/tpls/Ui_DlgConnectionExpertSettingsTpl.py
Added: trunk/fclient/src/fclient/Ui_DlgConnectionExpertSettings.py
===================================================================
--- trunk/fclient/src/fclient/Ui_DlgConnectionExpertSettings.py (rev 0)
+++ trunk/fclient/src/fclient/Ui_DlgConnectionExpertSettings.py 2008-07-27 11:13:36 UTC (rev 761)
@@ -0,0 +1,73 @@
+
+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 QtCore, QtGui
+
+from . import config
+
+from .tpls.Ui_DlgConnectionExpertSettingsTpl import Ui_DlgConnectionExpertSettings
+#**********************************************************************************
+#
+#**********************************************************************************
+class ConnectionExpertSettingsDlg(QtGui.QDialog, Ui_DlgConnectionExpertSettings ):
+
+ IdEdFcpConnectionName = 'edFcpConnectionName'
+ IdSpinFcpConnectionTimerMaxDuration = 'spinFcpConnectionTimerMaxDuration'
+ IdSpinConnectionTimerTimeout = 'spinConnectionTimerTimeout'
+ IdSpinFcpPollTimerTimeout = 'spinFcpPollTimerTimeout'
+
+ def __init__(self, parent=None):
+ QtGui.QDialog.__init__(self, parent)
+
+ self.setupUi(self)
+ self.setWindowTitle(config.FclientAppName + self.trUtf8(' - Connection expert settings'))
+
+ edName = self.controlById(self.IdEdFcpConnectionName)
+ edName.setText(config.settings.value('FcpConnectionName'))
+ self.connect(edName, QtCore.SIGNAL('textChanged(const QString &)'), self.onEdFcpConnectionNameChanged)
+
+ connectionWidget = config.ObjectRegistry.get(config.IdViewConnectionWidget, None)
+ spins = (
+ (self.IdSpinFcpConnectionTimerMaxDuration, 'FcpConnectionTimerMaxDuration'),
+ (self.IdSpinConnectionTimerTimeout, 'FcpConnectionTimerTimeout'),
+ (self.IdSpinFcpPollTimerTimeout, 'FcpPollTimerTimeout'),
+ )
+ for idControl, settingName in spins:
+ spin = self.controlById(idControl)
+ if connectionWidget is None:
+ spin.setEnabled(False)
+ else:
+ spin.setValue(connectionWidget.fcSettings.value(settingName))
+
+
+
+
+ def controlById(self, idControl):
+ return getattr(self, idControl)
+
+
+ def onEdFcpConnectionNameChanged(self, text):
+ config.settings.setValues(FcpConnectionName=text)
+
+
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+
+ class DummyKey(object):
+ KeyType = 'USK@'
+ def __init__(self): self.key = 'USG@qweqqweqwe'
+ def toString(self): return self.key
+
+ app = QtGui.QApplication(sys.argv)
+ w = ConnectionExpertSettingsDlg(None)
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
+
Modified: trunk/fclient/src/fclient/Ui_ViewConnection.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-27 11:12:38 UTC (rev 760)
+++ trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-27 11:13:36 UTC (rev 761)
@@ -1,4 +1,13 @@
#*********************************************************************
+#TODO:
+# x. setting fcp connection params currently won't reset connection. how to handle?
+#
+#
+#*********************************************************************
+
+
+
+#*********************************************************************
#NOTES:
#
# current handling is:
@@ -18,6 +27,7 @@
from . import config
from .lib import fcp2
+from .Ui_DlgConnectionExpertSettings import ConnectionExpertSettingsDlg
from .tpls.Ui_ViewConnectionWidgetTpl import Ui_ViewConnectionWidget
#**********************************************************************************
@@ -56,9 +66,9 @@
class Settings(config.SettingsBase):
_key_ = config.IdViewConnectionWidget
_settings_ = (
- ('ConnectionTimerTimeout', 'UInt', 500, config.SettingScopeExpert),
- ('ConnectionTimerMaxDuration', 'UInt', 20, config.SettingScopeExpert),
- ('PollTimerTimeout', 'UInt', 200, config.SettingScopeExpert),
+ ('FcpConnectionTimerTimeout', 'UInt', 500, config.SettingScopeExpert),
+ ('FcpConnectionTimerMaxDuration', 'UInt', 20, config.SettingScopeExpert),
+ ('FcpPollTimerTimeout', 'UInt', 200, config.SettingScopeExpert),
)
class ConnectionViewObject(config.ViewObject):
@@ -82,12 +92,13 @@
self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
def start(self, settings):
+ config.fcpClient.setConnectionName(config.settings.value('FcpConnectionName'))
self.fcpIterConnect = config.fcpClient.iterConnect(
- duration=settings.value('ConnectionTimerMaxDuration'),
+ duration=settings.value('FcpConnectionTimerMaxDuration'),
timeout=0
)
if not self.onNext():
- QtCore.QTimer.start(self, settings.value('ConnectionTimerTimeout'))
+ QtCore.QTimer.start(self, settings.value('FcpConnectionTimerTimeout'))
def onNext(self):
try:
@@ -112,7 +123,7 @@
self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
def start(self, settings):
- QtCore.QTimer.start(self, settings.value('PollTimerTimeout'))
+ QtCore.QTimer.start(self, settings.value('FcpPollTimerTimeout'))
def onNext(self):
if config.fcpClient.isConnected():
@@ -124,9 +135,11 @@
class ViewConnectionWidget(QtGui.QWidget, Ui_ViewConnectionWidget):
IdBtConnect = 'btConnect'
- IdCkFcpAutoConnect = 'ckFcpAutoConnect'
IdEdFcpFcpConnectionHost = 'edFcpConnectionHost'
IdFcpSpinFcpConnectionPort = 'spinFcpConnectionPort'
+ IdCkFcpAutoConnect = 'ckFcpAutoConnect'
+ IdBtFcpConnectionMore = 'btFcpConnectionMore'
+
IdEdFproxyConnectionHost = 'edFproxyConnectionHost'
IdFproxySpinConnectionPort = 'spinFproxyConnectionPort'
@@ -186,7 +199,7 @@
return
self._isCreated = True
- # setup fcp host / port
+ # setup fcp host / port / name
edHost = self.controlById(self.IdEdFcpFcpConnectionHost)
edHost.setText(config.settings.value('FcpConnectionHost'))
self.connect(edHost, QtCore.SIGNAL('textChanged(const QString &)'), self.onEdFcpConnectionHostChanged)
@@ -201,6 +214,9 @@
ck.setChecked(doAutoConnect)
self.connect(ck, QtCore.SIGNAL('stateChanged(int)'), self.onCkFcpAutoConnectStateChanged)
+ bt = self.controlById(self.IdBtFcpConnectionMore)
+ self.connect(bt, QtCore.SIGNAL('clicked()'), self.onBtFcpConnectionMoreClicked)
+
# setup fproxy host / port
edHost = self.controlById(self.IdEdFproxyConnectionHost)
edHost.setText(config.settings.value('FproxyConnectionHost'))
@@ -251,6 +267,11 @@
def onSpinFcpConnectionPortChanged(self, value):
config.settings.setValues(FcpConnectionPort=value)
+ def onBtFcpConnectionMoreClicked(self):
+ dlg = ConnectionExpertSettingsDlg(self)
+ if dlg.exec_() == dlg.Accepted:
+ pass
+
def onEdFproxyConnectionHostChanged(self, text):
config.settings.setValues(FproxyConnectionHost=text)
Added: trunk/fclient/src/fclient/tpls/DlgConnectionExpertSettingsTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/DlgConnectionExpertSettingsTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/tpls/DlgConnectionExpertSettingsTpl.ui 2008-07-27 11:13:36 UTC (rev 761)
@@ -0,0 +1,287 @@
+<ui version="4.0" >
+ <class>DlgConnectionExpertSettings</class>
+ <widget class="QDialog" name="DlgConnectionExpertSettings" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>392</width>
+ <height>589</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2" >
+ <item row="0" column="0" >
+ <widget class="QTabWidget" name="tabWidget" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>370</width>
+ <height>472</height>
+ </rect>
+ </property>
+ <attribute name="title" >
+ <string>Fcp connection</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>Adjusts the name the client uses to connect to the node. Use this for example to adjust the connection name in case the name is already in use by other clients. WARNING: changing this will loose all your current qequests</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Connection name:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="edFcpConnectionName" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>How long should the client try to connect to the node before finally giving up? How long should he wait before retrying to establish a connection? WARNING: setting timeout to low values may cause the gui to slow down</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3" >
+ <item>
+ <widget class="QLabel" name="label_3" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Connect duration:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Connect timeout:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QSpinBox" name="spinFcpConnectionTimerMaxDuration" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="suffix" >
+ <string> seconds</string>
+ </property>
+ <property name="maximum" >
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinConnectionTimerTimeout" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="suffix" >
+ <string> miliseconds</string>
+ </property>
+ <property name="maximum" >
+ <number>99999</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_7" >
+ <property name="text" >
+ <string>How long should the client wait before polling the node for a the next message? Warning: setting this to high values will make messages come in more slowly. Setting it to low values may cause the gui to slow down.
+</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3" >
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Poll frequency: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinFcpPollTimerTimeout" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="suffix" >
+ <string> miliseconds</string>
+ </property>
+ <property name="maximum" >
+ <number>99999</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>98</width>
+ <height>15</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>DlgConnectionExpertSettings</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>DlgConnectionExpertSettings</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
Added: trunk/fclient/src/fclient/tpls/Ui_DlgConnectionExpertSettingsTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_DlgConnectionExpertSettingsTpl.py (rev 0)
+++ trunk/fclient/src/fclient/tpls/Ui_DlgConnectionExpertSettingsTpl.py 2008-07-27 11:13:36 UTC (rev 761)
@@ -0,0 +1,173 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/DlgConnectionExpertSettingsTpl.ui'
+#
+# Created: Sat Jul 26 13:40:11 2008
+# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_DlgConnectionExpertSettings(object):
+ def setupUi(self, DlgConnectionExpertSettings):
+ DlgConnectionExpertSettings.setObjectName("DlgConnectionExpertSettings")
+ DlgConnectionExpertSettings.resize(392, 589)
+ self.gridLayout_2 = QtGui.QGridLayout(DlgConnectionExpertSettings)
+ self.gridLayout_2.setObjectName("gridLayout_2")
+ self.tabWidget = QtGui.QTabWidget(DlgConnectionExpertSettings)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.tabWidget.sizePolicy().hasHeightForWidth())
+ self.tabWidget.setSizePolicy(sizePolicy)
+ self.tabWidget.setObjectName("tabWidget")
+ self.tab = QtGui.QWidget()
+ self.tab.setGeometry(QtCore.QRect(0, 0, 370, 472))
+ self.tab.setObjectName("tab")
+ self.gridLayout = QtGui.QGridLayout(self.tab)
+ self.gridLayout.setObjectName("gridLayout")
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setSpacing(0)
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.label_5 = QtGui.QLabel(self.tab)
+ self.label_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.label_5.setWordWrap(True)
+ self.label_5.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard)
+ self.label_5.setObjectName("label_5")
+ self.verticalLayout.addWidget(self.label_5)
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setSpacing(6)
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.label = QtGui.QLabel(self.tab)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
+ self.label.setSizePolicy(sizePolicy)
+ self.label.setObjectName("label")
+ self.horizontalLayout.addWidget(self.label)
+ self.edFcpConnectionName = QtGui.QLineEdit(self.tab)
+ self.edFcpConnectionName.setObjectName("edFcpConnectionName")
+ self.horizontalLayout.addWidget(self.edFcpConnectionName)
+ self.verticalLayout.addLayout(self.horizontalLayout)
+ self.label_6 = QtGui.QLabel(self.tab)
+ self.label_6.setWordWrap(True)
+ self.label_6.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard)
+ self.label_6.setObjectName("label_6")
+ self.verticalLayout.addWidget(self.label_6)
+ self.horizontalLayout_2 = QtGui.QHBoxLayout()
+ self.horizontalLayout_2.setObjectName("horizontalLayout_2")
+ self.verticalLayout_3 = QtGui.QVBoxLayout()
+ self.verticalLayout_3.setObjectName("verticalLayout_3")
+ self.label_3 = QtGui.QLabel(self.tab)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth())
+ self.label_3.setSizePolicy(sizePolicy)
+ self.label_3.setObjectName("label_3")
+ self.verticalLayout_3.addWidget(self.label_3)
+ self.label_4 = QtGui.QLabel(self.tab)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
+ self.label_4.setSizePolicy(sizePolicy)
+ self.label_4.setObjectName("label_4")
+ self.verticalLayout_3.addWidget(self.label_4)
+ self.horizontalLayout_2.addLayout(self.verticalLayout_3)
+ self.verticalLayout_2 = QtGui.QVBoxLayout()
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.spinFcpConnectionTimerMaxDuration = QtGui.QSpinBox(self.tab)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.spinFcpConnectionTimerMaxDuration.sizePolicy().hasHeightForWidth())
+ self.spinFcpConnectionTimerMaxDuration.setSizePolicy(sizePolicy)
+ self.spinFcpConnectionTimerMaxDuration.setMaximum(999)
+ self.spinFcpConnectionTimerMaxDuration.setObjectName("spinFcpConnectionTimerMaxDuration")
+ self.verticalLayout_2.addWidget(self.spinFcpConnectionTimerMaxDuration)
+ self.spinConnectionTimerTimeout = QtGui.QSpinBox(self.tab)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.spinConnectionTimerTimeout.sizePolicy().hasHeightForWidth())
+ self.spinConnectionTimerTimeout.setSizePolicy(sizePolicy)
+ self.spinConnectionTimerTimeout.setMaximum(99999)
+ self.spinConnectionTimerTimeout.setObjectName("spinConnectionTimerTimeout")
+ self.verticalLayout_2.addWidget(self.spinConnectionTimerTimeout)
+ self.horizontalLayout_2.addLayout(self.verticalLayout_2)
+ self.verticalLayout.addLayout(self.horizontalLayout_2)
+ self.label_7 = QtGui.QLabel(self.tab)
+ self.label_7.setWordWrap(True)
+ self.label_7.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.TextSelectableByKeyboard)
+ self.label_7.setObjectName("label_7")
+ self.verticalLayout.addWidget(self.label_7)
+ self.horizontalLayout_3 = QtGui.QHBoxLayout()
+ self.horizontalLayout_3.setObjectName("horizontalLayout_3")
+ self.label_2 = QtGui.QLabel(self.tab)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
+ self.label_2.setSizePolicy(sizePolicy)
+ self.label_2.setObjectName("label_2")
+ self.horizontalLayout_3.addWidget(self.label_2)
+ self.spinFcpPollTimerTimeout = QtGui.QSpinBox(self.tab)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.spinFcpPollTimerTimeout.sizePolicy().hasHeightForWidth())
+ self.spinFcpPollTimerTimeout.setSizePolicy(sizePolicy)
+ self.spinFcpPollTimerTimeout.setMaximum(99999)
+ self.spinFcpPollTimerTimeout.setObjectName("spinFcpPollTimerTimeout")
+ self.horizontalLayout_3.addWidget(self.spinFcpPollTimerTimeout)
+ self.verticalLayout.addLayout(self.horizontalLayout_3)
+ self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
+ self.tabWidget.addTab(self.tab, "")
+ self.gridLayout_2.addWidget(self.tabWidget, 0, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(98, 15, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridLayout_2.addItem(spacerItem, 1, 0, 1, 1)
+ self.line = QtGui.QFrame(DlgConnectionExpertSettings)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridLayout_2.addWidget(self.line, 2, 0, 1, 1)
+ self.buttonBox = QtGui.QDialogButtonBox(DlgConnectionExpertSettings)
+ self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
+ self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok|QtGui.QDialogButtonBox.Reset)
+ self.buttonBox.setObjectName("buttonBox")
+ self.gridLayout_2.addWidget(self.buttonBox, 3, 0, 1, 1)
+
+ self.retranslateUi(DlgConnectionExpertSettings)
+ self.tabWidget.setCurrentIndex(0)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), DlgConnectionExpertSettings.accept)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), DlgConnectionExpertSettings.reject)
+ QtCore.QMetaObject.connectSlotsByName(DlgConnectionExpertSettings)
+
+ def retranslateUi(self, DlgConnectionExpertSettings):
+ DlgConnectionExpertSettings.setWindowTitle(QtGui.QApplication.translate("DlgConnectionExpertSettings", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_5.setText(QtGui.QApplication.translate("DlgConnectionExpertSettings", "Adjusts the name the client uses to connect to the node. Use this for example to adjust the connection name in case the name is already in use by other clients. WARNING: changing this will loose all your current qequests", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("DlgConnectionExpertSettings", "Connection name:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_6.setText(QtGui.QApplication.translate("DlgConnectionExpertSettings", "How long should the client try to connect to the node before finally giving up? How long should he wait before retrying to establish a connection? WARNING: setting timeout to low values may cause the gui to slow down", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("DlgConnectionExpertSettings", "Connect duration:", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_4.setText(QtGui.QApplication.translate("DlgConnectionExpertSettings", "Connect timeout:", None, QtGui.QApplication.UnicodeUTF8))
+ self.spinFcpConnectionTimerMaxDuration.setSuffix(QtGui.QApplication.translate("DlgConnectionExpertSettings", " seconds", None, QtGui.QApplication.UnicodeUTF8))
+ self.spinConnectionTimerTimeout.setSuffix(QtGui.QApplication.translate("DlgConnectionExpertSettings", " miliseconds", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_7.setText(QtGui.QApplication.translate("DlgConnectionExpertSettings", "How long should the client wait before polling the node for a the next message? Warning: setting this to high values will make messages come in more slowly. Setting it to low values may cause the gui to slow down.\n"
+"", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("DlgConnectionExpertSettings", "Poll frequency: ", None, QtGui.QApplication.UnicodeUTF8))
+ self.spinFcpPollTimerTimeout.setSuffix(QtGui.QApplication.translate("DlgConnectionExpertSettings", " miliseconds", None, QtGui.QApplication.UnicodeUTF8))
+ self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QtGui.QApplication.translate("DlgConnectionExpertSettings", "Fcp connection", None, QtGui.QApplication.UnicodeUTF8))
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ DlgConnectionExpertSettings = QtGui.QDialog()
+ ui = Ui_DlgConnectionExpertSettings()
+ ui.setupUi(DlgConnectionExpertSettings)
+ DlgConnectionExpertSettings.show()
+ sys.exit(app.exec_())
+
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewConnectionWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewConnectionWidgetTpl.py 2008-07-27 11:12:38 UTC (rev 760)
+++ trunk/fclient/src/fclient/t...
[truncated message content] |
|
From: <jU...@us...> - 2008-07-27 11:20:45
|
Revision: 763
http://fclient.svn.sourceforge.net/fclient/?rev=763&view=rev
Author: jUrner
Date: 2008-07-27 11:20:49 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
new package structure
Added Paths:
-----------
trunk/fclient/src/fclient/impl/downloads/
trunk/fclient/src/fclient/impl/lib/
trunk/fclient/src/fclient/impl/lib/__init__.py
trunk/fclient/src/fclient/impl/lib/compactpath/
trunk/fclient/src/fclient/impl/lib/fcp2/
trunk/fclient/src/fclient/impl/lib/qt4ex/
trunk/fclient/src/fclient/impl/res/
trunk/fclient/src/fclient/impl/res/icons/
trunk/fclient/src/fclient/impl/settings/
trunk/fclient/src/fclient/impl/tpls/
trunk/fclient/src/fclient/impl/tpls/DlgConnectionExpertSettingsTpl.ui
trunk/fclient/src/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui
trunk/fclient/src/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui
trunk/fclient/src/fclient/impl/tpls/MainWindowTpl.ui
trunk/fclient/src/fclient/impl/tpls/PrefsBrowserWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/Ui_DlgConnectionExpertSettingsTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_DlgDownloadKeyToDiskTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_DlgPropsBrowserObjectTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_MainWindowTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_PrefsBrowserWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_PrefsGlobalWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewBrowserWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewConnectionWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewDownloadsWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewLoggerWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/ViewBrowserWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/ViewConnectionWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/ViewDownloadsWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/ViewLoggerWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/ViewWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/__init__.py
Removed Paths:
-------------
trunk/fclient/src/fclient/downloads/
trunk/fclient/src/fclient/impl/lib/__init__.py
trunk/fclient/src/fclient/impl/lib/compactpath/
trunk/fclient/src/fclient/impl/lib/fcp2/
trunk/fclient/src/fclient/impl/lib/qt4ex/
trunk/fclient/src/fclient/impl/res/icons/
trunk/fclient/src/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui
trunk/fclient/src/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui
trunk/fclient/src/fclient/impl/tpls/MainWindowTpl.ui
trunk/fclient/src/fclient/impl/tpls/PrefsBrowserWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/Ui_DlgDownloadKeyToDiskTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_DlgPropsBrowserObjectTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_MainWindowTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_PrefsBrowserWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_PrefsGlobalWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewBrowserWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewConnectionWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewDownloadsWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewLoggerWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_ViewWidgetTpl.py
trunk/fclient/src/fclient/impl/tpls/ViewBrowserWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/ViewConnectionWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/ViewDownloadsWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/ViewLoggerWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/ViewWidgetTpl.ui
trunk/fclient/src/fclient/impl/tpls/__init__.py
trunk/fclient/src/fclient/lib/
trunk/fclient/src/fclient/res/
trunk/fclient/src/fclient/settings/
trunk/fclient/src/fclient/tpls/
Deleted: trunk/fclient/src/fclient/impl/lib/__init__.py
===================================================================
--- trunk/fclient/src/fclient/lib/__init__.py 2008-07-25 22:41:24 UTC (rev 749)
+++ trunk/fclient/src/fclient/impl/lib/__init__.py 2008-07-27 11:20:49 UTC (rev 763)
@@ -1 +0,0 @@
-
Copied: trunk/fclient/src/fclient/impl/lib/__init__.py (from rev 762, trunk/fclient/src/fclient/lib/__init__.py)
===================================================================
--- trunk/fclient/src/fclient/impl/lib/__init__.py (rev 0)
+++ trunk/fclient/src/fclient/impl/lib/__init__.py 2008-07-27 11:20:49 UTC (rev 763)
@@ -0,0 +1 @@
+
Copied: trunk/fclient/src/fclient/impl/tpls/DlgConnectionExpertSettingsTpl.ui (from rev 762, trunk/fclient/src/fclient/tpls/DlgConnectionExpertSettingsTpl.ui)
===================================================================
--- trunk/fclient/src/fclient/impl/tpls/DlgConnectionExpertSettingsTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/impl/tpls/DlgConnectionExpertSettingsTpl.ui 2008-07-27 11:20:49 UTC (rev 763)
@@ -0,0 +1,287 @@
+<ui version="4.0" >
+ <class>DlgConnectionExpertSettings</class>
+ <widget class="QDialog" name="DlgConnectionExpertSettings" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>392</width>
+ <height>589</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout_2" >
+ <item row="0" column="0" >
+ <widget class="QTabWidget" name="tabWidget" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Minimum" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="currentIndex" >
+ <number>0</number>
+ </property>
+ <widget class="QWidget" name="tab" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>370</width>
+ <height>472</height>
+ </rect>
+ </property>
+ <attribute name="title" >
+ <string>Fcp connection</string>
+ </attribute>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <property name="spacing" >
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label_5" >
+ <property name="text" >
+ <string>Adjusts the name the client uses to connect to the node. Use this for example to adjust the connection name in case the name is already in use by other clients. WARNING: changing this will loose all your current qequests</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Preferred" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Connection name:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="edFcpConnectionName" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_6" >
+ <property name="text" >
+ <string>How long should the client try to connect to the node before finally giving up? How long should he wait before retrying to establish a connection? WARNING: setting timeout to low values may cause the gui to slow down</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_2" >
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_3" >
+ <item>
+ <widget class="QLabel" name="label_3" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Connect duration:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_4" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Connect timeout:</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <widget class="QSpinBox" name="spinFcpConnectionTimerMaxDuration" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="suffix" >
+ <string> seconds</string>
+ </property>
+ <property name="maximum" >
+ <number>999</number>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinConnectionTimerTimeout" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="suffix" >
+ <string> miliseconds</string>
+ </property>
+ <property name="maximum" >
+ <number>99999</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_7" >
+ <property name="text" >
+ <string>How long should the client wait before polling the node for a the next message? Warning: setting this to high values will make messages come in more slowly. Setting it to low values may cause the gui to slow down.
+</string>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3" >
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="text" >
+ <string>Poll frequency: </string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinFcpPollTimerTimeout" >
+ <property name="sizePolicy" >
+ <sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="suffix" >
+ <string> miliseconds</string>
+ </property>
+ <property name="maximum" >
+ <number>99999</number>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>98</width>
+ <height>15</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Reset</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>DlgConnectionExpertSettings</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>DlgConnectionExpertSettings</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
Deleted: trunk/fclient/src/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/DlgDownloadKeyToDiskTpl.ui 2008-07-25 22:41:24 UTC (rev 749)
+++ trunk/fclient/src/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui 2008-07-27 11:20:49 UTC (rev 763)
@@ -1,134 +0,0 @@
-<ui version="4.0" >
- <class>DlgDownloadKeyToDisk</class>
- <widget class="QDialog" name="DlgDownloadKeyToDisk" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>431</width>
- <height>175</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QLabel" name="label" >
- <property name="text" >
- <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Key:</span></p></body></html></string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelKey" >
- <property name="text" >
- <string>USK@qwweqweqweqwe.../foo</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_2" >
- <property name="text" >
- <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
-<html><head><meta name="qrichtext" content="1" /><style type="text/css">
-p, li { white-space: pre-wrap; }
-</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
-<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Download to:</span></p></body></html></string>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QHBoxLayout" name="horizontalLayout" >
- <item>
- <widget class="QLineEdit" name="edDownloadFileName" >
- <property name="dragEnabled" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QPushButton" name="btChooseDownloadFileName" >
- <property name="text" >
- <string>...</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item row="1" column="0" >
- <spacer name="verticalSpacer" >
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeHint" stdset="0" >
- <size>
- <width>20</width>
- <height>15</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0" >
- <widget class="Line" name="line" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- </widget>
- </item>
- <item row="3" column="0" >
- <widget class="QDialogButtonBox" name="buttonBox" >
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="standardButtons" >
- <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- <resources/>
- <connections>
- <connection>
- <sender>buttonBox</sender>
- <signal>accepted()</signal>
- <receiver>DlgDownloadKeyToDisk</receiver>
- <slot>accept()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>248</x>
- <y>254</y>
- </hint>
- <hint type="destinationlabel" >
- <x>157</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- <connection>
- <sender>buttonBox</sender>
- <signal>rejected()</signal>
- <receiver>DlgDownloadKeyToDisk</receiver>
- <slot>reject()</slot>
- <hints>
- <hint type="sourcelabel" >
- <x>316</x>
- <y>260</y>
- </hint>
- <hint type="destinationlabel" >
- <x>286</x>
- <y>274</y>
- </hint>
- </hints>
- </connection>
- </connections>
-</ui>
Copied: trunk/fclient/src/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui (from rev 762, trunk/fclient/src/fclient/tpls/DlgDownloadKeyToDiskTpl.ui)
===================================================================
--- trunk/fclient/src/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui 2008-07-27 11:20:49 UTC (rev 763)
@@ -0,0 +1,134 @@
+<ui version="4.0" >
+ <class>DlgDownloadKeyToDisk</class>
+ <widget class="QDialog" name="DlgDownloadKeyToDisk" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>431</width>
+ <height>175</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Key:</span></p></body></html></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="labelKey" >
+ <property name="text" >
+ <string>USK@qwweqweqweqwe.../foo</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
+<html><head><meta name="qrichtext" content="1" /><style type="text/css">
+p, li { white-space: pre-wrap; }
+</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
+<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Download to:</span></p></body></html></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QLineEdit" name="edDownloadFileName" >
+ <property name="dragEnabled" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="btChooseDownloadFileName" >
+ <property name="text" >
+ <string>...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>15</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="3" column="0" >
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>DlgDownloadKeyToDisk</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>DlgDownloadKeyToDisk</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
Deleted: trunk/fclient/src/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui 2008-07-25 22:41:24 UTC (rev 749)
+++ trunk/fclient/src/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui 2008-07-27 11:20:49 UTC (rev 763)
@@ -1,247 +0,0 @@
-<ui version="4.0" >
- <class>DlgPropsBrowserObject</class>
- <widget class="QDialog" name="DlgPropsBrowserObject" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>420</width>
- <height>307</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Dialog</string>
- </property>
- <layout class="QGridLayout" name="gridLayout" >
- <item row="0" column="0" >
- <layout class="QVBoxLayout" name="verticalLayout" >
- <item>
- <widget class="QLabel" name="label" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string><b>Type:</b></string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labeType" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- <property name="textInteractionFlags" >
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_2" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string><b>Title:</b></string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelTitle" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- <property name="textInteractionFlags" >
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_99" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string><b>Name:</b></string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelName" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- <property name="textInteractionFlags" >
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_4" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string><b>LinkUrl:</b></string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelLinkUrl" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string>unknown</string>
- </property>
- <property name="textInteractionFlags" >
- <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="label_5" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text" >
- <string><b>ImageUrl:</b></string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QLabel" name="labelImageUrl" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <pro...
[truncated message content] |
|
From: <jU...@us...> - 2008-07-27 11:22:37
|
Revision: 764
http://fclient.svn.sourceforge.net/fclient/?rev=764&view=rev
Author: jUrner
Date: 2008-07-27 11:22:45 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
new package structure
Added Paths:
-----------
trunk/fclient/src/fclient/impl/Ui_DlgConnectionExpertSettings.py
trunk/fclient/src/fclient/impl/Ui_DlgDownloadKeyToDisk.py
trunk/fclient/src/fclient/impl/Ui_DlgPropsBrowserObject.py
trunk/fclient/src/fclient/impl/Ui_MainWindow.py
trunk/fclient/src/fclient/impl/Ui_Prefs.py
trunk/fclient/src/fclient/impl/Ui_PrefsBrowserWidget.py
trunk/fclient/src/fclient/impl/Ui_PrefsGlobal.py
trunk/fclient/src/fclient/impl/Ui_View.py
trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py
trunk/fclient/src/fclient/impl/Ui_ViewConnection.py
trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
trunk/fclient/src/fclient/impl/Ui_ViewLogger.py
trunk/fclient/src/fclient/impl/__init__.py
trunk/fclient/src/fclient/impl/config.py
Removed Paths:
-------------
trunk/fclient/src/fclient/Ui_DlgConnectionExpertSettings.py
trunk/fclient/src/fclient/Ui_DlgDownloadKeyToDisk.py
trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py
trunk/fclient/src/fclient/Ui_MainWindow.py
trunk/fclient/src/fclient/Ui_Prefs.py
trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py
trunk/fclient/src/fclient/Ui_PrefsGlobal.py
trunk/fclient/src/fclient/Ui_View.py
trunk/fclient/src/fclient/Ui_ViewBrowser.py
trunk/fclient/src/fclient/Ui_ViewConnection.py
trunk/fclient/src/fclient/Ui_ViewDownloads.py
trunk/fclient/src/fclient/Ui_ViewLogger.py
trunk/fclient/src/fclient/__init__.py
trunk/fclient/src/fclient/config.py
Deleted: trunk/fclient/src/fclient/Ui_DlgConnectionExpertSettings.py
===================================================================
--- trunk/fclient/src/fclient/Ui_DlgConnectionExpertSettings.py 2008-07-27 11:20:49 UTC (rev 763)
+++ trunk/fclient/src/fclient/Ui_DlgConnectionExpertSettings.py 2008-07-27 11:22:45 UTC (rev 764)
@@ -1,73 +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__)]
-
-from PyQt4 import QtCore, QtGui
-
-from . import config
-
-from .tpls.Ui_DlgConnectionExpertSettingsTpl import Ui_DlgConnectionExpertSettings
-#**********************************************************************************
-#
-#**********************************************************************************
-class ConnectionExpertSettingsDlg(QtGui.QDialog, Ui_DlgConnectionExpertSettings ):
-
- IdEdFcpConnectionName = 'edFcpConnectionName'
- IdSpinFcpConnectionTimerMaxDuration = 'spinFcpConnectionTimerMaxDuration'
- IdSpinConnectionTimerTimeout = 'spinConnectionTimerTimeout'
- IdSpinFcpPollTimerTimeout = 'spinFcpPollTimerTimeout'
-
- def __init__(self, parent=None):
- QtGui.QDialog.__init__(self, parent)
-
- self.setupUi(self)
- self.setWindowTitle(config.FclientAppName + self.trUtf8(' - Connection expert settings'))
-
- edName = self.controlById(self.IdEdFcpConnectionName)
- edName.setText(config.settings.value('FcpConnectionName'))
- self.connect(edName, QtCore.SIGNAL('textChanged(const QString &)'), self.onEdFcpConnectionNameChanged)
-
- connectionWidget = config.ObjectRegistry.get(config.IdViewConnectionWidget, None)
- spins = (
- (self.IdSpinFcpConnectionTimerMaxDuration, 'FcpConnectionTimerMaxDuration'),
- (self.IdSpinConnectionTimerTimeout, 'FcpConnectionTimerTimeout'),
- (self.IdSpinFcpPollTimerTimeout, 'FcpPollTimerTimeout'),
- )
- for idControl, settingName in spins:
- spin = self.controlById(idControl)
- if connectionWidget is None:
- spin.setEnabled(False)
- else:
- spin.setValue(connectionWidget.fcSettings.value(settingName))
-
-
-
-
- def controlById(self, idControl):
- return getattr(self, idControl)
-
-
- def onEdFcpConnectionNameChanged(self, text):
- config.settings.setValues(FcpConnectionName=text)
-
-
-
-#**********************************************************************************
-#
-#**********************************************************************************
-if __name__ == '__main__':
- import sys
-
- class DummyKey(object):
- KeyType = 'USK@'
- def __init__(self): self.key = 'USG@qweqqweqwe'
- def toString(self): return self.key
-
- app = QtGui.QApplication(sys.argv)
- w = ConnectionExpertSettingsDlg(None)
- w.show()
- res = app.exec_()
- sys.exit(res)
-
-
Deleted: trunk/fclient/src/fclient/Ui_DlgDownloadKeyToDisk.py
===================================================================
--- trunk/fclient/src/fclient/Ui_DlgDownloadKeyToDisk.py 2008-07-27 11:20:49 UTC (rev 763)
+++ trunk/fclient/src/fclient/Ui_DlgDownloadKeyToDisk.py 2008-07-27 11:22:45 UTC (rev 764)
@@ -1,79 +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 os
-from PyQt4 import QtCore, QtGui
-
-from . import config
-from .lib.compactpath.qt4 import pathlabelwrap
-
-
-from .tpls.Ui_DlgDownloadKeyToDiskTpl import Ui_DlgDownloadKeyToDisk
-#**********************************************************************************
-#
-#**********************************************************************************
-class DownloadKeyToDiskDlg(QtGui.QDialog, Ui_DlgDownloadKeyToDisk):
-
- IdLabelKey = 'labelKey'
- IdEdDownloadFileName = 'edDownloadFileName'
- IdBtChooseDownloadFileName = 'btChooseDownloadFileName'
-
-
- def __init__(self, parent=None, fcpKey=None):
- QtGui.QDialog.__init__(self, parent)
-
- self.setupUi(self)
- self.setWindowTitle(config.FclientAppName + self.trUtf8(' - Download key..'))
-
- self._filePath = None
- self._fcpKey = fcpKey
-
- self.pathLabelWrap = pathlabelwrap.PathLabelWrap(
- self.labelKey,
- fpath=unicode(self.labelKey.text()),
- path_module=config.CompactPathFcpKeyModule
- )
- self.connect(self.btChooseDownloadFileName, QtCore.SIGNAL('clicked()'), self.onChooseDownloadFileName)
-
- # find out fileName to dl key to
- fileName = config.guessFileNameFromKey(fcpKey)
- if fileName is None:
- fileName = self.trUtf8('UNKNOWN')
- self._filePath = os.path.join(unicode(config.settings.value('DownloadDir')), unicode(fileName))
- self.edDownloadFileName.setText(self._filePath)
- if self._fcpKey is not None:
- self.pathLabelWrap.setPath(self._fcpKey.toString())
-
- def filePath(self):
- return self._filePath
-
- def onChooseDownloadFileName(self):
- filePath = QtGui.QFileDialog.getSaveFileName(
- self,
- config.FclientAppName + self.trUtf8(' - Save key To..'),
- self.edDownloadFileName.text(),
- )
- if filePath:
- self._filePath = filePath
- self.edDownloadFileName.setText(filePath)
-
-
-#**********************************************************************************
-#
-#**********************************************************************************
-if __name__ == '__main__':
- import sys
-
- class DummyKey(object):
- KeyType = 'USK@'
- def __init__(self): self.key = 'USG@qweqqweqwe'
- def toString(self): return self.key
-
- app = QtGui.QApplication(sys.argv)
- w = DownloadKeyToDiskDlg(None, fcpKey=DummyKey())
- w.show()
- res = app.exec_()
- sys.exit(res)
-
-
Deleted: trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py
===================================================================
--- trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py 2008-07-27 11:20:49 UTC (rev 763)
+++ trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py 2008-07-27 11:22:45 UTC (rev 764)
@@ -1,69 +0,0 @@
-#*********************************************************************
-#TODO:
-# just a sketch so far
-#
-# x. link and image url are not selectable
-#
-#
-#**********************************************************************
-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 posixpath
-from PyQt4 import QtGui
-
-from . import config
-from .lib.compactpath.qt4 import pathlabelwrap
-from .lib.qt4ex.lib import tools as qtools
-
-from .tpls.Ui_DlgPropsBrowserObjectTpl import Ui_DlgPropsBrowserObject
-#**********************************************************************************
-#
-#**********************************************************************************
-class PropsBrowserObjectDlg(QtGui.QDialog, Ui_DlgPropsBrowserObject):
-
- IdLabelType = 'labelType'
- IdLabelTitle = 'labelTitle'
- IdLabelName = 'labelName'
- IdLabelLinkUrl = 'labelLinkUrl'
- IdLabelImageUrl = 'labelImageUrl'
-
- MaxText = 80
-
- def __init__(self, parent, browser=None, hitTestResult=None):
- QtGui.QDialog.__init__(self, parent)
-
- self.setupUi(self)
- self.setWindowTitle(config.FclientAppName + self.trUtf8(' - Properties'))
-
- if hitTestResult is not None:
-
- if not hitTestResult.linkUrl().isEmpty():
- labelLinkUrl = self.controlById(self.IdLabelLinkUrl)
- self.wrapLinkUrl = pathlabelwrap.PathLabelWrap(labelLinkUrl, path_module=config.CompactPathFcpKeyModule)
- self.wrapLinkUrl.setPath(unicode(hitTestResult.linkUrl().toString()))
- if not hitTestResult.imageUrl().isEmpty():
- labelImageUrl = self.controlById(self.IdLabelImageUrl)
- self.wrapImageUrl = pathlabelwrap.PathLabelWrap(labelImageUrl, path_module=config.CompactPathFcpKeyModule)
- self.wrapImageUrl.setPath(unicode(hitTestResult.imageUrl().toString()))
-
- ellipsis = self.trUtf8('..')
- self.labelTitle.setText(qtools.truncateString(self.MaxText, hitTestResult.linkTitle().toString(), ellipsis))
- self.labelTitle.setText(qtools.truncateString(self.MaxText, hitTestResult.linkText(), ellipsis))
-
- def controlById(self, idControl):
- return getattr(self, idControl)
-
-#**********************************************************************************
-#
-#**********************************************************************************
-if __name__ == '__main__':
- import sys
-
- app = QtGui.QApplication(sys.argv)
- w = PropsBrowserObjectDlg(None)
- w.show()
- res = app.exec_()
- sys.exit(res)
-
Deleted: trunk/fclient/src/fclient/Ui_MainWindow.py
===================================================================
--- trunk/fclient/src/fclient/Ui_MainWindow.py 2008-07-27 11:20:49 UTC (rev 763)
+++ trunk/fclient/src/fclient/Ui_MainWindow.py 2008-07-27 11:22:45 UTC (rev 764)
@@ -1,160 +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 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
Deleted: trunk/fclient/src/fclient/Ui_Prefs.py
===================================================================
--- trunk/fclient/src/fclient/Ui_Prefs.py 2008-07-27 11:20:49 UTC (rev 763)
+++ trunk/fclient/src/fclient/Ui_Prefs.py 2008-07-27 11:22:45 UTC (rev 764)
@@ -1,91 +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__)]
-
-
-from PyQt4 import QtGui
-
-from . import config
-from .lib.qt4ex import dlgpreferences
-from .Ui_PrefsGlobal import PrefsPageGlobal
-from .Ui_PrefsBrowserWidget import PrefsPageBrowser
-#**********************************************************************************
-#
-#**********************************************************************************
-class Settings(config.SettingsBase):
- _key_ = config.IdViewBrowserWidget
- _settings_ = (
- ('DlgState', 'String', '', config.SettingScopePrivate),
- )
-
-
-#***********************************************************************
-#
-#***********************************************************************
-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 PrefsDlg(dlgpreferences.DlgPreferencesFlatTree):
-
- def __init__(self, parent):
-
- pages = PrefsPageRoot()(
- PrefsPageGlobal(),
- PrefsPageBrowser(),
-
- )
-
- dlgpreferences.DlgPreferencesFlatTree.__init__(self,
- parent,
- pages=pages,
- startPage=PrefsPageGlobal.UUID,
- )
- self.fcSettings = Settings(self).restore()
-
-
- def showEvent(self, event):
- self.restoreState(self.fcSettings.value('DlgState'))
-
- def hideEvent(self, event):
- self.fcSettings.setValues(DlgState=self.saveState())
-
- def closeEvent(self, event):
- pass
-
-
-#**********************************************************************************
-#
-#**********************************************************************************
-if __name__ == '__main__':
- import sys
-
- app = QtGui.QApplication(sys.argv)
- w = PrefsDlg(None)
- w.show()
- res = app.exec_()
- sys.exit(res)
-
-
Deleted: trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py
===================================================================
--- trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py 2008-07-27 11:20:49 UTC (rev 763)
+++ trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py 2008-07-27 11:22:45 UTC (rev 764)
@@ -1,113 +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__)]
-
-
-from PyQt4 import QtCore, QtGui
-
-from . import config
-from .lib.qt4ex import dlgpreferences
-
-from .tpls.Ui_PrefsBrowserWidgetTpl import Ui_PrefsBrowserWidget
-#**********************************************************************************
-#
-#**********************************************************************************
-class PrefsBrowserWidget(QtGui.QWidget, Ui_PrefsBrowserWidget):
-
- IdEdHomePage = 'edHomePage'
- IdCkOpenAddressBarInNewTab = 'ckOpenAddressBarInNewTab'
- IdCkOpenBookmarksInNewTab = 'ckOpenBookmarksInNewTab'
- IdCkOpenLinksInNewTab = 'ckOpenLinksInNewTab'
- IdCkOpenHomePageOnNewTabCreated = 'ckOpenHomePageOnNewTabCreated'
- IdCkBackIsClose = 'ckBackIsClose'
- IdCkAutoLoadImages = 'ckAutoLoadImages'
-
- def __init__(self, parent):
- QtGui.QWidget.__init__(self, parent)
- self.setupUi(self)
-
- browser = config.ObjectRegistry.get(config.IdViewBrowserWidget, None)
- self.setEnabled(browser is not None)
- if browser is not None:
- self.controlById(self.IdEdHomePage).setText(browser.fcSettings.value('HomePage'))
- ck = self.controlById(self.IdCkOpenAddressBarInNewTab)
- ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('OpenAddressBarInNewTab') else QtCore.Qt.Unchecked)
- ck = self.controlById(self.IdCkOpenBookmarksInNewTab)
- ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('OpenBookmarksInNewTab') else QtCore.Qt.Unchecked)
- ck = self.controlById(self.IdCkOpenLinksInNewTab)
- ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('OpenLinksInNewTab') else QtCore.Qt.Unchecked)
- ck = self.controlById(self.IdCkOpenHomePageOnNewTabCreated)
- ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('OpenHomePageOnNewTabCreated') else QtCore.Qt.Unchecked)
- ck = self.controlById(self.IdCkBackIsClose)
- ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('BackIsClose') else QtCore.Qt.Unchecked)
- ck = self.controlById(self.IdCkAutoLoadImages)
- ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('AutoLoadImages') else QtCore.Qt.Unchecked)
-
- def controlById(self, idControl):
- return getattr(self, idControl)
-
- def apply(self):
- browser = config.ObjectRegistry.get(config.IdViewBrowserWidget, None)
- if browser is not None:
- edHomePage = self.controlById(self.IdEdHomePage)
-
- browser.fcSettings.setValues(
- HomePage=edHomePage.text(),
- OpenAddressBarInNewTab=self.controlById(self.IdCkOpenAddressBarInNewTab).checkState() == QtCore.Qt.Checked,
- OpenBookmarksInNewTab=self.controlById(self.IdCkOpenBookmarksInNewTab).checkState() == QtCore.Qt.Checked,
- OpenLinksInNewTab=self.controlById(self.IdCkOpenLinksInNewTab).checkState() == QtCore.Qt.Checked,
- OpenHomePageOnNewTabCreated=self.controlById(self.IdCkOpenHomePageOnNewTabCreated).checkState() == QtCore.Qt.Checked,
- BackIsClose=self.controlById(self.IdCkBackIsClose).checkState() == QtCore.Qt.Checked,
- AutoLoadImages=self.controlById(self.IdCkAutoLoadImages).checkState() == QtCore.Qt.Checked,
- )
-
-
-#***********************************************************************
-#
-#***********************************************************************
-class PrefsPageBrowser(dlgpreferences.Page):
-
- UUID = '{c85e63a8-6806-435a-81ce-f4b46872246f}'
-
- def __init__(self):
- dlgpreferences.Page.__init__(self, self.UUID)
- self._widget = None
- self.setDirty(True)
-
- def displayName(self):
- return self.trUtf8('Browser')
-
- 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 = PrefsBrowserWidget(parent)
- self._widget.setVisible(flag)
- return (createdNew, self._widget)
-
-
- def doApply(self):
- self._widget.apply()
- return True
-
- def doOk(self):
- return True
-
-
-#***********************************************************************
-#
-#***********************************************************************
-if __name__ == '__main__':
- from PyQt4 import QtGui
- import sys
-
- app = QtGui.QApplication(sys.argv)
- w = PrefsBrowserWidget(None)
- w.show()
- res = app.exec_()
- sys.exit(res)
-
Deleted: trunk/fclient/src/fclient/Ui_PrefsGlobal.py
===================================================================
--- trunk/fclient/src/fclient/Ui_PrefsGlobal.py 2008-07-27 11:20:49 UTC (rev 763)
+++ trunk/fclient/src/fclient/Ui_PrefsGlobal.py 2008-07-27 11:22:45 UTC (rev 764)
@@ -1,62 +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__)]
-
-
-from PyQt4 import QtGui
-
-from . import config
-from .lib.qt4ex import dlgpreferences
-
-from .tpls.Ui_PrefsGlobalWidgetTpl import Ui_PrefsGlobalWidget
-#**********************************************************************************
-#
-#**********************************************************************************
-class PrefsGlobalWidget(QtGui.QWidget, Ui_PrefsGlobalWidget):
-
- def __init__(self, parent):
- QtGui.QWidget.__init__(self, parent)
- 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 self.trUtf8('Global')
-
- 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 = PrefsGlobalWidget(parent)
- self._widget.setVisible(flag)
- return (createdNew, self._widget)
-
-
-
-#***********************************************************************
-#
-#***********************************************************************
-if __name__ == '__main__':
- from PyQt4 import QtGui
- import sys
-
- app = QtGui.QApplication(sys.argv)
- w = PrefsGlobalWidget(None)
- w.show()
- res = app.exec_()
- sys.exit(res)
-
Deleted: trunk/fclient/src/fclient/Ui_View.py
===================================================================
--- trunk/fclient/src/fclient/Ui_View.py 2008-07-27 11:20:49 UTC (rev 763)
+++ trunk/fclient/src/fclient/Ui_View.py 2008-07-27 11:22:45 UTC (rev 764)
@@ -1,277 +0,0 @@
-#FIXES
-#***************************************************************************
-# [0001]
-#
-# QTabWidget.closeEvent() does not seem to propagate close events
-# to child widgets
-#
-#
-#***************************************************************************
-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 QtCore, QtGui
-
-
-from . import config
-from .lib import fcp2
-from .tpls.Ui_ViewWidgetTpl import Ui_ViewWidget
-#**********************************************************************************
-#
-#**********************************************************************************
-class Actions(config.ActionsBase):
-
- def __init__(self, parent):
- config.ActionsBase.__init__(self, parent)
-
- self.action(
- name='ActionShowTopTabBar',
- text=self.trUtf8('Show top &tabs'),
- trigger=parent.onActionShowTabsTop,
- isCheckable=True,
- isChecked=True,
- )
-
-
-class GlobalFeedback(config.GlobalFeedbackBase):
- """wrapper for global statusbar widgets, menus"""
-
- def __init__(self, parent, idGlobalFeedback):
- config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback)
-
- # menus
- self.menus = []
- if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
- menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
- parent.populateMenu(menu)
- self.menus.append(menu)
- self.menuBar.addViewMenu(menu)
-
- def setVisible(self, flag):
- for menu in self.menus:
- menu.children()[0].setVisible(flag)
-
-
-
-class Settings(config.SettingsBase):
- _key_ = config.IdViewWidget
- _settings_ = (
- ('LastViewTop', 'String', '', config.SettingScopePrivate),
- ('LastViewBottom', 'String', '', config.SettingScopePrivate),
- ('SplitterPos', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate),
- ('ShowTopTabBar', 'Bool', True, config.SettingScopePrivate),
-
- )
-
-
-class ViewObject(config.ViewObject):
-
- def __init__(self, parent):
- config.ViewObject. __init__(self, parent)
-
- self.name=parent.objectName()
- self.displayName=self.trUtf8('View')
- self.icon=QtGui.QIcon()
-
-#***********************************************************************
-#
-#***********************************************************************
-class ViewWidget(QtGui.QWidget, Ui_ViewWidget):
-
- IdSplitter = 'Splitter'
- IdTabTop = 'tabTop'
- IdTabBottom = 'tabBottom'
-
-
- def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
- QtGui.QWidget.__init__(self, parent)
-
- self._isCreated = False
-
- self.views = {}
-
- self.setupUi(self)
- config.ObjectRegistry.register(self)
- self.fcActions = Actions(self)
- self.fcSettings = Settings().restore()
- self.fcViewObject = ViewObject(self)
- self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback)
-
- # setup tab widgets
- tabWidgetTop = self.controlById(self.IdTabTop)
- tabWidgetTop.removeTab(0)
- tabWidgetBottom = self.controlById(self.IdTabBottom)
- tabWidgetBottom.removeTab(0)
-
- # setup splitter
- splitter = self.controlById(self.IdSplitter)
- splitter.restoreState(self.fcSettings.value('SplitterPos'))
- self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved)
-
- # setup actions
- showTopTabBar = self.fcSettings.value('ShowTopTabBar')
- self.fcActions['ActionShowTopTabBar'].setChecked(showTopTabBar)
- tabWidgetTop.tabBar().setVisible(showTopTabBar)
-
-
-
- def controlById(self, idControl):
- return getattr(self, idControl)
-
-
- def _addViews(self, toTop, *views):
- tabWidget = self.controlById(self.IdTabTop) if toTop else self.controlById(self.IdTabBottom)
- for view in views:
- name = view.fcViewObject.name
- if not name:
- raise ValueError('view must have a name')
- if name in self.views:
- raise ValueError('view with that name is already present: %s' % name)
- view.setParent(tabWidget)
- i = tabWidget.addTab(view, view.fcViewObject.icon, view.fcViewObject.displayName)
- self.views[name] = (tabWidget, view)
-
- #tab.tabBar().setVisible(tab.count() > 1)
-
-
- def addBottomViews(self, *views):
- return self._addViews(False, *views)
-
-
- def addTopViews(self, *views):
- return self._addViews(True, *views)
-
-
- def populateMenu(self, menu):
- menu.addAction(self.fcActions['ActionShowTopTabBar'])
- return menu
-
-
-
- def setCurrentView(self, name):
- result = self.views.get(name, None)
- if result is not None:
- tab, view = result
- tab.setCurrentWidget(view)
- ...
[truncated message content] |
|
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.
|
|
From: <jU...@us...> - 2008-07-27 11:31:12
|
Revision: 768
http://fclient.svn.sourceforge.net/fclient/?rev=768&view=rev
Author: jUrner
Date: 2008-07-27 11:31:20 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
naming
Modified Paths:
--------------
trunk/fclient/src/fclient/fclient.py
trunk/fclient/src/fclient/impl/MainWindow.py
trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py
trunk/fclient/src/fclient/impl/Ui_ViewConnection.py
trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
Added Paths:
-----------
trunk/fclient/src/fclient/impl/View.py
Removed Paths:
-------------
trunk/fclient/src/fclient/impl/Ui_View.py
Modified: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py 2008-07-27 11:29:02 UTC (rev 767)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-27 11:31:20 UTC (rev 768)
@@ -7,7 +7,7 @@
from PyQt4 import QtGui
from .impl.MainWindow import MainWindow
-from .impl.Ui_View import ViewWidget
+from .impl.View import ViewWidget
from .impl.Ui_ViewBrowser import ViewBrowserWidget
from .impl.Ui_ViewConnection import ViewConnectionWidget
from .impl.Ui_ViewDownloads import ViewDownloadsWidget
Modified: trunk/fclient/src/fclient/impl/MainWindow.py
===================================================================
--- trunk/fclient/src/fclient/impl/MainWindow.py 2008-07-27 11:29:02 UTC (rev 767)
+++ trunk/fclient/src/fclient/impl/MainWindow.py 2008-07-27 11:31:20 UTC (rev 768)
@@ -10,7 +10,6 @@
from . import config
from . import Ui_Prefs
-from . import Ui_View
from .lib.qt4ex import dlgabout
from .tpls.Ui_MainWindowTpl import Ui_MainWindow
Deleted: trunk/fclient/src/fclient/impl/Ui_View.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_View.py 2008-07-27 11:29:02 UTC (rev 767)
+++ trunk/fclient/src/fclient/impl/Ui_View.py 2008-07-27 11:31:20 UTC (rev 768)
@@ -1,277 +0,0 @@
-#FIXES
-#***************************************************************************
-# [0001]
-#
-# QTabWidget.closeEvent() does not seem to propagate close events
-# to child widgets
-#
-#
-#***************************************************************************
-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 QtCore, QtGui
-
-
-from . import config
-from .lib import fcp2
-from .tpls.Ui_ViewWidgetTpl import Ui_ViewWidget
-#**********************************************************************************
-#
-#**********************************************************************************
-class Actions(config.ActionsBase):
-
- def __init__(self, parent):
- config.ActionsBase.__init__(self, parent)
-
- self.action(
- name='ActionShowTopTabBar',
- text=self.trUtf8('Show top &tabs'),
- trigger=parent.onActionShowTabsTop,
- isCheckable=True,
- isChecked=True,
- )
-
-
-class GlobalFeedback(config.GlobalFeedbackBase):
- """wrapper for global statusbar widgets, menus"""
-
- def __init__(self, parent, idGlobalFeedback):
- config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback)
-
- # menus
- self.menus = []
- if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
- menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
- parent.populateMenu(menu)
- self.menus.append(menu)
- self.menuBar.addViewMenu(menu)
-
- def setVisible(self, flag):
- for menu in self.menus:
- menu.children()[0].setVisible(flag)
-
-
-
-class Settings(config.SettingsBase):
- _key_ = config.IdViewWidget
- _settings_ = (
- ('LastViewTop', 'String', '', config.SettingScopePrivate),
- ('LastViewBottom', 'String', '', config.SettingScopePrivate),
- ('SplitterPos', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate),
- ('ShowTopTabBar', 'Bool', True, config.SettingScopePrivate),
-
- )
-
-
-class ViewObject(config.ViewObject):
-
- def __init__(self, parent):
- config.ViewObject. __init__(self, parent)
-
- self.name=parent.objectName()
- self.displayName=self.trUtf8('View')
- self.icon=QtGui.QIcon()
-
-#***********************************************************************
-#
-#***********************************************************************
-class ViewWidget(QtGui.QWidget, Ui_ViewWidget):
-
- IdSplitter = 'Splitter'
- IdTabTop = 'tabTop'
- IdTabBottom = 'tabBottom'
-
-
- def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
- QtGui.QWidget.__init__(self, parent)
-
- self._isCreated = False
-
- self.views = {}
-
- self.setupUi(self)
- config.ObjectRegistry.register(self)
- self.fcActions = Actions(self)
- self.fcSettings = Settings().restore()
- self.fcViewObject = ViewObject(self)
- self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback)
-
- # setup tab widgets
- tabWidgetTop = self.controlById(self.IdTabTop)
- tabWidgetTop.removeTab(0)
- tabWidgetBottom = self.controlById(self.IdTabBottom)
- tabWidgetBottom.removeTab(0)
-
- # setup splitter
- splitter = self.controlById(self.IdSplitter)
- splitter.restoreState(self.fcSettings.value('SplitterPos'))
- self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved)
-
- # setup actions
- showTopTabBar = self.fcSettings.value('ShowTopTabBar')
- self.fcActions['ActionShowTopTabBar'].setChecked(showTopTabBar)
- tabWidgetTop.tabBar().setVisible(showTopTabBar)
-
-
-
- def controlById(self, idControl):
- return getattr(self, idControl)
-
-
- def _addViews(self, toTop, *views):
- tabWidget = self.controlById(self.IdTabTop) if toTop else self.controlById(self.IdTabBottom)
- for view in views:
- name = view.fcViewObject.name
- if not name:
- raise ValueError('view must have a name')
- if name in self.views:
- raise ValueError('view with that name is already present: %s' % name)
- view.setParent(tabWidget)
- i = tabWidget.addTab(view, view.fcViewObject.icon, view.fcViewObject.displayName)
- self.views[name] = (tabWidget, view)
-
- #tab.tabBar().setVisible(tab.count() > 1)
-
-
- def addBottomViews(self, *views):
- return self._addViews(False, *views)
-
-
- def addTopViews(self, *views):
- return self._addViews(True, *views)
-
-
- def populateMenu(self, menu):
- menu.addAction(self.fcActions['ActionShowTopTabBar'])
- return menu
-
-
-
- def setCurrentView(self, name):
- result = self.views.get(name, None)
- if result is not None:
- tab, view = result
- tab.setCurrentWidget(view)
- return True
- return False
-
-
- def viewFromName(self, name):
- result = self.views.get(name, None)
- if result is not None:
- return result[1]
- return None
-
- #########################################################
- ##
- #########################################################
- def hideEvent(self, event):
- self.fcGlobalFeedback.setVisible(False)
-
-
- def showEvent(self, event):
- self.fcGlobalFeedback.setVisible(True)
-
-
- #########################################################
- ##
- #########################################################
- def closeEvent(self, event):
- for tab, view in self.views.values():
- view.viewClose()
-
-
- def showEvent(self, event):
- if self._isCreated:
- return
- self._isCreated = True
-
- # restore current views
- tabWidgetTop = self.controlById(self.IdTabTop)
- lastName = self.fcSettings.value('LastViewTop')
- self.setCurrentView(lastName)
-
- tabWidgetBottom = self.controlById(self.IdTabBottom)
- lastName = self.fcSettings.value('LastViewBottom')
- self.setCurrentView(lastName)
-
- # finally connect... not to overwrite settings
- self.connect(tabWidgetTop, QtCore.SIGNAL('currentChanged(int)'), self.onTabTopCurrentChanged)
- self.connect(tabWidgetBottom, QtCore.SIGNAL('currentChanged(int)'), self.onTabBottomCurrentChanged)
-
- #########################################################
- ##
- #########################################################
- def onActionShowTabsTop(self, action):
- tabWidgetTop = self.controlById(self.IdTabTop)
- tabWidgetTop.tabBar().setVisible(action.isChecked())
- self.fcSettings.setValues(ShowTopTabBar=action.isChecked())
-
-
- def onSplitterMoved(self, pos, index):
- splitter = self.controlById(self.IdSplitter)
- self.fcSettings.setValues(SplitterPos=splitter.saveState())
-
-
- def onTabTopCurrentChanged(self, index):
- tabWidget = self.controlById(self.IdTabTop)
- view = tabWidget.currentWidget()
- self.fcSettings.setValues(LastViewTop=view.fcViewObject.name)
-
-
- def onTabBottomCurrentChanged(self, index):
- tab = self.controlById(self.IdTabBottom)
- view = tab.currentWidget()
- self.fcSettings.setValues(LastViewBottom=view.fcViewObject.name)
-
-#**********************************************************************************
-#
-#**********************************************************************************
-#NOTE: to self. no need to register views to config.ObjectRegistry. they are just
-# opaque objects private to ViewWidget
-class View(object):
- """base class for views ond by L{ViewWidget}"""
-
- def __init__(self):
- raise NotImplemetedError()
-
- def viewClose(self):
- """called when the view is about to be closed"""
-
- def viewDisplayName(self):
- """should return the user visible name of the view
- @return: (QString)
- """
- raise NotImplemetedError()
-
-
- def viewIcon(self):
- """should return the icon associated to the view
- @return: (QIcon)
- """
- raise NotImplemetedError()
-
- def viewName(self):
- """should return the internally used id of the view
- @return: (str) id
- """
- raise NotImplemetedError()
-
-#**********************************************************************************
-#
-#**********************************************************************************
-if __name__ == '__main__':
- import sys
-
- app = QtGui.QApplication(sys.argv)
- w = ViewWidget(None)
- w.show()
- res = app.exec_()
- sys.exit(res)
-
-
-
-
Modified: trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py 2008-07-27 11:29:02 UTC (rev 767)
+++ trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py 2008-07-27 11:31:20 UTC (rev 768)
@@ -976,7 +976,7 @@
import sys
from .Ui_ViewLogger import ViewLoggerWidget
from .MainWindow import MainWindow
- from .Ui_View import ViewWidget
+ from .View import ViewWidget
from .Ui_ViewConnection import ViewConnectionWidget
from .Ui_ViewDownloads import ViewDownloadsWidget
Modified: trunk/fclient/src/fclient/impl/Ui_ViewConnection.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewConnection.py 2008-07-27 11:29:02 UTC (rev 767)
+++ trunk/fclient/src/fclient/impl/Ui_ViewConnection.py 2008-07-27 11:31:20 UTC (rev 768)
@@ -295,7 +295,7 @@
#**********************************************************************************
if __name__ == '__main__':
import sys
- from . import Ui_View, Ui_ViewLogger
+ from . import View, Ui_ViewLogger
app = QtGui.QApplication(sys.argv)
w = Ui_View.ViewWidget(None)
Modified: trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py 2008-07-27 11:29:02 UTC (rev 767)
+++ trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py 2008-07-27 11:31:20 UTC (rev 768)
@@ -253,7 +253,7 @@
#**********************************************************************************
if __name__ == '__main__':
import sys
- from . import Ui_View
+ from . import View
from . import Ui_ViewConnection
from . import Ui_ViewLogger
from . import MainWindow
Added: trunk/fclient/src/fclient/impl/View.py
===================================================================
--- trunk/fclient/src/fclient/impl/View.py (rev 0)
+++ trunk/fclient/src/fclient/impl/View.py 2008-07-27 11:31:20 UTC (rev 768)
@@ -0,0 +1,277 @@
+#FIXES
+#***************************************************************************
+# [0001]
+#
+# QTabWidget.closeEvent() does not seem to propagate close events
+# to child widgets
+#
+#
+#***************************************************************************
+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 QtCore, QtGui
+
+
+from . import config
+from .lib import fcp2
+from .tpls.Ui_ViewWidgetTpl import Ui_ViewWidget
+#**********************************************************************************
+#
+#**********************************************************************************
+class Actions(config.ActionsBase):
+
+ def __init__(self, parent):
+ config.ActionsBase.__init__(self, parent)
+
+ self.action(
+ name='ActionShowTopTabBar',
+ text=self.trUtf8('Show top &tabs'),
+ trigger=parent.onActionShowTabsTop,
+ isCheckable=True,
+ isChecked=True,
+ )
+
+
+class GlobalFeedback(config.GlobalFeedbackBase):
+ """wrapper for global statusbar widgets, menus"""
+
+ def __init__(self, parent, idGlobalFeedback):
+ config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback)
+
+ # menus
+ self.menus = []
+ if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
+ menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
+ parent.populateMenu(menu)
+ self.menus.append(menu)
+ self.menuBar.addViewMenu(menu)
+
+ def setVisible(self, flag):
+ for menu in self.menus:
+ menu.children()[0].setVisible(flag)
+
+
+
+class Settings(config.SettingsBase):
+ _key_ = config.IdViewWidget
+ _settings_ = (
+ ('LastViewTop', 'String', '', config.SettingScopePrivate),
+ ('LastViewBottom', 'String', '', config.SettingScopePrivate),
+ ('SplitterPos', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate),
+ ('ShowTopTabBar', 'Bool', True, config.SettingScopePrivate),
+
+ )
+
+
+class ViewObject(config.ViewObject):
+
+ def __init__(self, parent):
+ config.ViewObject. __init__(self, parent)
+
+ self.name=parent.objectName()
+ self.displayName=self.trUtf8('View')
+ self.icon=QtGui.QIcon()
+
+#***********************************************************************
+#
+#***********************************************************************
+class ViewWidget(QtGui.QWidget, Ui_ViewWidget):
+
+ IdSplitter = 'Splitter'
+ IdTabTop = 'tabTop'
+ IdTabBottom = 'tabBottom'
+
+
+ def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
+ QtGui.QWidget.__init__(self, parent)
+
+ self._isCreated = False
+
+ self.views = {}
+
+ self.setupUi(self)
+ config.ObjectRegistry.register(self)
+ self.fcActions = Actions(self)
+ self.fcSettings = Settings().restore()
+ self.fcViewObject = ViewObject(self)
+ self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback)
+
+ # setup tab widgets
+ tabWidgetTop = self.controlById(self.IdTabTop)
+ tabWidgetTop.removeTab(0)
+ tabWidgetBottom = self.controlById(self.IdTabBottom)
+ tabWidgetBottom.removeTab(0)
+
+ # setup splitter
+ splitter = self.controlById(self.IdSplitter)
+ splitter.restoreState(self.fcSettings.value('SplitterPos'))
+ self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved)
+
+ # setup actions
+ showTopTabBar = self.fcSettings.value('ShowTopTabBar')
+ self.fcActions['ActionShowTopTabBar'].setChecked(showTopTabBar)
+ tabWidgetTop.tabBar().setVisible(showTopTabBar)
+
+
+
+ def controlById(self, idControl):
+ return getattr(self, idControl)
+
+
+ def _addViews(self, toTop, *views):
+ tabWidget = self.controlById(self.IdTabTop) if toTop else self.controlById(self.IdTabBottom)
+ for view in views:
+ name = view.fcViewObject.name
+ if not name:
+ raise ValueError('view must have a name')
+ if name in self.views:
+ raise ValueError('view with that name is already present: %s' % name)
+ view.setParent(tabWidget)
+ i = tabWidget.addTab(view, view.fcViewObject.icon, view.fcViewObject.displayName)
+ self.views[name] = (tabWidget, view)
+
+ #tab.tabBar().setVisible(tab.count() > 1)
+
+
+ def addBottomViews(self, *views):
+ return self._addViews(False, *views)
+
+
+ def addTopViews(self, *views):
+ return self._addViews(True, *views)
+
+
+ def populateMenu(self, menu):
+ menu.addAction(self.fcActions['ActionShowTopTabBar'])
+ return menu
+
+
+
+ def setCurrentView(self, name):
+ result = self.views.get(name, None)
+ if result is not None:
+ tab, view = result
+ tab.setCurrentWidget(view)
+ return True
+ return False
+
+
+ def viewFromName(self, name):
+ result = self.views.get(name, None)
+ if result is not None:
+ return result[1]
+ return None
+
+ #########################################################
+ ##
+ #########################################################
+ def hideEvent(self, event):
+ self.fcGlobalFeedback.setVisible(False)
+
+
+ def showEvent(self, event):
+ self.fcGlobalFeedback.setVisible(True)
+
+
+ #########################################################
+ ##
+ #########################################################
+ def closeEvent(self, event):
+ for tab, view in self.views.values():
+ view.viewClose()
+
+
+ def showEvent(self, event):
+ if self._isCreated:
+ return
+ self._isCreated = True
+
+ # restore current views
+ tabWidgetTop = self.controlById(self.IdTabTop)
+ lastName = self.fcSettings.value('LastViewTop')
+ self.setCurrentView(lastName)
+
+ tabWidgetBottom = self.controlById(self.IdTabBottom)
+ lastName = self.fcSettings.value('LastViewBottom')
+ self.setCurrentView(lastName)
+
+ # finally connect... not to overwrite settings
+ self.connect(tabWidgetTop, QtCore.SIGNAL('currentChanged(int)'), self.onTabTopCurrentChanged)
+ self.connect(tabWidgetBottom, QtCore.SIGNAL('currentChanged(int)'), self.onTabBottomCurrentChanged)
+
+ #########################################################
+ ##
+ #########################################################
+ def onActionShowTabsTop(self, action):
+ tabWidgetTop = self.controlById(self.IdTabTop)
+ tabWidgetTop.tabBar().setVisible(action.isChecked())
+ self.fcSettings.setValues(ShowTopTabBar=action.isChecked())
+
+
+ def onSplitterMoved(self, pos, index):
+ splitter = self.controlById(self.IdSplitter)
+ self.fcSettings.setValues(SplitterPos=splitter.saveState())
+
+
+ def onTabTopCurrentChanged(self, index):
+ tabWidget = self.controlById(self.IdTabTop)
+ view = tabWidget.currentWidget()
+ self.fcSettings.setValues(LastViewTop=view.fcViewObject.name)
+
+
+ def onTabBottomCurrentChanged(self, index):
+ tab = self.controlById(self.IdTabBottom)
+ view = tab.currentWidget()
+ self.fcSettings.setValues(LastViewBottom=view.fcViewObject.name)
+
+#**********************************************************************************
+#
+#**********************************************************************************
+#NOTE: to self. no need to register views to config.ObjectRegistry. they are just
+# opaque objects private to ViewWidget
+class View(object):
+ """base class for views ond by L{ViewWidget}"""
+
+ def __init__(self):
+ raise NotImplemetedError()
+
+ def viewClose(self):
+ """called when the view is about to be closed"""
+
+ def viewDisplayName(self):
+ """should return the user visible name of the view
+ @return: (QString)
+ """
+ raise NotImplemetedError()
+
+
+ def viewIcon(self):
+ """should return the icon associated to the view
+ @return: (QIcon)
+ """
+ raise NotImplemetedError()
+
+ def viewName(self):
+ """should return the internally used id of the view
+ @return: (str) id
+ """
+ raise NotImplemetedError()
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+
+ app = QtGui.QApplication(sys.argv)
+ w = ViewWidget(None)
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-27 11:32:45
|
Revision: 769
http://fclient.svn.sourceforge.net/fclient/?rev=769&view=rev
Author: jUrner
Date: 2008-07-27 11:32:55 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
naming
Modified Paths:
--------------
trunk/fclient/src/fclient/fclient.py
Added Paths:
-----------
trunk/fclient/src/fclient/impl/ViewBrowser.py
Removed Paths:
-------------
trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py
Modified: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py 2008-07-27 11:31:20 UTC (rev 768)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-27 11:32:55 UTC (rev 769)
@@ -8,7 +8,7 @@
from .impl.MainWindow import MainWindow
from .impl.View import ViewWidget
-from .impl.Ui_ViewBrowser import ViewBrowserWidget
+from .impl.ViewBrowser import ViewBrowserWidget
from .impl.Ui_ViewConnection import ViewConnectionWidget
from .impl.Ui_ViewDownloads import ViewDownloadsWidget
from .impl.Ui_ViewLogger import ViewLoggerWidget
Deleted: trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py 2008-07-27 11:31:20 UTC (rev 768)
+++ trunk/fclient/src/fclient/impl/Ui_ViewBrowser.py 2008-07-27 11:32:55 UTC (rev 769)
@@ -1,1030 +0,0 @@
-#******************************************************************************************
-#TODO:
-# x. someday. maybe. reimpl to browse via fcp.
-# x. page history is cleared if we get an error on loading a page. reimpl page history?
-# x. back-is-close like behaviour
-# x. backand forward buttons suck somehow. sometimes fwd is enabled even if no fwd is available. reimpl page history?
-# x. save page to disk
-# x. download. idea is to add dls to global download widget and mark them (some color code) as new content.
-# alt would be to to do it firefox like in a separate widget. maybe an option to adjust if browser dls should be
-# persistent or not
-# x. tool buttons do not adjust their size to icon size. maybe it is some global setting via qt-config
-# x. fProxy is a bit tight-lipped when it comes to feedback. no idea
-# x. give feedback on tabs about load / finisched / error. maybe some color code. wait for new QTabWidget features (qt4.5)
-# x. close button on tabs. wait for new QTabWidget features (qt4.5)
-# x. page actions: CopyImageToClipboard,
-# x. when mouse pointer is over an opend image a magnifier cursor appears. no idea how this is handled
-# x. open new tab on tab bar double click. IIRC looks like no way before qt4.5. tabBars are not stretched to fit in qt4.4
-# x. global feedback on statusbar flickers. reason: first label is holds arbitrary length text
-# x. fproxy. "force browser to dl" should we dl it in downloads or store emidiately? no idea
-# x. visiting plugins via fproxy does not work
-# x. real toolbars
-# x. remove host/port from urls?
-# x. browser settings - QWebSettings
-# x. shortcuts
-# x. user staring gui for first time. maybe we should not connext untill the user connects explicitely
-#******************************************************************************************
-"""
-
-@newfield signal: signal, signals
-"""
-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 QtCore, QtGui, QtWebKit
-
-from . import config
-
-from .lib import fcp2
-from .lib.qt4ex.lib import tools as qtools
-from .lib.compactpath.qt4 import pathlabelwrap
-
-from . import Ui_DlgPropsBrowserObject
-from . import Ui_DlgDownloadKeyToDisk
-from .tpls.Ui_ViewBrowserWidgetTpl import Ui_ViewBrowserWidget
-#*****************************************************************************************
-#
-#*****************************************************************************************
-class Page(QtWebKit.QWebPage):
- def __init__(self, parent):
- QtWebKit.QWebPage.__init__(self, parent)
-
- #def acceptNavigationRequest(self, frame, request, typeRequest):
- # return True
-
-#*****************************************************************************************
-#
-#*****************************************************************************************
-class Browser(QtWebKit.QWebView):
- """ browser customized for freenet
- """
-
- MaxProgress = 100
-
- def __init__(self, parent=None, userData=None):
- QtWebKit.QWebView.__init__(self, parent)
-
- page = Page(self)
- self.setPage(page)
-
- #NOTE: we store last progress made to set busy cursor accordingly
- self._lastProgress = 0
- self._userData = userData
-
- # connect actions
- self.connect(self, QtCore.SIGNAL('loadStarted()'), self.onLoadStarted)
- self.connect(self, QtCore.SIGNAL('loadProgress(int)'), self.onLoadProgress)
- self.connect(self, QtCore.SIGNAL('loadFinished(bool)'), self.onLoadFinished)
- self.connect(self.pageAction(QtWebKit.QWebPage.Stop), QtCore.SIGNAL('triggered()'), self.onActionStopTriggered)
-
- ################################
- ## methods
- ################################
- #def createWindow(self, typeWindow):
- # pass
-
- def load(self, url):
- self._lastProgress = 0
- return QtWebKit.QWebView.load(self, url)
-
- def setLastStatusMessage(self, qString):
- self._lastStatusMessage = qString
-
- def setUrl(self, url):
- return self.load(url)
-
- def setContents(self, *args):
- """sets the contents of the browser without changing its url"""
- self._lastProgress = 0
- return QtWebKit.QWebView.setContents(self, *args)
-
- def setHtml(self, *args):
- """sets the contents of the browser without changing its url"""
- self._lastProgress = 0
- return QtWebKit.QWebView.setHtm(self, *args)
-
- def setPage(self, page):
- """sets the contents of the browser without changing its url"""
- self._lastProgress = 0
- return QtWebKit.QWebView.setPage(self, page)
-
- def setUserData(self, userData):
- self._userData = userData
-
- def mouseMoveEvent(self, event):
- if self._lastProgress < self.MaxProgress:
- self.setCursor(QtCore.Qt.BusyCursor)
- else:
- QtWebKit.QWebView.mouseMoveEvent(self, event)
-
- def userData(self):
- return self._userData
-
- ###############################
- ## event handlers
- ###############################
- def onActionStopTriggered(self):
- # check wich cursor to set cos we may have busy cursor set
- pt = self.mapFromGlobal(self.cursor().pos()) #TODO: self.mapFromGlobal(self.viewPort().cursor().pos()) ??
- frame = self.page().currentFrame()
- hitTest = frame.hitTestContent(pt)
- #if not hitTest.isNull(): #TODO: looks like hitTest.isNull() alwas returns True
- if hitTest.linkUrl().isValid():
- self.setCursor(QtCore.Qt.PointingHandCursor)
- else:
- self.setCursor(QtCore.Qt.ArrowCursor)
-
- def onLoadStarted(self):
- self._lastProgress = 0
-
- def onLoadProgress(self, n):
- self._lastProgress = n
-
- def onLoadFinished(self):
- self._lastProgress = self.MaxProgress
- self.onActionStopTriggered()
-
- def onPageDownloadRequested(self, networkRequest):
- self.emit(QtCore.SIGNAL('downloadRequested(const QNetworkRequest &)'), networkRequest)
-
-#**********************************************************************************
-#
-#**********************************************************************************
-class BrowserWidgetGlobalFeedback(config.GlobalFeedbackBase):
- """wrapper for global statusbar widgets, menus"""
-
- def __init__(self, parent, idGlobalFeedback):
- config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback)
-
- # menus
- self.menus = []
- if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
- menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
- parent.populateMenu(menu)
- self.menus.append(menu)
- self.menuBar.addViewMenu(menu)
-
- # status bar widgets
- self.labelStatus = None
- self.progress = None
- self.labelFeedbackWrap = None
- if self.statusBar is not None:
- self.labelStatus = QtGui.QLabel(QtCore.QString(), self.statusBar)
- self.statusBar.addWidget(self.labelStatus)
-
- self.progress = QtGui.QProgressBar(self.statusBar)
- self.progress.setRange(0, Browser.MaxProgress)
- self.progress.setValue(0)
- self.statusBar.addWidget(self.progress)
-
- label = QtGui.QLabel(self.statusBar)
- label.setFrameStyle(QtGui.QLabel.Sunken | QtGui.QLabel.Box)
- self.labelFeedbackWrap = pathlabelwrap.PathLabelWrap(
- label,
- path_module=config.CompactPathFcpKeyModule,
- )
- self.statusBar.addWidget(self.labelFeedbackWrap.label, 1)
-
-
- def setVisible(self, flag):
- if self.menuBar is not None:
- for menu in self.menus:
- menu.children()[0].setVisible(flag)
- if self.statusBar is not None:
- self.progress.setVisible(flag)
- self.labelStatus.setVisible(flag)
- self.labelFeedbackWrap.label.setVisible(flag)
-
- def setProgress(self, n):
- if self.progress is not None:
- self.progress.setValue(n)
-
- def setStatusMessage(self, qString):
- if self.labelStatus is not None:
- self.labelStatus.setText(qString)
-
- def setFeedback(self, qString):
- if self.labelFeedbackWrap is not None:
- self.labelFeedbackWrap.setPath(unicode(qString))
-
-
-class BrowserWidgetViewObject(config.ViewObject):
-
- def __init__(self, parent):
- config.ViewObject. __init__(self, parent)
-
- self.name=parent.objectName()
- self.displayName=self.trUtf8('Browser')
- self.icon=QtGui.QIcon()
-
-
-class BrowserWidgetSettings(config.SettingsBase):
- _key_ = config.IdViewBrowserWidget
- _settings_ = (
- ('OpenLinksInNewTab', 'Bool', False, config.SettingScopeUser),
- ('OpenAddressBarInNewTab', 'Bool', False, config.SettingScopeUser),
- ('OpenBookmarksInNewTab', 'Bool', False, config.SettingScopeUser),
- ('OpenHomePageOnNewTabCreated', 'Bool', False, config.SettingScopeUser),
- ('BackIsClose', 'Bool', False, config.SettingScopeUser), #TODO: not implemented
- ('HomePage', 'String', QtCore.QString(), config.SettingScopeUser),
- ('IconSize', 'UInt', 32, config.SettingScopeUser),
- ('IconTheme', 'String', QtCore.QString('crystal'), config.SettingScopeUser),
- ('AutoLoadImages', 'Bool', True, config.SettingScopeUser), #TODO: not yet implemented
- ('MaxTabText', 'UInt', 20, config.SettingScopeUser), #NOTE: make shure Max >= Min and Max and Min > 0
- ('MinTabText', 'UInt', 7, config.SettingScopeUser),
- )
-
- def setValues(self, **kws):
- autoLoadImages = kws.get('AutoLoadImages', None)
- if autoLoadImages is not None:
- browserWidget = self.parent()
- tabWidget = browserWidget.controlById(browserWidget.IdTabBrowsers)
- for i in xrange(tabWidget.count()):
- browser = tabWidget.widget(i)
- settings = browser.settings()
- settings.setAttribute(settings.AutoLoadImages, autoLoadImages)
- config.SettingsBase.setValues(self, **kws)
-
- #backIsClose = kws.get('BackIsClose', None)
- #if backIsClose is not None:
- # self.parent()._adjustBackIsClose()
-
-
-
-class BrowserWidgetActions(config.ActionsBase):
-
- def __init__(self, parent):
- config.ActionsBase.__init__(self, parent)
-
- iconSize = parent.fcSettings.value('IconSize')
- iconTheme = parent.fcSettings.value('IconTheme')
-
- self.action(
- name='ActionCloseCurrentTab',
- text=self.trUtf8('Close ¤t tab'),
- trigger=parent.onCloseCurrentTab,
- )
- self.action( # context menu only
- name='ActionCloseBrowserUnderMouse',
- text=self.trUtf8('&Close tab'),
- trigger=None,
- )
- self.action(
- name='ActionCloseAllTabs',
- text=self.trUtf8('Close &all tabs'),
- trigger=parent.onCloseAllTabs,
- )
- self.action(
- name='ActionOpenNewTab',
- text=self.trUtf8('Open &new tab'),
- trigger=parent.onOpenNewTab,
- )
- self.action(
- name='ActionGoToFProxy',
- text=self.trUtf8('Go to f&Proxy homepage'),
- trigger=parent.onGoToFProxy,
- )
- self.action(
- name='ActionGoToHomePage',
- text=self.trUtf8('Go to &homepage'),
- trigger=parent.onGoToHomePage,
- )
- self.action(
- name='ActionObjectProperties',
- text=self.trUtf8('Properties..'),
- trigger=None,
- )
- self.action(
- name='ActionZoomIn',
- text=self.trUtf8('Zoom in'),
- trigger=parent.onZoomIn,
- )
- self.action(
- name='ActionZoomOut',
- text=self.trUtf8('Zoom out'),
- trigger=parent.onZoomOut,
- )
-
- # default browser actions
- self.action(
- name='ActionBack',
- text=self.trUtf8('Back'),
- trigger=None,
- isEnabled=False,
- icon=config.resources.getIcon('back', iconSize, iconTheme=iconTheme),
- userData=(None, None),
- )
- self.action(
- name='ActionForward',
- text=self.trUtf8('Forward'),
- trigger=None,
- isEnabled=False,
- icon=config.resources.getIcon('forward', iconSize, iconTheme=iconTheme),
- userData=(None, None),
- )
- self.action(
- name='ActionReload',
- text=self.trUtf8('Reload'),
- trigger=None,
- isEnabled=False,
- icon=config.resources.getIcon('reload_page', iconSize, iconTheme=iconTheme),
- userData=(None, None),
- )
- self.action(
- name='ActionStop',
- text=self.trUtf8('Stop'),
- trigger=None,
- isEnabled=False,
- icon=config.resources.getIcon('stop', iconSize, iconTheme=iconTheme),
- userData=(None, None),
- )
-
- self.action(
- name='ActionBackIsClose',
- text=self.trUtf8('Back is close'),
- icon=config.resources.getIcon('button_cancel', iconSize, iconTheme=iconTheme),
- trigger=None,
- )
-
- # search actions
- self.action(
- parent=parent,
- name='ActionSearch',
- text=self.trUtf8('Search'),
- shortcut=QtGui.QKeySequence(self.trUtf8('Ctrl+F')),
- trigger=parent.onSearch,
- )
-
- def intertwineBrowserActions(self, browser=None):
- """intertwines Browser actions with BrowserWidget actions
- @note: call everytime the current browser changes
- """
- actions = (
- ('ActionBack', QtWebKit.QWebPage.Back),
- ('ActionForward', QtWebKit.QWebPage.Forward),
- ('ActionReload', QtWebKit.QWebPage.Reload),
- ('ActionStop', QtWebKit.QWebPage.Stop),
- )
- for actionName, pageAction in actions:
- myPageAction = self[actionName]
- newPageAction = None if browser is None else browser.pageAction(pageAction)
- oldPageAction, cb = myPageAction.userData()
-
- if oldPageAction is not None:
- myPageAction.disconnect(oldPageAction, QtCore.SIGNAL('changed()'), cb)
- oldPageAction.disconnect(myPageAction, QtCore.SIGNAL('triggered()'), oldPageAction.trigger)
-
- if newPageAction is None:
- myPageAction.setUserData((None, None))
- myPageAction.setEnabled(False)
- else:
- def onActionChanged(browser=browser, myPageAction=myPageAction, browserPageAction=newPageAction):
- myPageAction.setEnabled(browserPageAction.isEnabled())
-
- myPageAction.setEnabled(newPageAction.isEnabled())
- myPageAction.setUserData((newPageAction, onActionChanged))
- myPageAction.connect(newPageAction, QtCore.SIGNAL('changed()'), onActionChanged)
- newPageAction.connect(myPageAction, QtCore.SIGNAL('triggered()'), newPageAction.trigger)
-
-
-class LastBrowserState(object):
- """records the last known state browser"""
-
- __slots__ = ('icon', 'progress', 'statusMessage', 'title', 'url')
-
- def __init__(self, icon=None, progress=0, statusMessage=None, title=None, url=None):
- self.progress = 0
- self.icon = tCore.QIcon() if icon is None else icon
- self.statusMessage = QtCore.QString() if statusMessage is None else statusMessage
- self.title = QtCore.QString() if title is None else title
- #NOTE: opening a browser in a new tab may take a while to load.
- # self.url() will return '' untill the page is found, so we handle
- # it ourself and keep track of the last known url in self._lastUrl
- # to give feedback to the user on the navbar. downside is we have
- # to reimplement contextMenuEvent() :-(
- self.url = QtCore.QUrl() if url is None else url
-
-#**********************************************************************************
-#
-#**********************************************************************************
-#TODO: strip host:port on address bar?
-#TODO: rename home page to start page
-class ViewBrowserWidget(QtGui.QWidget, Ui_ViewBrowserWidget):
-
- IdTabBrowsers = 'tabBrowsers'
- IdFrameTools = 'frameTools'
- IdFrameAddressBar = 'frameAddressBar'
- IdEdAddressBar = 'edAddressBar'
-
- IdBtBack = 'btBack'
- IdBtForward = 'btForward'
- IdBtReload = 'btReload'
- IdBtStop = 'btStop'
-
- IdFrameSearch = 'frameSearch'
- IdEdSearch = 'edSearch'
- IdBtSearchUpwards = 'btSearchUpwards'
- IdBtSearchDownwards = 'btSearchDownwards'
- IdCkSearchCaseSensitive = 'ckSearchCaseSensitive'
-
- ForcedMinBrowserTabText = 5 # forced minimum number of chars on browser tabBar
-
- def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
- QtGui.QWidget.__init__(self, parent)
-
- self.setupUi(self)
- config.ObjectRegistry.register(self)
-
- self._initialConfigDataArrived = False
-
- self.fcSettings = BrowserWidgetSettings(self).restore()
- self.fcActions = BrowserWidgetActions(self)
- self.fcViewObject = BrowserWidgetViewObject(self)
- self.fcGlobalFeedback = BrowserWidgetGlobalFeedback(self, idGlobalFeedback)
-
- # setup tab bar
- tabWidget = self.controlById(self.IdTabBrowsers)
- tabWidget.clear()
- tabWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
- self.connect(tabWidget, QtCore.SIGNAL('currentChanged(int)'), self.onTabCurrentChanged)
- self.connect(tabWidget, QtCore.SIGNAL('customContextMenuRequested(const QPoint &)'), self.onTabContextMenuEvent)
-
- # setup addressbar
- addressbar = self.controlById(self.IdEdAddressBar)
- self.connect(addressbar, QtCore.SIGNAL('returnPressed()'), self.onNavBarReturnPressed)
-
- # setup tool buttons
- self.controlById(self.IdBtBack).setDefaultAction(self.fcActions['ActionBack'])
- self.controlById(self.IdBtForward).setDefaultAction(self.fcActions['ActionForward'])
- self.controlById(self.IdBtReload).setDefaultAction(self.fcActions['ActionReload'])
- self.controlById(self.IdBtStop).setDefaultAction(self.fcActions['ActionStop'])
-
- # setupp search bar
- bt = self.controlById(self.IdBtSearchUpwards)
- self.connect(bt, QtCore.SIGNAL('clicked()'), self.onSearchUpwards)
- bt = self.controlById(self.IdBtSearchDownwards)
- self.connect(bt, QtCore.SIGNAL('clicked()'), self.onSearchDownwards)
- ed = self.controlById(self.IdEdSearch)
- self.connect(ed, QtCore.SIGNAL('returnPressed()'), self.onSearchDownwards)
- frameSearch = self.controlById(self.IdFrameSearch)
- frameSearch.setVisible(False)
-
- # fire up a new broser to make a start
- self.newBrowser(title=self.trUtf8('Waiting for fproxy'))
- self.fcActions['ActionGoToHomePage'].trigger()
-
- #########################################
- ## private methods
- #########################################
- #NOTE: to reduce flicker set min size to max size
- def _adjustTabText(self, qString):
- maxTabText = self.fcSettings.value('MaxTabText')
- minTabText = self.fcSettings.value('MinTabText')
- ellipsis = self.trUtf8('..')
-
- if minTabText < self.ForcedMinBrowserTabText:
- minTabText = self.ForcedMinBrowserTabText
- self.fcSettings.setValues(MinTabText=minTabText)
- if maxTabText < self.ForcedMinBrowserTabText:
- maxTabText = self.ForcedMinBrowserTabText
- self.fcSettings.setValues(MaxTabText=maxTabText)
- if minTabText > maxTabText:
- minTabText = maxTabText
- self.fcSettings.setValues(MinTabText=maxTabText)
-
- if qString.count() < minTabText:
- qString = qString.append('\x20' * (minTabText - qString.count()))
- else:
- if maxTabText < self.ForcedMinBrowserTabText:
- maxTabText = sminTabText
- qString = qtools.truncateString(maxTabText, qString, ellipsis)
- return qString
-
- def _downloadImageToDisk(self, hitTestResult):
- px = hitTestResult.pixmap()
- if px.isNull():
- return False
-
- key = config.qStringToFcpKey(hitTestResult.imageUrl().toString())
- if key is None:
- return False
-
- # thow a dialog box at the user to select a filename
- # ..qt seems to place the filename part as suggestion into the filename box. so try it
- caption = config.FclientAppName + self.trUtf8(' - Save Image To..')
- directory = unicode(config.settings.value('DownloadDir'))
- fileName = unicode(config.guessFileNameFromKey(key, default=QtCore.QString('')))
-
- if directory and fileName:
- directory = os.path.join(directory, fileName)
- elif not directory:
- directory = fileName
- filePath = QtGui.QFileDialog.getSaveFileName(self, caption, directory)
-
- if filePath:
- filePath= unicode(filePath)
- if os.path.exists(filePath):
- try:
- os.remove(filePath)
- except Exception, details:
- QtGui.QMessageBox.critical(
- self,
- caption,
- self.trUtf8('Could not remove file'), #NOTE: no details please, may contain arbitrary lenght filepath
- )
- return False
- px.save(filePath)
- return True
-
- def _downloadKeyToDisk(self, qUrl):
- """
- @return: (bool) False if the key in the url is invalid, True otherwise
- """
- fcpKey = config.qStringToFcpKey(QtCore.QString(qUrl.encodedPath()))
- if fcpKey is not None:
- dlg = Ui_DlgDownloadKeyToDisk.DownloadKeyToDiskDlg(self, fcpKey=fcpKey)
- if dlg.exec_() == dlg.Accepted:
- filePath = dlg.filePath()
- downloadsWidget = config.ObjectRegistry.get(config.IdViewCDownloadsWidget, None)
- if downloadsWidget is None:
- raise ValueError('no downloads widget found')
- downloadsWidget.downloadFile(
- fcpKey,
- filePath,
- persistence=fcp2.ConstPersistence.Forever,
- handleFilenameCollision=True,
-
- )
- return True
- return False
-
- #########################################
- ## methods
- #########################################
- def controlById(self, idControl):
- return getattr(self, idControl)
-
- def currentBrowser(self):
- """returns the current browser or None"""
- tabWidget = self.controlById(self.IdTabBrowsers)
- return tabWidget.currentWidget()
-
- def load(self, url, force=False, browser=None):
- """loads an url in the current browser. if there is no current browser, a new browser is created
- @param force: (bool) if True, a new browser is opend if there is no browser available
- @param browser: browser to load the url in or None to use the current browser
- @return: (bool)
- """
- browser = self.currentBrowser() if browser is None else browser
- tabWidget = self.controlById(self.IdTabBrowsers)
- addressBar = self.controlById(self.IdEdAddressBar)
- url = QtCore.QUrl(url)
-
- # check if we have a browser at hand
- if force and browser is None:
- browser = self.newBrowser()
- if browser is None:
- return False
-
- # load url
- url.setScheme('http')
- url.setHost(config.settings.value('FproxyConnectionHost'))
- url.setPort(config.settings.value('FproxyConnectionPort'))
- tabWidget.setTabText(tabWidget.indexOf(browser), self._adjustTabText(self.trUtf8('Loading')))
- addressBar.setText(url.toString())
- lastBrowserState = browser.userData()
- lastBrowserState.url = url
- browser.load(url)
- return True
-
- def newBrowser(self, title=''):
- """opens a browser in a new tab"""
- tabWidget = self.controlById(self.IdTabBrowsers)
- browser = Browser(self)
- page = browser.page()
- settings = browser.settings()
- title = QtCore.QString(title)
-
- # attatch browser state information
- lastBrowserState = LastBrowserState(
- icon=browser.icon(),
- statusMessage=self.trUtf8('Waiting'),
- )
- browser.setUserData(lastBrowserState)
-
- # customize browser
- browser.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
- settings.setAttribute(settings.DeveloperExtrasEnabled, False)
- settings.setAttribute(settings.JavaEnabled, False)
- settings.setAttribute(settings.JavascriptEnabled, False)
- settings.setAttribute(settings.JavascriptCanOpenWindows, False)
- settings.setAttribute(settings.JavascriptCanAccessClipboard, False)
- settings.setAttribute(settings.PluginsEnabled, False)
- settings.setAttribute(settings.AutoLoadImages, self.fcSettings.value('AutoLoadImages'))
-
- # connect browser signals
- self.connect(browser, QtCore.SIGNAL('loadStarted()'), self.onBrowserLoadStarted)
- self.connect(browser, QtCore.SIGNAL('loadProgress(int)'), self.onBrowserLoadProgress)
- self.connect(browser, QtCore.SIGNAL('loadFinished(bool)'), self.onBrowserLoadFinished)
- self.connect(browser, QtCore.SIGNAL('iconChanged()'), self.onBrowserIconChanged)
- self.connect(browser, QtCore.SIGNAL('statusBarMessage(const QString &)'), self.onBrowserStatusBarMessage)
- self.connect(browser, QtCore.SIGNAL('titleChanged(const QString &)'), self.onBrowserTitleChanged)
- self.connect(browser, QtCore.SIGNAL('urlChanged(const QUrl &)'), self.onBrowserUrlChanged)
- self.connect(browser, QtCore.SIGNAL('customContextMenuRequested(const QPoint &)'), self.onBrowserCustomContextMenuRequested)
- self.connect(browser, QtCore.SIGNAL('linkClicked(const QUrl &)'), self.onBrowserLinkClicked)
-
- # adjust browser actions
- act = browser.pageAction(page.OpenLinkInNewWindow)
- act.setText(self.trUtf8('Open page in new tab'))
- act = browser.pageAction(page.OpenImageInNewWindow)
- act.setText(self.trUtf8('Open image in new tab'))
- act = browser.pageAction(page.OpenFrameInNewWindow)
- act.setText(self.trUtf8('Open frame in new tab'))
-
- # customize page
- page.setLinkDelegationPolicy(page.DelegateAllLinks)
-
- # connect page signals
- self.connect(page, QtCore.SIGNAL('linkHovered(const QString &, const QString &, const QString &)'), self.onPageLinkHovered)
-
- tabWidget.addTab(browser, self._adjustTabText(title))
- if tabWidget.currentWidget() == browser:
- self.fcGlobalFeedback.setStatusMessage(lastBrowserState.statusMessage)
- return browser
-
- #TODO: rework. we need more then one menu
- def populateMenu(self, menu):
- menu.addAction(self.fcActions['ActionGoToFProxy'])
- menu.addAction(self.fcActions['ActionGoToHomePage'])
- menu.addAction(self.fcActions['ActionCloseCurrentTab'])
- menu.addAction(self.fcActions['ActionCloseAllTabs'])
- menu.addAction(self.fcActions['ActionOpenNewTab'])
- menu.addAction(self.fcActions['ActionZoomIn'])
- menu.addAction(self.fcActions['ActionZoomOut'])
- menu.addAction(self.fcActions['ActionSearch'])
- return menu
-
- #########################################
- ## overwritten events
- #########################################
- def closeEvent(self):
- self.viewClose()
-
- def hideEvent(self, event):
- self.fcGlobalFeedback.setVisible(False)
-
- def showEvent(self, event):
- self.fcGlobalFeedback.setVisible(True)
-
- def viewClose(self):
- pass
-
- #########################################
- ## event handlers
- #########################################
- #TODO: actions need some comb over
- def onBrowserCustomContextMenuRequested(self, pt):
- browser = self.sender()
- frame = browser.page().currentFrame()
- page = browser.page()
- hitTestResult = frame.hitTestContent(pt)
-
- #if not hitTest.isNull(): #TODO: looks like hitTest.isNull() alwas returns True
-
- menu = QtGui.QMenu()
-
- menu.addAction(browser.pageAction(page.OpenLink))
- menu.addAction(browser.pageAction(page.OpenLinkInNewWindow))
- menu.addAction(browser.pageAction(page.CopyLinkToClipboard))
- menu.addAction(browser.pageAction(page.DownloadLinkToDisk))
-
- menu.addSeparator()
- menu.addAction(browser.pageAction(page.OpenImageInNewWindow))
- menu.addAction(browser.pageAction(page.CopyImageToClipboard))
- menu.addAction(browser.pageAction(page.DownloadImageToDisk))
-
- menu.addSeparator()
- menu.addAction(browser.pageAction(page.OpenFrameInNewWindow))
-
- menu.addSeparator()
- menu.addAction(browser.pageAction(page.Copy))
- menu.addAction(self.fcActions['ActionObjectProperties'])
-
- action = menu.exec_(pt)
-
- if action == browser.pageAction(page.OpenLinkInNewWindow):
- browser = self.newBrowser(title=self.trUtf8('Loading'))
- self.load(hitTestResult.linkUrl(), browser=browser)
- elif action == browser.pageAction(page.OpenImageInNewWindow):
- browser = self.newBrowser(title=self.trUtf8('Loading'))
- self.load(hitTestResult.imageUrl(), browser=browser)
- elif action == browser.pageAction(page.OpenFrameInNewWindow):
- browser = self.newBrowser(title=self.trUtf8('Loading'))
- self.load(hitTestResult.frame().url(), browser=browser)
- elif action == browser.pageAction(page.DownloadImageToDisk):
- self._downloadImageToDisk(hitTestResult)
- elif action == browser.pageAction(page.DownloadLinkToDisk):
- self._downloadKeyToDisk(hitTestResult.linkUrl())
- elif action == self.fcActions['ActionObjectProperties']:
- dlg = Ui_DlgPropsBrowserObject.PropsBrowserObjectDlg(self, hitTestResult=hitTestResult)
- if dlg.exec_() == dlg.Accepted:
- pass
-
- #TODO: nav buttons seem to get confused on error
- def onBrowserLoadFinished(self, ok):
- browser = self.sender()
- lastBrowserState = browser.userData()
- tabWidget = self.controlById(self.IdTabBrowsers)
-
- lastBrowserState.progress = Browser.MaxProgress
- if ok:
- lastBrowserState.statusMessage = self.trUtf8('Complete')
- if lastBrowserState.title.isEmpty():
- tabWidget.setTabText(tabWidget.indexOf(browser), self._adjustTabText(self.trUtf8('Complete')))
- if browser == self.currentBrowser():
- self.fcGlobalFeedback.setStatusMessage(lastBrowserState.statusMessage)
- else:
- # something went wrong. most likely fProxy can not be reached
- lastBrowserState.statusMessage = self.trUtf8('Error')
- tabWidget.setTabText(tabWidget.indexOf(browser), self._adjustTabText(self.trUtf8('Error')))
- if browser == self.currentBrowser():
- self.fcGlobalFeedback.setStatusMessage(lastBrowserState.statusMessage)
-
- settings = browser.settings()
- settings.setAttribute(settings.JavascriptEnabled, True)
- try:
- p = (
- '<h3>%s</h3>' % self.trUtf8('Error: request failed'),
- self.trUtf8('Possible reasons:'),
- '<u...
[truncated message content] |
|
From: <jU...@us...> - 2008-07-27 11:34:31
|
Revision: 770
http://fclient.svn.sourceforge.net/fclient/?rev=770&view=rev
Author: jUrner
Date: 2008-07-27 11:34:40 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
naming
Modified Paths:
--------------
trunk/fclient/src/fclient/fclient.py
trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
trunk/fclient/src/fclient/impl/ViewBrowser.py
Added Paths:
-----------
trunk/fclient/src/fclient/impl/ViewConnection.py
Removed Paths:
-------------
trunk/fclient/src/fclient/impl/Ui_ViewConnection.py
Modified: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py 2008-07-27 11:32:55 UTC (rev 769)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-27 11:34:40 UTC (rev 770)
@@ -9,7 +9,7 @@
from .impl.MainWindow import MainWindow
from .impl.View import ViewWidget
from .impl.ViewBrowser import ViewBrowserWidget
-from .impl.Ui_ViewConnection import ViewConnectionWidget
+from .impl.ViewConnection import ViewConnectionWidget
from .impl.Ui_ViewDownloads import ViewDownloadsWidget
from .impl.Ui_ViewLogger import ViewLoggerWidget
#*************************************************************
Deleted: trunk/fclient/src/fclient/impl/Ui_ViewConnection.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewConnection.py 2008-07-27 11:32:55 UTC (rev 769)
+++ trunk/fclient/src/fclient/impl/Ui_ViewConnection.py 2008-07-27 11:34:40 UTC (rev 770)
@@ -1,310 +0,0 @@
-#*********************************************************************
-#TODO:
-# x. setting fcp connection params currently won't reset connection. how to handle?
-#
-#
-#*********************************************************************
-
-
-
-#*********************************************************************
-#NOTES:
-#
-# current handling is:
-# 1. connect to fcp client
-# 2. query config
-#
-# all listebners interested in fcp client should take arrival of config
-# as signal to start doing whatever
-#
-#*********************************************************************
-
-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 QtCore, QtGui
-
-from . import config
-from .lib import fcp2
-from .Ui_DlgConnectionExpertSettings import ConnectionExpertSettingsDlg
-
-from .tpls.Ui_ViewConnectionWidgetTpl import Ui_ViewConnectionWidget
-#**********************************************************************************
-#
-#**********************************************************************************
-class Actions(config.ActionsBase):
- pass
-
-
-class GlobalFeedback(config.GlobalFeedbackBase):
- """wrapper for global statusbar widgets, menus"""
-
- def __init__(self, parent,idGlobalFeedback):
- config.GlobalFeedbackBase.__init__(self, parent,idGlobalFeedback)
-
- # menus
- self.menus = []
- if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
- menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
- parent.populateMenu(menu)
- self.menus.append(menu)
- self.menuBar.addViewMenu(menu)
-
- # status bar widgets
- self.label1 = None
- #if self.statusBar is not None:
- # self.label1 = QtGui.QLabel('foo here', self.statusBar)
-
- def setVisible(self, flag):
- for menu in self.menus:
- menu.children()[0].setVisible(flag)
- if self.label1 is not None:
- self.label1.setVisible(flag)
-
-
-class Settings(config.SettingsBase):
- _key_ = config.IdViewConnectionWidget
- _settings_ = (
- ('FcpConnectionTimerTimeout', 'UInt', 500, config.SettingScopeExpert),
- ('FcpConnectionTimerMaxDuration', 'UInt', 20, config.SettingScopeExpert),
- ('FcpPollTimerTimeout', 'UInt', 200, config.SettingScopeExpert),
- )
-
-class ConnectionViewObject(config.ViewObject):
-
- def __init__(self, parent):
- config.ViewObject. __init__(self, parent)
-
- self.name=parent.objectName()
- self.displayName=self.trUtf8('Connection')
- self.icon=QtGui.QIcon()
-
-
-#**********************************************************************************
-#
-#**********************************************************************************
-class ConnectionTimer(QtCore.QTimer):
-
- def __init__(self,parent):
- QtCore.QTimer.__init__(self, parent)
- self.fcpIterConnect = None
- self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
-
- def start(self, settings):
- config.fcpClient.setConnectionName(config.settings.value('FcpConnectionName'))
- self.fcpIterConnect = config.fcpClient.iterConnect(
- duration=settings.value('FcpConnectionTimerMaxDuration'),
- timeout=0
- )
- if not self.onNext():
- QtCore.QTimer.start(self, settings.value('FcpConnectionTimerTimeout'))
-
- def onNext(self):
- try:
- result = self.fcpIterConnect.next()
- except StopIteration:
- self.stop()
- else:
- if result is not None:
- self.stop()
- # 1st thing todo after connect is to query the config from the node so all
- # listeners right away so not everyone has to query it so. needs more details
- # or joins the gui later.. feel free to query again
- config.fcpClient.getConfig()
- return True
- return False
-
-
-class PollTimer(QtCore.QTimer):
-
- def __init__(self,parent):
- QtCore.QTimer.__init__(self, parent)
- self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
-
- def start(self, settings):
- QtCore.QTimer.start(self, settings.value('FcpPollTimerTimeout'))
-
- def onNext(self):
- if config.fcpClient.isConnected():
- result = config.fcpClient.next()
-
-#***********************************************************************
-#
-#***********************************************************************
-class ViewConnectionWidget(QtGui.QWidget, Ui_ViewConnectionWidget):
-
- IdBtConnect = 'btConnect'
- IdEdFcpFcpConnectionHost = 'edFcpConnectionHost'
- IdFcpSpinFcpConnectionPort = 'spinFcpConnectionPort'
- IdCkFcpAutoConnect = 'ckFcpAutoConnect'
- IdBtFcpConnectionMore = 'btFcpConnectionMore'
-
- IdEdFproxyConnectionHost = 'edFproxyConnectionHost'
- IdFproxySpinConnectionPort = 'spinFproxyConnectionPort'
-
-
- def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
- QtGui.QWidget.__init__(self, parent)
-
- self._isCreated = False
- self._connectionTimer = ConnectionTimer(self)
- self._pollTimer = PollTimer(self)
- self._fcpEventonrs = (
- (config.fcpClient.events.ClientConnected, self.onFcpClientConected),
- (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconected),
- )
- config.fcpClient.events += self._fcpEventonrs
- self._mainWindowMenus = ()
-
-
- self.setupUi(self)
- config.ObjectRegistry.register(self)
- self.fcSettings = Settings().restore()
- self.fcActions = Actions(self)
- self.fcViewObject = ConnectionViewObject(self)
- self.fcGlobalFeedback = GlobalFeedback(self,idGlobalFeedback)
-
-
-
- #########################################
- ## methods
- #########################################
- def controlById(self, idControl):
- return getattr(self, idControl)
-
-
- def populateMenu(self, menu):
- return menu
-
- #########################################
- ## view methods
- #########################################
- def viewClose(self):
- config.fcpClient.events -= self._fcpEventonrs
-
- #########################################
- ## overwritten events
- #########################################
- def closeEvent(self, event):
- self.viewClose()
-
- def hideEvent(self, event):
- self.fcGlobalFeedback.setVisible(False)
-
-
- def showEvent(self, event):
- self.fcGlobalFeedback.setVisible(True)
- if self._isCreated:
- return
- self._isCreated = True
-
- # setup fcp host / port / name
- edHost = self.controlById(self.IdEdFcpFcpConnectionHost)
- edHost.setText(config.settings.value('FcpConnectionHost'))
- self.connect(edHost, QtCore.SIGNAL('textChanged(const QString &)'), self.onEdFcpConnectionHostChanged)
-
- spinPort = self.controlById(self.IdFcpSpinFcpConnectionPort)
- spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable
- spinPort.setValue(config.settings.value('FcpConnectionPort'))
- self.connect(spinPort, QtCore.SIGNAL('valueChanged(int)'), self.onSpinFcpConnectionPortChanged)
-
- doAutoConnect = config.settings.value('FcpAutoConnect')
- ck = self.controlById(self.IdCkFcpAutoConnect)
- ck.setChecked(doAutoConnect)
- self.connect(ck, QtCore.SIGNAL('stateChanged(int)'), self.onCkFcpAutoConnectStateChanged)
-
- bt = self.controlById(self.IdBtFcpConnectionMore)
- self.connect(bt, QtCore.SIGNAL('clicked()'), self.onBtFcpConnectionMoreClicked)
-
- # setup fproxy host / port
- edHost = self.controlById(self.IdEdFproxyConnectionHost)
- edHost.setText(config.settings.value('FproxyConnectionHost'))
- self.connect(edHost, QtCore.SIGNAL('textChanged(const QString &)'), self.onEdFproxyConnectionHostChanged)
-
- spinPort = self.controlById(self.IdFproxySpinConnectionPort)
- spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable
- spinPort.setValue(config.settings.value('FproxyConnectionPort'))
- self.connect(spinPort, QtCore.SIGNAL('valueChanged(int)'), self.onSpinFproxyConnectionPortChanged)
-
- bt = self.controlById(self.IdBtConnect)
- self.connect(bt, QtCore.SIGNAL('clicked(bool)'), self.onBtConnectClicked)
- if doAutoConnect:
- self.controlById(self.IdBtConnect).click()
-
- ########################################
- ## overwritten methods
- #########################################
- def retranslateUi(self, w):
- Ui_ViewConnectionWidget.retranslateUi(self, w)
- bt = self.controlById(self.IdBtConnect)
- bt.setText(self.trUtf8('Disconnect') if bt.isChecked() else self.trUtf8('Connect'))
-
-
- #########################################
- ## event onrs
- #########################################
- def onBtConnectClicked(self, isChecked):
- bt = self.controlById(self.IdBtConnect)
- bt.setText(self.trUtf8('Disconnect') if isChecked else self.trUtf8('Connect'))
- if isChecked:
- if config.fcpClient.isConnected():
- config.fcpClient.close()
- self._connectionTimer.start(self.fcSettings)
- else:
- self._connectionTimer.stop()
- if config.fcpClient.isConnected():
- self._pollTimer.stop()
- config.fcpClient.close()
-
-
- def onCkFcpAutoConnectStateChanged(self, state):
- config.settings.setValues(FcpAutoConnect=state == QtCore.Qt.Checked)
-
- def onEdFcpConnectionHostChanged(self, text):
- config.settings.setValues(FcpConnectionHost=text)
-
- def onSpinFcpConnectionPortChanged(self, value):
- config.settings.setValues(FcpConnectionPort=value)
-
- def onBtFcpConnectionMoreClicked(self):
- dlg = ConnectionExpertSettingsDlg(self)
- if dlg.exec_() == dlg.Accepted:
- pass
-
- def onEdFproxyConnectionHostChanged(self, text):
- config.settings.setValues(FproxyConnectionHost=text)
-
- def onSpinFproxyConnectionPortChanged(self, value):
- config.settings.setValues(FproxyConnectionPort=value)
-
-
- #########################################
- ## fcp event onrs
- #########################################
- def onFcpClientDisconected(self, event, msg):
- bt = self.controlById(self.IdBtConnect)
- if bt.isChecked():
- bt.click()
-
- def onFcpClientConected(self, event, msg):
- self._pollTimer.start(self.fcSettings)
-
-#**********************************************************************************
-#
-#**********************************************************************************
-if __name__ == '__main__':
- import sys
- from . import View, Ui_ViewLogger
-
- app = QtGui.QApplication(sys.argv)
- w = Ui_View.ViewWidget(None)
- w.addTopViews(ViewConnectionWidget(None))
- w.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
-
- w.show()
- res = app.exec_()
- sys.exit(res)
-
-
-
Modified: trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py 2008-07-27 11:32:55 UTC (rev 769)
+++ trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py 2008-07-27 11:34:40 UTC (rev 770)
@@ -254,7 +254,7 @@
if __name__ == '__main__':
import sys
from . import View
- from . import Ui_ViewConnection
+ from . import ViewConnection
from . import Ui_ViewLogger
from . import MainWindow
Modified: trunk/fclient/src/fclient/impl/ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/impl/ViewBrowser.py 2008-07-27 11:32:55 UTC (rev 769)
+++ trunk/fclient/src/fclient/impl/ViewBrowser.py 2008-07-27 11:34:40 UTC (rev 770)
@@ -977,7 +977,7 @@
from .Ui_ViewLogger import ViewLoggerWidget
from .MainWindow import MainWindow
from .View import ViewWidget
- from .Ui_ViewConnection import ViewConnectionWidget
+ from .ViewConnection import ViewConnectionWidget
from .Ui_ViewDownloads import ViewDownloadsWidget
app = QtGui.QApplication(sys.argv)
Added: trunk/fclient/src/fclient/impl/ViewConnection.py
===================================================================
--- trunk/fclient/src/fclient/impl/ViewConnection.py (rev 0)
+++ trunk/fclient/src/fclient/impl/ViewConnection.py 2008-07-27 11:34:40 UTC (rev 770)
@@ -0,0 +1,310 @@
+#*********************************************************************
+#TODO:
+# x. setting fcp connection params currently won't reset connection. how to handle?
+#
+#
+#*********************************************************************
+
+
+
+#*********************************************************************
+#NOTES:
+#
+# current handling is:
+# 1. connect to fcp client
+# 2. query config
+#
+# all listebners interested in fcp client should take arrival of config
+# as signal to start doing whatever
+#
+#*********************************************************************
+
+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 QtCore, QtGui
+
+from . import config
+from .lib import fcp2
+from .Ui_DlgConnectionExpertSettings import ConnectionExpertSettingsDlg
+
+from .tpls.Ui_ViewConnectionWidgetTpl import Ui_ViewConnectionWidget
+#**********************************************************************************
+#
+#**********************************************************************************
+class Actions(config.ActionsBase):
+ pass
+
+
+class GlobalFeedback(config.GlobalFeedbackBase):
+ """wrapper for global statusbar widgets, menus"""
+
+ def __init__(self, parent,idGlobalFeedback):
+ config.GlobalFeedbackBase.__init__(self, parent,idGlobalFeedback)
+
+ # menus
+ self.menus = []
+ if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
+ menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
+ parent.populateMenu(menu)
+ self.menus.append(menu)
+ self.menuBar.addViewMenu(menu)
+
+ # status bar widgets
+ self.label1 = None
+ #if self.statusBar is not None:
+ # self.label1 = QtGui.QLabel('foo here', self.statusBar)
+
+ def setVisible(self, flag):
+ for menu in self.menus:
+ menu.children()[0].setVisible(flag)
+ if self.label1 is not None:
+ self.label1.setVisible(flag)
+
+
+class Settings(config.SettingsBase):
+ _key_ = config.IdViewConnectionWidget
+ _settings_ = (
+ ('FcpConnectionTimerTimeout', 'UInt', 500, config.SettingScopeExpert),
+ ('FcpConnectionTimerMaxDuration', 'UInt', 20, config.SettingScopeExpert),
+ ('FcpPollTimerTimeout', 'UInt', 200, config.SettingScopeExpert),
+ )
+
+class ConnectionViewObject(config.ViewObject):
+
+ def __init__(self, parent):
+ config.ViewObject. __init__(self, parent)
+
+ self.name=parent.objectName()
+ self.displayName=self.trUtf8('Connection')
+ self.icon=QtGui.QIcon()
+
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class ConnectionTimer(QtCore.QTimer):
+
+ def __init__(self,parent):
+ QtCore.QTimer.__init__(self, parent)
+ self.fcpIterConnect = None
+ self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
+
+ def start(self, settings):
+ config.fcpClient.setConnectionName(config.settings.value('FcpConnectionName'))
+ self.fcpIterConnect = config.fcpClient.iterConnect(
+ duration=settings.value('FcpConnectionTimerMaxDuration'),
+ timeout=0
+ )
+ if not self.onNext():
+ QtCore.QTimer.start(self, settings.value('FcpConnectionTimerTimeout'))
+
+ def onNext(self):
+ try:
+ result = self.fcpIterConnect.next()
+ except StopIteration:
+ self.stop()
+ else:
+ if result is not None:
+ self.stop()
+ # 1st thing todo after connect is to query the config from the node so all
+ # listeners right away so not everyone has to query it so. needs more details
+ # or joins the gui later.. feel free to query again
+ config.fcpClient.getConfig()
+ return True
+ return False
+
+
+class PollTimer(QtCore.QTimer):
+
+ def __init__(self,parent):
+ QtCore.QTimer.__init__(self, parent)
+ self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext)
+
+ def start(self, settings):
+ QtCore.QTimer.start(self, settings.value('FcpPollTimerTimeout'))
+
+ def onNext(self):
+ if config.fcpClient.isConnected():
+ result = config.fcpClient.next()
+
+#***********************************************************************
+#
+#***********************************************************************
+class ViewConnectionWidget(QtGui.QWidget, Ui_ViewConnectionWidget):
+
+ IdBtConnect = 'btConnect'
+ IdEdFcpFcpConnectionHost = 'edFcpConnectionHost'
+ IdFcpSpinFcpConnectionPort = 'spinFcpConnectionPort'
+ IdCkFcpAutoConnect = 'ckFcpAutoConnect'
+ IdBtFcpConnectionMore = 'btFcpConnectionMore'
+
+ IdEdFproxyConnectionHost = 'edFproxyConnectionHost'
+ IdFproxySpinConnectionPort = 'spinFproxyConnectionPort'
+
+
+ def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
+ QtGui.QWidget.__init__(self, parent)
+
+ self._isCreated = False
+ self._connectionTimer = ConnectionTimer(self)
+ self._pollTimer = PollTimer(self)
+ self._fcpEventonrs = (
+ (config.fcpClient.events.ClientConnected, self.onFcpClientConected),
+ (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconected),
+ )
+ config.fcpClient.events += self._fcpEventonrs
+ self._mainWindowMenus = ()
+
+
+ self.setupUi(self)
+ config.ObjectRegistry.register(self)
+ self.fcSettings = Settings().restore()
+ self.fcActions = Actions(self)
+ self.fcViewObject = ConnectionViewObject(self)
+ self.fcGlobalFeedback = GlobalFeedback(self,idGlobalFeedback)
+
+
+
+ #########################################
+ ## methods
+ #########################################
+ def controlById(self, idControl):
+ return getattr(self, idControl)
+
+
+ def populateMenu(self, menu):
+ return menu
+
+ #########################################
+ ## view methods
+ #########################################
+ def viewClose(self):
+ config.fcpClient.events -= self._fcpEventonrs
+
+ #########################################
+ ## overwritten events
+ #########################################
+ def closeEvent(self, event):
+ self.viewClose()
+
+ def hideEvent(self, event):
+ self.fcGlobalFeedback.setVisible(False)
+
+
+ def showEvent(self, event):
+ self.fcGlobalFeedback.setVisible(True)
+ if self._isCreated:
+ return
+ self._isCreated = True
+
+ # setup fcp host / port / name
+ edHost = self.controlById(self.IdEdFcpFcpConnectionHost)
+ edHost.setText(config.settings.value('FcpConnectionHost'))
+ self.connect(edHost, QtCore.SIGNAL('textChanged(const QString &)'), self.onEdFcpConnectionHostChanged)
+
+ spinPort = self.controlById(self.IdFcpSpinFcpConnectionPort)
+ spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable
+ spinPort.setValue(config.settings.value('FcpConnectionPort'))
+ self.connect(spinPort, QtCore.SIGNAL('valueChanged(int)'), self.onSpinFcpConnectionPortChanged)
+
+ doAutoConnect = config.settings.value('FcpAutoConnect')
+ ck = self.controlById(self.IdCkFcpAutoConnect)
+ ck.setChecked(doAutoConnect)
+ self.connect(ck, QtCore.SIGNAL('stateChanged(int)'), self.onCkFcpAutoConnectStateChanged)
+
+ bt = self.controlById(self.IdBtFcpConnectionMore)
+ self.connect(bt, QtCore.SIGNAL('clicked()'), self.onBtFcpConnectionMoreClicked)
+
+ # setup fproxy host / port
+ edHost = self.controlById(self.IdEdFproxyConnectionHost)
+ edHost.setText(config.settings.value('FproxyConnectionHost'))
+ self.connect(edHost, QtCore.SIGNAL('textChanged(const QString &)'), self.onEdFproxyConnectionHostChanged)
+
+ spinPort = self.controlById(self.IdFproxySpinConnectionPort)
+ spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable
+ spinPort.setValue(config.settings.value('FproxyConnectionPort'))
+ self.connect(spinPort, QtCore.SIGNAL('valueChanged(int)'), self.onSpinFproxyConnectionPortChanged)
+
+ bt = self.controlById(self.IdBtConnect)
+ self.connect(bt, QtCore.SIGNAL('clicked(bool)'), self.onBtConnectClicked)
+ if doAutoConnect:
+ self.controlById(self.IdBtConnect).click()
+
+ ########################################
+ ## overwritten methods
+ #########################################
+ def retranslateUi(self, w):
+ Ui_ViewConnectionWidget.retranslateUi(self, w)
+ bt = self.controlById(self.IdBtConnect)
+ bt.setText(self.trUtf8('Disconnect') if bt.isChecked() else self.trUtf8('Connect'))
+
+
+ #########################################
+ ## event onrs
+ #########################################
+ def onBtConnectClicked(self, isChecked):
+ bt = self.controlById(self.IdBtConnect)
+ bt.setText(self.trUtf8('Disconnect') if isChecked else self.trUtf8('Connect'))
+ if isChecked:
+ if config.fcpClient.isConnected():
+ config.fcpClient.close()
+ self._connectionTimer.start(self.fcSettings)
+ else:
+ self._connectionTimer.stop()
+ if config.fcpClient.isConnected():
+ self._pollTimer.stop()
+ config.fcpClient.close()
+
+
+ def onCkFcpAutoConnectStateChanged(self, state):
+ config.settings.setValues(FcpAutoConnect=state == QtCore.Qt.Checked)
+
+ def onEdFcpConnectionHostChanged(self, text):
+ config.settings.setValues(FcpConnectionHost=text)
+
+ def onSpinFcpConnectionPortChanged(self, value):
+ config.settings.setValues(FcpConnectionPort=value)
+
+ def onBtFcpConnectionMoreClicked(self):
+ dlg = ConnectionExpertSettingsDlg(self)
+ if dlg.exec_() == dlg.Accepted:
+ pass
+
+ def onEdFproxyConnectionHostChanged(self, text):
+ config.settings.setValues(FproxyConnectionHost=text)
+
+ def onSpinFproxyConnectionPortChanged(self, value):
+ config.settings.setValues(FproxyConnectionPort=value)
+
+
+ #########################################
+ ## fcp event onrs
+ #########################################
+ def onFcpClientDisconected(self, event, msg):
+ bt = self.controlById(self.IdBtConnect)
+ if bt.isChecked():
+ bt.click()
+
+ def onFcpClientConected(self, event, msg):
+ self._pollTimer.start(self.fcSettings)
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+ from . import View, Ui_ViewLogger
+
+ app = QtGui.QApplication(sys.argv)
+ w = Ui_View.ViewWidget(None)
+ w.addTopViews(ViewConnectionWidget(None))
+ w.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
+
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-27 11:35:59
|
Revision: 771
http://fclient.svn.sourceforge.net/fclient/?rev=771&view=rev
Author: jUrner
Date: 2008-07-27 11:36:07 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
naming
Modified Paths:
--------------
trunk/fclient/src/fclient/fclient.py
trunk/fclient/src/fclient/impl/ViewBrowser.py
Added Paths:
-----------
trunk/fclient/src/fclient/impl/ViewDownloads.py
Removed Paths:
-------------
trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
Modified: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py 2008-07-27 11:34:40 UTC (rev 770)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-27 11:36:07 UTC (rev 771)
@@ -10,7 +10,7 @@
from .impl.View import ViewWidget
from .impl.ViewBrowser import ViewBrowserWidget
from .impl.ViewConnection import ViewConnectionWidget
-from .impl.Ui_ViewDownloads import ViewDownloadsWidget
+from .impl.ViewDownloads import ViewDownloadsWidget
from .impl.Ui_ViewLogger import ViewLoggerWidget
#*************************************************************
#
Deleted: trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py 2008-07-27 11:34:40 UTC (rev 770)
+++ trunk/fclient/src/fclient/impl/Ui_ViewDownloads.py 2008-07-27 11:36:07 UTC (rev 771)
@@ -1,276 +0,0 @@
-""""""
-
-#**************************************************************************************************************
-#TODO:
-#
-# x. prtty tricky to get dls right when the node or client may disconnect unexpectedly
-# problem: dls that we send and that have not reached the node
-# problem: what to do when the user wants to quit and we still have dls to push to the node
-#
-# solution would require keeping track of all requests
-# a. keep identifiers of requests that reached the node (have to do it anyways)
-# b. keep track of requests ahead of sending them to the node (feels not too good doubeling downloads.dat.gz)
-#
-# best idea seems to be to ignore the problem
-# 1. wait till (if ever) freenet devels fdrop node keeping track of client requests
-#
-# 2. a box thrown to the user (x. do not show this message again) to inform him about pendings
-# should be enough. maybe along with a separate widget or some separate color code for pendings
-#
-# x. performance
-# start with a standard model and improve it over time. no need to set any hard
-# limits. the user will find out by himself how many dls his machine can handle.
-# have to be carefrul though when adding dls, like from a *.frdx to provide appropriate
-# warnings
-#**************************************************************************************************************
-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 os
-from PyQt4 import QtCore, QtGui
-
-from . import config
-from .lib import fcp2
-
-from .tpls.Ui_ViewDownloadsWidgetTpl import Ui_ViewDownloadsWidget
-#**********************************************************************************
-#
-#**********************************************************************************
-class DownloadsViewObject(config.ViewObject):
-
- def __init__(self, parent):
- config.ViewObject. __init__(self, parent)
-
- self.name=parent.objectName()
- self.displayName=self.trUtf8('Downloads')
- self.icon=QtGui.QIcon()
-
-#**********************************************************************************
-#
-#**********************************************************************************
-# from: network/torrent/mainwindow.cpp
-# TorrentViewDelegate is used to draw the progress bars.
-class DownloadTreeDelegate(QtGui.QItemDelegate):
-
- def __init__(self, parent):
- QtGui.QItemDelegate.__init__(self, parent)
-
- def paint(self, painter, option, index):
- if index.column() != self.parent().HeaderIndexProgress:
- return QtGui.QItemDelegate.paint(self, painter, option, index)
-
- application = QtGui.QApplication.instance()
- fcpRequest = self.parent().fcRequests.itemFromIndex(index.row()).fcpRequest
- progress = fcpRequest['ProgressSucceeeded']
- required = fcpRequest['ProgressRequired']
-
- # Set up a QprogressbarOptionProgressBar to precisely mimic the
- # environment of a progress bar.
- progressBarOption = QtGui.QStyleOptionProgressBar()
- progressBarOption.state = QtGui.QStyle.State_Enabled
- progressBarOption.direction = application.layoutDirection()
- progressBarOption.rect = option.rect
- progressBarOption.fontMetrics = application.fontMetrics()
- progressBarOption.minimum = 0
- progressBarOption.maximum = fcpRequest['ProgressRequired']
- progressBarOption.textAlignment = QtCore.Qt.AlignCenter
- progressBarOption.textVisible = True
-
- # Set the progress and text values of the style option.
- progressBarOption.progress = progress
- if required:
- progressBarOption.text = '%s%%' % round(progress * 100 / required, 2)
- else:
- progressBarOption.text = '0%'
-
- # Draw the progress bar onto the view.
- application.style().drawControl(QtGui.QStyle.CE_ProgressBar, progressBarOption, painter)
-
-#**********************************************************************************
-#
-#**********************************************************************************
-class TreeItem(QtGui.QTreeWidgetItem):
-
- def __init__(self, fcpIdentifier, *params):
- QtGui.QTreeWidgetItem.__init__(self, *params)
- self.fcpIdentifier = fcpIdentifier
-
-
-#**********************************************************************************
-#
-#**********************************************************************************
-class Requests(object):
-
- def __init__(self):
- self.identifiers = []
- self.items = []
-
- def addRequest(self, identifier, item):
- self.identifiers.append(identifier)
- self.items.append(item)
-
- def itemFromIndex(self, index):
- return self.items[index]
-
-
-class ViewDownloadsWidget(QtGui.QWidget, Ui_ViewDownloadsWidget):
-
- IdTree = 'tree'
-
-
- HeaderIndexName = 0
- HeaderIndexFoo = 1
- HeaderIndexProgress = 2
-
- def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
- QtGui.QWidget.__init__(self, parent)
- self._isCreated = False
-
- self.setupUi(self)
- config.ObjectRegistry.register(self)
-
- self.fcViewObject = DownloadsViewObject(self)
- self.fcpEvents = (
- (config.fcpClient.events.ConfigData, self.onFcpConfigData),
- (config.fcpClient.events.RequestCompleted, self.onFcpRequestCompleted),
- (config.fcpClient.events.RequestFailed, self.onFcpRequestFailed),
- (config.fcpClient.events.RequestModified, self.onFcpRequestModified),
- (config.fcpClient.events.RequestProgress, self.onFcpRequestProgress),
- (config.fcpClient.events.RequestStarted, self.onFcpRequestStarted),
- )
- config.fcpClient.events += self.fcpEvents
- self.fcHeadeLabels = {}
- self.fcpRequests = {}
-
- #XXX
- self.foo = False
-
-
- def retranslateUi(self, parent):
- self.fcHeadeLabels = {
- self.HeaderIndexName: self.trUtf8('Name'),
- self.HeaderIndexFoo: self.trUtf8('Foo'),
- self.HeaderIndexProgress: self.trUtf8('Progress'),
- }
- self.tree.setHeaderLabels([i[1] for i in sorted(self.fcHeadeLabels.items())])
-
-
- def closeEvent(self):
- self.viewClose()
-
-
- def viewClose(self):
- config.fcpClient.events -= self.fcpEvents
-
-
- def downloadFile(self, fcpKey, fileName, **kws):
- """"""
- fileName = unicode(fileName)
- fcpIdentifier = config.fcpClient.getFile(fcpKey, fileName, **kws)
- item= TreeItem(fcpIdentifier, self.tree)
-
- item.setData(
- self.HeaderIndexName,
- QtCore.Qt.DisplayRole,
- QtCore.QVariant(os.path.basename(fileName))
- )
-
- progressBar = QtGui.QProgressBar(self)
- progressBar.setRange(0, 0)
- self.tree.setItemWidget(item, self.HeaderIndexProgress, progressBar)
- self.fcpRequests[fcpIdentifier] = item
-
-
- #########################################
- ## methods
- #########################################
- def controlById(idGlobalFeedback, idControl):
- return getattr(idGlobalFeedback, idControl)
-
- #########################################
- ## fcp event handlers
- #########################################
- def onFcpConfigData(self, fcpEvent, fcpRequest):
- if not self.foo:
- self.foo = True
-
- return
- # for testing: dl some frost.zip
- key = fcp2.Key('CHK@tJ0qyIr8dwvYKoSkmR1N-soABstL0RjgiYqQm3Gtv8g,Pqj7jpPUBzRgnVTaA3fEw6gE8QHcJsTwA4liL9FZ-Fg,AAIC--8/frost-04-Mar-2008.zip')
- fileName = config.guessFileNameFromKey(key, default=self.trUtf8('Unknown.file'))
- directory = config.settings.value('DownloadDir')
- fpath = os.path.join(unicode(directory), unicode(fileName))
- self.downloadFile(key, fpath)
-
-
- def onFcpRequestCompleted(self, fcpEvent, fcpRequest):
- item = self.fcpRequests.get(fcpRequest['Identifier'], None)
- if item is not None:
- progressBar = self.tree.itemWidget(item, self.HeaderIndexProgress)
- progressBar.setValue(progressBar.maximum())
-
- def onFcpRequestFailed(self, fcpEvent, fcpRequest):
- pass
-
-
- #TODO: not tested
- def onFcpRequestModified(self, fcpEvent, fcpRequest):
- if fcp2.ConstRequestModified.Identifier in fcpRequest['Modified']:
- newFcpIdentifier = fcpRequest['Identifier']
- oldFcpIdentifier = fcpRequest['Modified'][fcp2.ConstRequestModified.Identifier]
- item = self.fcpRequests.get(oldFcpIdentifier, None)
- if item is not None:
- del self.fcpRequests[oldFcpIdentifier]
- self.fcpRequests[newFcpIdentifier] = item
- item.fcpIdentifier = newFcpIdentifier
-
- if fcp2.ConstRequestModified.Filename in fcpRequest['Modified']:
- item = self.fcpRequests.get(fcpRequest['Identifier'], None)
- if item is not None:
- item.setData(
- self.HeaderIndexName,
- QtCore.Qt.DisplayRole,
- QtCore.QVariant(os.path.basename(fcpRequest['Filename']))
- )
-
-
- def onFcpRequestProgress(self, fcpEvent, fcpRequest):
- item = self.fcpRequests.get(fcpRequest['Identifier'], None)
- if item is not None:
- progressBar = self.tree.itemWidget(item, self.HeaderIndexProgress)
-
- progressBar.setRange(0, fcpRequest['ProgressRequired'])
- progressBar.setValue(fcpRequest['ProgressSucceeded'])
-
-
- def onFcpRequestStarted(self, fcpEvent, fcpRequest):
- pass
-
-
-#**********************************************************************************
-#
-#**********************************************************************************
-if __name__ == '__main__':
- import sys
- from . import View
- from . import ViewConnection
- from . import Ui_ViewLogger
- from . import MainWindow
-
- app = QtGui.QApplication(sys.argv)
-
- mainWindow = Ui_MainWindow.MainWindow()
- viewWidget = Ui_View.ViewWidget(mainWindow)
- mainWindow.setCentralWidget(viewWidget)
-
-
- viewWidget.addTopViews(
- Ui_ViewConnection.ViewConnectionWidget(None),
- ViewDownloadsWidget(None),
- )
- viewWidget.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
-
- mainWindow.show()
- res = app.exec_()
- sys.exit(res)
\ No newline at end of file
Modified: trunk/fclient/src/fclient/impl/ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/impl/ViewBrowser.py 2008-07-27 11:34:40 UTC (rev 770)
+++ trunk/fclient/src/fclient/impl/ViewBrowser.py 2008-07-27 11:36:07 UTC (rev 771)
@@ -978,7 +978,7 @@
from .MainWindow import MainWindow
from .View import ViewWidget
from .ViewConnection import ViewConnectionWidget
- from .Ui_ViewDownloads import ViewDownloadsWidget
+ from .ViewDownloads import ViewDownloadsWidget
app = QtGui.QApplication(sys.argv)
Added: trunk/fclient/src/fclient/impl/ViewDownloads.py
===================================================================
--- trunk/fclient/src/fclient/impl/ViewDownloads.py (rev 0)
+++ trunk/fclient/src/fclient/impl/ViewDownloads.py 2008-07-27 11:36:07 UTC (rev 771)
@@ -0,0 +1,276 @@
+""""""
+
+#**************************************************************************************************************
+#TODO:
+#
+# x. prtty tricky to get dls right when the node or client may disconnect unexpectedly
+# problem: dls that we send and that have not reached the node
+# problem: what to do when the user wants to quit and we still have dls to push to the node
+#
+# solution would require keeping track of all requests
+# a. keep identifiers of requests that reached the node (have to do it anyways)
+# b. keep track of requests ahead of sending them to the node (feels not too good doubeling downloads.dat.gz)
+#
+# best idea seems to be to ignore the problem
+# 1. wait till (if ever) freenet devels fdrop node keeping track of client requests
+#
+# 2. a box thrown to the user (x. do not show this message again) to inform him about pendings
+# should be enough. maybe along with a separate widget or some separate color code for pendings
+#
+# x. performance
+# start with a standard model and improve it over time. no need to set any hard
+# limits. the user will find out by himself how many dls his machine can handle.
+# have to be carefrul though when adding dls, like from a *.frdx to provide appropriate
+# warnings
+#**************************************************************************************************************
+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 os
+from PyQt4 import QtCore, QtGui
+
+from . import config
+from .lib import fcp2
+
+from .tpls.Ui_ViewDownloadsWidgetTpl import Ui_ViewDownloadsWidget
+#**********************************************************************************
+#
+#**********************************************************************************
+class DownloadsViewObject(config.ViewObject):
+
+ def __init__(self, parent):
+ config.ViewObject. __init__(self, parent)
+
+ self.name=parent.objectName()
+ self.displayName=self.trUtf8('Downloads')
+ self.icon=QtGui.QIcon()
+
+#**********************************************************************************
+#
+#**********************************************************************************
+# from: network/torrent/mainwindow.cpp
+# TorrentViewDelegate is used to draw the progress bars.
+class DownloadTreeDelegate(QtGui.QItemDelegate):
+
+ def __init__(self, parent):
+ QtGui.QItemDelegate.__init__(self, parent)
+
+ def paint(self, painter, option, index):
+ if index.column() != self.parent().HeaderIndexProgress:
+ return QtGui.QItemDelegate.paint(self, painter, option, index)
+
+ application = QtGui.QApplication.instance()
+ fcpRequest = self.parent().fcRequests.itemFromIndex(index.row()).fcpRequest
+ progress = fcpRequest['ProgressSucceeeded']
+ required = fcpRequest['ProgressRequired']
+
+ # Set up a QprogressbarOptionProgressBar to precisely mimic the
+ # environment of a progress bar.
+ progressBarOption = QtGui.QStyleOptionProgressBar()
+ progressBarOption.state = QtGui.QStyle.State_Enabled
+ progressBarOption.direction = application.layoutDirection()
+ progressBarOption.rect = option.rect
+ progressBarOption.fontMetrics = application.fontMetrics()
+ progressBarOption.minimum = 0
+ progressBarOption.maximum = fcpRequest['ProgressRequired']
+ progressBarOption.textAlignment = QtCore.Qt.AlignCenter
+ progressBarOption.textVisible = True
+
+ # Set the progress and text values of the style option.
+ progressBarOption.progress = progress
+ if required:
+ progressBarOption.text = '%s%%' % round(progress * 100 / required, 2)
+ else:
+ progressBarOption.text = '0%'
+
+ # Draw the progress bar onto the view.
+ application.style().drawControl(QtGui.QStyle.CE_ProgressBar, progressBarOption, painter)
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class TreeItem(QtGui.QTreeWidgetItem):
+
+ def __init__(self, fcpIdentifier, *params):
+ QtGui.QTreeWidgetItem.__init__(self, *params)
+ self.fcpIdentifier = fcpIdentifier
+
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class Requests(object):
+
+ def __init__(self):
+ self.identifiers = []
+ self.items = []
+
+ def addRequest(self, identifier, item):
+ self.identifiers.append(identifier)
+ self.items.append(item)
+
+ def itemFromIndex(self, index):
+ return self.items[index]
+
+
+class ViewDownloadsWidget(QtGui.QWidget, Ui_ViewDownloadsWidget):
+
+ IdTree = 'tree'
+
+
+ HeaderIndexName = 0
+ HeaderIndexFoo = 1
+ HeaderIndexProgress = 2
+
+ def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
+ QtGui.QWidget.__init__(self, parent)
+ self._isCreated = False
+
+ self.setupUi(self)
+ config.ObjectRegistry.register(self)
+
+ self.fcViewObject = DownloadsViewObject(self)
+ self.fcpEvents = (
+ (config.fcpClient.events.ConfigData, self.onFcpConfigData),
+ (config.fcpClient.events.RequestCompleted, self.onFcpRequestCompleted),
+ (config.fcpClient.events.RequestFailed, self.onFcpRequestFailed),
+ (config.fcpClient.events.RequestModified, self.onFcpRequestModified),
+ (config.fcpClient.events.RequestProgress, self.onFcpRequestProgress),
+ (config.fcpClient.events.RequestStarted, self.onFcpRequestStarted),
+ )
+ config.fcpClient.events += self.fcpEvents
+ self.fcHeadeLabels = {}
+ self.fcpRequests = {}
+
+ #XXX
+ self.foo = False
+
+
+ def retranslateUi(self, parent):
+ self.fcHeadeLabels = {
+ self.HeaderIndexName: self.trUtf8('Name'),
+ self.HeaderIndexFoo: self.trUtf8('Foo'),
+ self.HeaderIndexProgress: self.trUtf8('Progress'),
+ }
+ self.tree.setHeaderLabels([i[1] for i in sorted(self.fcHeadeLabels.items())])
+
+
+ def closeEvent(self):
+ self.viewClose()
+
+
+ def viewClose(self):
+ config.fcpClient.events -= self.fcpEvents
+
+
+ def downloadFile(self, fcpKey, fileName, **kws):
+ """"""
+ fileName = unicode(fileName)
+ fcpIdentifier = config.fcpClient.getFile(fcpKey, fileName, **kws)
+ item= TreeItem(fcpIdentifier, self.tree)
+
+ item.setData(
+ self.HeaderIndexName,
+ QtCore.Qt.DisplayRole,
+ QtCore.QVariant(os.path.basename(fileName))
+ )
+
+ progressBar = QtGui.QProgressBar(self)
+ progressBar.setRange(0, 0)
+ self.tree.setItemWidget(item, self.HeaderIndexProgress, progressBar)
+ self.fcpRequests[fcpIdentifier] = item
+
+
+ #########################################
+ ## methods
+ #########################################
+ def controlById(idGlobalFeedback, idControl):
+ return getattr(idGlobalFeedback, idControl)
+
+ #########################################
+ ## fcp event handlers
+ #########################################
+ def onFcpConfigData(self, fcpEvent, fcpRequest):
+ if not self.foo:
+ self.foo = True
+
+ return
+ # for testing: dl some frost.zip
+ key = fcp2.Key('CHK@tJ0qyIr8dwvYKoSkmR1N-soABstL0RjgiYqQm3Gtv8g,Pqj7jpPUBzRgnVTaA3fEw6gE8QHcJsTwA4liL9FZ-Fg,AAIC--8/frost-04-Mar-2008.zip')
+ fileName = config.guessFileNameFromKey(key, default=self.trUtf8('Unknown.file'))
+ directory = config.settings.value('DownloadDir')
+ fpath = os.path.join(unicode(directory), unicode(fileName))
+ self.downloadFile(key, fpath)
+
+
+ def onFcpRequestCompleted(self, fcpEvent, fcpRequest):
+ item = self.fcpRequests.get(fcpRequest['Identifier'], None)
+ if item is not None:
+ progressBar = self.tree.itemWidget(item, self.HeaderIndexProgress)
+ progressBar.setValue(progressBar.maximum())
+
+ def onFcpRequestFailed(self, fcpEvent, fcpRequest):
+ pass
+
+
+ #TODO: not tested
+ def onFcpRequestModified(self, fcpEvent, fcpRequest):
+ if fcp2.ConstRequestModified.Identifier in fcpRequest['Modified']:
+ newFcpIdentifier = fcpRequest['Identifier']
+ oldFcpIdentifier = fcpRequest['Modified'][fcp2.ConstRequestModified.Identifier]
+ item = self.fcpRequests.get(oldFcpIdentifier, None)
+ if item is not None:
+ del self.fcpRequests[oldFcpIdentifier]
+ self.fcpRequests[newFcpIdentifier] = item
+ item.fcpIdentifier = newFcpIdentifier
+
+ if fcp2.ConstRequestModified.Filename in fcpRequest['Modified']:
+ item = self.fcpRequests.get(fcpRequest['Identifier'], None)
+ if item is not None:
+ item.setData(
+ self.HeaderIndexName,
+ QtCore.Qt.DisplayRole,
+ QtCore.QVariant(os.path.basename(fcpRequest['Filename']))
+ )
+
+
+ def onFcpRequestProgress(self, fcpEvent, fcpRequest):
+ item = self.fcpRequests.get(fcpRequest['Identifier'], None)
+ if item is not None:
+ progressBar = self.tree.itemWidget(item, self.HeaderIndexProgress)
+
+ progressBar.setRange(0, fcpRequest['ProgressRequired'])
+ progressBar.setValue(fcpRequest['ProgressSucceeded'])
+
+
+ def onFcpRequestStarted(self, fcpEvent, fcpRequest):
+ pass
+
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+ from . import View
+ from . import ViewConnection
+ from . import Ui_ViewLogger
+ from . import MainWindow
+
+ app = QtGui.QApplication(sys.argv)
+
+ mainWindow = Ui_MainWindow.MainWindow()
+ viewWidget = Ui_View.ViewWidget(mainWindow)
+ mainWindow.setCentralWidget(viewWidget)
+
+
+ viewWidget.addTopViews(
+ Ui_ViewConnection.ViewConnectionWidget(None),
+ ViewDownloadsWidget(None),
+ )
+ viewWidget.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
+
+ mainWindow.show()
+ res = app.exec_()
+ sys.exit(res)
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-27 11:37:49
|
Revision: 772
http://fclient.svn.sourceforge.net/fclient/?rev=772&view=rev
Author: jUrner
Date: 2008-07-27 11:37:58 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
naming
Modified Paths:
--------------
trunk/fclient/src/fclient/fclient.py
trunk/fclient/src/fclient/impl/ViewConnection.py
trunk/fclient/src/fclient/impl/ViewDownloads.py
Added Paths:
-----------
trunk/fclient/src/fclient/impl/ViewLogger.py
Removed Paths:
-------------
trunk/fclient/src/fclient/impl/Ui_ViewLogger.py
Modified: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py 2008-07-27 11:36:07 UTC (rev 771)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-27 11:37:58 UTC (rev 772)
@@ -11,7 +11,7 @@
from .impl.ViewBrowser import ViewBrowserWidget
from .impl.ViewConnection import ViewConnectionWidget
from .impl.ViewDownloads import ViewDownloadsWidget
-from .impl.Ui_ViewLogger import ViewLoggerWidget
+from .impl.ViewLogger import ViewLoggerWidget
#*************************************************************
#
#*************************************************************
Deleted: trunk/fclient/src/fclient/impl/Ui_ViewLogger.py
===================================================================
--- trunk/fclient/src/fclient/impl/Ui_ViewLogger.py 2008-07-27 11:36:07 UTC (rev 771)
+++ trunk/fclient/src/fclient/impl/Ui_ViewLogger.py 2008-07-27 11:37:58 UTC (rev 772)
@@ -1,276 +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
-import logging
-
-from PyQt4 import QtCore, QtGui
-
-from . import config
-from .lib import fcp2
-
-from .tpls.Ui_ViewLoggerWidgetTpl import Ui_ViewLoggerWidget
-#**********************************************************************************
-#
-#**********************************************************************************
-class Actions(config.ActionsBase):
-
- PrefixVerbosity = 'ActionVerbosity'
-
- def __init__(self, parent):
- config.ActionsBase.__init__(self, parent)
-
- # for ease of use verbosities are mapped to verbosity actions like this: PrefixVerbosity + Verbosity
- self.action(
- name='ActionLoggerClear',
- text=self.trUtf8('C&lear'),
- trigger=parent.onActionLoggerClear,
- )
-
- groupVerbosity = self.group(
- name='GroupVerbosity',
- trigger=parent.onGroupVerbosityTriggered,
- isExclusive=True,
- )
- self.action(
- name='ActionVerbosityInfo',
- text=self.trUtf8('Info'),
- group=groupVerbosity,
- trigger=None,
- isCheckable=True,
- userData=fcp2.ConstDebugVerbosity.Info,
- )
- self.action(
- name='ActionVerbosityMessage',
- text=self.trUtf8('Message'),
- group=groupVerbosity,
- trigger=None,
- isCheckable=True,
- userData=fcp2.ConstDebugVerbosity.Message,
- )
- self.action(
- name='ActionVerbosityDebug',
- text=self.trUtf8('Debug'),
- group=groupVerbosity,
- trigger=None,
- isCheckable=True,
- userData=fcp2.ConstDebugVerbosity.Debug,
- )
- self.action(
- name='ActionVerbosityChatty',
- text=self.trUtf8('Chatty'),
- group=groupVerbosity,
- trigger=None,
- isCheckable=True,
- userData=fcp2.ConstDebugVerbosity.Chatty,
- )
-
-
-class GlobalFeedback(config.GlobalFeedbackBase):
- """wrapper for global statusbar widgets, menus"""
-
- def __init__(self, parent, idGlobalFeedback):
- config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback)
-
- # menus
- self.menus = []
- if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
- menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
- parent.populateMenu(menu)
- self.menus.append(menu)
- self.menuBar.addViewMenu(menu)
-
- # status bar widgets
- self.label1 = None
- #if self.statusBar is not None:
- # self.label1 = QtGui.QLabel('foo here', self.statusBar)
-
- def setVisible(self, flag):
- for menu in self.menus:
- menu.children()[0].setVisible(flag)
- if self.label1 is not None:
- self.label1.setVisible(flag)
-
-
-class Settings(config.SettingsBase):
-
- PrefixVerbosityColorFg = 'ColorFgVerbosity'
-
- _key_ = config.IdViewLoggerWidget
- _settings_ = (
- ('MaxLines', 'UInt', 1000, config.SettingScopeUser),
- ('Verbosity', 'PyString', 'Info', config.SettingScopePrivate),
-
- #TODO: Chatty does not seem to work. check in fcp2.client
- ('ColorFgVerbosityCRITICAL', 'QColor', QtGui.QColor('red'), config.SettingScopeUser),
- ('ColorFgVerbosityERROR', 'QColor', QtGui.QColor('red'), config.SettingScopeUser),
- ('ColorFgVerbosityWARNING', 'QColor', QtGui.QColor('red'), config.SettingScopeUser),
- ('ColorFgVerbosityINFO', 'QColor', QtGui.QColor('black'), config.SettingScopeUser),
- ('ColorFgVerbosityMESSAGE', 'QColor', QtGui.QColor('blue'), config.SettingScopeUser),
- ('ColorFgVerbosityDEBUG', 'QColor', QtGui.QColor('slategray'), config.SettingScopeUser),
- ('ColorFgVerbosityCHATTY', 'QColor', QtGui.QColor('lightslategray'), config.SettingScopeUser),
- )
-
-
-class LoggerViewObject(config.ViewObject):
-
- def __init__(self, parent):
- config.ViewObject. __init__(self, parent)
-
- self.name=parent.objectName()
- self.displayName=self.trUtf8('Logger')
- self.icon=QtGui.QIcon()
-
-
-#***********************************************************************
-#
-#***********************************************************************
-class MyLoggingHandler(logging.Handler):
-
- def __init__(self, cb, *args, **kwargs):
- logging.Handler.__init__(self, *args, **kwargs)
- self.cb = cb
-
- def emit(self, record):
- self.cb(record)
-
-#***********************************************************************
-#
-#***********************************************************************
-class ViewLoggerWidget(QtGui.QWidget, Ui_ViewLoggerWidget):
-
- IdEdLogger = 'edLogger'
-
-
- def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
- QtGui.QWidget.__init__(self, parent)
- self._isCreated = False
- self._mainWindowMenus = {} #TODO: wrap along with toolbars to a handy class MainWindowStuff
-
- self.setupUi(self)
- config.ObjectRegistry.register(self)
-
- self.fcActions = Actions(self)
- self.fcSettings = Settings(self).restore()
- self.fcViewObject = LoggerViewObject(self)
- self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback)
-
-
- # setup editbox
- #NOTE: do not move to showEvent(). we want to be up and alive as soon as possible to catch logs
- ed = self.controlById(self.IdEdLogger)
- ed.document().setMaximumBlockCount(self.fcSettings.value('MaxLines'))
- ed.contextMenuEvent = self.loggerContextMenuEvent
- self.connect(ed, QtCore.SIGNAL('textChanged()'), self.onLoggerTextChanged)
-
- # setup logger
- self.loggingHandler = MyLoggingHandler(self.addRecord)
- logging.getLogger('').addHandler(self.loggingHandler)
-
- # setup actions
- verbosity = self.fcSettings.value('Verbosity').title()
- action = self.fcActions.get(self.fcActions.PrefixVerbosity + verbosity, None)
- if action is None:
- verbosity = self.fcSettings.restoreDefaults('Verbosity')['Verbosity']
- action = self.fcActions.get(self.fcActions.PrefixVerbosity + verbosity, None)
- if action is None:
- raise ValueError('default verbosity action "%s" not found. WTF?' % self.actions.PrefixVerbosity + verbosity)
- action.trigger()
-
- #########################################
- ## methods
- #########################################
- def addRecord(self, record):
- """adds a logging record"""
-
- ed = self.controlById(self.IdEdLogger)
- fmt = ed.currentCharFormat()
- colorFg = self.fcSettings.value(self.fcSettings.PrefixVerbosityColorFg + record.levelname)
- fmt.setForeground(QtGui.QBrush(colorFg))
- ed.setCurrentCharFormat(fmt)
-
- text = '%s:%s:%s' % (record.levelname, record.name, record.getMessage())
- ed.appendPlainText(text)
-
-
- def controlById(self, idControl):
- return getattr(self, idControl)
-
-
- def populateMenu(self, menu):
- menu.addAction(self.fcActions['ActionLoggerClear'])
- subMenu = menu.addMenu(self.trUtf8('Verbosity'))
- subMenu.addActions(self.fcActions['GroupVerbosity'].actions())
- return menu
-
- #########################################
- ##view methods
- #########################################
- def viewClose(self):
- pass
-
- def viewDisplayName(self):
- return self.trUtf8('Logger')
-
- def viewIcon(self):
- return QtGui.QIcon()
-
- def viewName(self):
- return self.objectName()
-
- #########################################
- ## overwritten events
- #########################################
- def loggerContextMenuEvent(self, event):
- """customize context menu of the logger QTextEdit"""
- ed = self.controlById(self.IdEdLogger)
- menu = ed.createStandardContextMenu()
- self.populateMenu(menu)
- menu.exec_(event.globalPos())
-
-
- def hideEvent(self, event):
- self.fcGlobalFeedback.setVisible(False)
-
-
- def showEvent(self, event):
- self.fcGlobalFeedback.setVisible(True)
- if self._isCreated:
- return
- self._isCreated = True
-
- #########################################
- ## event onrs
- #########################################
- def onActionLoggerClear(self, action):
- self.controlById(self.IdEdLogger).clear()
-
-
- def onGroupVerbosityTriggered(self, action):
- nameVerbosity = action.objectName()[len(self.fcActions.PrefixVerbosity):]
- self.fcSettings.setValues(Verbosity=nameVerbosity)
- logging.getLogger().setLevel(action.userData())
-
-
- def onLoggerTextChanged(self):
- ed = self.controlById(self.IdEdLogger)
- self.fcActions['ActionLoggerClear'].setEnabled(not ed.document().isEmpty())
-
-#**********************************************************************************
-#
-#**********************************************************************************
-if __name__ == '__main__':
- import sys
- from . import Ui_ViewLogger
-
- app = QtGui.QApplication(sys.argv)
- w = ViewLoggerWidget(None)
-
- w.show()
- res = app.exec_()
- sys.exit(res)
-
-
-
Modified: trunk/fclient/src/fclient/impl/ViewConnection.py
===================================================================
--- trunk/fclient/src/fclient/impl/ViewConnection.py 2008-07-27 11:36:07 UTC (rev 771)
+++ trunk/fclient/src/fclient/impl/ViewConnection.py 2008-07-27 11:37:58 UTC (rev 772)
@@ -295,7 +295,7 @@
#**********************************************************************************
if __name__ == '__main__':
import sys
- from . import View, Ui_ViewLogger
+ from . import View, ViewLogger
app = QtGui.QApplication(sys.argv)
w = Ui_View.ViewWidget(None)
Modified: trunk/fclient/src/fclient/impl/ViewDownloads.py
===================================================================
--- trunk/fclient/src/fclient/impl/ViewDownloads.py 2008-07-27 11:36:07 UTC (rev 771)
+++ trunk/fclient/src/fclient/impl/ViewDownloads.py 2008-07-27 11:37:58 UTC (rev 772)
@@ -255,7 +255,7 @@
import sys
from . import View
from . import ViewConnection
- from . import Ui_ViewLogger
+ from . import ViewLogger
from . import MainWindow
app = QtGui.QApplication(sys.argv)
@@ -269,7 +269,7 @@
Ui_ViewConnection.ViewConnectionWidget(None),
ViewDownloadsWidget(None),
)
- viewWidget.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
+ viewWidget.addBottomViews(ViewLogger.ViewLoggerWidget(None))
mainWindow.show()
res = app.exec_()
Added: trunk/fclient/src/fclient/impl/ViewLogger.py
===================================================================
--- trunk/fclient/src/fclient/impl/ViewLogger.py (rev 0)
+++ trunk/fclient/src/fclient/impl/ViewLogger.py 2008-07-27 11:37:58 UTC (rev 772)
@@ -0,0 +1,276 @@
+
+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
+import logging
+
+from PyQt4 import QtCore, QtGui
+
+from . import config
+from .lib import fcp2
+
+from .tpls.Ui_ViewLoggerWidgetTpl import Ui_ViewLoggerWidget
+#**********************************************************************************
+#
+#**********************************************************************************
+class Actions(config.ActionsBase):
+
+ PrefixVerbosity = 'ActionVerbosity'
+
+ def __init__(self, parent):
+ config.ActionsBase.__init__(self, parent)
+
+ # for ease of use verbosities are mapped to verbosity actions like this: PrefixVerbosity + Verbosity
+ self.action(
+ name='ActionLoggerClear',
+ text=self.trUtf8('C&lear'),
+ trigger=parent.onActionLoggerClear,
+ )
+
+ groupVerbosity = self.group(
+ name='GroupVerbosity',
+ trigger=parent.onGroupVerbosityTriggered,
+ isExclusive=True,
+ )
+ self.action(
+ name='ActionVerbosityInfo',
+ text=self.trUtf8('Info'),
+ group=groupVerbosity,
+ trigger=None,
+ isCheckable=True,
+ userData=fcp2.ConstDebugVerbosity.Info,
+ )
+ self.action(
+ name='ActionVerbosityMessage',
+ text=self.trUtf8('Message'),
+ group=groupVerbosity,
+ trigger=None,
+ isCheckable=True,
+ userData=fcp2.ConstDebugVerbosity.Message,
+ )
+ self.action(
+ name='ActionVerbosityDebug',
+ text=self.trUtf8('Debug'),
+ group=groupVerbosity,
+ trigger=None,
+ isCheckable=True,
+ userData=fcp2.ConstDebugVerbosity.Debug,
+ )
+ self.action(
+ name='ActionVerbosityChatty',
+ text=self.trUtf8('Chatty'),
+ group=groupVerbosity,
+ trigger=None,
+ isCheckable=True,
+ userData=fcp2.ConstDebugVerbosity.Chatty,
+ )
+
+
+class GlobalFeedback(config.GlobalFeedbackBase):
+ """wrapper for global statusbar widgets, menus"""
+
+ def __init__(self, parent, idGlobalFeedback):
+ config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback)
+
+ # menus
+ self.menus = []
+ if self.menuBar is not None and hasattr(parent, 'fcViewObject'):
+ menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar)
+ parent.populateMenu(menu)
+ self.menus.append(menu)
+ self.menuBar.addViewMenu(menu)
+
+ # status bar widgets
+ self.label1 = None
+ #if self.statusBar is not None:
+ # self.label1 = QtGui.QLabel('foo here', self.statusBar)
+
+ def setVisible(self, flag):
+ for menu in self.menus:
+ menu.children()[0].setVisible(flag)
+ if self.label1 is not None:
+ self.label1.setVisible(flag)
+
+
+class Settings(config.SettingsBase):
+
+ PrefixVerbosityColorFg = 'ColorFgVerbosity'
+
+ _key_ = config.IdViewLoggerWidget
+ _settings_ = (
+ ('MaxLines', 'UInt', 1000, config.SettingScopeUser),
+ ('Verbosity', 'PyString', 'Info', config.SettingScopePrivate),
+
+ #TODO: Chatty does not seem to work. check in fcp2.client
+ ('ColorFgVerbosityCRITICAL', 'QColor', QtGui.QColor('red'), config.SettingScopeUser),
+ ('ColorFgVerbosityERROR', 'QColor', QtGui.QColor('red'), config.SettingScopeUser),
+ ('ColorFgVerbosityWARNING', 'QColor', QtGui.QColor('red'), config.SettingScopeUser),
+ ('ColorFgVerbosityINFO', 'QColor', QtGui.QColor('black'), config.SettingScopeUser),
+ ('ColorFgVerbosityMESSAGE', 'QColor', QtGui.QColor('blue'), config.SettingScopeUser),
+ ('ColorFgVerbosityDEBUG', 'QColor', QtGui.QColor('slategray'), config.SettingScopeUser),
+ ('ColorFgVerbosityCHATTY', 'QColor', QtGui.QColor('lightslategray'), config.SettingScopeUser),
+ )
+
+
+class LoggerViewObject(config.ViewObject):
+
+ def __init__(self, parent):
+ config.ViewObject. __init__(self, parent)
+
+ self.name=parent.objectName()
+ self.displayName=self.trUtf8('Logger')
+ self.icon=QtGui.QIcon()
+
+
+#***********************************************************************
+#
+#***********************************************************************
+class MyLoggingHandler(logging.Handler):
+
+ def __init__(self, cb, *args, **kwargs):
+ logging.Handler.__init__(self, *args, **kwargs)
+ self.cb = cb
+
+ def emit(self, record):
+ self.cb(record)
+
+#***********************************************************************
+#
+#***********************************************************************
+class ViewLoggerWidget(QtGui.QWidget, Ui_ViewLoggerWidget):
+
+ IdEdLogger = 'edLogger'
+
+
+ def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
+ QtGui.QWidget.__init__(self, parent)
+ self._isCreated = False
+ self._mainWindowMenus = {} #TODO: wrap along with toolbars to a handy class MainWindowStuff
+
+ self.setupUi(self)
+ config.ObjectRegistry.register(self)
+
+ self.fcActions = Actions(self)
+ self.fcSettings = Settings(self).restore()
+ self.fcViewObject = LoggerViewObject(self)
+ self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback)
+
+
+ # setup editbox
+ #NOTE: do not move to showEvent(). we want to be up and alive as soon as possible to catch logs
+ ed = self.controlById(self.IdEdLogger)
+ ed.document().setMaximumBlockCount(self.fcSettings.value('MaxLines'))
+ ed.contextMenuEvent = self.loggerContextMenuEvent
+ self.connect(ed, QtCore.SIGNAL('textChanged()'), self.onLoggerTextChanged)
+
+ # setup logger
+ self.loggingHandler = MyLoggingHandler(self.addRecord)
+ logging.getLogger('').addHandler(self.loggingHandler)
+
+ # setup actions
+ verbosity = self.fcSettings.value('Verbosity').title()
+ action = self.fcActions.get(self.fcActions.PrefixVerbosity + verbosity, None)
+ if action is None:
+ verbosity = self.fcSettings.restoreDefaults('Verbosity')['Verbosity']
+ action = self.fcActions.get(self.fcActions.PrefixVerbosity + verbosity, None)
+ if action is None:
+ raise ValueError('default verbosity action "%s" not found. WTF?' % self.actions.PrefixVerbosity + verbosity)
+ action.trigger()
+
+ #########################################
+ ## methods
+ #########################################
+ def addRecord(self, record):
+ """adds a logging record"""
+
+ ed = self.controlById(self.IdEdLogger)
+ fmt = ed.currentCharFormat()
+ colorFg = self.fcSettings.value(self.fcSettings.PrefixVerbosityColorFg + record.levelname)
+ fmt.setForeground(QtGui.QBrush(colorFg))
+ ed.setCurrentCharFormat(fmt)
+
+ text = '%s:%s:%s' % (record.levelname, record.name, record.getMessage())
+ ed.appendPlainText(text)
+
+
+ def controlById(self, idControl):
+ return getattr(self, idControl)
+
+
+ def populateMenu(self, menu):
+ menu.addAction(self.fcActions['ActionLoggerClear'])
+ subMenu = menu.addMenu(self.trUtf8('Verbosity'))
+ subMenu.addActions(self.fcActions['GroupVerbosity'].actions())
+ return menu
+
+ #########################################
+ ##view methods
+ #########################################
+ def viewClose(self):
+ pass
+
+ def viewDisplayName(self):
+ return self.trUtf8('Logger')
+
+ def viewIcon(self):
+ return QtGui.QIcon()
+
+ def viewName(self):
+ return self.objectName()
+
+ #########################################
+ ## overwritten events
+ #########################################
+ def loggerContextMenuEvent(self, event):
+ """customize context menu of the logger QTextEdit"""
+ ed = self.controlById(self.IdEdLogger)
+ menu = ed.createStandardContextMenu()
+ self.populateMenu(menu)
+ menu.exec_(event.globalPos())
+
+
+ def hideEvent(self, event):
+ self.fcGlobalFeedback.setVisible(False)
+
+
+ def showEvent(self, event):
+ self.fcGlobalFeedback.setVisible(True)
+ if self._isCreated:
+ return
+ self._isCreated = True
+
+ #########################################
+ ## event onrs
+ #########################################
+ def onActionLoggerClear(self, action):
+ self.controlById(self.IdEdLogger).clear()
+
+
+ def onGroupVerbosityTriggered(self, action):
+ nameVerbosity = action.objectName()[len(self.fcActions.PrefixVerbosity):]
+ self.fcSettings.setValues(Verbosity=nameVerbosity)
+ logging.getLogger().setLevel(action.userData())
+
+
+ def onLoggerTextChanged(self):
+ ed = self.controlById(self.IdEdLogger)
+ self.fcActions['ActionLoggerClear'].setEnabled(not ed.document().isEmpty())
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+ from . import Ui_ViewLogger
+
+ app = QtGui.QApplication(sys.argv)
+ w = ViewLoggerWidget(None)
+
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-27 12:02:33
|
Revision: 780
http://fclient.svn.sourceforge.net/fclient/?rev=780&view=rev
Author: jUrner
Date: 2008-07-27 12:02:42 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
new package structure
Modified Paths:
--------------
trunk/fclient/src/fclient/impl/config.py
Added Paths:
-----------
trunk/fclient/src/fclient/doc/
trunk/fclient/src/fclient/downloads/
trunk/fclient/src/fclient/settings/
Modified: trunk/fclient/src/fclient/impl/config.py
===================================================================
--- trunk/fclient/src/fclient/impl/config.py 2008-07-27 11:51:54 UTC (rev 779)
+++ trunk/fclient/src/fclient/impl/config.py 2008-07-27 12:02:42 UTC (rev 780)
@@ -22,14 +22,15 @@
FclientHomepage = 'http://fclient.sourceforge.net/'
FclientConnectionName = QtCore.QString(FclientAppName + ':{08625b10-2b44-4689-b1bf-8baf208b9641}')
-_ = os.path.dirname(os.path.abspath(__file__))
-FclientDir = QtCore.QString(_)
-FclientDocDir = QtCore.QString(os.path.join(_, 'doc'))
-FclientDownloadDir = QtCore.QString(os.path.join(_, 'downloads'))
-FclientResDir = QtCore.QString(os.path.join(_, 'res'))
-FclientSettingsDir = QtCore.QString(os.path.join(_, 'settings'))
-del _
-
+_implDir = os.path.dirname(os.path.abspath(__file__))
+_fclientDir = os.path.dirname(_implDir)
+FclientImplDir = QtCore.QString(_implDir)
+FclientDir = QtCore.QString(_fclientDir)
+FclientDocDir = QtCore.QString(os.path.join(_fclientDir, 'doc'))
+FclientDownloadDir = QtCore.QString(os.path.join(_fclientDir, 'downloads'))
+FclientResDir = QtCore.QString(os.path.join(_implDir, 'res'))
+FclientSettingsDir = QtCore.QString(os.path.join(_fclientDir, 'settings'))
+del _implDir, _fclientDir
#**********************************************************************************
# looks like QObject.findChild() does not always work. docs mention troubles
# with MSVC 6 where you should use qFindChild(). can not test this. so keep
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-30 10:49:35
|
Revision: 819
http://fclient.svn.sourceforge.net/fclient/?rev=819&view=rev
Author: jUrner
Date: 2008-07-30 10:49:43 +0000 (Wed, 30 Jul 2008)
Log Message:
-----------
add single application ckeck on startup ++ error dlg ++ prefs page
Modified Paths:
--------------
trunk/fclient/src/fclient/fclient.py
trunk/fclient/src/fclient/impl/Prefs.py
trunk/fclient/src/fclient/impl/config.py
Added Paths:
-----------
trunk/fclient/src/fclient/impl/DlgSingleAppError.py
trunk/fclient/src/fclient/impl/PrefsSingleApp.py
trunk/fclient/src/fclient/impl/tpls/DlgSingleAppErrorTpl.ui
trunk/fclient/src/fclient/impl/tpls/PrefsSingleAppTpl.ui
trunk/fclient/src/fclient/impl/tpls/Ui_DlgSingleAppErrorTpl.py
trunk/fclient/src/fclient/impl/tpls/Ui_PrefsSingleAppTpl.py
Modified: trunk/fclient/src/fclient/fclient.py
===================================================================
--- trunk/fclient/src/fclient/fclient.py 2008-07-30 10:47:21 UTC (rev 818)
+++ trunk/fclient/src/fclient/fclient.py 2008-07-30 10:49:43 UTC (rev 819)
@@ -6,33 +6,67 @@
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():
- app = QtGui.QApplication(sys.argv)
- mainWindow = 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)
+ 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:
+ 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)
#**********************************************************************************
#
Added: trunk/fclient/src/fclient/impl/DlgSingleAppError.py
===================================================================
--- trunk/fclient/src/fclient/impl/DlgSingleAppError.py (rev 0)
+++ trunk/fclient/src/fclient/impl/DlgSingleAppError.py 2008-07-30 10:49:43 UTC (rev 819)
@@ -0,0 +1,133 @@
+#***************************************************************************************
+#TODO:
+# x. error icon
+#
+#*************************************************************************************
+
+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 os
+from PyQt4 import QtCore, QtGui
+
+from . import config
+from .lib import fcp2
+
+from .tpls.Ui_DlgSingleAppErrorTpl import Ui_DlgSingleAppError
+#**********************************************************************************
+#
+#**********************************************************************************
+class Settings(config.SettingsBase):
+ _key_ = 'DlgSingleAppError'
+ _settings_ = (
+ ('Geometry', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate),
+ ('SplitterPos', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate),
+ )
+
+
+#**********************************************************************************
+#
+#**********************************************************************************
+class DlgSingleAppError(QtGui.QDialog, Ui_DlgSingleAppError):
+
+ IdTextEdit = 'textEdit'
+ IdEdHost = 'edHost'
+ IdSpinPort = 'spinPort'
+ IdSplitter = 'splitter'
+
+
+ def __init__(self, parent=None, fcpKey=None):
+ QtGui.QDialog.__init__(self, parent)
+
+ self.setupUi(self)
+ self.fcSettings = Settings(self).restore()
+
+ # setup dialog
+ self.restoreGeometry(self.fcSettings.value('Geometry'))
+ self.setWindowTitle(config.FcAppName + self.trUtf8(' - Error starting up'))
+
+
+ # setup host / port
+ edHost = self.controlById(self.IdEdHost)
+ edHost.setText(config.fcSettings.value('SingleAppHost'))
+
+ spinPort = self.controlById(self.IdSpinPort)
+ spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable
+ spinPort.setValue(config.fcSettings.value('SingleAppPort'))
+
+
+ # setup text edit
+ ed = self.controlById(self.IdTextEdit)
+ text = self.trUtf8('<b>%1 could not be started!</b>').arg(config.FcAppName)
+ ed.insertHtml(text)
+ ed.insertHtml('<br><br>')
+ text = self.trUtf8('%1 could not establish a socket connection needed to enshure only one application is running at a time. Possible reasons are:').arg(config.FcAppName)
+ ed.insertHtml(text)
+
+ text = '''<ol>
+ <li>%s</li>
+ <li>%s</li>
+
+ </ol>
+ ''' % (
+ self.trUtf8('Your firewall blocks the connection. Adjust your firewall to allow the connection as shown to the left.'),
+ self.trUtf8('Another application may already use host and port as shown. Adjust host and port to your needs. In most cases setting port to an arbitrary (high) number should do the job.'),
+
+ )
+ ed.insertHtml(text)
+ cursor = ed.textCursor()
+ cursor.movePosition(cursor.Start, cursor.MoveAnchor)
+ ed.setTextCursor(cursor)
+
+ # setup splitter
+ splitter = self.controlById(self.IdSplitter)
+ splitter.restoreState(self.fcSettings.value('SplitterPos'))
+ self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved)
+
+ ##############################
+ ## methods
+ ##############################
+ def controlById(self, idControl):
+ return getattr(self, idControl)
+
+ ##############################
+ ## overwritten methods
+ ##############################
+ def accept(self):
+ edHost = self.controlById(self.IdEdHost)
+ spinPort = self.controlById(self.IdSpinPort)
+ config.fcSettings.setValues(
+ SingleAppHost=edHost.text(),
+ SingleAppPort=spinPort.value(),
+ )
+
+
+ self.done(self.Accepted)
+
+ ##############################
+ ## overwritten events
+ ##############################
+ def hideEvent(self, event):
+ self.fcSettings.setValues(Geometry=self.saveGeometry())
+
+ ##############################
+ ## event handlers
+ ##############################
+ def onSplitterMoved(self, pos, index):
+ splitter = self.controlById(self.IdSplitter)
+ self.fcSettings.setValues(SplitterPos=splitter.saveState())
+
+#**********************************************************************************
+#
+#**********************************************************************************
+if __name__ == '__main__':
+ import sys
+
+ app = QtGui.QApplication(sys.argv)
+ w = DlgSingleAppError()
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
+
Modified: trunk/fclient/src/fclient/impl/Prefs.py
===================================================================
--- trunk/fclient/src/fclient/impl/Prefs.py 2008-07-30 10:47:21 UTC (rev 818)
+++ trunk/fclient/src/fclient/impl/Prefs.py 2008-07-30 10:49:43 UTC (rev 819)
@@ -10,6 +10,7 @@
from .PrefsGlobal import PrefsPageGlobal
from .PrefsBrowserWidget import PrefsPageBrowser
from .PrefsConnectionWidget import PrefsPageConnectionExpertSettings
+from .PrefsSingleApp import PrefsPageSingleApp
#**********************************************************************************
#
#**********************************************************************************
@@ -55,7 +56,10 @@
pages = PrefsPageRoot()(
PrefsPageGlobal(),
- PrefsPageConnectionExpertSettings(),
+ PrefsPageConnectionExpertSettings()
+ (
+ PrefsPageSingleApp(),
+ ),
PrefsPageBrowser(),
)
Added: trunk/fclient/src/fclient/impl/PrefsSingleApp.py
===================================================================
--- trunk/fclient/src/fclient/impl/PrefsSingleApp.py (rev 0)
+++ trunk/fclient/src/fclient/impl/PrefsSingleApp.py 2008-07-30 10:49:43 UTC (rev 819)
@@ -0,0 +1,104 @@
+
+
+from __future__ import absolute_import
+if __name__ == '__main__': # see --> http://bugs.python.org/Fc1510172 . works only current dir and below
+ import os; __path__ = [os.path.dirname(__file__)]
+
+
+from PyQt4 import QtCore, QtGui
+
+from . import config
+from .lib.qt4ex import dlgpreferences
+from .lib.qt4ex.lib import settings
+
+from .tpls.Ui_PrefsSingleAppTpl import Ui_PrefsSingleApp
+#**********************************************************************************
+#
+#**********************************************************************************
+class PrefsSingleApp(QtGui.QWidget, Ui_PrefsSingleApp):
+
+ IdEdHost = 'edHost'
+ IdSpinPort = 'spinPort'
+
+ def __init__(self, parent=None, page=None):
+ QtGui.QWidget.__init__(self, parent)
+
+ self.setupUi(self)
+
+ self.fcSettingsControler = settings.SettingsControler(config.fcSettings, parent=self)
+ if page is not None:
+ page.connect(self.fcSettingsControler, QtCore.SIGNAL('isDirty(bool)'), page.setDirty)
+
+ self.fcSettingsControler.addLineEdit(
+ self.controlById(self.IdEdHost),
+ 'SingleAppHost',
+ )
+
+ spinPort = self.controlById(self.IdSpinPort)
+ spinPort.setRange(0, 0xFFFF) #TODO: no idea if port range (0, 0xFFFF) this is reasonable
+ self.fcSettingsControler.addSpinBox(
+ spinPort,
+ 'SingleAppPort',
+ )
+
+
+ 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
+
+#***********************************************************************
+#
+#***********************************************************************
+class PrefsPageSingleApp(dlgpreferences.Page):
+
+ UUID = '{9b76279c-46da-4fbe-9c02-a62fc843d6fc}'
+
+ def __init__(self):
+ dlgpreferences.Page.__init__(self, self.UUID)
+ self._widget = None
+
+ def displayName(self):
+ return self.trUtf8('Single application')
+
+ def canApply(self): return True
+ def canHelp(self): return False
+ def canRestoreDefaults(self): return True
+
+ def doApply(self):
+ self._widget.doApply()
+ return True
+
+ def doRestoreDefaults(self):
+ self._widget.doRestoreDefaults()
+ return True
+
+ def setVisible(self, parent, flag):
+ createdNew = False
+ if flag and self._widget is None:
+ createdNew = True
+ self._widget = PrefsSingleApp(parent=parent, page=self)
+ self._widget.setVisible(flag)
+ return (createdNew, self._widget)
+
+#***********************************************************************
+#
+#***********************************************************************
+if __name__ == '__main__':
+ from PyQt4 import QtGui
+ import sys
+
+ app = QtGui.QApplication(sys.argv)
+ w = PrefsSingleApp(None)
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
Modified: trunk/fclient/src/fclient/impl/config.py
===================================================================
--- trunk/fclient/src/fclient/impl/config.py 2008-07-30 10:47:21 UTC (rev 818)
+++ trunk/fclient/src/fclient/impl/config.py 2008-07-30 10:49:43 UTC (rev 819)
@@ -101,6 +101,9 @@
class Settings(SettingsBase):
_key_ = 'ConfigSettings'
_settings_ = (
+ ('SingleAppHost', 'String', QtCore.QString('localhost'), SettingScopeExpert),
+ ('SingleAppPort', 'UInt', 45663, SettingScopeExpert),
+
('SettingsDir', 'String', QtCore.QString(FcSettingsDir), SettingScopeUser), # if not None, settings are stored locally in the app folder
('SettingsAllUsers', 'Bool', False, SettingScopeUser), # store settings for all users?
('IconTheme', 'String', 'crystal', SettingScopeUser), #TODO: global icon theme?
Added: trunk/fclient/src/fclient/impl/tpls/DlgSingleAppErrorTpl.ui
===================================================================
--- trunk/fclient/src/fclient/impl/tpls/DlgSingleAppErrorTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/impl/tpls/DlgSingleAppErrorTpl.ui 2008-07-30 10:49:43 UTC (rev 819)
@@ -0,0 +1,125 @@
+<ui version="4.0" >
+ <class>DlgSingleAppError</class>
+ <widget class="QDialog" name="DlgSingleAppError" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>410</width>
+ <height>277</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <widget class="QSplitter" name="splitter" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <widget class="QTextEdit" name="textEdit" />
+ <widget class="QWidget" name="" >
+ <layout class="QVBoxLayout" name="verticalLayout_2" >
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string><b>Host: </b></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="edHost" />
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string><b>Port: </b></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinPort" />
+ </item>
+ </layout>
+ </item>
+ <item>
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="Line" name="line" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QDialogButtonBox" name="buttonBox" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="standardButtons" >
+ <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <zorder>textEdit</zorder>
+ <zorder>line</zorder>
+ <zorder>buttonBox</zorder>
+ <zorder>textEdit</zorder>
+ <zorder>textEdit</zorder>
+ <zorder>splitter</zorder>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>DlgSingleAppError</receiver>
+ <slot>accept()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>248</x>
+ <y>254</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>157</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>rejected()</signal>
+ <receiver>DlgSingleAppError</receiver>
+ <slot>reject()</slot>
+ <hints>
+ <hint type="sourcelabel" >
+ <x>316</x>
+ <y>260</y>
+ </hint>
+ <hint type="destinationlabel" >
+ <x>286</x>
+ <y>274</y>
+ </hint>
+ </hints>
+ </connection>
+ </connections>
+</ui>
Added: trunk/fclient/src/fclient/impl/tpls/PrefsSingleAppTpl.ui
===================================================================
--- trunk/fclient/src/fclient/impl/tpls/PrefsSingleAppTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/impl/tpls/PrefsSingleAppTpl.ui 2008-07-30 10:49:43 UTC (rev 819)
@@ -0,0 +1,86 @@
+<ui version="4.0" >
+ <class>PrefsSingleApp</class>
+ <widget class="QWidget" name="PrefsSingleApp" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>533</width>
+ <height>399</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>The gui uses a socket connection to enshure only one instance is running at a time. Use the boxes below to adjust host and port of the connection to your needs.</string>
+ </property>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
+ </property>
+ <property name="wordWrap" >
+ <bool>true</bool>
+ </property>
+ <property name="textInteractionFlags" >
+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <layout class="QVBoxLayout" name="verticalLayout" >
+ <item>
+ <widget class="QLabel" name="label_2" >
+ <property name="text" >
+ <string><b>Single application host: </b></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="edHost" />
+ </item>
+ <item>
+ <widget class="QLabel" name="label_3" >
+ <property name="text" >
+ <string><b>Single application port: </b></string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QSpinBox" name="spinPort" />
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="1" >
+ <spacer name="horizontalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>251</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item row="2" column="0" >
+ <spacer name="verticalSpacer" >
+ <property name="orientation" >
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0" >
+ <size>
+ <width>20</width>
+ <height>218</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Added: trunk/fclient/src/fclient/impl/tpls/Ui_DlgSingleAppErrorTpl.py
===================================================================
--- trunk/fclient/src/fclient/impl/tpls/Ui_DlgSingleAppErrorTpl.py (rev 0)
+++ trunk/fclient/src/fclient/impl/tpls/Ui_DlgSingleAppErrorTpl.py 2008-07-30 10:49:43 UTC (rev 819)
@@ -0,0 +1,75 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/DlgSingleAppErrorTpl.ui'
+#
+# Created: Wed Jul 30 11:43:40 2008
+# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_DlgSingleAppError(object):
+ def setupUi(self, DlgSingleAppError):
+ DlgSingleAppError.setObjectName("DlgSingleAppError")
+ DlgSingleAppError.resize(410, 277)
+ self.gridLayout = QtGui.QGridLayout(DlgSingleAppError)
+ self.gridLayout.setObjectName("gridLayout")
+ self.splitter = QtGui.QSplitter(DlgSingleAppError)
+ self.splitter.setOrientation(QtCore.Qt.Horizontal)
+ self.splitter.setObjectName("splitter")
+ self.textEdit = QtGui.QTextEdit(self.splitter)
+ self.textEdit.setObjectName("textEdit")
+ self.widget = QtGui.QWidget(self.splitter)
+ self.widget.setObjectName("widget")
+ self.verticalLayout_2 = QtGui.QVBoxLayout(self.widget)
+ self.verticalLayout_2.setObjectName("verticalLayout_2")
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.label = QtGui.QLabel(self.widget)
+ self.label.setObjectName("label")
+ self.verticalLayout.addWidget(self.label)
+ self.edHost = QtGui.QLineEdit(self.widget)
+ self.edHost.setObjectName("edHost")
+ self.verticalLayout.addWidget(self.edHost)
+ self.label_3 = QtGui.QLabel(self.widget)
+ self.label_3.setObjectName("label_3")
+ self.verticalLayout.addWidget(self.label_3)
+ self.spinPort = QtGui.QSpinBox(self.widget)
+ self.spinPort.setObjectName("spinPort")
+ self.verticalLayout.addWidget(self.spinPort)
+ self.verticalLayout_2.addLayout(self.verticalLayout)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.verticalLayout_2.addItem(spacerItem)
+ self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1)
+ self.line = QtGui.QFrame(DlgSingleAppError)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridLayout.addWidget(self.line, 1, 0, 1, 1)
+ self.buttonBox = QtGui.QDialogButtonBox(DlgSingleAppError)
+ self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
+ self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
+ self.buttonBox.setObjectName("buttonBox")
+ self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 1)
+
+ self.retranslateUi(DlgSingleAppError)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), DlgSingleAppError.accept)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), DlgSingleAppError.reject)
+ QtCore.QMetaObject.connectSlotsByName(DlgSingleAppError)
+
+ def retranslateUi(self, DlgSingleAppError):
+ DlgSingleAppError.setWindowTitle(QtGui.QApplication.translate("DlgSingleAppError", "Dialog", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("DlgSingleAppError", "<b>Host: </b>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("DlgSingleAppError", "<b>Port: </b>", None, QtGui.QApplication.UnicodeUTF8))
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ DlgSingleAppError = QtGui.QDialog()
+ ui = Ui_DlgSingleAppError()
+ ui.setupUi(DlgSingleAppError)
+ DlgSingleAppError.show()
+ sys.exit(app.exec_())
+
Added: trunk/fclient/src/fclient/impl/tpls/Ui_PrefsSingleAppTpl.py
===================================================================
--- trunk/fclient/src/fclient/impl/tpls/Ui_PrefsSingleAppTpl.py (rev 0)
+++ trunk/fclient/src/fclient/impl/tpls/Ui_PrefsSingleAppTpl.py 2008-07-30 10:49:43 UTC (rev 819)
@@ -0,0 +1,62 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/PrefsSingleAppTpl.ui'
+#
+# Created: Wed Jul 30 12:28:11 2008
+# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_PrefsSingleApp(object):
+ def setupUi(self, PrefsSingleApp):
+ PrefsSingleApp.setObjectName("PrefsSingleApp")
+ PrefsSingleApp.resize(533, 399)
+ self.gridLayout = QtGui.QGridLayout(PrefsSingleApp)
+ self.gridLayout.setObjectName("gridLayout")
+ self.label = QtGui.QLabel(PrefsSingleApp)
+ self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop)
+ self.label.setWordWrap(True)
+ self.label.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse)
+ self.label.setObjectName("label")
+ self.gridLayout.addWidget(self.label, 0, 0, 1, 2)
+ self.verticalLayout = QtGui.QVBoxLayout()
+ self.verticalLayout.setObjectName("verticalLayout")
+ self.label_2 = QtGui.QLabel(PrefsSingleApp)
+ self.label_2.setObjectName("label_2")
+ self.verticalLayout.addWidget(self.label_2)
+ self.edHost = QtGui.QLineEdit(PrefsSingleApp)
+ self.edHost.setObjectName("edHost")
+ self.verticalLayout.addWidget(self.edHost)
+ self.label_3 = QtGui.QLabel(PrefsSingleApp)
+ self.label_3.setObjectName("label_3")
+ self.verticalLayout.addWidget(self.label_3)
+ self.spinPort = QtGui.QSpinBox(PrefsSingleApp)
+ self.spinPort.setObjectName("spinPort")
+ self.verticalLayout.addWidget(self.spinPort)
+ self.gridLayout.addLayout(self.verticalLayout, 1, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(251, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
+ self.gridLayout.addItem(spacerItem, 1, 1, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(20, 218, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridLayout.addItem(spacerItem1, 2, 0, 1, 1)
+
+ self.retranslateUi(PrefsSingleApp)
+ QtCore.QMetaObject.connectSlotsByName(PrefsSingleApp)
+
+ def retranslateUi(self, PrefsSingleApp):
+ PrefsSingleApp.setWindowTitle(QtGui.QApplication.translate("PrefsSingleApp", "Form", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("PrefsSingleApp", "The gui uses a socket connection to enshure only one instance is running at a time. Use the boxes below to adjust host and port of the connection to your needs.", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_2.setText(QtGui.QApplication.translate("PrefsSingleApp", "<b>Single application host: </b>", None, QtGui.QApplication.UnicodeUTF8))
+ self.label_3.setText(QtGui.QApplication.translate("PrefsSingleApp", "<b>Single application port: </b>", None, QtGui.QApplication.UnicodeUTF8))
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ PrefsSingleApp = QtGui.QWidget()
+ ui = Ui_PrefsSingleApp()
+ ui.setupUi(PrefsSingleApp)
+ PrefsSingleApp.show()
+ sys.exit(app.exec_())
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|