fclient-commit Mailing List for fclient (Page 11)
Status: Pre-Alpha
Brought to you by:
jurner
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(23) |
Nov
(54) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(17) |
Feb
(209) |
Mar
(63) |
Apr
(31) |
May
(7) |
Jun
(39) |
Jul
(390) |
Aug
(122) |
Sep
(6) |
Oct
|
Nov
|
Dec
|
|
From: <jU...@us...> - 2008-07-25 07:06:22
|
Revision: 720
http://fclient.svn.sourceforge.net/fclient/?rev=720&view=rev
Author: jUrner
Date: 2008-07-25 07:06:32 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
unicode unicode unicode
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/lib/resources.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/lib/resources.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/lib/resources.py 2008-07-25 07:03:16 UTC (rev 719)
+++ trunk/fclient/src/fclient/lib/qt4ex/lib/resources.py 2008-07-25 07:06:32 UTC (rev 720)
@@ -23,11 +23,11 @@
"""
import os
-from PyQt4 import QtGui
+from PyQt4 import QtCore, QtGui
#***************************************************************************************
#
#***************************************************************************************
-ResDir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'res')
+ResDir = QtCore.QString(os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'res'))
#***************************************************************************************
#
@@ -42,7 +42,7 @@
self.iconCache = {}
self.cursorCache = {}
- self._resourceDirs = list(resourceDirs)
+ self._resourceDirs = [unicode(i) for i in resourceDirs]
self._resourceDirs.append(ResDir)
@@ -68,9 +68,9 @@
size = '%sx%s' % (size, size)
iconDir = 'icons'
if iconTheme is not None:
- iconDir = os.path.join(iconDir, iconTheme)
+ iconDir = os.path.join(unicode(iconDir), unicode(iconTheme))
for resourceDir in self._resourceDirs:
- fpath = os.path.join(resourceDir, iconDir, size, name + '.png')
+ fpath = os.path.join(unicode(resourceDir), unicode(iconDir), size, unicode(name) + '.png')
if os.path.isfile(fpath):
return fpath
return None
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-25 07:03:07
|
Revision: 719
http://fclient.svn.sourceforge.net/fclient/?rev=719&view=rev
Author: jUrner
Date: 2008-07-25 07:03:16 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
new method to trunc a string
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py 2008-07-21 13:15:55 UTC (rev 718)
+++ trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py 2008-07-25 07:03:16 UTC (rev 719)
@@ -107,3 +107,21 @@
#****************************************************************************
#
#****************************************************************************
+def truncateString(n, qString, ellipsis):
+ """truncates a string from the right
+ @param n: size to truncate the string to
+ @param qString: string to truncate
+ @param ellispsis: (QString) ellipsis to be used for replacement chars
+ """
+ if qString.count() <= n:
+ return qString
+ ellipsis = QtCore.QString(ellipsis)
+ if n < ellipsis.count():
+ ellipsis.truncate(n)
+ return ellipsis
+ n = n - ellipsis.count()
+ if n < 0:
+ n = 0
+ qString.truncate(n)
+ return qString + ellipsis
+
\ 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-21 13:15:53
|
Revision: 718
http://fclient.svn.sourceforge.net/fclient/?rev=718&view=rev
Author: jUrner
Date: 2008-07-21 13:15:55 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
adjust layout margins
Modified Paths:
--------------
trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py
trunk/fclient/src/fclient/tpls/Ui_ViewConnectionWidgetTpl.py
trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py
trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui
trunk/fclient/src/fclient/tpls/ViewConnectionWidgetTpl.ui
trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py 2008-07-21 13:11:16 UTC (rev 717)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py 2008-07-21 13:15:55 UTC (rev 718)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui'
#
-# Created: Mon Jul 21 09:35:32 2008
+# Created: Mon Jul 21 14:54:05 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
@@ -14,8 +14,11 @@
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")
self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setSpacing(0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.hboxlayout = QtGui.QHBoxLayout()
self.hboxlayout.setObjectName("hboxlayout")
@@ -59,7 +62,7 @@
self.tabBrowsers = QtGui.QTabWidget(ViewBrowserWidget)
self.tabBrowsers.setObjectName("tabBrowsers")
self.tab = QtGui.QWidget()
- self.tab.setGeometry(QtCore.QRect(0, 0, 548, 434))
+ self.tab.setGeometry(QtCore.QRect(0, 0, 566, 458))
self.tab.setObjectName("tab")
self.tabBrowsers.addTab(self.tab, "")
self.gridLayout_3.addWidget(self.tabBrowsers, 1, 0, 1, 1)
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewConnectionWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewConnectionWidgetTpl.py 2008-07-21 13:11:16 UTC (rev 717)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewConnectionWidgetTpl.py 2008-07-21 13:15:55 UTC (rev 718)
@@ -2,8 +2,8 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewConnectionWidgetTpl.ui'
#
-# Created: Sat Jul 12 15:26:16 2008
-# by: PyQt4 UI code generator 4.3.3
+# Created: Mon Jul 21 14:58:16 2008
+# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
@@ -12,58 +12,47 @@
class Ui_ViewConnectionWidget(object):
def setupUi(self, ViewConnectionWidget):
ViewConnectionWidget.setObjectName("ViewConnectionWidget")
- ViewConnectionWidget.resize(QtCore.QSize(QtCore.QRect(0,0,533,356).size()).expandedTo(ViewConnectionWidget.minimumSizeHint()))
-
+ ViewConnectionWidget.resize(533, 356)
self.gridlayout = QtGui.QGridLayout(ViewConnectionWidget)
+ self.gridlayout.setMargin(0)
+ self.gridlayout.setSpacing(0)
self.gridlayout.setObjectName("gridlayout")
-
self.hboxlayout = QtGui.QHBoxLayout()
self.hboxlayout.setObjectName("hboxlayout")
-
self.vboxlayout = QtGui.QVBoxLayout()
self.vboxlayout.setObjectName("vboxlayout")
-
self.label = QtGui.QLabel(ViewConnectionWidget)
self.label.setObjectName("label")
self.vboxlayout.addWidget(self.label)
-
self.label_2 = QtGui.QLabel(ViewConnectionWidget)
self.label_2.setObjectName("label_2")
self.vboxlayout.addWidget(self.label_2)
self.hboxlayout.addLayout(self.vboxlayout)
-
self.vboxlayout1 = QtGui.QVBoxLayout()
self.vboxlayout1.setObjectName("vboxlayout1")
-
self.edConnectionHost = QtGui.QLineEdit(ViewConnectionWidget)
self.edConnectionHost.setObjectName("edConnectionHost")
self.vboxlayout1.addWidget(self.edConnectionHost)
-
self.spinConnectionPort = QtGui.QSpinBox(ViewConnectionWidget)
self.spinConnectionPort.setObjectName("spinConnectionPort")
self.vboxlayout1.addWidget(self.spinConnectionPort)
self.hboxlayout.addLayout(self.vboxlayout1)
-
self.vboxlayout2 = QtGui.QVBoxLayout()
self.vboxlayout2.setObjectName("vboxlayout2")
-
self.ckAutoConnect = QtGui.QCheckBox(ViewConnectionWidget)
self.ckAutoConnect.setObjectName("ckAutoConnect")
self.vboxlayout2.addWidget(self.ckAutoConnect)
-
- spacerItem = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Fixed)
+ spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
self.vboxlayout2.addItem(spacerItem)
self.hboxlayout.addLayout(self.vboxlayout2)
- self.gridlayout.addLayout(self.hboxlayout,0,0,1,1)
-
- spacerItem1 = QtGui.QSpacerItem(321,51,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding)
- self.gridlayout.addItem(spacerItem1,1,0,1,1)
-
+ self.gridlayout.addLayout(self.hboxlayout, 0, 0, 1, 1)
+ spacerItem1 = QtGui.QSpacerItem(321, 51, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridlayout.addItem(spacerItem1, 1, 0, 1, 1)
self.btConnect = QtGui.QPushButton(ViewConnectionWidget)
self.btConnect.setCheckable(True)
- self.btConnect.setAutoExclusive(True)
+ self.btConnect.setAutoExclusive(False)
self.btConnect.setObjectName("btConnect")
- self.gridlayout.addWidget(self.btConnect,2,0,1,1)
+ self.gridlayout.addWidget(self.btConnect, 2, 0, 1, 1)
self.retranslateUi(ViewConnectionWidget)
QtCore.QMetaObject.connectSlotsByName(ViewConnectionWidget)
@@ -76,7 +65,6 @@
self.btConnect.setText(QtGui.QApplication.translate("ViewConnectionWidget", "Connect", None, QtGui.QApplication.UnicodeUTF8))
-
if __name__ == "__main__":
import sys
app = QtGui.QApplication(sys.argv)
@@ -85,3 +73,4 @@
ui.setupUi(ViewConnectionWidget)
ViewConnectionWidget.show()
sys.exit(app.exec_())
+
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py 2008-07-21 13:11:16 UTC (rev 717)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py 2008-07-21 13:15:55 UTC (rev 718)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui'
#
-# Created: Mon Jul 21 12:30:45 2008
+# Created: Mon Jul 21 14:55:28 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
@@ -14,6 +14,8 @@
ViewDownloadsWidget.setObjectName("ViewDownloadsWidget")
ViewDownloadsWidget.resize(400, 300)
self.gridLayout = QtGui.QGridLayout(ViewDownloadsWidget)
+ self.gridLayout.setMargin(0)
+ self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName("gridLayout")
self.tree = QtGui.QTreeWidget(ViewDownloadsWidget)
self.tree.setObjectName("tree")
Modified: trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui 2008-07-21 13:11:16 UTC (rev 717)
+++ trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui 2008-07-21 13:15:55 UTC (rev 718)
@@ -13,8 +13,17 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_3" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
<item row="0" column="0" >
<layout class="QHBoxLayout" name="horizontalLayout" >
+ <property name="spacing" >
+ <number>0</number>
+ </property>
<item>
<layout class="QHBoxLayout" >
<item>
@@ -107,8 +116,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>548</width>
- <height>434</height>
+ <width>566</width>
+ <height>458</height>
</rect>
</property>
<attribute name="title" >
Modified: trunk/fclient/src/fclient/tpls/ViewConnectionWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/ViewConnectionWidgetTpl.ui 2008-07-21 13:11:16 UTC (rev 717)
+++ trunk/fclient/src/fclient/tpls/ViewConnectionWidgetTpl.ui 2008-07-21 13:15:55 UTC (rev 718)
@@ -13,6 +13,12 @@
<string>Form</string>
</property>
<layout class="QGridLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
@@ -60,7 +66,7 @@
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@@ -77,7 +83,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
- <property name="sizeHint" >
+ <property name="sizeHint" stdset="0" >
<size>
<width>321</width>
<height>51</height>
Modified: trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui 2008-07-21 13:11:16 UTC (rev 717)
+++ trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui 2008-07-21 13:15:55 UTC (rev 718)
@@ -13,6 +13,12 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout" >
+ <property name="margin" >
+ <number>0</number>
+ </property>
+ <property name="spacing" >
+ <number>0</number>
+ </property>
<item row="0" column="0" >
<widget class="QTreeWidget" name="tree" >
<column>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-21 13:11:08
|
Revision: 717
http://fclient.svn.sourceforge.net/fclient/?rev=717&view=rev
Author: jUrner
Date: 2008-07-21 13:11:16 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
tab menu
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewBrowser.py
Modified: trunk/fclient/src/fclient/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-21 12:45:47 UTC (rev 716)
+++ trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-21 13:11:16 UTC (rev 717)
@@ -65,7 +65,7 @@
)
self.action( # context menu only
name='ActionCloseBrowserUnderMouse',
- text=self.trUtf8('&Close tab under mouse'),
+ text=self.trUtf8('&Close tab'),
trigger=None,
#isEnabled=False,
)
@@ -713,8 +713,10 @@
def onTabBrowsersContextMenuEvent(self, pt):
menu = QtGui.QMenu()
+ #TODO: enable / disable actions
actCloseBrowserUnderMouse = self.fcActions['ActionCloseBrowserUnderMouse']
menu.addAction(actCloseBrowserUnderMouse)
+ menu.addAction(self.fcActions['ActionCloseAllTabs'])
tab = self.controlById(self.IdTabBrowsers)
pt = tab.mapToGlobal(pt)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-21 12:49:29
|
Revision: 716
http://fclient.svn.sourceforge.net/fclient/?rev=716&view=rev
Author: jUrner
Date: 2008-07-21 12:45:47 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
add compactpath package, we might need it
Added Paths:
-----------
trunk/fclient/src/fclient/lib/compactpath/
trunk/fclient/src/fclient/lib/compactpath/LICENCE.MIT
trunk/fclient/src/fclient/lib/compactpath/README
trunk/fclient/src/fclient/lib/compactpath/__init__.py
trunk/fclient/src/fclient/lib/compactpath/compactpath.py
trunk/fclient/src/fclient/lib/compactpath/qt4/
trunk/fclient/src/fclient/lib/compactpath/qt4/__init__.py
trunk/fclient/src/fclient/lib/compactpath/qt4/pathlabelwrap.py
trunk/fclient/src/fclient/lib/compactpath/qt4/sample_gui.py
trunk/fclient/src/fclient/lib/compactpath/scripts/
trunk/fclient/src/fclient/lib/compactpath/scripts/__init__.py
trunk/fclient/src/fclient/lib/compactpath/scripts/gen_docs.py
Added: trunk/fclient/src/fclient/lib/compactpath/LICENCE.MIT
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/LICENCE.MIT (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/LICENCE.MIT 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1,24 @@
+"compactpath" is a python package to handle compacting of filepaths
+
+Copyright (c) 2006-2008 Juergen Urner
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in the
+Software without restriction, including without limitation the rights to use, copy,
+modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
+and to permit persons to whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+
Added: trunk/fclient/src/fclient/lib/compactpath/README
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/README (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/README 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1,71 @@
+"compactpath" is a python package to handle compacting of filepaths
+
+project web: https://sourceforge.net/projects/compactpath/
+
+
+
+Version history
+#*******************************************************************
+compactpath 0.5.0
+#********************************************************************
+release: 06/15/2008
+
+did a complete rewrite of the package. sorry for any inconveniences and incompatibilities
+
+news:
+
+ x. reimplemented compactpath algo. bells and whistels have gone. this makes it ~15x faster
+ x. combed over PathLabelWrap (qt4). styling and enabling / disabling works now
+ x. added a script to auto generate epydoc docs. you will find it in the [scripts] folder
+
+
+fixes:
+
+
+incompatibilieites:
+
+ x. the "compactPath" function is named "compactpath" now
+ x. the function takes the desired width as first parameter now --> compactpath(w, fpath)
+ x. the keyword parameters "type" has gone. use "path_module" now
+ x. the keyword "max_pardirs" has gone. not supported anymore
+
+ x. qt4 implementations of the algo have been moved to --> compactpath/qt4/*
+ use: from compactpath.qt4 import <whatever>
+
+ x. PathLabelWrap (qt3) has gone. that is, no more support for qt3
+
+ x. PathLabelWrap (qt4) getPath() method is now PathLabelWrap.path()
+ x. the keyword parameters "type" has gone. use "path_module" now
+ x. the keyword "max_pardirs" has gone. not supported anymore
+
+ x. documentation is now uses epydoc markup
+
+
+#*******************************************************************
+compactpath 0.4.2
+#********************************************************************
+news:
+ x. PathLabelWrap.setPath() now takes the same keywords as constructor
+
+fixes:
+
+ x. root of nt posix paths was chewed off emidiately - fixed
+ x. root of mac paths was chewed off to soon - fixed
+
+
+#*******************************************************************
+compactpath 0.4.1
+#********************************************************************
+news:
+
+ x. updated inline docs ("sep" keyword was still there. This has changed to "type")
+
+
+#*******************************************************************
+compactpath 0.4.0
+#********************************************************************
+news:
+
+ x. added support for mac paths.
+ x. removed the "sep" keyword argument. Use the "type" keyword to explicitely
+ specify the type of path to be compacted if required.
\ No newline at end of file
Added: trunk/fclient/src/fclient/lib/compactpath/__init__.py
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/__init__.py (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/__init__.py 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1,16 @@
+"""compact a filepath to fit into a desired width
+
+@note: the package is designed so you can drop it into any project
+and use it right away. no need to install it to --> lib/site-packages
+
+@note: you may use --> scripts/gen_docs.py to generate epydoc documentation for the package
+
+"""
+__author__ = 'Juergen Urner'
+__copyright__ = '(c) 2006-2008 Juergen Urner'
+__email__ = 'jU...@ar...'
+__licence__ = 'Mit'
+__version__ = '0.5.0'
+
+
+
Added: trunk/fclient/src/fclient/lib/compactpath/compactpath.py
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/compactpath.py (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/compactpath.py 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1,180 @@
+"""compactpath algorithm
+
+compacts a filepath to fit into a desired length by replacing chars with ellipsis. the funktion
+preserves the last component of the filepath as long as possible. assumption is that this component
+is of major importance for the user.
+"""
+
+import os
+#****************************************************************************************************
+# consts
+#****************************************************************************************************
+ELLIPSIS = '...'
+
+#****************************************************************************************************
+# helpers
+#****************************************************************************************************
+def rtrunc(n, chars, ellipsis=ELLIPSIS):
+ """truncates a string to from the right to the desired number of chars, replacing chars with ellipsis
+
+ @param n: (int) desired number of truncated chars
+ @param chars: (str) chars to truncate
+ @param ellipsis: (str) ellipsis to use for char substitution
+ @return: (str) the truncated string
+
+ >>> rtrunc(4, 'abcd')
+ '...d'
+
+ >>> rtrunc(99, 'abc')
+ '...'
+
+ >>> rtrunc(1, 'abc')
+ '.'
+
+ >>> rtrunc(0, 'abc')
+ ''
+
+ >>> rtrunc(-1, 'abc')
+ ''
+
+ >>> ellipsis = '01234'
+ >>> for n in range(len(ellipsis), 0, -1):
+ ... rtrunc(n, ellipsis, ellipsis=ellipsis)
+ '01234'
+ '1234'
+ '234'
+ '34'
+ '4'
+ """
+ if n > len(chars):
+ n = len(chars)
+ if n < 0:
+ n = 0
+ x = len(ellipsis) - n
+ if x < 0:
+ x = 0
+ e = ellipsis[x:]
+ return e + chars[len(chars) - n + len(e): ]
+
+
+def ltrunc(n, chars, ellipsis=ELLIPSIS):
+ """truncates a string to from the left to the desired number of chars, replacing chars with ellipsis
+
+ @param n: (int) desired number of truncated chars
+ @param chars: (str) chars to truncate
+ @param ellipsis: (str) ellipsis to use for char substitution
+ @return: (str) the truncated string
+
+ >>> ltrunc(4, 'abcd')
+ 'a...'
+
+ >>> ltrunc(99, 'abc')
+ '...'
+
+ >>> ltrunc(1, 'abc')
+ '.'
+
+ >>> ltrunc(0, 'abc')
+ ''
+
+ >>> ltrunc(-1, 'abc')
+ ''
+ >>> ellipsis = '01234'
+ >>> for n in range(len(ellipsis), 0, -1):
+ ... ltrunc(n, ellipsis, ellipsis=ellipsis)
+ '01234'
+ '0123'
+ '012'
+ '01'
+ '0'
+ """
+ if n > len(chars):
+ n = len(chars)
+ if n < 0:
+ n = 0
+ e = ellipsis[:n]
+ return chars[ :n - len(e)] + e
+
+#************************************************************************************************
+#
+#************************************************************************************************
+#NOTE:
+# a nicer but more complicated (and slower) implementation would preserve
+# components more intelligently. e.g. the emidiate parent component of the
+# last component would be preserved longer than some intermediate component
+
+def compactpath(w, fpath, measure=len, ellipsis=ELLIPSIS, path_module=os.path):
+ """compacts a filepath to fit into a desired width
+
+ @param fpath: (str) filepath to compact
+ @param measure: function to measure length of the filepath. the function
+ should take one parameter: the filepath and should return its length
+ @param ellipsis: (str) ellipsis to use for char substitution
+ @param path_module: path module to use to split and join filepath
+
+ @note: you can always assume that on return measure(fpath) is < w
+ for measure(fpath) > 0
+
+
+ >>> import posixpath
+ >>> compactpath(10, '/aaa/bbb/ccc', path_module=posixpath)
+ '/a.../ccc'
+
+ >>> compactpath(0, '', path_module=posixpath)
+ ''
+
+ >>> compactpath(-1, '', path_module=posixpath)
+ ''
+
+ >>> p = 'aaa/bbb/ccc'
+ >>> for n in range(len(p), 0, -1):
+ ... compactpath(n, p, path_module=posixpath)
+ 'aaa.../ccc'
+ 'aa.../ccc'
+ 'a.../ccc'
+ '.../ccc'
+ '...ccc'
+ '...cc'
+ '...c'
+ '...'
+ '..'
+ '.'
+ ''
+ """
+ if measure(fpath) < w:
+ return fpath
+
+ if w > 0:
+ head, tail = path_module.split(fpath)
+ n = len(head)
+
+ while n >= len(ellipsis):
+ head = ltrunc(n, head, ellipsis=ellipsis)
+ n -= 1
+ fpath = path_module.join(head, tail)
+ if measure(fpath) < w:
+ return fpath
+
+ if head == ellipsis:
+ tail = ellipsis + tail
+ n = len(tail) - 1
+ elif head:
+ tail = path_module.join(head, tail, ellipsis=ellipsis)
+ n = len(tail)
+ else:
+ n = len(tail)
+
+ while tail:
+ if measure(tail) < w:
+ return tail
+ tail = rtrunc(n, tail)
+ n -= 1
+
+ return ''
+
+#************************************************************************************************
+#
+#************************************************************************************************
+if __name__ == '__main__':
+ import doctest
+ print 'doctests failed: %s/%s' % doctest.testmod()
Added: trunk/fclient/src/fclient/lib/compactpath/qt4/__init__.py
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/qt4/__init__.py (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/qt4/__init__.py 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1 @@
+"""compactpath implementations for qt4"""
Added: trunk/fclient/src/fclient/lib/compactpath/qt4/pathlabelwrap.py
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/qt4/pathlabelwrap.py (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/qt4/pathlabelwrap.py 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1,226 @@
+"""QLabel wrapper to turn a QLabel into a label that displays a compacted filepath
+"""
+
+import os, sys
+from PyQt4 import QtCore, QtGui
+
+#--> rel import hack
+class SysPathHack(object):
+ def __init__(self, n):
+ fpath = os.path.abspath(__file__)
+ for i in xrange(n): fpath = os.path.dirname(fpath)
+ sys.path.insert(0, fpath)
+ def __del__(self): sys.path.pop(0)
+hack = SysPathHack(2)
+
+from compactpath import compactpath
+
+del hack
+#<-- rel import hack
+#********************************************************************************
+#
+#********************************************************************************
+class PathLabelWrap(object):
+ """class wrapping a QLabel to display a filepath or url that is compacted or decompacted on resizing of the label
+
+ usage::
+ # create a label in designer or wherever and wrap it afterwards
+ self.wrap = PathLabelWrap(self.myLabel, '/foo/bar/baz', prefix='MyPath: ')
+
+ @ivar fpath: filepath wrapped. setting this attr directly will not update the label. use L{setPath} instead
+ @ivar label: the QLabel wrapped
+ @ivar path_module: module to use to split and join the filepath. setting this attr directly will not update the label. use L{setPath} instead
+ @ivar prefix: fixed size string to prefix the filepath with. setting this attr directly will not update the label. use L{setPath} instead
+ """
+
+ def __init__(self, label, fpath='', prefix='', path_module=os.path):
+ """constructor
+
+ @param label: an initialized QLabel to wrap compactPath funktionality around
+ @param fpath: the filepath or url the label should display
+ @param path_module: module to use to split and join the filepath. hint: if you want
+ to display a macpath on linux pass macpath.
+ @param prefix: fixed size string to prefix the filepath with (will never be compacted)
+
+ @note: problem to tackle is that qt adjusts the size of any label to fit its contents. this wrapper
+ does it vice versa and adjusts the contents to the size of the label. so by default qt has to assume
+ the label is empty. you can set a text to the label (wich never gets displayed) to force a minimum label size
+
+ @note: currently the wrapper does not know how anything about rich text. no use to pass
+ a label containing rich text. the rich text it won't show up and behaviour of the label is undefined
+
+ @note: when used on a statusbar you may want to adjust the stretch facor. otherwise label
+ contents may not be visible because it never gets resized
+ """
+ self.fpath = fpath
+ self.label = label
+ self.path_module = path_module
+ self.prefix = prefix
+
+ self.label.paintEvent = self.paintEvent # overwrite
+
+
+ def setPath(self, fpath, prefix=None, path_module=None):
+ """sets the filepath to be displayed by the label
+
+ @param fpath: the filepath or url the label should display
+ @param path_module: module to use to split and join the filepath or None to keep the current one
+ @param prefix: fixed size string to prefix the filepath with (will never be compacted) or None to keep the current one
+ """
+ if prefix is not None:
+ self.prefix = prefix
+ if path_module is not None:
+ path_module = path_module
+ self.fpath = fpath
+ self.label.update()
+
+
+ def path(self):
+ """retrieves the (uncompacted) filepath wrapped
+ """
+ return self.fpath
+
+
+ def paintEvent(self, event):
+ """reimplemented QLabel.paintEvent()"""
+ style = self.label.style()
+ painter = QtGui.QPainter(self.label)
+ palette = self.label.palette()
+ fm = self.label.fontMetrics()
+ cr = self.label.contentsRect()
+ align = style.visualAlignment(self.label.layoutDirection(), self.label.alignment())
+
+ cr.adjust(self.label.margin(), self.label.margin(), -self.label.margin(), -self.label.margin())
+
+ indent = self.label.indent()
+ if indent < 0: # see Qt docs: label.indent()
+ if indent > 0:
+ indent = fm.width("x") / 2
+ else:
+ indent = 0
+ if indent > 0:
+ if align & QtCore.Qt.AlignLeft:
+ cr.setLeft( cr.left() + indent);
+ if align & QtCore.Qt.AlignRight:
+ cr.setRight(cr.right() - indent)
+ if align & QtCore.Qt.AlignTop:
+ cr.setTop(cr.top() + indent)
+ if align & QtCore.Qt.AlignBottom:
+ cr.setBottom(cr.bottom() - indent)
+
+ w = cr.width()
+ if self.prefix:
+ w -= fm.width(self.prefix)
+ fpath = compactpath(
+ w,
+ self.fpath,
+ measure=fm.width,
+ path_module=self.path_module
+ )
+ self.label.drawFrame(painter)
+ style.drawItemText(painter, cr, align, palette, self.label.isEnabled(), self.prefix + fpath, self.label.foregroundRole())
+
+
+ #************************************************************************************************
+ # the original QLabel.painEvent() handler (for readability pixmap and movie stuff removed)
+ # quite a beast with calls to obscure private methods ...the reason why PathLabelWrap() currently
+ # does not support rich text
+ #
+ # as a hint: QTextDocument can be retrieved like this:
+ ##textDocument = None
+ ##for i in self.label.children():
+ ## for j in i.children():
+ ## if isinstance(j, QtGui.QTextDocument):
+ ## textDocument = j
+ ##
+ ##if textDocument is not None:
+ ## # process
+
+ """
+ void QLabel::paintEvent(QPaintEvent *)
+ {
+ Q_D(QLabel);
+ QStyle *style = QWidget::style();
+ QPainter painter(this);
+ drawFrame(&painter);
+ QRect cr = contentsRect();
+ cr.adjust(d->margin, d->margin, -d->margin, -d->margin);
+ int align = QStyle::visualAlignment(layoutDirection(), QFlag(d->align));
+
+
+ if (d->isTextLabel) {
+ QRectF lr = d->layoutRect();
+ if (d->control) {
+ #ifndef QT_NO_SHORTCUT
+ const bool underline = (bool)style->styleHint(QStyle::SH_UnderlineShortcut, 0, this, 0);
+ if (d->shortcutId != 0
+ && underline != d->shortcutCursor.charFormat().fontUnderline()) {
+ QTextCharFormat fmt;
+ fmt.setFontUnderline(underline);
+ d->shortcutCursor.mergeCharFormat(fmt);
+ }
+ #endif
+ d->ensureTextLayouted();
+
+ QAbstractTextDocumentLayout::PaintContext context;
+ QStyleOption opt(0);
+ opt.init(this);
+
+ if (!isEnabled() && style->styleHint(QStyle::SH_EtchDisabledText, &opt, this)) {
+ context.palette = palette();
+ context.palette.setColor(QPalette::Text, context.palette.light().color());
+ painter.save();
+ painter.translate(lr.x() + 1, lr.y() + 1);
+ painter.setClipRect(lr.translated(-lr.x() - 1, -lr.y() - 1));
+ QAbstractTextDocumentLayout *layout = d->control->document()->documentLayout();
+ layout->draw(&painter, context);
+ painter.restore();
+ }
+
+ // Adjust the palette
+ context.palette = palette();
+ if (foregroundRole() != QPalette::Text && isEnabled())
+ context.palette.setColor(QPalette::Text, context.palette.color(foregroundRole()));
+
+ painter.save();
+ painter.translate(lr.topLeft());
+ painter.setClipRect(lr.translated(-lr.x(), -lr.y()));
+ d->control->setPalette(context.palette);
+ d->control->drawContents(&painter, QRectF(), this);
+ painter.restore();
+ } else {
+ int flags = align;
+ if (d->hasShortcut) {
+ flags |= Qt::TextShowMnemonic;
+ QStyleOption opt;
+ opt.initFrom(this);
+ if (!style->styleHint(QStyle::SH_UnderlineShortcut, &opt, this))
+ flags |= Qt::TextHideMnemonic;
+ }
+ style->drawItemText(&painter, lr.toRect(), flags, palette(), isEnabled(), d->text, foregroundRole());
+ }
+ } else
+ #ifndef QT_NO_PICTURE
+
+ (...)
+
+ """
+
+#******************************************************************************
+#
+#******************************************************************************
+if __name__ == "__main__":
+
+ # for playing around...
+ a = QtGui.QApplication(sys.argv)
+ QtCore.QObject.connect(a,QtCore.SIGNAL("lastWindowClosed()"),a,QtCore.SLOT("quit()"))
+ w = QtGui.QLabel('aaa')
+ w.setIndent(39)
+ w.setStyleSheet('QLabel {background: yellow; border: 1py solid black}')
+ w.setTextFormat(QtCore.Qt.RichText)
+
+ PathLabelWrap(w, os.path.join(*[i*5 for i in 'abcdefg']))
+ w.show()
+ a.exec_()
+
+
\ No newline at end of file
Added: trunk/fclient/src/fclient/lib/compactpath/qt4/sample_gui.py
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/qt4/sample_gui.py (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/qt4/sample_gui.py 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1,122 @@
+"""qt4 sample gui"""
+
+import os, sys
+import ntpath
+import macpath
+import posixpath
+
+from PyQt4 import QtCore, QtGui
+
+
+#--> rel import hack
+class SysPathHack(object):
+ def __init__(self, n):
+ fpath = os.path.abspath(__file__)
+ for i in xrange(n): fpath = os.path.dirname(fpath)
+ sys.path.insert(0, fpath)
+ def __del__(self): sys.path.pop(0)
+hack = SysPathHack(1)
+
+from pathlabelwrap import PathLabelWrap, compactpath
+
+del hack
+#<-- rel import hack
+#********************************************************************************
+# test GUI
+#*******************************************************************************
+CAPTION = "compactPath - [%s]"
+PATHS = (
+ (posixpath, "/my/very/long/path/containing/many/compoponents/here.txt"),
+ (ntpath, "c:\\my\\very\\long\\path\\containing\\many\\compoponents\\here.txt"),
+ (macpath, "my:very:long:path:containing:many:compoponents:here.txt"),
+ (posixpath, "http://my/very/long/path/containing/many/compoponents/here.txt"),
+ )
+BLINDTEXT = "xxxxxxxxxx" # this is set as text to the labels to force a minimum size. Adjust to your needs
+
+#******************************************************************************
+#
+#******************************************************************************
+class SampleGui(QtGui.QMainWindow):
+ """test gui"""
+
+ def __init__(self):
+ QtGui.QMainWindow.__init__(self)
+
+ self.mainWidget = QtGui.QWidget(self)
+ self.setCentralWidget(self.mainWidget)
+
+ # NOTE:
+ #
+ # too bad, no label or the like is retrievable for the caption bar. so no way to adjust it anything
+ # on the caption dynamically. best practice seems to be to init to some fixed width. plus is that
+ # the width of the caption bar label seems to have no effect on the GUI width. but this may
+ # vary from window manager to window manager.
+ #
+ pathModule, fpath = PATHS[0]
+ fpath = compactpath(50 - len(CAPTION), fpath, path_module=pathModule)
+ self.setWindowTitle(CAPTION % fpath)
+
+
+ def newPathlabelWrap(mainWidget, layout, frameStyle, pathModule, fpath, prefix=None):
+ label = QtGui.QLabel(BLINDTEXT, mainWidget)
+ label.setFrameStyle(frameStyle)
+ layout.addWidget(label)
+ if prefix is None:
+ prefix = pathModule.__name__ + ': '
+ wrap = PathLabelWrap(label, fpath=fpath, prefix=prefix, path_module=pathModule)
+ mainWidget.pathLabels.append(wrap)
+ return wrap
+
+ # throw labels into the Gui
+ layout = QtGui.QVBoxLayout(self.centralWidget())
+ frameStyle = QtGui.QLabel.Sunken | QtGui.QLabel.Box
+ self.pathLabels = []
+ for pathModule, fpath in PATHS:
+ newPathlabelWrap(self, layout, frameStyle, pathModule, fpath, prefix=None)
+
+ # add a disabled label
+ wrap = newPathlabelWrap(self, layout, frameStyle, pathModule, fpath, prefix='disabled: ')
+ wrap.label.setEnabled(False)
+
+ # for kicks a styled one
+ wrap = newPathlabelWrap(self, layout, frameStyle, pathModule, fpath, prefix='styled: ')
+ wrap.label.setStyleSheet('QLabel{border: 2px solid cyan; background: blue; color: white}')
+
+ # indent should work, too
+ wrap = newPathlabelWrap(self, layout, frameStyle, pathModule, fpath, prefix='indented: ')
+ wrap.label.setIndent(20)
+
+ # as should margin
+ wrap = newPathlabelWrap(self, layout, frameStyle, pathModule, fpath, prefix='margined: ')
+ wrap.label.setMargin(20)
+
+
+ # default QLabel to see test label to see if our owner drawn labels are ok
+ self.labelTest = QtGui.QLabel("no shortcuts, no rich text yet", self.mainWidget)
+ self.labelTest.setFrameStyle(frameStyle)
+ layout.addWidget(self.labelTest)
+
+ layout.addItem(QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding))
+
+ # add another wrap on the statusbar
+ self.status = self.statusBar()
+ self.statusLabelWrap = PathLabelWrap(QtGui.QLabel(BLINDTEXT, self.status), fpath=fpath, prefix='status: ')
+ self.statusLabelWrap.label.setFrameStyle(frameStyle)
+ self.status.addWidget(self.statusLabelWrap.label, 10)
+ self.status.addWidget(QtGui.QLabel('foo-bar', self.status))
+
+
+ def styleChange(self, oldStyle):
+ """styleChange handler"""
+ self.update()
+
+
+#******************************************************************************
+#
+#******************************************************************************
+if __name__ == "__main__":
+ a = QtGui.QApplication(sys.argv)
+ QtCore.QObject.connect(a,QtCore.SIGNAL("lastWindowClosed()"),a,QtCore.SLOT("quit()"))
+ w = SampleGui()
+ w.show()
+ a.exec_()
Added: trunk/fclient/src/fclient/lib/compactpath/scripts/__init__.py
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/scripts/__init__.py (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/scripts/__init__.py 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1 @@
+"""scripts and helpers for the package"""
Added: trunk/fclient/src/fclient/lib/compactpath/scripts/gen_docs.py
===================================================================
--- trunk/fclient/src/fclient/lib/compactpath/scripts/gen_docs.py (rev 0)
+++ trunk/fclient/src/fclient/lib/compactpath/scripts/gen_docs.py 2008-07-21 12:45:47 UTC (rev 716)
@@ -0,0 +1,81 @@
+"""Generates epydoc documentation for the package in --> packageDir/doc
+
+gen_docs.py
+
+@note: the script assumes it is located in the <doc> or any other emidiate subdirectory of the package
+@note: Use gen_docs.py -? or --help to print out this help text
+
+@requires: epydoc
+"""
+
+import sys, os
+from epydoc import cli
+import subprocess
+#************************************************************************************
+# consts
+#************************************************************************************
+PACKAGE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+DOC_DIR = os.path.join(PACKAGE_DIR, 'doc')
+EPYDOC_FOLDER = 'epydoc'
+EPYDOC_DIR = os.path.join(DOC_DIR, EPYDOC_FOLDER)
+
+#************************************************************************************
+# helpers
+#************************************************************************************
+def save_create_dir(directory):
+ """creates a directory if it does not exist already"""
+ if not os.path.isdir(directory):
+ os.makedirs(directory)
+
+def enshure_doc_dir_dxists():
+ """enshures epydoc docdir exists"""
+ save_create_dir(EPYDOC_DIR)
+
+def pprint(msg, *params):
+ """helper to pprint user feedback"""
+ print '>' + msg
+ for i in params:
+ print ' ' + i
+
+#**************************************************************************
+#
+#**************************************************************************
+def main():
+ """"""
+ pprint('dumping docs to:', EPYDOC_DIR)
+ enshure_doc_dir_dxists()
+ pprint('calling epydoc')
+ sys.argv = [
+ __file__,
+ '-v',
+ '-o%s' % EPYDOC_DIR,
+ '--src-code-tab-width', '4',
+ #'--debug',
+ PACKAGE_DIR,
+ ]
+ cli.cli()
+
+ # create a redirect to 'epydoc/index.html'
+ html_index = os.path.join(DOC_DIR, 'index.html')
+ pprint('creating redirect:', html_index)
+ fp = open(html_index, 'w')
+ try:
+ fp.write('''<html>
+ <head>
+ <meta http-equiv="Refresh" content="0; URL=%s">
+ </head>
+</html>
+''' % (EPYDOC_FOLDER + '/' + 'index.html') )
+ finally:
+ fp.close()
+
+ pprint('done')
+
+#**************************************************************************************
+#
+#**************************************************************************************
+if __name__ == '__main__':
+ wantsHelp = len(sys.argv) > 1 and sys.argv[1] or None
+ if wantsHelp not in ('-?', '--help'):
+ sys.exit(main())
+ print __doc__
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-21 11:03:01
|
Revision: 715
http://fclient.svn.sourceforge.net/fclient/?rev=715&view=rev
Author: jUrner
Date: 2008-07-21 11:02:08 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
haz many changes
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewDownloads.py
Modified: trunk/fclient/src/fclient/Ui_ViewDownloads.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewDownloads.py 2008-07-21 10:59:00 UTC (rev 714)
+++ trunk/fclient/src/fclient/Ui_ViewDownloads.py 2008-07-21 11:02:08 UTC (rev 715)
@@ -18,10 +18,10 @@
# 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
+# 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
@@ -45,23 +45,79 @@
self.displayName=self.trUtf8('Downloads')
self.icon=QtGui.QIcon()
-
#**********************************************************************************
#
#**********************************************************************************
-class Model(QtGui.QStandardItemModel):
+# from: network/torrent/mainwindow.cpp
+# TorrentViewDelegate is used to draw the progress bars.
+class DownloadTreeDelegate(QtGui.QItemDelegate):
- def __init__(self, parent=None):
- pass
+ def __init__(self, parent):
+ QtGui.QItemDelegate.__init__(self, parent)
+ def paint(self, painter, option, index):
+ if index.column() != self.parent().HeaderIndexProgressBar:
+ 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
+ progressBarOption.text = '%s%%' % round(progress * 100 / required, 2)
+
+ # Draw the progress bar onto the view.
+ application.style().drawControl(QtGui.QStyle.CE_ProgressBar, progressBarOption, painter)
+
#**********************************************************************************
#
#**********************************************************************************
+class TreeItem(QtGui.QTreeWidgetItem):
+
+ def __init__(self, fcpRequest, *params):
+ QtGui.QTreeWidgetItem.__init__(self, *params)
+ self.fcpRequest = fcpRequest
+
+#**********************************************************************************
+#
+#**********************************************************************************
+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):
- IdTreeView = 'treeView'
+ IdTree = 'tree'
+ HeaderIndexName = 0
+ HeaderIndexFoo = 1
+ HeaderIndexProgressBar = 2
+
def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
QtGui.QWidget.__init__(self, parent)
self._isCreated = False
@@ -70,17 +126,64 @@
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.RequestProgress, self.onFcpRequestProgress),
+ (config.fcpClient.events.RequestFailed, self.onFcpRequestFailed),
+ (config.fcpClient.events.RequestModified, self.onFcpRequestModified),
+ )
+ config.fcpClient.events += self.fcpEvents
+
+ self.fcRequests = Requests()
+ self.fcHeadeLabels = {
+ self.HeaderIndexName: self.trUtf8('Name'),
+ self.HeaderIndexFoo: self.trUtf8('Foo'),
+ self.HeaderIndexProgressBar: self.trUtf8('Progress'),
+ }
+
+ self.tree.setHeaderLabels([i[1] for i in sorted(self.fcHeadeLabels.items())])
+ self.tree.setItemDelegate(DownloadTreeDelegate(self))
+
+ def closeEvent(self):
+ self.viewClose()
+
+
def viewClose(self):
- pass
+ config.fcpClient.events -= self.fcpEvents
+
+ def addRequest(self, fcpIdentifier):
+ fcpRequest = config.fcpClient.getRequest(fcpIdentifier)
+ item= TreeItem(fcpRequest, self.tree)
+ self.fcRequests.addRequest(fcpIdentifier, item)
+
+
#########################################
## methods
#########################################
def controlById(idGlobalFeedback, idControl):
return getattr(idGlobalFeedback, idControl)
-
+ #########################################
+ ## fcp event handlers
+ #########################################
+ def onFcpConfigData(self, event, msg):
+ pass
+
+ def onFcpRequestCompleted(self, event, msg):
+ pass
+
+ def onFcpRequestProgress(self, event, msg):
+ pass
+
+ def onFcpRequestFailed(self, event, msg):
+ pass
+
+ def onFcpRequestModified(self, event, msg):
+ pass
+
#**********************************************************************************
#
#**********************************************************************************
@@ -89,16 +192,22 @@
from . import Ui_View
from . import Ui_ViewConnection
from . import Ui_ViewLogger
+ from . import Ui_MainWindow
app = QtGui.QApplication(sys.argv)
- w = Ui_View.ViewWidget(None)
- w.addTopViews(
+
+ mainWindow = Ui_MainWindow.MainWindow()
+ viewWidget = Ui_View.ViewWidget(mainWindow)
+ mainWindow.setCentralWidget(viewWidget)
+
+
+ viewWidget.addTopViews(
Ui_ViewConnection.ViewConnectionWidget(None),
ViewDownloadsWidget(None),
)
- w.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
+ viewWidget.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
- w.show()
+ 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-21 10:59:35
|
Revision: 714
http://fclient.svn.sourceforge.net/fclient/?rev=714&view=rev
Author: jUrner
Date: 2008-07-21 10:59:00 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
beautify
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewConnection.py
Modified: trunk/fclient/src/fclient/Ui_ViewConnection.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-21 10:57:23 UTC (rev 713)
+++ trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-21 10:59:00 UTC (rev 714)
@@ -133,7 +133,7 @@
IdEdConnectionHost = 'edConnectionHost' #TODO: combobox? validate input.
IdSpinConnectionPort = 'spinConnectionPort'
- def __init__(self, parent,idGlobalFeedback=config.IdMainWindow):
+ def __init__(self, parent, idGlobalFeedback=config.IdMainWindow):
QtGui.QWidget.__init__(self, parent)
self._isCreated = False
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:57:21
|
Revision: 713
http://fclient.svn.sourceforge.net/fclient/?rev=713&view=rev
Author: jUrner
Date: 2008-07-21 10:57:23 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
a few actions more and a props dialog
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewBrowser.py
Modified: trunk/fclient/src/fclient/Ui_ViewBrowser.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-21 10:54:28 UTC (rev 712)
+++ trunk/fclient/src/fclient/Ui_ViewBrowser.py 2008-07-21 10:57:23 UTC (rev 713)
@@ -31,6 +31,7 @@
from . import config
from .lib import fcp2
+from . import Ui_DlgPropsBrowserObject
from .tpls.Ui_ViewBrowserWidgetTpl import Ui_ViewBrowserWidget
#**********************************************************************************
#
@@ -75,6 +76,13 @@
isEnabled=True,
)
self.action(
+ name='ActionGoToHomePage',
+ text=self.trUtf8('Go to &homepage'),
+ trigger=parent.onActionGoToHomePage,
+ isEnabled=True,
+ )
+
+ self.action(
name='ActionCloseAllTabs',
text=self.trUtf8('Close &all tabs'),
trigger=parent.onActionCloseAllTabs,
@@ -107,6 +115,8 @@
class Settings(config.SettingsBase):
_key_ = config.IdViewBrowserWidget
_settings_ = (
+ ('HomePage', 'String', '', config.SettingScopeUser),
+ ('HomePageIsStartPage', 'Bool', False, config.SettingScopeUser),
)
@@ -152,6 +162,13 @@
def __init__(self, webView):
config.ActionsBase.__init__(self, webView)
+
+ self.action(
+ name='ActionObjectProperties',
+ text=self.trUtf8('Properties..'),
+ trigger=None,
+ isEnabled=True,
+ )
class BrowserGlobalFeedback(config.GlobalFeedbackBase):
@@ -329,7 +346,12 @@
menu.addSeparator()
menu.addAction(self.pageAction(page.Copy))
+
+ menu.addAction(self.fcActions['ActionObjectProperties'])
+ downloadsWidget = config.ObjectRegistry.get(config.IdViewCDownloadsWidget)
+ self.pageAction(page.DownloadImageToDisk).setEnabled(downloadsWidget is not None)
+
action = menu.exec_(event.globalPos())
if action in (self.pageAction(page.OpenLinkInNewWindow), self.pageAction(page.OpenImageInNewWindow), self.pageAction(page.OpenFrameInNewWindow)):
if self.tabWidget is not None:
@@ -347,9 +369,26 @@
elif action == self.pageAction(page.OpenFrameInNewWindow):
browser.load(hitTest.frame().url())
- elif self.pageAction(page.DownloadImageToDisk):
- #TODO: implement
- pass
+ elif action == self.pageAction(page.DownloadImageToDisk):
+ url = hitTest.imageUrl().toString()
+ try:
+ url = str(url)
+ except UnicodeEncodeError:
+ #TODO: handle
+ return
+ try:
+ key = fcp2.Key(url)
+ except ValueError:
+ #TODO: handle
+ return
+ requestIdentifier = config.fcpClient.getData(key)
+ downloadsWidget.addRequest(requestIdentifier)
+
+ elif action == self.fcActions['ActionObjectProperties']:
+ dlg = Ui_DlgPropsBrowserObject.PropsBrowserObjectDlg(self, hitTest=hitTest)
+ if dlg.exec_() == dlg.Accepted:
+ pass
+
def showEvent(self, event):
@@ -511,7 +550,7 @@
config.ObjectRegistry.register(self)
self.fcActions = Actions(self)
- self.fcSettings = Settings()
+ self.fcSettings = Settings().restore()
self.fcViewObject = BrowserViewObject(self)
self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback)
@@ -519,10 +558,10 @@
self.fproxyHost = None
self.fproxyPort = None
- self.fcpEventonrs = (
+ self.fcpEvents = (
(config.fcpClient.events.ConfigData, self.onFcpConfigData),
)
- config.fcpClient.events += self.fcpEventonrs
+ config.fcpClient.events += self.fcpEvents
navBar = self.controlById(self.IdEdNavBar)
self.connect(navBar, QtCore.SIGNAL('returnPressed()'), self.onNavBarReturnPressed)
@@ -593,6 +632,7 @@
#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'])
return menu
@@ -615,6 +655,10 @@
def closeEvent(self):
self.viewClose()
+
+ def viewClose(self):
+ config.fcpClient.events -= self.fcpEvents
+
#########################################
## fcp event onrs
#########################################
@@ -651,7 +695,10 @@
navBar = self.controlById(self.IdEdNavBar)
text = navBar.text()
if text.isEmpty():
- self.fcActions['ActionGoToFProxy'].trigger()
+ if self.fcSettings.value('HomePageIsStartPage'):
+ self.fcActions['ActionGoToHomePage'].trigger()
+ else:
+ self.fcActions['ActionGoToFProxy'].trigger()
else:
self.load(text)
@@ -710,14 +757,21 @@
def onActionGoToFProxy(self, action):
if self.fproxyHost is None:
- #TODO: on
+ #TODO: handle
return
url = QtCore.QUrl()
tabWidget = self.controlById(self.IdTabBrowsers)
if not tabWidget.count():
self.newTab(tabText=self.trUtf8('Waiting for fproxy'))
+ self.load(url)
+ def onActionGoToHomePage(self, action):
+ home = self.fcSettings.value('HomePage')
+ url = QtCore.QUrl(home)
+ tabWidget = self.controlById(self.IdTabBrowsers)
+ if not tabWidget.count():
+ self.newTab(tabText=self.trUtf8('Waiting for fproxy'))
self.load(url)
#**********************************************************************************
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:55:02
|
Revision: 712
http://fclient.svn.sourceforge.net/fclient/?rev=712&view=rev
Author: jUrner
Date: 2008-07-21 10:54:28 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
minor
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_PrefsGlobal.py
Modified: trunk/fclient/src/fclient/Ui_PrefsGlobal.py
===================================================================
--- trunk/fclient/src/fclient/Ui_PrefsGlobal.py 2008-07-21 10:51:12 UTC (rev 711)
+++ trunk/fclient/src/fclient/Ui_PrefsGlobal.py 2008-07-21 10:54:28 UTC (rev 712)
@@ -32,7 +32,7 @@
self.setDirty(True)
def displayName(self):
- return QtGui.QApplication.translate("PreferencesGlobal", 'Global', None, QtGui.QApplication.UnicodeUTF8)
+ return self.trUtf8('Global')
def canApply(self): return True
def canHelp(self): return True
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:51:53
|
Revision: 711
http://fclient.svn.sourceforge.net/fclient/?rev=711&view=rev
Author: jUrner
Date: 2008-07-21 10:51:12 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
save state on exit
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_Prefs.py
Modified: trunk/fclient/src/fclient/Ui_Prefs.py
===================================================================
--- trunk/fclient/src/fclient/Ui_Prefs.py 2008-07-21 10:48:36 UTC (rev 710)
+++ trunk/fclient/src/fclient/Ui_Prefs.py 2008-07-21 10:51:12 UTC (rev 711)
@@ -5,11 +5,20 @@
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),
+ )
+
+
#***********************************************************************
#
#***********************************************************************
@@ -34,7 +43,7 @@
createdNew = True
self._widget = QtGui.QWidget(parent)
self._widget.setVisible(flag)
- return (createdNew, self._widget)
+ return (createdNew, self._widget)
#**********************************************************************************
#
@@ -44,7 +53,9 @@
def __init__(self, parent):
pages = PrefsPageRoot()(
- PrefsPageGlobal()
+ PrefsPageGlobal(),
+ PrefsPageBrowser(),
+
)
dlgpreferences.DlgPreferencesFlatTree.__init__(self,
@@ -52,6 +63,17 @@
pages=pages,
startPage=PrefsPageGlobal.UUID,
)
+ self.fcSettings = Settings(self).restore()
+
+
+ def showEvent(self, event):
+ print self.restoreState(self.fcSettings.value('DlgState'))
+
+ def hideEvent(self, event):
+ self.fcSettings.setValues(DlgState=self.saveState())
+
+ def closeEvent(self, event):
+ pass
#**********************************************************************************
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:48:34
|
Revision: 710
http://fclient.svn.sourceforge.net/fclient/?rev=710&view=rev
Author: jUrner
Date: 2008-07-21 10:48:36 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
add prefs page for browser
Added Paths:
-----------
trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py
Added: trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py
===================================================================
--- trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py (rev 0)
+++ trunk/fclient/src/fclient/Ui_PrefsBrowserWidget.py 2008-07-21 10:48:36 UTC (rev 710)
@@ -0,0 +1,98 @@
+
+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'
+ IdCkHomePageIsStartPage = 'ckHomePageIsStartPage'
+
+ 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:
+ ed = self.controlById(self.IdEdHomePage)
+ ed.setText(browser.fcSettings.value('HomePage'))
+
+ ck = self.controlById(self.IdCkHomePageIsStartPage)
+ ck.setCheckState(QtCore.Qt.Checked if browser.fcSettings.value('HomePageIsStartPage') else QtCore.Qt.Unchecked)
+
+
+
+ def controlById(self, idControl):
+ return getattr(self, idControl)
+
+ def apply(self):
+ browser = config.ObjectRegistry.get(config.IdViewBrowserWidget, None)
+ self.setEnabled(browser is not None)
+ if browser is not None:
+ edHomePage = self.controlById(self.IdEdHomePage)
+ ckHomePageIsStartPage = self.controlById(self.IdCkHomePageIsStartPage)
+
+ browser.fcSettings.setValues(
+ HomePage=edHomePage.text(),
+ HomePageIsStartPage=ckHomePageIsStartPage.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()
+
+ def doOk(self):
+ self._widget.apply()
+
+
+#***********************************************************************
+#
+#***********************************************************************
+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)
+
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:47:15
|
Revision: 709
http://fclient.svn.sourceforge.net/fclient/?rev=709&view=rev
Author: jUrner
Date: 2008-07-21 10:47:17 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
add props dialog for browser
Added Paths:
-----------
trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py
Added: trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py
===================================================================
--- trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py (rev 0)
+++ trunk/fclient/src/fclient/Ui_DlgPropsBrowserObject.py 2008-07-21 10:47:17 UTC (rev 709)
@@ -0,0 +1,64 @@
+#*********************************************************************
+#TODO:
+# just a sketch so far
+#
+# x. layout labels
+# x. limits! compact urls, truncate text (...)
+#
+#
+#**********************************************************************
+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 .tpls.Ui_DlgPropsBrowserObjectTpl import Ui_DlgPropsBrowserObject
+#**********************************************************************************
+#
+#**********************************************************************************
+class PropsBrowserObjectDlg(QtGui.QDialog, Ui_DlgPropsBrowserObject):
+
+ IdLabelType = 'labelType'
+ IdLabelTitle = 'labelTitle'
+ IdLabelName = 'labelName'
+ IdLabelLinkUrl = 'labelLinkUrl'
+ IdLabelImageUrl = 'labelImageUrl'
+
+
+ def __init__(self, parent, browser=None, hitTest=None):
+ QtGui.QDialog.__init__(self, parent)
+
+ self.setupUi(self)
+
+ if hitTest is not None:
+ self.labelTitle.setText(hitTest.linkTitle().toString())
+ self.labelName.setText(hitTest.linkText())
+
+ if not hitTest.linkUrl().isEmpty():
+ self.labelLinkUrl.setText(hitTest.linkUrl().toString())
+ if not hitTest.imageUrl().isEmpty():
+ self.labelImageUrl.setText(hitTest.imageUrl().toString())
+
+
+
+ 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)
+
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:44:23
|
Revision: 708
http://fclient.svn.sourceforge.net/fclient/?rev=708&view=rev
Author: jUrner
Date: 2008-07-21 10:43:44 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
add default settings dir
Added Paths:
-----------
trunk/fclient/src/fclient/settings/
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-21 10:36:57
|
Revision: 706
http://fclient.svn.sourceforge.net/fclient/?rev=706&view=rev
Author: jUrner
Date: 2008-07-21 10:36:11 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
update progress on successful completion
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/client.py
Modified: trunk/fclient/src/fclient/lib/fcp2/client.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-21 10:32:57 UTC (rev 705)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-21 10:36:11 UTC (rev 706)
@@ -818,6 +818,7 @@
initialRequest['RequestStatus'] |= consts.ConstRequestStatus.Success
initialRequest['MetadataContentType'] = msg.get('Metadata.ContentType', '')
initialRequest['MetadataSize'] = msg.get('DataLength', '')
+ initialRequest['ProgressSucceeeded'] = initialRequest['ProgressRequired']
# except from GetData all requests are complete here. Next GetData will run through AllData...
@@ -1002,6 +1003,7 @@
# we ignore them
initialRequest['RequestStatus'] |= consts.ConstRequestStatus.Success
initialRequest['URI'] = msg['URI']
+ initialRequest['ProgressSucceeeded'] = initialRequest['ProgressRequired']
self._finalizeRequest(msg, initialRequest, self.events.RequestCompleted)
return True
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:33:32
|
Revision: 705
http://fclient.svn.sourceforge.net/fclient/?rev=705&view=rev
Author: jUrner
Date: 2008-07-21 10:32:57 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
...
Modified Paths:
--------------
trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py
trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py 2008-07-21 10:29:59 UTC (rev 704)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py 2008-07-21 10:32:57 UTC (rev 705)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui'
#
-# Created: Sun Jul 20 23:07:41 2008
+# Created: Mon Jul 21 12:30:45 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
Modified: trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui 2008-07-21 10:29:59 UTC (rev 704)
+++ trunk/fclient/src/fclient/tpls/ViewDownloadsWidgetTpl.ui 2008-07-21 10:32:57 UTC (rev 705)
@@ -14,7 +14,13 @@
</property>
<layout class="QGridLayout" name="gridLayout" >
<item row="0" column="0" >
- <widget class="QTreeView" name="treeView" />
+ <widget class="QTreeWidget" name="tree" >
+ <column>
+ <property name="text" >
+ <string>1</string>
+ </property>
+ </column>
+ </widget>
</item>
</layout>
</widget>
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:29:57
|
Revision: 704
http://fclient.svn.sourceforge.net/fclient/?rev=704&view=rev
Author: jUrner
Date: 2008-07-21 10:29:59 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
...
Modified Paths:
--------------
trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py
trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py 2008-07-21 10:27:21 UTC (rev 703)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py 2008-07-21 10:29:59 UTC (rev 704)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui'
#
-# Created: Wed Jul 16 16:55:20 2008
+# Created: Mon Jul 21 09:35:32 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py 2008-07-21 10:27:21 UTC (rev 703)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewDownloadsWidgetTpl.py 2008-07-21 10:29:59 UTC (rev 704)
@@ -2,7 +2,7 @@
# 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
+# Created: Sun Jul 20 23:07:41 2008
# by: PyQt4 UI code generator 4.4.3-snapshot-20080705
#
# WARNING! All changes made in this file will be lost!
@@ -15,15 +15,16 @@
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.tree = QtGui.QTreeWidget(ViewDownloadsWidget)
+ self.tree.setObjectName("tree")
+ self.gridLayout.addWidget(self.tree, 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))
+ self.tree.headerItem().setText(0, QtGui.QApplication.translate("ViewDownloadsWidget", "1", 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-21 10:27:50
|
Revision: 703
http://fclient.svn.sourceforge.net/fclient/?rev=703&view=rev
Author: jUrner
Date: 2008-07-21 10:27:21 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
templates for browser props
Added Paths:
-----------
trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui
trunk/fclient/src/fclient/tpls/Ui_DlgPropsBrowserObjectTpl.py
Added: trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/tpls/DlgPropsBrowserObjectTpl.ui 2008-07-21 10:27:21 UTC (rev 703)
@@ -0,0 +1,240 @@
+<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>189</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Dialog</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <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>
+ </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>
+ </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>397</width>
+ <height>17</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::Ok</set>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections>
+ <connection>
+ <sender>buttonBox</sender>
+ <signal>accepted()</signal>
+ <receiver>DlgPropsBrowserObject</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>DlgPropsBrowserObject</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_DlgPropsBrowserObjectTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_DlgPropsBrowserObjectTpl.py (rev 0)
+++ trunk/fclient/src/fclient/tpls/Ui_DlgPropsBrowserObjectTpl.py 2008-07-21 10:27:21 UTC (rev 703)
@@ -0,0 +1,152 @@
+# -*- coding: utf-8 -*-
+
+# 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
+# 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_DlgPropsBrowserObject(object):
+ def setupUi(self, DlgPropsBrowserObject):
+ DlgPropsBrowserObject.setObjectName("DlgPropsBrowserObject")
+ DlgPropsBrowserObject.resize(420, 189)
+ 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.label = QtGui.QLabel(DlgPropsBrowserObject)
+ sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred)
+ sizePolicy.setHorizontalStretch(0)
+ sizePolicy.setVerticalStretch(0)
+ sizePolicy.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
+ 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.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.setObjectName("labeType")
+ self.verticalLayout.addWidget(self.labeType)
+ 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.setObjectName("labelTitle")
+ self.verticalLayout.addWidget(self.labelTitle)
+ 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.setObjectName("labelName")
+ self.verticalLayout.addWidget(self.labelName)
+ 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.setObjectName("labelLinkUrl")
+ self.verticalLayout.addWidget(self.labelLinkUrl)
+ 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.setObjectName("labelImageUrl")
+ self.verticalLayout.addWidget(self.labelImageUrl)
+ self.horizontalLayout.addLayout(self.verticalLayout)
+ self.gridLayout.addLayout(self.horizontalLayout, 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)
+ self.line.setFrameShape(QtGui.QFrame.HLine)
+ self.line.setFrameShadow(QtGui.QFrame.Sunken)
+ self.line.setObjectName("line")
+ self.gridLayout.addWidget(self.line, 2, 0, 1, 1)
+ self.buttonBox = QtGui.QDialogButtonBox(DlgPropsBrowserObject)
+ self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
+ self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok)
+ self.buttonBox.setObjectName("buttonBox")
+ self.gridLayout.addWidget(self.buttonBox, 3, 0, 1, 1)
+
+ self.retranslateUi(DlgPropsBrowserObject)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("accepted()"), DlgPropsBrowserObject.accept)
+ QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL("rejected()"), DlgPropsBrowserObject.reject)
+ QtCore.QMetaObject.connectSlotsByName(DlgPropsBrowserObject)
+
+ 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.labeType.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+ self.labelTitle.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+ self.labelName.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+ self.labelLinkUrl.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+ self.labelImageUrl.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8))
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ DlgPropsBrowserObject = QtGui.QDialog()
+ ui = Ui_DlgPropsBrowserObject()
+ ui.setupUi(DlgPropsBrowserObject)
+ DlgPropsBrowserObject.show()
+ sys.exit(app.exec_())
+
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:24:21
|
Revision: 702
http://fclient.svn.sourceforge.net/fclient/?rev=702&view=rev
Author: jUrner
Date: 2008-07-21 10:23:46 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
templates for browser prefs
Added Paths:
-----------
trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui
trunk/fclient/src/fclient/tpls/Ui_PrefsBrowserWidgetTpl.py
Added: trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui 2008-07-21 10:23:46 UTC (rev 702)
@@ -0,0 +1,54 @@
+<ui version="4.0" >
+ <class>PrefsBrowserWidget</class>
+ <widget class="QWidget" name="PrefsBrowserWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>532</width>
+ <height>354</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout" >
+ <item row="0" column="0" >
+ <layout class="QHBoxLayout" name="horizontalLayout" >
+ <item>
+ <widget class="QLabel" name="label" >
+ <property name="text" >
+ <string>Homepage:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="edHomePage" />
+ </item>
+ </layout>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QCheckBox" name="ckHomePageIsStartPage" >
+ <property name="text" >
+ <string>Homepage is start page</string>
+ </property>
+ </widget>
+ </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>297</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
Added: trunk/fclient/src/fclient/tpls/Ui_PrefsBrowserWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_PrefsBrowserWidgetTpl.py (rev 0)
+++ trunk/fclient/src/fclient/tpls/Ui_PrefsBrowserWidgetTpl.py 2008-07-21 10:23:46 UTC (rev 702)
@@ -0,0 +1,50 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/PrefsBrowserWidgetTpl.ui'
+#
+# Created: Mon Jul 21 10:53:36 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_PrefsBrowserWidget(object):
+ def setupUi(self, PrefsBrowserWidget):
+ PrefsBrowserWidget.setObjectName("PrefsBrowserWidget")
+ PrefsBrowserWidget.resize(532, 354)
+ self.gridLayout = QtGui.QGridLayout(PrefsBrowserWidget)
+ self.gridLayout.setObjectName("gridLayout")
+ self.horizontalLayout = QtGui.QHBoxLayout()
+ self.horizontalLayout.setObjectName("horizontalLayout")
+ self.label = QtGui.QLabel(PrefsBrowserWidget)
+ self.label.setObjectName("label")
+ self.horizontalLayout.addWidget(self.label)
+ self.edHomePage = QtGui.QLineEdit(PrefsBrowserWidget)
+ self.edHomePage.setObjectName("edHomePage")
+ self.horizontalLayout.addWidget(self.edHomePage)
+ self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
+ self.ckHomePageIsStartPage = QtGui.QCheckBox(PrefsBrowserWidget)
+ self.ckHomePageIsStartPage.setObjectName("ckHomePageIsStartPage")
+ self.gridLayout.addWidget(self.ckHomePageIsStartPage, 1, 0, 1, 1)
+ spacerItem = QtGui.QSpacerItem(20, 297, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
+ self.gridLayout.addItem(spacerItem, 2, 0, 1, 1)
+
+ self.retranslateUi(PrefsBrowserWidget)
+ QtCore.QMetaObject.connectSlotsByName(PrefsBrowserWidget)
+
+ def retranslateUi(self, PrefsBrowserWidget):
+ PrefsBrowserWidget.setWindowTitle(QtGui.QApplication.translate("PrefsBrowserWidget", "Form", None, QtGui.QApplication.UnicodeUTF8))
+ self.label.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Homepage:", None, QtGui.QApplication.UnicodeUTF8))
+ self.ckHomePageIsStartPage.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Homepage is start page", None, QtGui.QApplication.UnicodeUTF8))
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ PrefsBrowserWidget = QtGui.QWidget()
+ ui = Ui_PrefsBrowserWidget()
+ ui.setupUi(PrefsBrowserWidget)
+ PrefsBrowserWidget.show()
+ sys.exit(app.exec_())
+
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:19:23
|
Revision: 701
http://fclient.svn.sourceforge.net/fclient/?rev=701&view=rev
Author: jUrner
Date: 2008-07-21 10:18:49 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
versionInfo() returns now sip version aswell
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py 2008-07-21 10:15:50 UTC (rev 700)
+++ trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py 2008-07-21 10:18:49 UTC (rev 701)
@@ -14,11 +14,18 @@
"""
import sys
from PyQt4.QtCore import qVersion, PYQT_VERSION_STR
+ try:
+ import sipconfig
+ sipVersion = sipconfig.Configuration().sip_version_str
+ except ImportError:
+ sipVersion = 'unknown'
+
return (
('Platform', sys.platform),
('Python Version', sys.version.split()[0]),
('Qt Version', qVersion()),
('PyQt Version', PYQT_VERSION_STR),
+ ('Sip Version', sipVersion)
)
#***************************************************************
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:16:28
|
Revision: 700
http://fclient.svn.sourceforge.net/fclient/?rev=700&view=rev
Author: jUrner
Date: 2008-07-21 10:15:50 +0000 (Mon, 21 Jul 2008)
Log Message:
-----------
combed over restoreState()
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/dlgpreferences.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/dlgpreferences.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/dlgpreferences.py 2008-07-20 19:59:12 UTC (rev 699)
+++ trunk/fclient/src/fclient/lib/qt4ex/dlgpreferences.py 2008-07-21 10:15:50 UTC (rev 700)
@@ -658,26 +658,31 @@
def restoreState(self, state):
"""Restors the state of the dialog
- @param state: (str) state to restore
+ @param state: (str, QString) state to restore
+ @return: (bool) True if the state could be restored, False otherwise
"""
+ if isinstance(state, QtCore.QString):
+ state = str(state)
try:
state = cPickle.loads(state)
assert isinstance(state, dict)
except Exception, d:
- pass
+ print Exception, d
+ return False
else:
try:
self.restoreGeometry(state.get('geometry', None))
except Exception, d:
- pass
+ print 2
+ return False
try:
self.controlById(self.IdSplitter).restoreState(state.get('splitter', None))
except Exception, d:
- pass
+ return False
try:
self.selectPage(state.get('currentPage', None))
except Exception, d:
- pass
+ return False
try:
expandedPages = state.get('expandedPages', None)
tree = self.controlById(self.IdTreePages)
@@ -685,7 +690,9 @@
uuid = str( item.data(0, QtCore.Qt.UserRole).toString() )
if uuid in expandedPages:
item.setExpanded(True)
- except: pass
+ except Exception, d:
+ return False
+ return True
def setWindowTitle(self, title):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-20 19:59:03
|
Revision: 699
http://fclient.svn.sourceforge.net/fclient/?rev=699&view=rev
Author: jUrner
Date: 2008-07-20 19:59:12 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
removed RequestType param - no longer needed
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/message.py
Modified: trunk/fclient/src/fclient/lib/fcp2/message.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/message.py 2008-07-20 19:57:42 UTC (rev 698)
+++ trunk/fclient/src/fclient/lib/fcp2/message.py 2008-07-20 19:59:12 UTC (rev 699)
@@ -291,7 +291,6 @@
class PersistentParamsGet(pmstruct.PMStruct):
_fields_ = (
('Version', pmstruct.INT),
- ('RequestType', pmstruct.INT),
('InitTime', pmstruct.FLOAT),
('PersistentUserData', pmstruct.STRING),
('HandleFilenameCollision', pmstruct.BOOL),
@@ -304,7 +303,6 @@
class PersistentParamsPut(pmstruct.PMStruct):
_fields_ = (
('Version', pmstruct.INT),
- ('RequestType', pmstruct.INT),
('InitTime', pmstruct.FLOAT),
('PersistentUserData', pmstruct.STRING),
)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-20 19:57:34
|
Revision: 698
http://fclient.svn.sourceforge.net/fclient/?rev=698&view=rev
Author: jUrner
Date: 2008-07-20 19:57:42 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
removed RequestType param - no longer needed
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/__init__.py
trunk/fclient/src/fclient/lib/fcp2/client.py
trunk/fclient/src/fclient/lib/fcp2/consts.py
trunk/fclient/src/fclient/lib/fcp2/message.py
trunk/fclient/src/fclient/lib/fcp2/test/test_client.py
Modified: trunk/fclient/src/fclient/lib/fcp2/__init__.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/__init__.py 2008-07-20 17:55:11 UTC (rev 697)
+++ trunk/fclient/src/fclient/lib/fcp2/__init__.py 2008-07-20 19:57:42 UTC (rev 698)
@@ -17,12 +17,11 @@
from .client import Client
from .config import (Config, ConfigDataType, ConfigItem, ConfigKeySep, ConfigValueClass)
from .consts import (ConstByteAmountPostfix, ConstConnectReason, ConstDebugVerbosity, ConstDisconnectReason,
- ConstFetchError, ConstInsertError, ConstKeyType, ConstLogMessages,
- ConstLogger, ConstMessage, ConstPeerNodeStatus, ConstPeerNoteType, ConstPersistence,
- ConstPriority, ConstProtocolError, ConstRequestModified, ConstRequestStatus,
- ConstRequestType, ConstReturnType, ConstTimeDeltaPostfix, ConstUploadFrom, ConstVerbosity,
- Error, ErrorIOBroken, ErrorIOClosed, ErrorIOConnectFailed, ErrorIOTimeout, ErrorMessageParse,
- FcpFalse, FcpTrue)
+ ConstFetchError, ConstInsertError, ConstKeyType, ConstLogMessages, ConstLogger, ConstMessage,
+ ConstPeerNodeStatus, ConstPeerNoteType, ConstPersistence, ConstPriority, ConstProtocolError,
+ ConstRequestModified, ConstRequestStatus, ConstPutMultiple, ConstReturnType,
+ ConstTimeDeltaPostfix, ConstUploadFrom, ConstVerbosity, Error, ErrorIOBroken, ErrorIOClosed,
+ ErrorIOConnectFailed, ErrorIOTimeout, ErrorMessageParse, FcpFalse, FcpTrue)
from .key import (Key, KeyCHK, KeyKSK, KeySSK, KeyTypesAll, KeyUSK, TypeKey, base64UrlsaveDecode, keyNormkey)
from .message import (MessagesAll, MsgAddPeer, MsgAllData, MsgClientDisconnected, MsgClientGet, MsgClientHello,
MsgClientPut, MsgClientPutComplexDir, MsgClientPutDiskDir, MsgClientSocketDied,
Modified: trunk/fclient/src/fclient/lib/fcp2/client.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-20 17:55:11 UTC (rev 697)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-20 19:57:42 UTC (rev 698)
@@ -352,7 +352,6 @@
def registerRequest(self,
msg,
- requestType,
userData=None,
identifier=None,
initTime=None,
@@ -362,7 +361,6 @@
):
"""Registers a request
@param msg: message to register
- @param requestType: (L{consts.ConstRequestType}) type of request to register
@param handleFilenameCollision: (bool) if True, the file is automatically renamed if "filename" collides
with a file object already present on disk
@param identifier: (str) identifier of the request or None to create a new one
@@ -381,9 +379,8 @@
#TODO: keep an eye on additional params, they may collide with Fcp parameters
msg['Identifier'] = self.newIdentifier(identifiers=self._requests) if identifier is None else identifier
- msg['RequestType'] = requestType
msg['InitTime'] = time.time() if initTime is None else initTime
- if requestType & consts.ConstRequestType.MaskGet:
+ if msg == message.MsgClientGet:
msg['HandleFilenameCollision'] = handleFilenameCollision
msg['HandlePermanentRedirect'] = handlePermanentRedirect
msg['UserData'] = userData
@@ -391,17 +388,17 @@
msg['ClientToken'] = ''
msg.updatePersistentParams()
- elif requestType & consts.ConstRequestType.MaskPut:
+ elif msg == message.MsgClientPut or msg == message.MsgClientPutDiskDir or msg == message.MsgClientPutComplexDir:
msg['UserData'] = userData
msg['PersistentUserData'] = persistentUserData
msg['ClientToken'] = ''
msg.updatePersistentParams()
- elif requestType & consts.ConstRequestType.MaskGenerateKeypair:
+ elif msg == message.MsgGenerateSSK:
pass
- elif requestType & consts.ConstRequestType.SubscribeUSK:
+ elif msg == message.MsgSubscribeUSK:
msg['UserData'] = userData
- elif requestType & consts.ConstRequestType.PluginInfo:
+ elif msg == message.MsgGetPluginInfo:
pass
else:
raise ValueError('Can not register request: ' + msg.name)
@@ -827,7 +824,7 @@
# For GetData with persistence != connection the node sends no All Data message
# whatever that is good for ..fix this here to get all GetData request to complete on
# All Data.
- if initialRequest['RequestType'] == consts.ConstRequestType.GetData:
+ if initialRequest['ReturnType'] == consts.ConstReturnType.Direct and not initialRequest['IsGetKeyInfo']:
if initialRequest['Persistence'] != consts.ConstPersistence.Connection:
self.sendMessage(
message.MsgGetRequestStatus(
@@ -866,7 +863,7 @@
return True
# check if it is one of our requests for key information
- if code == consts.ConstFetchError.TooBig and initialRequest['RequestType'] & consts.ConstRequestType.GetKeyInfo:
+ if code == consts.ConstFetchError.TooBig and initialRequest['IsGetKeyInfo']:
initialRequest['MetadataContentType'] = msg.get('ExpectedMetadata.ContentType', '')
initialRequest['DataLength'] = msg.get('ExpectedDataLength', -1)
initialRequest['RequestStatus'] |= consts.ConstRequestStatus.Success
@@ -1097,8 +1094,7 @@
insertURI = msg['InsertURI']
requestURI = msg['RequestURI']
-
- if initialRequest['RequestType'] & consts.ConstRequestType.GenerateUSKKeypair:
+ if initialRequest['KeyPairType'] == consts.ConstKeyType.USK:
insertURI = key.KeyUSK(insertURI.keyData, docName=insertURI.docName)
insertURI = key.KeyUSK(insertURI.keyData, docName=insertURI.docName)
requestURI = key.KeyUSK(requestURI.keyData, docName=requestURI.docName)
@@ -1266,46 +1262,6 @@
## ClientGet related methods
##
########################################################
- def clientGet(self,
- uri,
- requestType,
- userData,
- persistentUserData,
- handleFilenameCollision=False,
- handlePermanentRedirect=False,
- **messageParams
- ):
- """Requests a key from the node
- @param uri: (L{key._KeyBase}) key to request
- @param requestType: (L{consts.ConstRequestType}) sub type of the message
- @param userData: any non persistent data to associate to the request or None
- @param persistentUserData: any string to associate to the request as persistent data or None
- @param handleFilenameCollision: (bool) if True, the file is automatically renamed if "filename" collides
- with a file object already present on disk
- @param handlePermanentRedirect: (bool) if True, permanent redirect are handled automatically. for example USK@.../-1
- will look for the current edition. if handlePermanentRedirect is True, the request is automatically resend to retrieve the current edition
- @param messageParams: keyword arguments to pass along with the ClientGet message (uppercase first letter!!).
- If the value of a keyword is None, it is ignored.
-
- @return: (str) request identifier
- """
- msg = message.MsgClientGet(URI=uri)
- for paramName, value in messageParams.items():
- if value is not None:
- msg[paramName] = value
-
- self.registerRequest(
- msg,
- requestType,
- handleFilenameCollision=handleFilenameCollision,
- handlePermanentRedirect=handlePermanentRedirect,
- persistentUserData=persistentUserData,
- userData=userData,
- )
- self.sendMessage(msg)
- return msg['Identifier']
-
-
def getData(self,
uri,
@@ -1351,28 +1307,31 @@
@note: if persistence is L{consts.ConstPersistence.Connection} the request is removed from the client
as soon as it completes or failes
"""
- return self.clientGet(
- uri,
- consts.ConstRequestType.GetData,
- userData,
- persistentUserData,
- handlePermanentRedirect=handlePermanentRedirect,
-
- # Fcp params
- AllowedMimeTypes = allowedMimeTypes,
+ msg = message.MsgClientGet(
+ URI=uri,
BinaryBlob=binaryBlob,
Global=False,
DSOnly=dsOnly,
Identifier=None,
IgnoreDS=ignoreDS,
- MaxRetries = maxRetries,
- MaxSize = maxSize,
Persistence=persistence,
PriorityClass=priorityClass,
ReturnType=consts.ConstReturnType.Direct,
Verbosity=consts.ConstVerbosity.ReportProgress,
)
-
+ if allowedMimeTypes is not None: msg['AllowedMimeTypes'] = allowedMimeTypes
+ if maxRetries is not None: msg['MaxRetries'] = maxRetries
+ if maxSize is not None: msg['MaxSize'] = maxSize
+
+ self.registerRequest(
+ msg,
+ handlePermanentRedirect=handlePermanentRedirect,
+ persistentUserData=persistentUserData,
+ userData=userData,
+ )
+ self.sendMessage(msg)
+ return msg['Identifier']
+
def getFile(self,
uri,
@@ -1424,31 +1383,34 @@
@note: if persistence is L{consts.ConstPersistence.Connection} the request is removed from the client
as soon as it completes or failes
"""
- return self.clientGet(
- uri,
- consts.ConstRequestType.GetFile,
- userData,
- persistentUserData,
- handleFilenameCollision=handleFilenameCollision,
- handlePermanentRedirect=handlePermanentRedirect,
-
- # Fcp params
- AllowedMimeTypes = allowedMimeTypes,
- BinaryBlob=binaryBlob,
+ msg = message.MsgClientGet(
+ URI=uri,
Filename=filename,
+ BinaryBlob=binaryBlob,
Global=False,
DSOnly=dsOnly,
Identifier=None,
IgnoreDS=ignoreDS,
- MaxRetries = maxRetries,
- MaxSize = maxSize,
- Persistence=persistence,
+ Persistence=persistence,
PriorityClass=priorityClass,
- ReturnType=consts.ConstReturnType.Disk,
+ ReturnType=consts.ConstReturnType.Direct,
Verbosity=consts.ConstVerbosity.ReportProgress,
- )
+ )
+ if allowedMimeTypes is not None: msg['AllowedMimeTypes'] = allowedMimeTypes
+ if maxRetries is not None: msg['MaxRetries'] = maxRetries
+ if maxSize is not None: msg['MaxSize'] = maxSize
+ self.registerRequest(
+ msg,
+ handleFilenameCollision=handleFilenameCollision,
+ handlePermanentRedirect=handlePermanentRedirect,
+ persistentUserData=persistentUserData,
+ userData=userData,
+ )
+ self.sendMessage(msg)
+ return msg['Identifier']
+
def getKeyInfo(self,
uri,
@@ -1488,27 +1450,33 @@
as soon as it completes or failes
"""
# how to retrieve meta info about a key? ...idea is to provoke a GetFailed (TooBig)
- return self.clientGet(
- uri,
- consts.ConstRequestType.GetKeyInfo,
- userData,
- persistentUserData,
- handlePermanentRedirect=handlePermanentRedirect,
-
- # Fcp params
+ msg = message.MsgClientGet(
+ URI=uri,
Global=False,
DSOnly=dsOnly,
Identifier=None,
IgnoreDS=ignoreDS,
- MaxRetries = maxRetries,
MaxSize=self.MaxSizeKeyInfo,
Persistence=persistence,
PriorityClass=priorityClass,
- ReturnType=consts.ConstReturnType.Nothing,
+ ReturnType=consts.ConstReturnType.Direct,
Verbosity=consts.ConstVerbosity.ReportProgress,
+
+ IsGetKeyInfo=True,
)
-
-
+ if maxRetries is not None: msg['MaxRetries'] = maxRetries
+
+
+ self.registerRequest(
+ msg,
+ handlePermanentRedirect=handlePermanentRedirect,
+ persistentUserData=persistentUserData,
+ userData=userData,
+ )
+ self.sendMessage(msg)
+ return msg['Identifier']
+
+
def subscribeUSK(self, uri, dontPoll=True):
"""Asks the node to notify the client when an USK is updated
@param uri: (L{key.KeyUSK}) key to subscribe to
@@ -1535,158 +1503,6 @@
## CHK ClientPut related methods
##
########################################################
- def clientPut(self,
- requestType,
- uri,
- userData=None,
- persistentUserData=None,
- data=None,
- items=None,
- **msgParams
- ):
- """Uploads to the node
- @param requestType: (L{consts.ConstRequestType}). Can be PutData, PutDir or PutMultiple
- @param uri: (str) key or Uri
- @param data: (str) for L{consts.ConstRequestType.PutData} data to upload or None
- @param persistentUserData: (str) persistent data to be assosiated to the requestor None
- @param userData: (any) any data to be associated to the request at runtime or None
- @param items: for L{consts.ConstRequestType.PutMultiple}, items to upload
- @param msgParams: (dict) Fcp parameters to pass along with the message
-
- @note: the Fcp message parameter 'Metadata.ContentType' may be passed as 'ContentType'
- to this method
- @note: to upload multiple items at once pass a dict for each item containig the following members:
-
- - RequestType: L{consts.ConstRequestType.PutData}, L{consts.ConstRequestType.PutFile} or L{consts.ConstRequestType.PutRedirect}
- - Data: if requestType is L{consts.ConstRequestType.PutData}, data to upload
- - Filename: if requestType is L{consts.ConstRequestType.PutFile}, filepath of the file to upload
- - TargetURI: if requestType is L{consts.ConstRequestType.PutRedirect}, uri to redirect to
- - Name: name under wich the item will be accesible via freenet
- - Metadata.ContentType: (optional) may be passed as 'ContentType'
-
- All items will be accessible under one single key as 'Uri/Name'. The default item (the item when
- only 'Uri' is requested from freenet) is always the first item in the list.
- """
-
- #FIX: enables passing params as python keywords
- contentType = msgParams.get('ContentType', None)
- if contentType is not None:
- del msgParams['ContentType']
- msgParams['Metadata.ContentType'] = contentType
-
- # find out wich message to use
- if requestType & (consts.ConstRequestType.PutData | consts.ConstRequestType.PutFile | consts.ConstRequestType.PutRedirect):
- msgClass = message.MsgClientPut
- elif requestType & consts.ConstRequestType.PutDir:
- msgClass = message.MsgClientPutDiskDir
- elif requestType & consts.ConstRequestType.PutMultiple:
- msgClass = message.MsgClientPutComplexDir
- else:
- raise ValueError('Unsupported request type')
- msg = msgClass(URI=uri)
-
- #
- if uri.KeyType == consts.ConstKeyType.CHK:
- if uri.tail is not None:
- raise ValueError('no tail allowed')
- if uri.filename is not None:
- msg['TargetFilename'] = uri.docName
- elif uri.KeyType == consts.ConstKeyType.SSK:
- if uri.tail is not None:
- raise ValueError('no tail allowed')
- elif uri.KeyType == consts.ConstKeyType.USK:
- if uri.tail is not None:
- raise ValueError('no tail allowed')
-
- # add params
- for param, value in msgParams.items():
- if value is not None:
- msg[param] = value
-
- if data is not None:
- if not requestType & consts.ConstRequestType.PutData:
- raise ValueError('Data can only be passed along with putData uploads')
- msg.data = data
-
- if items is not None:
- if not requestType & consts.ConstRequestType.PutMultiple:
- raise ValueError('Items can only be passed along with PutMultiple uploads')
-
- uploadTypeMapping = {
- consts.ConstRequestType.PutData: consts.ConstUploadFrom.Direct,
- consts.ConstRequestType.PutFile: consts.ConstUploadFrom.Disk,
- consts.ConstRequestType.PutRedirect: consts.ConstUploadFrom.Redirect,
- }
- # requestType --> [(allowedParam: boolParamIsRequired), ...]
- paramMapping = {
- consts.ConstRequestType.PutData: [
- ('Name', True),
- ('Data', True),
- ('ContentType', False),
- ],
- consts.ConstRequestType.PutFile: [
- ('Name', True),
- ('Filename', True),
- ('Metadata.ContentType', False),
- ],
- consts.ConstRequestType.PutRedirect: [
- ('Name', True),
- ('TargetURI', True),
- ],
- }
-
- data = ''
- for n, item in enumerate(items):
- requestType = item.get('RequestType', None)
- if requestType is None:
- raise ValueError('No request type specified for item: %s' % n)
- uploadFrom = uploadTypeMapping.get(requestType, None)
- if uploadFrom is None:
- raise ValueError('Unsupported request type for item %s: %s' % (n, requestType))
-
- contentType = item.get('ContentType', None)
- if contentType is not None:
- del msgParams['ContentType']
- item['Metadata.ContentType'] = contentType
-
- allowedParams = dict(paramMapping[requestType])
- msg.params['Files.%s.UploadFrom' % n] = uploadFrom
- for param, value in item.items():
- if param == 'RequestType':
- continue
-
- if param in allowedParams:
- del allowedParams[param]
- else:
- raise ValueError('Unsupported param for item %s: %s' % (n, param))
-
- if param == 'Data':
- data += value
- msg.params['Files.%s.DataLength' % n] = len(value)
- continue
- msg.params['Files.%s.%s' % (n, param)] = value
-
- # errorcheck params
- if allowedParams:
- for paramName, isRequired in allowedParams.items():
- if isRequired:
- raise ValueError('Param "%s" is required for item %s' % (paramName, n))
-
- msg['DefaultName'] = items[0].get('Name', '')
- if data:
- msg.data = data
-
- # finally
- self.registerRequest(
- msg,
- requestType,
- persistentUserData=persistentUserData,
- userData=userData,
- )
- self.sendMessage(msg)
- return msg['Identifier']
-
-
def putData(self,
uri,
data,
@@ -1726,29 +1542,46 @@
@todo: EarlyEncode and GetCHKOnly message params not implemented
"""
- return self.clientPut(
- consts.ConstRequestType.PutData,
- uri,
- userData,
- persistentUserData,
- data=data,
-
- # fcp params
- ContentType=contentType,
+ msg = message.MsgClientPut(
+ URI=uri,
DataLength=len(data),
#EarlyEncode='false',
#GetCHKOnly='false',
Global=False,
Identifier=None,
- MaxRetries=maxRetries,
- DontCompress=dontCompress,
Persistence=persistence,
PriorityClass=priorityClass,
UploadFrom=consts.ConstUploadFrom.Direct,
Verbosity=consts.ConstVerbosity.ReportProgress | consts.ConstVerbosity.ReportCompression,
)
-
-
+
+ #
+ if uri.KeyType == consts.ConstKeyType.CHK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ if uri.filename is not None:
+ msg['TargetFilename'] = uri.docName
+ elif uri.KeyType == consts.ConstKeyType.SSK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ elif uri.KeyType == consts.ConstKeyType.USK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+
+ if contentType is not None: msg['Metadata.ContentType'] = allowedMimeTypes
+ if dontCompress is not None: msg['DontCompress'] = dontCompresss
+ if maxRetries is not None: msg['MaxRetries'] = maxRetries
+
+ msg.data = data
+ self.registerRequest(
+ msg,
+ persistentUserData=persistentUserData,
+ userData=userData,
+ )
+ self.sendMessage(msg)
+ return msg['Identifier']
+
+
def putDir(self,
uri,
directory,
@@ -1760,8 +1593,7 @@
maxRetries=None,
persistence=consts.ConstPersistence.Connection,
priorityClass=consts.ConstPriority.Medium,
- targetFilename=None,
-
+
userData=None,
persistentUserData='',
@@ -1781,29 +1613,47 @@
@todo: EarlyEncode and GetCHKOnly message params not implemented
@todo: 2MiB compressed zize allowed?
"""
- return self.clientPut(
- consts.ConstRequestType.PutDir,
- uri,
- userData,
- persistentUserData,
-
- # fcp params
- ContentType=contentType,
- DefaultName=defaultName,
- #EarlyEncode='false',
+ msg = message.MsgClientPutDiskDir(
+ URI=uri,
Filename=directory,
+ #EarlyEncode='false',
#GetCHKOnly='false',
Global=False,
Identifier=None,
- MaxRetries=maxRetries,
DontCompress=dontCompress,
Persistence=persistence,
PriorityClass=priorityClass,
UploadFrom=consts.ConstUploadFrom.Disk,
Verbosity=consts.ConstVerbosity.ReportProgress | consts.ConstVerbosity.ReportCompression,
)
-
+ #
+ if uri.KeyType == consts.ConstKeyType.CHK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ if uri.filename is not None:
+ msg['TargetFilename'] = uri.docName
+ elif uri.KeyType == consts.ConstKeyType.SSK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ elif uri.KeyType == consts.ConstKeyType.USK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+
+ if contentType is not None: msg['Metadata.ContentType'] = allowedMimeTypes
+ if defaultName is not None: msg['DefaultName'] = defaultName
+ if dontCompress is not None: msg['DontCompress'] = dontCompresss
+ if maxRetries is not None: msg['MaxRetries'] = maxRetries
+
+ self.registerRequest(
+ msg,
+ persistentUserData=persistentUserData,
+ userData=userData,
+ )
+ self.sendMessage(msg)
+ return msg['Identifier']
+
+
def putFile(self,
uri,
filename,
@@ -1825,27 +1675,45 @@
@todo: EarlyEncode and GetCHKOnly message params not implemented
"""
- return self.clientPut(
- consts.ConstRequestType.PutFile,
- uri,
- userData,
- persistentUserData,
-
- # fcp params
- ContentType=contentType,
- #EarlyEncode='false',
+ msg = message.MsgClientPut(
+ URI=uri,
Filename=filename,
+ #EarlyEncode='false',
#GetCHKOnly='false',
Global=False,
Identifier=None,
- MaxRetries=maxRetries,
- DontCompress=dontCompress,
Persistence=persistence,
PriorityClass=priorityClass,
UploadFrom=consts.ConstUploadFrom.Disk,
Verbosity=consts.ConstVerbosity.ReportProgress | consts.ConstVerbosity.ReportCompression,
)
-
+
+ #
+ if uri.KeyType == consts.ConstKeyType.CHK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ if uri.filename is not None:
+ msg['TargetFilename'] = uri.docName
+ elif uri.KeyType == consts.ConstKeyType.SSK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ elif uri.KeyType == consts.ConstKeyType.USK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+
+ if contentType is not None: msg['Metadata.ContentType'] = allowedMimeTypes
+ if dontCompress is not None: msg['DontCompress'] = dontCompresss
+ if maxRetries is not None: msg['MaxRetries'] = maxRetries
+
+ self.registerRequest(
+ msg,
+ persistentUserData=persistentUserData,
+ userData=userData,
+ )
+ self.sendMessage(msg)
+ return msg['Identifier']
+
+
def putMultiple(self,
uri,
items,
@@ -1855,8 +1723,7 @@
maxRetries=None,
persistence=consts.ConstPersistence.Connection,
priorityClass=consts.ConstPriority.Medium,
- targetFilename=None,
-
+
userData=None,
persistentUserData='',
@@ -1869,10 +1736,10 @@
@note: for other params see L{putDir}
@note: to upload multiple items at once pass a dict for each item containig the following members:
- - RequestType: L{consts.ConstRequestType.PutData}, L{consts.ConstRequestType.PutFile} or L{consts.ConstRequestType.PutRedirect}
- - Data: if requestType is L{consts.ConstRequestType.PutData}, data to upload
- - Filename: if requestType is L{consts.ConstRequestType.PutFile}, filepath of the file to upload
- - TargetURI: if requestType is L{consts.ConstRequestType.PutRedirect}, uri to redirect to
+ - RequestType: L{consts.ConstPutMultiple.Data}, L{consts.ConstPutMultiple.File} or L{consts.ConstPutMultiple.Redirect}
+ - Data: if requestType is L{consts.ConstPutMultiple.Data}, data to upload
+ - Filename: if requestType is L{consts.ConstPutMultiple.File}, filepath of the file to upload
+ - TargetURI: if requestType is L{consts.ConstPutMultiple.Redirect}, uri to redirect to
- Name: name under wich the item will be accesible via freenet
- Metadata.ContentType: (optional) may be passed as 'ContentType'
@@ -1882,28 +1749,107 @@
@todo: EarlyEncode and GetCHKOnly message params not implemented
"""
- return self.clientPut(
- consts.ConstRequestType.PutMultiple,
- uri,
- userData,
- persistentUserData,
- items=items,
-
- # fcp params
- DefaultName=defaultName,
- #EarlyEncode='false',
+ msg = message.MsgClientPutComplexDir(
+ URI=uri,
+ #EarlyEncode='false',
#GetCHKOnly='false',
Global=False,
Identifier=None,
- MaxRetries=maxRetries,
- DontCompress=dontCompress,
Persistence=persistence,
PriorityClass=priorityClass,
- UploadFrom=consts.ConstUploadFrom.Disk,
Verbosity=consts.ConstVerbosity.ReportProgress | consts.ConstVerbosity.ReportCompression,
)
-
+ #
+ if uri.KeyType == consts.ConstKeyType.CHK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ if uri.filename is not None:
+ msg['TargetFilename'] = uri.docName
+ elif uri.KeyType == consts.ConstKeyType.SSK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ elif uri.KeyType == consts.ConstKeyType.USK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+
+ if defaultName is not None: msg['DefaultName'] = defaultName
+ if dontCompress is not None: msg['DontCompress'] = dontCompresss
+ if maxRetries is not None: msg['MaxRetries'] = maxRetries
+
+ uploadTypeMapping = {
+ consts.ConstPutMultiple.Data: consts.ConstUploadFrom.Direct,
+ consts.ConstPutMultiple.File: consts.ConstUploadFrom.Disk,
+ consts.ConstPutMultiple.Redirect: consts.ConstUploadFrom.Redirect,
+ }
+ # requestType --> [(allowedParam: boolParamIsRequired), ...]
+ paramMapping = {
+ consts.ConstPutMultiple.Data: [
+ ('Name', True),
+ ('Data', True),
+ ('ContentType', False),
+ ],
+ consts.ConstPutMultiple.File: [
+ ('Name', True),
+ ('Filename', True),
+ ('Metadata.ContentType', False),
+ ],
+ consts.ConstPutMultiple.Redirect: [
+ ('Name', True),
+ ('TargetURI', True),
+ ],
+ }
+
+ data = ''
+ for n, item in enumerate(items):
+ requestType = item.get('RequestType', None)
+ if requestType is None:
+ raise ValueError('No request type specified for item: %s' % n)
+ uploadFrom = uploadTypeMapping.get(requestType, None)
+ if uploadFrom is None:
+ raise ValueError('Unsupported request type for item %s: %s' % (n, requestType))
+
+ contentType = item.get('ContentType', None)
+ if contentType is not None:
+ del msgParams['ContentType']
+ item['Metadata.ContentType'] = contentType
+
+ allowedParams = dict(paramMapping[requestType])
+ msg.params['Files.%s.UploadFrom' % n] = uploadFrom
+ for param, value in item.items():
+ if param == 'RequestType':
+ continue
+
+ if param in allowedParams:
+ del allowedParams[param]
+ else:
+ raise ValueError('Unsupported param for item %s: %s' % (n, param))
+
+ if param == 'Data':
+ data += value
+ msg.params['Files.%s.DataLength' % n] = len(value)
+ continue
+ msg.params['Files.%s.%s' % (n, param)] = value
+
+ # errorcheck params
+ if allowedParams:
+ for paramName, isRequired in allowedParams.items():
+ if isRequired:
+ raise ValueError('Param "%s" is required for item %s' % (paramName, n))
+
+ msg['DefaultName'] = items[0].get('Name', '')
+ if data:
+ msg.data = data
+
+ self.registerRequest(
+ msg,
+ persistentUserData=persistentUserData,
+ userData=userData,
+ )
+ self.sendMessage(msg)
+ return msg['Identifier']
+
+
def putRedirect(self,
uri,
targetKey,
@@ -1923,17 +1869,41 @@
@param userData: (any) any data to be associated to the request at runtime
@return: (str) request identifier
"""
- return self.clientPut(
- consts.ConstRequestType.PutRedirect,
- uri,
- userData,
- persistentUserData,
- Persistence=persistence,
- PriorityClass=priorityClass,
- TargetURI=targetKey,
- UploadFrom=consts.ConstUploadFrom.Redirect,
- )
-
+ #
+ if uri.KeyType == consts.ConstKeyType.CHK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ if uri.filename is not None:
+ msg['TargetFilename'] = uri.docName
+ elif uri.KeyType == consts.ConstKeyType.SSK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+ elif uri.KeyType == consts.ConstKeyType.USK:
+ if uri.tail is not None:
+ raise ValueError('no tail allowed')
+
+ msg = message.MsgClientPut(
+ URI=uri,
+ TargetURI=targetKey,
+ #EarlyEncode='false',
+ #GetCHKOnly='false',
+ Global=False,
+ Identifier=None,
+ Persistence=persistence,
+ PriorityClass=priorityClass,
+ UploadFrom=consts.ConstUploadFrom.Redirect,
+ Verbosity=consts.ConstVerbosity.ReportProgress | consts.ConstVerbosity.ReportCompression,
+ )
+ if maxRetries is not None: msg['MaxRetries'] = maxRetries
+
+ self.registerRequest(
+ msg,
+ persistentUserData=persistentUserData,
+ userData=userData,
+ )
+ self.sendMessage(msg)
+ return msg['Identifier']
+
########################################################
##
## request related methods
@@ -1970,7 +1940,10 @@
Fcp does not provide means to do so.
"""
initialRequest = self._requests[requestIdentifier]
- if not initialRequest['RequestType'] & (consts.ConstRequestType.MaskGet | consts.ConstRequestType.MaskPut):
+ if not initialRequest == message.MsgClientGet or \
+ initialRequest == message.MsgClientPut or \
+ initialRequest == message.MsgClientPutDiskDir or \
+ initialRequest == message.MsgClientPutComplexDir:
raise ValueError('Can not modify request: %s' % initialRequest.name)
#FIX: [0002083]
@@ -2013,7 +1986,10 @@
"""
initialRequest = self._requests[requestIdentifier]
initialRequest['RequestStatus'] |= consts.ConstRequestStatus.Removed | consts.ConstRequestStatus.Completed
- if initialRequest['RequestType'] & (consts.ConstRequestType.MaskGet | consts.ConstRequestType.MaskPut):
+ if initialRequest == message.MsgClientGet or \
+ initialRequest == message.MsgClientPut or \
+ initialRequest == message.MsgClientPutDiskDir or \
+ initialRequest == message.MsgClientPutComplexDir:
self.sendMessage(
message.MsgRemoveRequest(
Global=False,
@@ -2153,7 +2129,7 @@
PluginName=pluginName,
Detailed=detailed,
)
- self.registerRequest(msg, consts.ConstRequestType.PluginInfo)
+ self.registerRequest(msg)
self.sendMessage(msg)
return msg['Identifier']
@@ -2190,20 +2166,18 @@
## others
##
##########################################################
- def generateKeypair(self, keypairType=consts.ConstKeyType.SSK):
+ def generateKeypair(self, keyPairType=consts.ConstKeyType.SSK):
"""Generates a public / private keypair
- @param keypairType: type of keypair to generate (either L{consts.ConstKeyType.SSK} or L{consts.ConstKeyType.SSK})
+ @param keyPairType: type of keypair to generate (either L{consts.ConstKeyType.SSK} or L{consts.ConstKeyType.SSK})
@return: identifier of the request
@event: L{events.Events.KeypairGenerated} triggered as soon as the request is complete
"""
- if keypairType not in (consts.ConstKeyType.SSK, consts.ConstKeyType.USK):
+ if keyPairType not in (consts.ConstKeyType.SSK, consts.ConstKeyType.USK):
raise ValueError('keypairType must be SSK or USK')
-
- requestType = consts.ConstRequestType.GenerateSSKKeypair if keypairType == consts.ConstKeyType.SSK else consts.ConstRequestType.GenerateUSKKeypair
- msg = message.MsgGenerateSSK()
- self.registerRequest(msg, requestType)
+ msg = message.MsgGenerateSSK(KeyPairType=keyPairType)
+ self.registerRequest(msg)
self.sendMessage(msg)
return msg['Identifier']
Modified: trunk/fclient/src/fclient/lib/fcp2/consts.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/consts.py 2008-07-20 17:55:11 UTC (rev 697)
+++ trunk/fclient/src/fclient/lib/fcp2/consts.py 2008-07-20 19:57:42 UTC (rev 698)
@@ -408,6 +408,12 @@
DarknetPeerOnly = 31
NoSuchPlugin = 32
+class ConstPutMultiple:
+ Data = 0
+ File = 1
+ Redirect = 2
+
+
class ConstRequestModified(_BaseBitFlags):
"""Flags indicating what aspect of a request has been modified
@cvar Filename: the filename has been modified
Modified: trunk/fclient/src/fclient/lib/fcp2/message.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/message.py 2008-07-20 17:55:11 UTC (rev 697)
+++ trunk/fclient/src/fclient/lib/fcp2/message.py 2008-07-20 19:57:42 UTC (rev 698)
@@ -89,8 +89,11 @@
@param data: data associated to the message
@param params: {field-name: value, ...} of parameters of the message
"""
- params.update(self._additional_params_.copy())
-
+ additionalParams = self._additional_params_.copy()
+ for name, value in additionalParams.items():
+ if name not in params:
+ params[name] = value
+
self.data = data
self.params = params
@@ -198,13 +201,13 @@
_AdditionalGetParams = {
# persistent params
- _PrivateParam('RequestType'): consts.ConstRequestType.Null, # identifies sub message types
_PrivateParam('InitTime'): 0, # when was the request started?
_PrivateParam('PersistentUserData'): '', # any user defined persistent data
_PrivateParam('HandleFilenameCollision'): False,
_PrivateParam('FilenameCollisionHandled'): False,
_PrivateParam('HandlePermanentRedirect'): False,
_PrivateParam('PermanentRedirectHandled'): False,
+ _PrivateParam('IsGetKeyInfo'): False,
# non persistent params
_PrivateParam('RequestStatus'): consts.ConstRequestStatus.Null,
@@ -233,7 +236,6 @@
_AdditionalPutParams = {
# persistent params
- _PrivateParam('RequestType'): consts.ConstRequestType.Null, # identifies sub message types
_PrivateParam('InitTime'): 0, # when was the request started?
_PrivateParam('PersistentUserData'): '', # any user defined persistent data
@@ -261,9 +263,9 @@
}
_GenerateSSKParams = {
- _PrivateParam('RequestType'): consts.ConstRequestType.Null, # identifies sub message types
_PrivateParam('RequestStatus'): consts.ConstRequestStatus.Null,
_PrivateParam('InitTime'): 0, # when was the request started?
+ _PrivateParam('KeyPairType'): consts.ConstKeyType.SSK,
}
_SubscribeUSKParams = {
@@ -296,6 +298,7 @@
('FilenameCollisionHandled', pmstruct.BOOL),
('HandlePermanentRedirect', pmstruct.BOOL),
('PermanentRedirectHandled', pmstruct.BOOL),
+ ('IsGetKeyInfo', pmstruct.BOOL),
)
class PersistentParamsPut(pmstruct.PMStruct):
@@ -433,7 +436,6 @@
def updatePersistentParams(self):
params = PersistentParamsGet(
Version=1,
- RequestType=self['RequestType'],
InitTime=self['InitTime'],
PersistentUserData=self['PersistentUserData'],
HandleFilenameCollision=self['HandleFilenameCollision'],
@@ -483,7 +485,6 @@
def updatePersistentParams(self):
params = PersistentParamsPut(
Version=1,
- RequestType=self['RequestType'],
InitTime=self['InitTime'],
PersistentUserData=self['PersistentUserData'],
)
Modified: trunk/fclient/src/fclient/lib/fcp2/test/test_client.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/test/test_client.py 2008-07-20 17:55:11 UTC (rev 697)
+++ trunk/fclient/src/fclient/lib/fcp2/test/test_client.py 2008-07-20 19:57:42 UTC (rev 698)
@@ -883,8 +883,7 @@
requestsAll = self.client.getRequests()
self.failUnless(myIdentifier in requestsAll)
myRequest = self.client.getRequest(myIdentifier)
- self.assertEqual(myRequest['RequestType'], fcp2.ConstRequestType.GetData)
-
+
def test_300_message_send(self):
self.connectClient()
@@ -1141,8 +1140,7 @@
requestsAll = self.client.getRequests()
self.failUnless(myIdentifier in requestsAll)
myRequest = self.client.getRequest(myIdentifier)
- self.assertEqual(myRequest['RequestType'], fcp2.ConstRequestType.GetFile)
-
+
def test_200_key_object_is_accepted(self):
self.connectClient()
@@ -1242,7 +1240,7 @@
requestsAll = self.client.getRequests()
self.failUnless(myIdentifier in requestsAll)
myRequest = self.client.getRequest(myIdentifier)
- self.assertEqual(myRequest['RequestType'], fcp2.ConstRequestType.GetKeyInfo)
+
def test_200_key_object_is_accepted(self):
self.connectClient()
@@ -1473,13 +1471,13 @@
# key.tail is not allowed in all put actions
myKey = fcp2.KeyCHK(keyData=DummyKeyData, tail='foo')
- self.assertRaises(ValueError, self.client.clientPut, fcp2.ConstRequestType.PutData, myKey, data='foo')
+ self.assertRaises(ValueError, self.client.putData, myKey, data='foo')
myKey = fcp2.KeySSK(keyData=DummyKeyData, tail='foo')
- self.assertRaises(ValueError, self.client.clientPut, fcp2.ConstRequestType.PutData, myKey, data='foo')
+ self.assertRaises(ValueError, self.client.putData, myKey, data='foo')
myKey = fcp2.KeyUSK(keyData=DummyKeyData, tail='foo')
- self.assertRaises(ValueError, self.client.clientPut, fcp2.ConstRequestType.PutData, myKey, data='foo')
+ self.assertRaises(ValueError, self.client.putData, myKey, data='foo')
#***********************************************************************************
#
@@ -1707,22 +1705,22 @@
items = [
{
- 'RequestType': fcp2.ConstRequestType.PutData,
+ 'RequestType': fcp2.ConstPutMultiple.Data,
'Data': '12345',
'Name': 'myItem0',
},
{
- 'RequestType': fcp2.ConstRequestType.PutFile,
+ 'RequestType': fcp2.ConstPutMultiple.File,
'Filename': 'myFile.txt',
'Name': 'myItem1',
},
{
- 'RequestType': fcp2.ConstRequestType.PutRedirect,
+ 'RequestType': fcp2.ConstPutMultiple.Redirect,
'TargetURI': 'CHK@123456789',
'Name': 'myItem2',
},
{
- 'RequestType': fcp2.ConstRequestType.PutData,
+ 'RequestType': fcp2.ConstPutMultiple.Data,
'Data': '67890',
'Name': 'myItem3',
},
@@ -1786,16 +1784,7 @@
def test_putMultiple_ItemErrors(self):
self.connectClient()
- # upload directory is not allowed
- items = [
- {
- 'RequestType': fcp2.ConstRequestType.PutDir,
- 'Data': '12345',
- 'Name': 'myItem0',
- },
- ]
myKey = fcp2.KeyKSK('foo')
- self.assertRaises(ValueError, self.client.putMultiple, myKey, items)
#TODO: how to test required params?
# ...just some samples below
@@ -1813,7 +1802,7 @@
# param missing (we enforce all required parameters)
items = [
{
- 'RequestType': fcp2.ConstRequestType.PutData,
+ 'RequestType': fcp2.ConstPutMultiple.Data,
#'Data': '12345',
#'Name': 'myItem0',
},
@@ -2960,19 +2949,20 @@
self.connectClient()
myIdentifier = self.client.generateKeypair(fcp2.ConstKeyType.USK)
+
myRequest = self.client.getRequest(myIdentifier)
requestsAll = self.client.getRequests()
self.assertHasNextMessage(fcp2.MsgGenerateSSK)
priv = fcp2.Key('SSK@' + DummyKeyData + '/')
pub = fcp2.Key('SSK@' + DummyKeyData + '/')
+
self.sendResponseMessage(
'SSKKeypair',
Identifier=myIdentifier,
RequestURI=pub,
InsertURI=priv,
)
-
priv = fcp2.KeyUSK(priv.keyData, docName=priv.docName)
pub = fcp2.KeyUSK(pub.keyData, docName=pub.docName)
msg = self.assertHasNextEvent(
@@ -3007,7 +2997,6 @@
requestsAll = self.client.getRequests()
self.failUnless(myIdentifier in requestsAll)
myRequest = self.client.getRequest(myIdentifier)
- self.assertEqual(myRequest['RequestType'], fcp2.ConstRequestType.SubscribeUSK)
self.assertHasNextMessage(
fcp2.MsgSubscribeUSK,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-20 17:55:03
|
Revision: 697
http://fclient.svn.sourceforge.net/fclient/?rev=697&view=rev
Author: jUrner
Date: 2008-07-20 17:55:11 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
removed unused ConstPutDirType
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/__init__.py
trunk/fclient/src/fclient/lib/fcp2/consts.py
Modified: trunk/fclient/src/fclient/lib/fcp2/__init__.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/__init__.py 2008-07-20 11:53:59 UTC (rev 696)
+++ trunk/fclient/src/fclient/lib/fcp2/__init__.py 2008-07-20 17:55:11 UTC (rev 697)
@@ -19,7 +19,7 @@
from .consts import (ConstByteAmountPostfix, ConstConnectReason, ConstDebugVerbosity, ConstDisconnectReason,
ConstFetchError, ConstInsertError, ConstKeyType, ConstLogMessages,
ConstLogger, ConstMessage, ConstPeerNodeStatus, ConstPeerNoteType, ConstPersistence,
- ConstPriority, ConstProtocolError, ConstPutDirType, ConstRequestModified, ConstRequestStatus,
+ ConstPriority, ConstProtocolError, ConstRequestModified, ConstRequestStatus,
ConstRequestType, ConstReturnType, ConstTimeDeltaPostfix, ConstUploadFrom, ConstVerbosity,
Error, ErrorIOBroken, ErrorIOClosed, ErrorIOConnectFailed, ErrorIOTimeout, ErrorMessageParse,
FcpFalse, FcpTrue)
Modified: trunk/fclient/src/fclient/lib/fcp2/consts.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/consts.py 2008-07-20 11:53:59 UTC (rev 696)
+++ trunk/fclient/src/fclient/lib/fcp2/consts.py 2008-07-20 17:55:11 UTC (rev 697)
@@ -408,10 +408,6 @@
DarknetPeerOnly = 31
NoSuchPlugin = 32
-class ConstPutDirType:
- Complex = 'complex'
- Disk = 'disk'
-
class ConstRequestModified(_BaseBitFlags):
"""Flags indicating what aspect of a request has been modified
@cvar Filename: the filename has been modified
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-20 11:54:51
|
Revision: 696
http://fclient.svn.sourceforge.net/fclient/?rev=696&view=rev
Author: jUrner
Date: 2008-07-20 11:53:59 +0000 (Sun, 20 Jul 2008)
Log Message:
-----------
registering requests is mandatory to make the client work
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/client.py
Modified: trunk/fclient/src/fclient/lib/fcp2/client.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-20 11:49:59 UTC (rev 695)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-20 11:53:59 UTC (rev 696)
@@ -372,6 +372,7 @@
@param handlePermanentRedirect: (bool) if True, permanent redirect are handled automatically. for example USK@.../-1
will look for the current edition. if handlePermanentRedirect is True, the request is automatically resend to retrieve the current edition
@return: (str) identifer of therequest
+ @note: the client can only deal with requests registered here
@note: the identifier returned is unique to the client but may not be unique to the node
"""
identifier = self.newIdentifier(identifiers=self._requests) if identifier is None else identifier
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|