Thread: SF.net SVN: fclient:[842] trunk/fclient/fclient/impl
Status: Pre-Alpha
Brought to you by:
jurner
From: <jU...@us...> - 2008-07-31 18:45:33
|
Revision: 842 http://fclient.svn.sourceforge.net/fclient/?rev=842&view=rev Author: jUrner Date: 2008-07-31 18:45:36 +0000 (Thu, 31 Jul 2008) Log Message: ----------- more work on layout and css Modified Paths: -------------- trunk/fclient/fclient/impl/res/stylesheets/default.css trunk/fclient/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui trunk/fclient/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui trunk/fclient/fclient/impl/tpls/DlgSingleAppErrorTpl.ui trunk/fclient/fclient/impl/tpls/PrefsBrowserWidgetTpl.ui trunk/fclient/fclient/impl/tpls/PrefsConnectionExpertSettingsTpl.ui trunk/fclient/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui trunk/fclient/fclient/impl/tpls/PrefsSingleAppTpl.ui trunk/fclient/fclient/impl/tpls/Ui_DlgDownloadKeyToDiskTpl.py trunk/fclient/fclient/impl/tpls/Ui_DlgPropsBrowserObjectTpl.py trunk/fclient/fclient/impl/tpls/Ui_DlgSingleAppErrorTpl.py trunk/fclient/fclient/impl/tpls/Ui_PrefsBrowserWidgetTpl.py trunk/fclient/fclient/impl/tpls/Ui_PrefsConnectionExpertSettingsTpl.py trunk/fclient/fclient/impl/tpls/Ui_PrefsGlobalWidgetTpl.py trunk/fclient/fclient/impl/tpls/Ui_PrefsSingleAppTpl.py trunk/fclient/fclient/impl/tpls/Ui_ViewConnectionWidgetTpl.py trunk/fclient/fclient/impl/tpls/ViewConnectionWidgetTpl.ui Modified: trunk/fclient/fclient/impl/res/stylesheets/default.css =================================================================== --- trunk/fclient/fclient/impl/res/stylesheets/default.css 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/res/stylesheets/default.css 2008-07-31 18:45:36 UTC (rev 842) @@ -12,8 +12,26 @@ (..) **********************************************************************************************/ +/* label style. sample: + Host: + | 9999| +*/ +QLabel#fieldHeader, +QLabel#fieldHeader_2, +QLabel#fieldHeader_3, +QLabel#fieldNHeader_4, +QLabel#fieldHeader_5, +QLabel#fieldHeader_6, +QLabel#fieldHeader_7, +QLabel#fieldHeader_8, +QLabel#fieldHeader_9{ + font: bold; + } -/* style for "Name: | |" labels. for example "Host: |9999|" */ + +/* label style. sample: + Host: | 9999| +*/ QLabel#fieldName, QLabel#fieldName_2, QLabel#fieldName_3, @@ -24,4 +42,5 @@ QLabel#fieldName_8, QLabel#fieldName_9{ font: bold; + color: green; } \ No newline at end of file Modified: trunk/fclient/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui 2008-07-31 18:45:36 UTC (rev 842) @@ -16,7 +16,7 @@ <item row="0" column="0" > <layout class="QVBoxLayout" name="verticalLayout" > <item> - <widget class="QLabel" name="fieldName" > + <widget class="QLabel" name="fieldHeader" > <property name="text" > <string>Key:</string> </property> @@ -30,7 +30,7 @@ </widget> </item> <item> - <widget class="QLabel" name="fieldName_2" > + <widget class="QLabel" name="fieldHeader_2" > <property name="text" > <string>File name:</string> </property> @@ -40,7 +40,7 @@ <widget class="QLineEdit" name="edFileName" /> </item> <item> - <widget class="QLabel" name="fieldName_3" > + <widget class="QLabel" name="fieldHeader_3" > <property name="text" > <string>Directory:</string> </property> Modified: trunk/fclient/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui 2008-07-31 18:45:36 UTC (rev 842) @@ -16,7 +16,7 @@ <item row="0" column="0" > <layout class="QVBoxLayout" name="verticalLayout" > <item> - <widget class="QLabel" name="fieldName" > + <widget class="QLabel" name="fieldHeader" > <property name="sizePolicy" > <sizepolicy vsizetype="Preferred" hsizetype="Minimum" > <horstretch>0</horstretch> @@ -48,7 +48,7 @@ </widget> </item> <item> - <widget class="QLabel" name="fieldName_2" > + <widget class="QLabel" name="fieldHeader_2" > <property name="sizePolicy" > <sizepolicy vsizetype="Preferred" hsizetype="Minimum" > <horstretch>0</horstretch> @@ -80,7 +80,7 @@ </widget> </item> <item> - <widget class="QLabel" name="fieldName_3" > + <widget class="QLabel" name="fieldHeader_3" > <property name="sizePolicy" > <sizepolicy vsizetype="Preferred" hsizetype="Minimum" > <horstretch>0</horstretch> @@ -112,7 +112,7 @@ </widget> </item> <item> - <widget class="QLabel" name="fieldName_4" > + <widget class="QLabel" name="fieldHeader_4" > <property name="sizePolicy" > <sizepolicy vsizetype="Preferred" hsizetype="Minimum" > <horstretch>0</horstretch> @@ -144,7 +144,7 @@ </widget> </item> <item> - <widget class="QLabel" name="fieldName_5" > + <widget class="QLabel" name="fieldHeader_5" > <property name="sizePolicy" > <sizepolicy vsizetype="Preferred" hsizetype="Minimum" > <horstretch>0</horstretch> Modified: trunk/fclient/fclient/impl/tpls/DlgSingleAppErrorTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/DlgSingleAppErrorTpl.ui 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/DlgSingleAppErrorTpl.ui 2008-07-31 18:45:36 UTC (rev 842) @@ -41,7 +41,7 @@ <item> <layout class="QVBoxLayout" name="verticalLayout" > <item> - <widget class="QLabel" name="fieldName" > + <widget class="QLabel" name="fieldHeader" > <property name="text" > <string>Host: </string> </property> @@ -51,7 +51,7 @@ <widget class="QLineEdit" name="edHost" /> </item> <item> - <widget class="QLabel" name="fieldName_2" > + <widget class="QLabel" name="fieldHeader_2" > <property name="text" > <string>Port: </string> </property> @@ -80,9 +80,6 @@ </widget> </item> </layout> - <zorder>line</zorder> - <zorder>buttonBox</zorder> - <zorder>splitter</zorder> </widget> <resources/> <connections> Modified: trunk/fclient/fclient/impl/tpls/PrefsBrowserWidgetTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/PrefsBrowserWidgetTpl.ui 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/PrefsBrowserWidgetTpl.ui 2008-07-31 18:45:36 UTC (rev 842) @@ -5,109 +5,104 @@ <rect> <x>0</x> <y>0</y> - <width>532</width> - <height>186</height> + <width>456</width> + <height>253</height> </rect> </property> <property name="windowTitle" > <string>Form</string> </property> - <layout class="QGridLayout" name="gridLayout_3" > + <layout class="QGridLayout" name="gridLayout" > <item row="0" column="0" > - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <item> - <widget class="QLabel" name="label" > - <property name="text" > - <string>Homepage:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="edHomePage" > - <property name="dragEnabled" > - <bool>true</bool> - </property> - </widget> - </item> - </layout> + <widget class="QLabel" name="fieldHeader" > + <property name="text" > + <string>Homepage:</string> + </property> + </widget> </item> <item row="1" column="0" > + <widget class="QLineEdit" name="edHomePage" > + <property name="dragEnabled" > + <bool>true</bool> + </property> + </widget> + </item> + <item row="2" column="0" > <layout class="QHBoxLayout" name="horizontalLayout" > <item> - <widget class="QGroupBox" name="groupBox" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Minimum" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="title" > - <string>Open in new tab</string> - </property> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > - <widget class="QCheckBox" name="ckOpenLinksInNewTab" > - <property name="text" > - <string>Links</string> - </property> - </widget> - </item> - <item row="4" column="0" > - <widget class="QCheckBox" name="ckOpenBookmarksInNewTab" > - <property name="text" > - <string>Bookmarks</string> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QCheckBox" name="ckOpenAddressBarInNewTab" > - <property name="text" > - <string>Address bar</string> - </property> - </widget> - </item> - </layout> - </widget> + <layout class="QVBoxLayout" name="verticalLayout_2" > + <item> + <widget class="QLabel" name="fieldHeader_2" > + <property name="text" > + <string>Open in new tab:</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ckOpenAddressBarInNewTab" > + <property name="text" > + <string>Address bar</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ckOpenBookmarksInNewTab" > + <property name="text" > + <string>Bookmarks</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ckOpenLinksInNewTab" > + <property name="text" > + <string>Links</string> + </property> + </widget> + </item> + </layout> </item> <item> - <widget class="QGroupBox" name="groupBox_2" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Minimum" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <widget class="Line" name="line" > + <property name="orientation" > + <enum>Qt::Vertical</enum> </property> - <property name="title" > - <string>Others</string> - </property> - <layout class="QGridLayout" name="gridLayout_2" > - <item row="0" column="0" > - <widget class="QCheckBox" name="ckOpenHomePageOnNewTabCreated" > - <property name="text" > - <string>Open home page when a new tab is created</string> - </property> - </widget> - </item> - <item row="1" column="0" > - <widget class="QCheckBox" name="ckBackIsClose" > - <property name="text" > - <string>Back is close</string> - </property> - </widget> - </item> - <item row="2" column="0" > - <widget class="QCheckBox" name="ckAutoLoadImages" > - <property name="text" > - <string>Auto load images</string> - </property> - </widget> - </item> - </layout> </widget> </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout" > + <item> + <widget class="QLabel" name="fieldHeader_3" > + <property name="text" > + <string>Others:</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ckOpenHomePageOnNewTabCreated" > + <property name="text" > + <string>Open homepage in new created tab</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ckBackIsClose" > + <property name="text" > + <string>Back is close</string> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ckAutoLoadImages" > + <property name="text" > + <string>Auto load images</string> + </property> + </widget> + </item> + </layout> + </item> </layout> </item> - <item row="2" column="0" > + <item row="3" column="0" > <spacer name="verticalSpacer" > <property name="orientation" > <enum>Qt::Vertical</enum> @@ -115,7 +110,7 @@ <property name="sizeHint" stdset="0" > <size> <width>20</width> - <height>297</height> + <height>56</height> </size> </property> </spacer> Modified: trunk/fclient/fclient/impl/tpls/PrefsConnectionExpertSettingsTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/PrefsConnectionExpertSettingsTpl.ui 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/PrefsConnectionExpertSettingsTpl.ui 2008-07-31 18:45:36 UTC (rev 842) @@ -6,44 +6,85 @@ <x>0</x> <y>0</y> <width>520</width> - <height>550</height> + <height>502</height> </rect> </property> <property name="windowTitle" > <string>Form</string> </property> - <layout class="QGridLayout" name="gridLayout_2" > + <layout class="QGridLayout" name="gridLayout" > <item row="0" column="0" > - <widget class="QTabWidget" name="tabWidget" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Minimum" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="currentIndex" > - <number>0</number> - </property> - <widget class="QWidget" name="tab" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>498</width> - <height>490</height> - </rect> - </property> - <attribute name="title" > - <string>Fcp connection</string> - </attribute> - <layout class="QGridLayout" name="gridLayout" > - <item row="0" column="0" > + <layout class="QVBoxLayout" name="verticalLayout_3" > + <item> + <widget class="QLabel" name="fieldHeader" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Connection name:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_5" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Adjusts the name the client uses to connect to the node. Use this for example to adjust the connection name in case the name is already in use by other clients. WARNING: changing this will loose your current qequests untill you connect under that name again</string> + </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + <property name="textInteractionFlags" > + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="edFcpConnectionName" /> + </item> + <item> + <widget class="QLabel" name="fieldHeader_2" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Connect duration and timeout:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_6" > + <property name="text" > + <string>How long should the client try to connect to the node before finally giving up? How long should he wait before retrying to establish a connection? WARNING: setting timeout to low values may cause the gui to slow down</string> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + <property name="textInteractionFlags" > + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> + </property> + </widget> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout" > + <item> <layout class="QVBoxLayout" name="verticalLayout" > - <property name="spacing" > - <number>0</number> - </property> <item> - <widget class="QLabel" name="label_5" > + <widget class="QLabel" name="fieldName" > <property name="sizePolicy" > <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > <horstretch>0</horstretch> @@ -51,177 +92,112 @@ </sizepolicy> </property> <property name="text" > - <string>Adjusts the name the client uses to connect to the node. Use this for example to adjust the connection name in case the name is already in use by other clients. WARNING: changing this will loose your current qequests untill you connect under that name again</string> + <string>Duration: </string> </property> - <property name="alignment" > - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - <property name="wordWrap" > - <bool>true</bool> - </property> - <property name="textInteractionFlags" > - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> - </property> </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout" > - <property name="spacing" > - <number>0</number> + <widget class="QLabel" name="fieldName_2" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <item> - <widget class="QLabel" name="label" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Connection name:</string> - </property> - </widget> - </item> - <item> - <widget class="QLineEdit" name="edFcpConnectionName" /> - </item> - </layout> + <property name="text" > + <string>Timeout:</string> + </property> + </widget> </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout_2" > <item> - <widget class="QLabel" name="label_6" > - <property name="text" > - <string>How long should the client try to connect to the node before finally giving up? How long should he wait before retrying to establish a connection? WARNING: setting timeout to low values may cause the gui to slow down</string> + <widget class="QSpinBox" name="spinFcpConnectionTimerMaxDuration" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="wordWrap" > - <bool>true</bool> + <property name="suffix" > + <string> seconds</string> </property> - <property name="textInteractionFlags" > - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> + <property name="maximum" > + <number>999</number> </property> </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <item> - <layout class="QVBoxLayout" name="verticalLayout_3" > - <item> - <widget class="QLabel" name="label_3" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Connect duration: </string> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_4" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Connect timeout:</string> - </property> - </widget> - </item> - </layout> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout_2" > - <item> - <widget class="QSpinBox" name="spinFcpConnectionTimerMaxDuration" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="suffix" > - <string> seconds</string> - </property> - <property name="maximum" > - <number>999</number> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinConnectionTimerTimeout" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="suffix" > - <string> miliseconds</string> - </property> - <property name="maximum" > - <number>99999</number> - </property> - </widget> - </item> - </layout> - </item> - </layout> - </item> - <item> - <widget class="QLabel" name="label_7" > - <property name="text" > - <string>How long should the client wait before polling the node for a the next message? Warning: setting this to high values will make messages come in more slowly. Setting it to low values may cause the gui to slow down. -</string> + <widget class="QSpinBox" name="spinConnectionTimerTimeout" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <property name="wordWrap" > - <bool>true</bool> + <property name="suffix" > + <string> miliseconds</string> </property> - <property name="textInteractionFlags" > - <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> + <property name="maximum" > + <number>99999</number> </property> </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_3" > - <item> - <widget class="QLabel" name="label_2" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="text" > - <string>Poll frequency: </string> - </property> - </widget> - </item> - <item> - <widget class="QSpinBox" name="spinFcpPollTimerTimeout" > - <property name="sizePolicy" > - <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="suffix" > - <string> miliseconds</string> - </property> - <property name="maximum" > - <number>99999</number> - </property> - </widget> - </item> - </layout> - </item> </layout> </item> </layout> - </widget> - </widget> + </item> + <item> + <widget class="QLabel" name="fieldHeader_3" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Fixed" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>Poll frequency: </string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="label_7" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Preferred" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="text" > + <string>How long should the client wait before polling the node for a the next message? Warning: setting this to high values will make messages come in more slowly. Setting it to low values may cause the gui to slow down.</string> + </property> + <property name="wordWrap" > + <bool>true</bool> + </property> + <property name="textInteractionFlags" > + <set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard</set> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="spinFcpPollTimerTimeout" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="suffix" > + <string> miliseconds</string> + </property> + <property name="maximum" > + <number>99999</number> + </property> + </widget> + </item> + </layout> </item> <item row="1" column="0" > <spacer name="verticalSpacer" > @@ -230,13 +206,29 @@ </property> <property name="sizeHint" stdset="0" > <size> - <width>502</width> - <height>21</height> + <width>20</width> + <height>87</height> </size> </property> </spacer> </item> </layout> + <zorder>tabWidget</zorder> + <zorder>label</zorder> + <zorder>fieldHeader</zorder> + <zorder>label_5</zorder> + <zorder>edFcpConnectionName</zorder> + <zorder>fieldHeader_2</zorder> + <zorder>label_6</zorder> + <zorder>fieldName</zorder> + <zorder>spinFcpConnectionTimerMaxDuration</zorder> + <zorder>fieldName_2</zorder> + <zorder>spinConnectionTimerTimeout</zorder> + <zorder>label_7</zorder> + <zorder>spinFcpPollTimerTimeout</zorder> + <zorder>fieldHeader_3</zorder> + <zorder>verticalSpacer</zorder> + <zorder></zorder> </widget> <resources/> <connections/> Modified: trunk/fclient/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/PrefsGlobalWidgetTpl.ui 2008-07-31 18:45:36 UTC (rev 842) @@ -6,7 +6,7 @@ <x>0</x> <y>0</y> <width>465</width> - <height>269</height> + <height>316</height> </rect> </property> <property name="windowTitle" > @@ -14,9 +14,16 @@ </property> <layout class="QGridLayout" name="gridLayout" > <item row="0" column="0" > + <widget class="QLabel" name="fieldHeader" > + <property name="text" > + <string>Settings directory:</string> + </property> + </widget> + </item> + <item row="1" column="0" > <widget class="QLabel" name="label" > <property name="text" > - <string>Specify directory to store settings to.Leave empty to store settings in a location your os feels best with</string> + <string>Directory to store settings to.Leave empty to store settings in a location your os feels best with</string> </property> <property name="wordWrap" > <bool>true</bool> @@ -26,7 +33,7 @@ </property> </widget> </item> - <item row="1" column="0" > + <item row="2" column="0" > <layout class="QHBoxLayout" > <item> <widget class="QLineEdit" name="edSettingsDir" /> @@ -40,7 +47,7 @@ </item> </layout> </item> - <item row="2" column="0" > + <item row="3" column="0" > <widget class="QLabel" name="label_2" > <property name="text" > <string>If no path for settings is specified, store settings only for the the current user or for all users?</string> @@ -53,17 +60,17 @@ </property> </widget> </item> - <item row="3" column="0" > + <item row="4" column="0" > <widget class="QCheckBox" name="ckSettingsAllUsers" > <property name="text" > <string>Store settings for all users</string> </property> </widget> </item> - <item row="4" column="0" > - <widget class="QLabel" name="label_3" > + <item row="5" column="0" > + <widget class="QLabel" name="fieldHeader_2" > <property name="text" > - <string>Default directory to store downloads to </string> + <string>Default download directory:</string> </property> <property name="wordWrap" > <bool>true</bool> @@ -73,7 +80,7 @@ </property> </widget> </item> - <item row="5" column="0" > + <item row="6" column="0" > <layout class="QHBoxLayout" name="horizontalLayout" > <item> <widget class="QLineEdit" name="edDownloadDir" /> @@ -87,7 +94,7 @@ </item> </layout> </item> - <item row="6" column="0" > + <item row="7" column="0" > <spacer name="verticalSpacer" > <property name="orientation" > <enum>Qt::Vertical</enum> Modified: trunk/fclient/fclient/impl/tpls/PrefsSingleAppTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/PrefsSingleAppTpl.ui 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/PrefsSingleAppTpl.ui 2008-07-31 18:45:36 UTC (rev 842) @@ -32,7 +32,7 @@ <item row="1" column="0" > <layout class="QVBoxLayout" name="verticalLayout" > <item> - <widget class="QLabel" name="fieldName" > + <widget class="QLabel" name="fieldHeader" > <property name="text" > <string>Single application host: </string> </property> @@ -42,7 +42,7 @@ <widget class="QLineEdit" name="edHost" /> </item> <item> - <widget class="QLabel" name="fieldName_2" > + <widget class="QLabel" name="fieldHeader_2" > <property name="text" > <string>Single application port: </string> </property> Modified: trunk/fclient/fclient/impl/tpls/Ui_DlgDownloadKeyToDiskTpl.py =================================================================== --- trunk/fclient/fclient/impl/tpls/Ui_DlgDownloadKeyToDiskTpl.py 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/Ui_DlgDownloadKeyToDiskTpl.py 2008-07-31 18:45:36 UTC (rev 842) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui' +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/DlgDownloadKeyToDiskTpl.ui' # -# Created: Thu Jul 31 18:23:06 2008 +# Created: Thu Jul 31 20:24:05 2008 # by: PyQt4 UI code generator 4.4.3-snapshot-20080705 # # WARNING! All changes made in this file will be lost! @@ -17,22 +17,22 @@ self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") - self.fieldName = QtGui.QLabel(DlgDownloadKeyToDisk) - self.fieldName.setObjectName("fieldName") - self.verticalLayout.addWidget(self.fieldName) + self.fieldHeader = QtGui.QLabel(DlgDownloadKeyToDisk) + self.fieldHeader.setObjectName("fieldHeader") + self.verticalLayout.addWidget(self.fieldHeader) self.edKey = QtGui.QLineEdit(DlgDownloadKeyToDisk) self.edKey.setDragEnabled(True) self.edKey.setObjectName("edKey") self.verticalLayout.addWidget(self.edKey) - self.fieldName_2 = QtGui.QLabel(DlgDownloadKeyToDisk) - self.fieldName_2.setObjectName("fieldName_2") - self.verticalLayout.addWidget(self.fieldName_2) + self.fieldHeader_2 = QtGui.QLabel(DlgDownloadKeyToDisk) + self.fieldHeader_2.setObjectName("fieldHeader_2") + self.verticalLayout.addWidget(self.fieldHeader_2) self.edFileName = QtGui.QLineEdit(DlgDownloadKeyToDisk) self.edFileName.setObjectName("edFileName") self.verticalLayout.addWidget(self.edFileName) - self.fieldName_3 = QtGui.QLabel(DlgDownloadKeyToDisk) - self.fieldName_3.setObjectName("fieldName_3") - self.verticalLayout.addWidget(self.fieldName_3) + self.fieldHeader_3 = QtGui.QLabel(DlgDownloadKeyToDisk) + self.fieldHeader_3.setObjectName("fieldHeader_3") + self.verticalLayout.addWidget(self.fieldHeader_3) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.edDirectory = QtGui.QLineEdit(DlgDownloadKeyToDisk) @@ -64,9 +64,9 @@ def retranslateUi(self, DlgDownloadKeyToDisk): DlgDownloadKeyToDisk.setWindowTitle(QtGui.QApplication.translate("DlgDownloadKeyToDisk", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName.setText(QtGui.QApplication.translate("DlgDownloadKeyToDisk", "Key:", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName_2.setText(QtGui.QApplication.translate("DlgDownloadKeyToDisk", "File name:", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName_3.setText(QtGui.QApplication.translate("DlgDownloadKeyToDisk", "Directory:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader.setText(QtGui.QApplication.translate("DlgDownloadKeyToDisk", "Key:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_2.setText(QtGui.QApplication.translate("DlgDownloadKeyToDisk", "File name:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_3.setText(QtGui.QApplication.translate("DlgDownloadKeyToDisk", "Directory:", None, QtGui.QApplication.UnicodeUTF8)) self.btChooseDirectory.setText(QtGui.QApplication.translate("DlgDownloadKeyToDisk", "...", None, QtGui.QApplication.UnicodeUTF8)) Modified: trunk/fclient/fclient/impl/tpls/Ui_DlgPropsBrowserObjectTpl.py =================================================================== --- trunk/fclient/fclient/impl/tpls/Ui_DlgPropsBrowserObjectTpl.py 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/Ui_DlgPropsBrowserObjectTpl.py 2008-07-31 18:45:36 UTC (rev 842) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui' +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/DlgPropsBrowserObjectTpl.ui' # -# Created: Thu Jul 31 18:25:16 2008 +# Created: Thu Jul 31 20:23:14 2008 # by: PyQt4 UI code generator 4.4.3-snapshot-20080705 # # WARNING! All changes made in this file will be lost! @@ -17,15 +17,15 @@ self.gridLayout.setObjectName("gridLayout") self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") - self.fieldName = QtGui.QLabel(DlgPropsBrowserObject) + self.fieldHeader = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fieldName.sizePolicy().hasHeightForWidth()) - self.fieldName.setSizePolicy(sizePolicy) - self.fieldName.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.fieldName.setObjectName("fieldName") - self.verticalLayout.addWidget(self.fieldName) + sizePolicy.setHeightForWidth(self.fieldHeader.sizePolicy().hasHeightForWidth()) + self.fieldHeader.setSizePolicy(sizePolicy) + self.fieldHeader.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.fieldHeader.setObjectName("fieldHeader") + self.verticalLayout.addWidget(self.fieldHeader) self.labeType = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -35,15 +35,15 @@ self.labeType.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) self.labeType.setObjectName("labeType") self.verticalLayout.addWidget(self.labeType) - self.fieldName_2 = QtGui.QLabel(DlgPropsBrowserObject) + self.fieldHeader_2 = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fieldName_2.sizePolicy().hasHeightForWidth()) - self.fieldName_2.setSizePolicy(sizePolicy) - self.fieldName_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.fieldName_2.setObjectName("fieldName_2") - self.verticalLayout.addWidget(self.fieldName_2) + sizePolicy.setHeightForWidth(self.fieldHeader_2.sizePolicy().hasHeightForWidth()) + self.fieldHeader_2.setSizePolicy(sizePolicy) + self.fieldHeader_2.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.fieldHeader_2.setObjectName("fieldHeader_2") + self.verticalLayout.addWidget(self.fieldHeader_2) self.labelTitle = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -53,15 +53,15 @@ self.labelTitle.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) self.labelTitle.setObjectName("labelTitle") self.verticalLayout.addWidget(self.labelTitle) - self.fieldName_3 = QtGui.QLabel(DlgPropsBrowserObject) + self.fieldHeader_3 = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fieldName_3.sizePolicy().hasHeightForWidth()) - self.fieldName_3.setSizePolicy(sizePolicy) - self.fieldName_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.fieldName_3.setObjectName("fieldName_3") - self.verticalLayout.addWidget(self.fieldName_3) + sizePolicy.setHeightForWidth(self.fieldHeader_3.sizePolicy().hasHeightForWidth()) + self.fieldHeader_3.setSizePolicy(sizePolicy) + self.fieldHeader_3.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.fieldHeader_3.setObjectName("fieldHeader_3") + self.verticalLayout.addWidget(self.fieldHeader_3) self.labelName = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -71,15 +71,15 @@ self.labelName.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) self.labelName.setObjectName("labelName") self.verticalLayout.addWidget(self.labelName) - self.fieldName_4 = QtGui.QLabel(DlgPropsBrowserObject) + self.fieldHeader_4 = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fieldName_4.sizePolicy().hasHeightForWidth()) - self.fieldName_4.setSizePolicy(sizePolicy) - self.fieldName_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.fieldName_4.setObjectName("fieldName_4") - self.verticalLayout.addWidget(self.fieldName_4) + sizePolicy.setHeightForWidth(self.fieldHeader_4.sizePolicy().hasHeightForWidth()) + self.fieldHeader_4.setSizePolicy(sizePolicy) + self.fieldHeader_4.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.fieldHeader_4.setObjectName("fieldHeader_4") + self.verticalLayout.addWidget(self.fieldHeader_4) self.labelLinkUrl = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -89,15 +89,15 @@ self.labelLinkUrl.setTextInteractionFlags(QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) self.labelLinkUrl.setObjectName("labelLinkUrl") self.verticalLayout.addWidget(self.labelLinkUrl) - self.fieldName_5 = QtGui.QLabel(DlgPropsBrowserObject) + self.fieldHeader_5 = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.fieldName_5.sizePolicy().hasHeightForWidth()) - self.fieldName_5.setSizePolicy(sizePolicy) - self.fieldName_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) - self.fieldName_5.setObjectName("fieldName_5") - self.verticalLayout.addWidget(self.fieldName_5) + sizePolicy.setHeightForWidth(self.fieldHeader_5.sizePolicy().hasHeightForWidth()) + self.fieldHeader_5.setSizePolicy(sizePolicy) + self.fieldHeader_5.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.fieldHeader_5.setObjectName("fieldHeader_5") + self.verticalLayout.addWidget(self.fieldHeader_5) self.labelImageUrl = QtGui.QLabel(DlgPropsBrowserObject) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) @@ -128,15 +128,15 @@ def retranslateUi(self, DlgPropsBrowserObject): DlgPropsBrowserObject.setWindowTitle(QtGui.QApplication.translate("DlgPropsBrowserObject", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Type:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Type:", None, QtGui.QApplication.UnicodeUTF8)) self.labeType.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName_2.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Title:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_2.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Title:", None, QtGui.QApplication.UnicodeUTF8)) self.labelTitle.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName_3.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Name:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_3.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "Name:", None, QtGui.QApplication.UnicodeUTF8)) self.labelName.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName_4.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "LinkUrl:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_4.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "LinkUrl:", None, QtGui.QApplication.UnicodeUTF8)) self.labelLinkUrl.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName_5.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "ImageUrl:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_5.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "ImageUrl:", None, QtGui.QApplication.UnicodeUTF8)) self.labelImageUrl.setText(QtGui.QApplication.translate("DlgPropsBrowserObject", "unknown", None, QtGui.QApplication.UnicodeUTF8)) Modified: trunk/fclient/fclient/impl/tpls/Ui_DlgSingleAppErrorTpl.py =================================================================== --- trunk/fclient/fclient/impl/tpls/Ui_DlgSingleAppErrorTpl.py 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/Ui_DlgSingleAppErrorTpl.py 2008-07-31 18:45:36 UTC (rev 842) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/DlgSingleAppErrorTpl.ui' +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/DlgSingleAppErrorTpl.ui' # -# Created: Thu Jul 31 18:26:22 2008 +# Created: Thu Jul 31 20:24:37 2008 # by: PyQt4 UI code generator 4.4.3-snapshot-20080705 # # WARNING! All changes made in this file will be lost! @@ -36,15 +36,15 @@ self.verticalLayout_2.setObjectName("verticalLayout_2") self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") - self.fieldName = QtGui.QLabel(self.layoutWidget) - self.fieldName.setObjectName("fieldName") - self.verticalLayout.addWidget(self.fieldName) + self.fieldHeader = QtGui.QLabel(self.layoutWidget) + self.fieldHeader.setObjectName("fieldHeader") + self.verticalLayout.addWidget(self.fieldHeader) self.edHost = QtGui.QLineEdit(self.layoutWidget) self.edHost.setObjectName("edHost") self.verticalLayout.addWidget(self.edHost) - self.fieldName_2 = QtGui.QLabel(self.layoutWidget) - self.fieldName_2.setObjectName("fieldName_2") - self.verticalLayout.addWidget(self.fieldName_2) + self.fieldHeader_2 = QtGui.QLabel(self.layoutWidget) + self.fieldHeader_2.setObjectName("fieldHeader_2") + self.verticalLayout.addWidget(self.fieldHeader_2) self.spinPort = QtGui.QSpinBox(self.layoutWidget) self.spinPort.setObjectName("spinPort") self.verticalLayout.addWidget(self.spinPort) @@ -60,8 +60,8 @@ def retranslateUi(self, DlgSingleAppError): DlgSingleAppError.setWindowTitle(QtGui.QApplication.translate("DlgSingleAppError", "Dialog", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName.setText(QtGui.QApplication.translate("DlgSingleAppError", "Host: ", None, QtGui.QApplication.UnicodeUTF8)) - self.fieldName_2.setText(QtGui.QApplication.translate("DlgSingleAppError", "Port: ", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader.setText(QtGui.QApplication.translate("DlgSingleAppError", "Host: ", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_2.setText(QtGui.QApplication.translate("DlgSingleAppError", "Port: ", None, QtGui.QApplication.UnicodeUTF8)) if __name__ == "__main__": Modified: trunk/fclient/fclient/impl/tpls/Ui_PrefsBrowserWidgetTpl.py =================================================================== --- trunk/fclient/fclient/impl/tpls/Ui_PrefsBrowserWidgetTpl.py 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/Ui_PrefsBrowserWidgetTpl.py 2008-07-31 18:45:36 UTC (rev 842) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/PrefsBrowserWidgetTpl.ui' +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/PrefsBrowserWidgetTpl.ui' # -# Created: Sun Jul 27 13:41:50 2008 +# Created: Thu Jul 31 20:43:06 2008 # by: PyQt4 UI code generator 4.4.3-snapshot-20080705 # # WARNING! All changes made in this file will be lost! @@ -12,75 +12,69 @@ class Ui_PrefsBrowserWidget(object): def setupUi(self, PrefsBrowserWidget): PrefsBrowserWidget.setObjectName("PrefsBrowserWidget") - PrefsBrowserWidget.resize(532, 186) - self.gridLayout_3 = QtGui.QGridLayout(PrefsBrowserWidget) - self.gridLayout_3.setObjectName("gridLayout_3") - self.horizontalLayout_2 = QtGui.QHBoxLayout() - self.horizontalLayout_2.setObjectName("horizontalLayout_2") - self.label = QtGui.QLabel(PrefsBrowserWidget) - self.label.setObjectName("label") - self.horizontalLayout_2.addWidget(self.label) + PrefsBrowserWidget.resize(456, 253) + self.gridLayout = QtGui.QGridLayout(PrefsBrowserWidget) + self.gridLayout.setObjectName("gridLayout") + self.fieldHeader = QtGui.QLabel(PrefsBrowserWidget) + self.fieldHeader.setObjectName("fieldHeader") + self.gridLayout.addWidget(self.fieldHeader, 0, 0, 1, 1) self.edHomePage = QtGui.QLineEdit(PrefsBrowserWidget) self.edHomePage.setDragEnabled(True) self.edHomePage.setObjectName("edHomePage") - self.horizontalLayout_2.addWidget(self.edHomePage) - self.gridLayout_3.addLayout(self.horizontalLayout_2, 0, 0, 1, 1) + self.gridLayout.addWidget(self.edHomePage, 1, 0, 1, 1) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") - self.groupBox = QtGui.QGroupBox(PrefsBrowserWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.groupBox.sizePolicy().hasHeightForWidth()) - self.groupBox.setSizePolicy(sizePolicy) - self.groupBox.setObjectName("groupBox") - self.gridLayout = QtGui.QGridLayout(self.groupBox) - self.gridLayout.setObjectName("gridLayout") - self.ckOpenLinksInNewTab = QtGui.QCheckBox(self.groupBox) - self.ckOpenLinksInNewTab.setObjectName("ckOpenLinksInNewTab") - self.gridLayout.addWidget(self.ckOpenLinksInNewTab, 0, 0, 1, 1) - self.ckOpenBookmarksInNewTab = QtGui.QCheckBox(self.groupBox) - self.ckOpenBookmarksInNewTab.setObjectName("ckOpenBookmarksInNewTab") - self.gridLayout.addWidget(self.ckOpenBookmarksInNewTab, 4, 0, 1, 1) - self.ckOpenAddressBarInNewTab = QtGui.QCheckBox(self.groupBox) + self.verticalLayout_2 = QtGui.QVBoxLayout() + self.verticalLayout_2.setObjectName("verticalLayout_2") + self.fieldHeader_2 = QtGui.QLabel(PrefsBrowserWidget) + self.fieldHeader_2.setObjectName("fieldHeader_2") + self.verticalLayout_2.addWidget(self.fieldHeader_2) + self.ckOpenAddressBarInNewTab = QtGui.QCheckBox(PrefsBrowserWidget) self.ckOpenAddressBarInNewTab.setObjectName("ckOpenAddressBarInNewTab") - self.gridLayout.addWidget(self.ckOpenAddressBarInNewTab, 1, 0, 1, 1) - self.horizontalLayout.addWidget(self.groupBox) - self.groupBox_2 = QtGui.QGroupBox(PrefsBrowserWidget) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Minimum) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth(self.groupBox_2.sizePolicy().hasHeightForWidth()) - self.groupBox_2.setSizePolicy(sizePolicy) - self.groupBox_2.setObjectName("groupBox_2") - self.gridLayout_2 = QtGui.QGridLayout(self.groupBox_2) - self.gridLayout_2.setObjectName("gridLayout_2") - self.ckOpenHomePageOnNewTabCreated = QtGui.QCheckBox(self.groupBox_2) + self.verticalLayout_2.addWidget(self.ckOpenAddressBarInNewTab) + self.ckOpenBookmarksInNewTab = QtGui.QCheckBox(PrefsBrowserWidget) + self.ckOpenBookmarksInNewTab.setObjectName("ckOpenBookmarksInNewTab") + self.verticalLayout_2.addWidget(self.ckOpenBookmarksInNewTab) + self.ckOpenLinksInNewTab = QtGui.QCheckBox(PrefsBrowserWidget) + self.ckOpenLinksInNewTab.setObjectName("ckOpenLinksInNewTab") + self.verticalLayout_2.addWidget(self.ckOpenLinksInNewTab) + self.horizontalLayout.addLayout(self.verticalLayout_2) + self.line = QtGui.QFrame(PrefsBrowserWidget) + self.line.setFrameShape(QtGui.QFrame.VLine) + self.line.setFrameShadow(QtGui.QFrame.Sunken) + self.line.setObjectName("line") + self.horizontalLayout.addWidget(self.line) + self.verticalLayout = QtGui.QVBoxLayout() + self.verticalLayout.setObjectName("verticalLayout") + self.fieldHeader_3 = QtGui.QLabel(PrefsBrowserWidget) + self.fieldHeader_3.setObjectName("fieldHeader_3") + self.verticalLayout.addWidget(self.fieldHeader_3) + self.ckOpenHomePageOnNewTabCreated = QtGui.QCheckBox(PrefsBrowserWidget) self.ckOpenHomePageOnNewTabCreated.setObjectName("ckOpenHomePageOnNewTabCreated") - self.gridLayout_2.addWidget(self.ckOpenHomePageOnNewTabCreated, 0, 0, 1, 1) - self.ckBackIsClose = QtGui.QCheckBox(self.groupBox_2) + self.verticalLayout.addWidget(self.ckOpenHomePageOnNewTabCreated) + self.ckBackIsClose = QtGui.QCheckBox(PrefsBrowserWidget) self.ckBackIsClose.setObjectName("ckBackIsClose") - self.gridLayout_2.addWidget(self.ckBackIsClose, 1, 0, 1, 1) - self.ckAutoLoadImages = QtGui.QCheckBox(self.groupBox_2) + self.verticalLayout.addWidget(self.ckBackIsClose) + self.ckAutoLoadImages = QtGui.QCheckBox(PrefsBrowserWidget) self.ckAutoLoadImages.setObjectName("ckAutoLoadImages") - self.gridLayout_2.addWidget(self.ckAutoLoadImages, 2, 0, 1, 1) - self.horizontalLayout.addWidget(self.groupBox_2) - self.gridLayout_3.addLayout(self.horizontalLayout, 1, 0, 1, 1) - spacerItem = QtGui.QSpacerItem(20, 297, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) - self.gridLayout_3.addItem(spacerItem, 2, 0, 1, 1) + self.verticalLayout.addWidget(self.ckAutoLoadImages) + self.horizontalLayout.addLayout(self.verticalLayout) + self.gridLayout.addLayout(self.horizontalLayout, 2, 0, 1, 1) + spacerItem = QtGui.QSpacerItem(20, 56, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) + self.gridLayout.addItem(spacerItem, 3, 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.groupBox.setTitle(QtGui.QApplication.translate("PrefsBrowserWidget", "Open in new tab", None, QtGui.QApplication.UnicodeUTF8)) - self.ckOpenLinksInNewTab.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Links", None, QtGui.QApplication.UnicodeUTF8)) - self.ckOpenBookmarksInNewTab.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Bookmarks", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Homepage:", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_2.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Open in new tab:", None, QtGui.QApplication.UnicodeUTF8)) self.ckOpenAddressBarInNewTab.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Address bar", None, QtGui.QApplication.UnicodeUTF8)) - self.groupBox_2.setTitle(QtGui.QApplication.translate("PrefsBrowserWidget", "Others", None, QtGui.QApplication.UnicodeUTF8)) - self.ckOpenHomePageOnNewTabCreated.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Open home page when a new tab is created", None, QtGui.QApplication.UnicodeUTF8)) + self.ckOpenBookmarksInNewTab.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Bookmarks", None, QtGui.QApplication.UnicodeUTF8)) + self.ckOpenLinksInNewTab.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Links", None, QtGui.QApplication.UnicodeUTF8)) + self.fieldHeader_3.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Others:", None, QtGui.QApplication.UnicodeUTF8)) + self.ckOpenHomePageOnNewTabCreated.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Open homepage in new created tab", None, QtGui.QApplication.UnicodeUTF8)) self.ckBackIsClose.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Back is close", None, QtGui.QApplication.UnicodeUTF8)) self.ckAutoLoadImages.setText(QtGui.QApplication.translate("PrefsBrowserWidget", "Auto load images", None, QtGui.QApplication.UnicodeUTF8)) Modified: trunk/fclient/fclient/impl/tpls/Ui_PrefsConnectionExpertSettingsTpl.py =================================================================== --- trunk/fclient/fclient/impl/tpls/Ui_PrefsConnectionExpertSettingsTpl.py 2008-07-31 17:37:10 UTC (rev 841) +++ trunk/fclient/fclient/impl/tpls/Ui_PrefsConnectionExpertSettingsTpl.py 2008-07-31 18:45:36 UTC (rev 842) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/PrefsConnectionExpertSettingsTpl.ui' +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/PrefsConnectionExpertSettingsTpl.ui' # -# Created: Wed Jul 30 17:47:37 2008 +# Created: Thu Jul 31 20:22:01 2008 # by: PyQt4 UI code generator 4.4.3-snapshot-20080705 # # WARNING! All changes made in this file will be lost! @@ -12,25 +12,20 @@ class Ui_PrefsConnectionExpertSettings(object): def setupUi(self, PrefsConnectionExpertSettings): PrefsConnectionExpertSettings.setObjectName("PrefsConnectionExpertSettings") - PrefsConnectionExpertSettings.resize(520, 550) - self.gridLayout_2 = QtGui.QGridLayout(PrefsConn... [truncated message content] |
From: <jU...@us...> - 2008-08-02 10:31:24
|
Revision: 857 http://fclient.svn.sourceforge.net/fclient/?rev=857&view=rev Author: jUrner Date: 2008-08-02 10:31:31 +0000 (Sat, 02 Aug 2008) Log Message: ----------- give DlgPrefs a name Modified Paths: -------------- trunk/fclient/fclient/impl/Prefs.py trunk/fclient/fclient/impl/config.py Modified: trunk/fclient/fclient/impl/Prefs.py =================================================================== --- trunk/fclient/fclient/impl/Prefs.py 2008-08-02 10:21:41 UTC (rev 856) +++ trunk/fclient/fclient/impl/Prefs.py 2008-08-02 10:31:31 UTC (rev 857) @@ -15,7 +15,7 @@ # #********************************************************************************** class Settings(config.SettingsBase): - _key_ = config.IdViewBrowserWidget + _key_ = config.IdDlgPrefs _settings_ = ( ('DlgState', 'String', '', config.SettingScopePrivate), ) @@ -53,7 +53,6 @@ class PrefsDlg(dlgpreferences.DlgPreferencesFlatTree): def __init__(self, parent): - pages = PrefsPageRoot()( PrefsPageGlobal(), PrefsPageConnectionExpertSettings() @@ -62,12 +61,12 @@ ), PrefsPageBrowser(), ) - dlgpreferences.DlgPreferencesFlatTree.__init__(self, parent, pages=pages, startPage=PrefsPageGlobal.UUID, ) + self.setObjectName(config.IdDlgPrefs) self.fcSettings = Settings(self).restore() Modified: trunk/fclient/fclient/impl/config.py =================================================================== --- trunk/fclient/fclient/impl/config.py 2008-08-02 10:21:41 UTC (rev 856) +++ trunk/fclient/fclient/impl/config.py 2008-08-02 10:31:31 UTC (rev 857) @@ -44,6 +44,7 @@ IdViewCDownloadsWidget = 'ViewDownloadsWidget' IdViewLoggerWidget = 'ViewDownloadsWidget' IdViewLoggerWidget = 'ViewLoggerWidget' +IdDlgPrefs = 'DlgPrefs' class ObjectRegistry(weakref.WeakValueDictionary): @@ -102,6 +103,7 @@ class Settings(SettingsBase): _key_ = 'ConfigSettings' _settings_ = ( + ('Version', 'String', QtCore.QString(FcVersion), SettingScopePrivate), ('SingleAppHost', 'String', QtCore.QString('localhost'), SettingScopeExpert), ('SingleAppPort', 'UInt', 45663, SettingScopeExpert), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-03 08:21:47
|
Revision: 870 http://fclient.svn.sourceforge.net/fclient/?rev=870&view=rev Author: jUrner Date: 2008-08-03 08:21:56 +0000 (Sun, 03 Aug 2008) Log Message: ----------- fixed a bug in dls when removing dls (was: ups, QTreeWidgetItemIterator does not work as i expected) Modified Paths: -------------- trunk/fclient/fclient/impl/ViewDownloads.py trunk/fclient/fclient/impl/lib/qt4ex/treewidgetwrap.py Modified: trunk/fclient/fclient/impl/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-02 19:33:37 UTC (rev 869) +++ trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-03 08:21:56 UTC (rev 870) @@ -349,18 +349,25 @@ def onRemoveSelectedDownloads(self, action): tree = self.controlById(self.IdTree) - for item in tree.selectedItems(): + selectedItems = tree.selectedItems() + + # remove items + for item in selectedItems: parent = item.parent() if parent is None: parent = tree.invisibleRootItem() - it = treewidgetwrap.TreeWidgetIterator(parent) - it.next() - for tmp_item in it: - del self.fcpRequests[tmp_item.fcpRequest['Identifier']] - config.fcpClient.removeRequest(tmp_item.fcpRequest) - tmp_item.fcpRequest = None parent.removeChild(item) + # cancel all requests + for item in selectedItems: + for tmp_item in treewidgetwrap.walkItem(item): + if tmp_item.fcpRequest is not None: # we may come across the same item multiple times + del self.fcpRequests[tmp_item.fcpRequest['Identifier']] + config.fcpClient.removeRequest(tmp_item.fcpRequest) + tmp_item.fcpRequest = None + + + def onRestartSelectedDownloads(self, action): tree = self.controlById(self.IdTree) for item in tree.selectedItems(): Modified: trunk/fclient/fclient/impl/lib/qt4ex/treewidgetwrap.py =================================================================== --- trunk/fclient/fclient/impl/lib/qt4ex/treewidgetwrap.py 2008-08-02 19:33:37 UTC (rev 869) +++ trunk/fclient/fclient/impl/lib/qt4ex/treewidgetwrap.py 2008-08-03 08:21:56 UTC (rev 870) @@ -26,3 +26,24 @@ raise StopIteration return value +#*************************************************************************************** +# ups, if my observaions are correct, QTreeWidgetItemIterator handles the tree as list. +#<root> +# <item1> +# <item2> +# +#for i in TreeWidgetIterator(<item1>): item +#<item1> +#<item2> +#for i in TreeWidgetIterator(<item2>): item +#<item2> +# +#thow in a walker to fix this.. +#************************************************************************************** +def walkItem(item): + yield item + for i in xrange(item.childCount()): + child = item.child(i) + for x in walkItem(child): + yield x + \ 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-08-03 19:18:46
|
Revision: 871 http://fclient.svn.sourceforge.net/fclient/?rev=871&view=rev Author: jUrner Date: 2008-08-03 19:18:54 +0000 (Sun, 03 Aug 2008) Log Message: ----------- this and that Modified Paths: -------------- trunk/fclient/fclient/impl/DlgDownloadKeyToDisk.py trunk/fclient/fclient/impl/DlgSingleAppError.py trunk/fclient/fclient/impl/MainWindow.py trunk/fclient/fclient/impl/Prefs.py trunk/fclient/fclient/impl/View.py trunk/fclient/fclient/impl/ViewBrowser.py trunk/fclient/fclient/impl/ViewConnection.py trunk/fclient/fclient/impl/ViewDownloads.py trunk/fclient/fclient/impl/ViewLogger.py trunk/fclient/fclient/impl/config.py trunk/fclient/fclient/impl/lib/fcp2/client.py trunk/fclient/fclient/impl/lib/fcp2/consts.py trunk/fclient/fclient/impl/lib/fcp2/key.py trunk/fclient/fclient/impl/lib/numbers.py Modified: trunk/fclient/fclient/impl/DlgDownloadKeyToDisk.py =================================================================== --- trunk/fclient/fclient/impl/DlgDownloadKeyToDisk.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/DlgDownloadKeyToDisk.py 2008-08-03 19:18:54 UTC (rev 871) @@ -22,7 +22,7 @@ class Settings(config.SettingsBase): _key_ = 'DlgDownloadKeyToDisk' _settings_ = ( - ('Geometry', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate), + ('Geometry', 'ByteArray', QtCore.QByteArray()), ) @@ -49,6 +49,7 @@ # setup key editbox ed = self.controlById(self.IdEdKey) + print fcpKey if fcpKey is not None: ed.setText(fcpKey.toString()) Modified: trunk/fclient/fclient/impl/DlgSingleAppError.py =================================================================== --- trunk/fclient/fclient/impl/DlgSingleAppError.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/DlgSingleAppError.py 2008-08-03 19:18:54 UTC (rev 871) @@ -21,8 +21,8 @@ class Settings(config.SettingsBase): _key_ = 'DlgSingleAppError' _settings_ = ( - ('Geometry', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate), - ('SplitterPos', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate), + ('Geometry', 'ByteArray', QtCore.QByteArray()), + ('SplitterPos', 'ByteArray', QtCore.QByteArray()), ) Modified: trunk/fclient/fclient/impl/MainWindow.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/MainWindow.py 2008-08-03 19:18:54 UTC (rev 871) @@ -20,7 +20,7 @@ _key_ = config.IdMainWindow _settings_ = ( - ('Geometry', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate), + ('Geometry', 'ByteArray', QtCore.QByteArray()), ) Modified: trunk/fclient/fclient/impl/Prefs.py =================================================================== --- trunk/fclient/fclient/impl/Prefs.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/Prefs.py 2008-08-03 19:18:54 UTC (rev 871) @@ -3,7 +3,7 @@ import os; __path__ = [os.path.dirname(__file__)] -from PyQt4 import QtGui +from PyQt4 import QtCore, QtGui from . import config from .lib.qt4ex import dlgpreferences @@ -17,7 +17,7 @@ class Settings(config.SettingsBase): _key_ = config.IdDlgPrefs _settings_ = ( - ('DlgState', 'String', '', config.SettingScopePrivate), + ('DlgState', 'String', QtCore.QString('')), ) Modified: trunk/fclient/fclient/impl/View.py =================================================================== --- trunk/fclient/fclient/impl/View.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/View.py 2008-08-03 19:18:54 UTC (rev 871) @@ -2,8 +2,8 @@ #TODO: # # x. shortcuts for "Go to" menus and items +# x. detatch tabs # -# #*************************************************************************** from __future__ import absolute_import if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below @@ -60,11 +60,11 @@ class Settings(config.SettingsBase): _key_ = config.IdViewWidget _settings_ = ( - ('LastViewTop', 'String', '', config.SettingScopePrivate), - ('LastViewBottom', 'String', '', config.SettingScopePrivate), - ('SplitterPos', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate), - ('ShowTopTabBar', 'Bool', True, config.SettingScopePrivate), - ('ShowBottomTabBar', 'Bool', True, config.SettingScopePrivate), + ('LastViewTop', 'String', QtCore.QString('')), + ('LastViewBottom', 'String', QtCore.QString('')), + ('SplitterPos', 'ByteArray', QtCore.QByteArray()), + ('ShowTopTabBar', 'Bool', True), + ('ShowBottomTabBar', 'Bool', True), ) Modified: trunk/fclient/fclient/impl/ViewBrowser.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/ViewBrowser.py 2008-08-03 19:18:54 UTC (rev 871) @@ -36,6 +36,9 @@ # more menu entries # x. dropping. accept keys +1. what else to accept? # x. option to upload content from browser? "upload current page" / image ..whatevs +# x. print contents +# x. save page +# x. a note on "save link". if it points to a html page, no media is saved, just the html #****************************************************************************************** """ @@ -60,9 +63,26 @@ #***************************************************************************************** # #***************************************************************************************** +# to browse via fcp... +#from PyQt4 import QtNetwork +#class NetworkAccessManager(QtNetwork.QNetworkAccessManager): +# +# def __init__(self, parent): +# QtNetwork.QNetworkAccessManager.__init__(self, parent) +# +# def createRequest(self, operation, request, outgoingData): +# print 'createRequest', request.url() +# reply = QtNetwork.QNetworkAccessManager.createRequest(self, operation, request, outgoingData) +# #TODO: implement QNetworkReply() +# return reply + + + class Page(QtWebKit.QWebPage): def __init__(self, parent): QtWebKit.QWebPage.__init__(self, parent) + + #self.setNetworkAccessManager(NetworkAccessManager(self)) #def acceptNavigationRequest(self, frame, request, typeRequest): # return True @@ -214,18 +234,18 @@ class BrowserWidgetSettings(config.SettingsBase): _key_ = config.IdViewBrowserWidget _settings_ = ( - ('OpenLinksInNewTab', 'Bool', False, config.SettingScopeUser), - ('OpenAddressBarInNewTab', 'Bool', False, config.SettingScopeUser), - ('OpenBookmarksInNewTab', 'Bool', False, config.SettingScopeUser), - ('OpenHomePageOnNewTabCreated', 'Bool', False, config.SettingScopeUser), - ('BackIsClose', 'Bool', False, config.SettingScopeUser), #TODO: not implemented - ('HomePage', 'String', QtCore.QString(), config.SettingScopeUser), - ('AutoLoadImages', 'Bool', True, config.SettingScopeUser), #TODO: not yet implemented - ('MaxTabText', 'UInt', 15, config.SettingScopeUser), #NOTE: make shure Max >= Min and Max and Min > 0 - ('MinTabText', 'UInt', 15, config.SettingScopeUser), + ('OpenLinksInNewTab', 'Bool', False), + ('OpenAddressBarInNewTab', 'Bool', False), + ('OpenBookmarksInNewTab', 'Bool', False), + ('OpenHomePageOnNewTabCreated', 'Bool', False), + ('BackIsClose', 'Bool', False), #TODO: not implemented + ('HomePage', 'String', QtCore.QString()), + ('AutoLoadImages', 'Bool', True), #TODO: not yet implemented + ('MaxTabText', 'UInt', 15), #NOTE: make shure Max >= Min and Max and Min > 0 + ('MinTabText', 'UInt', 15), - ('TabProgressBarColor', 'QColor', QtGui.QColor('blue'), config.SettingScopeUser), - ('TabProgressBarAlpha', 'UInt', 55, config.SettingScopeUser), + ('TabProgressBarColor', 'QColor', QtGui.QColor('blue')), + ('TabProgressBarAlpha', 'UInt', 55), ) def setValues(self, **kws): @@ -647,7 +667,7 @@ dlg = DlgDownloadKeyToDisk.DlgDownloadKeyToDisk(self, fcpKey=fcpKey) if dlg.exec_() == dlg.Accepted: fileName = dlg.fileName() - downloadsWidget = config.ObjectRegistry.get(config.IdViewCDownloadsWidget, None) + downloadsWidget = config.ObjectRegistry.get(config.IdViewDownloadsWidget, None) if downloadsWidget is None: raise ValueError('no downloads widget found') downloadsWidget.downloadFile( @@ -822,7 +842,7 @@ page = browser.page() hitTestResult = frame.hitTestContent(pt) pt = browser.mapToGlobal(pt) - + #if not hitTest.isNull(): #TODO: looks like hitTest.isNull() alwas returns True menu = QtGui.QMenu() @@ -936,6 +956,7 @@ url = browser.userData().url self.load(url, browser=browser) + def onBrowserStatusBarMessage(self, qString): browser = self.sender() qString = QtCore.QString(qString) # copy it - qt nukes it on return @@ -1129,33 +1150,3 @@ res = app.exec_() sys.exit(res) -#********************************************************************************** -# -#********************************************************************************** -## looks we could serve pages via fcp, bypassing fproxy -## no reason to do so.. -## -##class NetworkAccessManager(QtNetwork.QNetworkAccessManager): -## -## def __init__(self, parent): -## QtNetwork.QNetworkAccessManager.__init__(self, parent) -## -## def createRequest(self, operation, request, outgoingData): -## print 'createRequest', request.url() -## reply = QtNetwork.QNetworkAccessManager.createRequest(self, operation, request, outgoingData) -## #TODO: implement QNetworkReply() -## return reply -## -## -##class Browser(QtWebKit.QWebView): -## -##def __init__(self, browserWidget): -## QtWebKit.QWebView.__init__(self, browserWidget) -## -## self.nam = NetworkAccessManager(self) -## self.page().setNetworkAccessManager(self.nam) -## -#********************************************************************************** -# -#********************************************************************************** - \ No newline at end of file Modified: trunk/fclient/fclient/impl/ViewConnection.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/ViewConnection.py 2008-08-03 19:18:54 UTC (rev 871) @@ -50,16 +50,16 @@ class Settings(config.SettingsBase): _key_ = config.IdViewConnectionWidget _settings_ = ( - ('FcpAutoConnect', 'Bool', True, config.SettingScopeUser), - ('FcpConnectionName', 'String', config.FcConnectionName, config.SettingScopeExpert), - ('FcpConnectionHost', 'String', fcp2.Client.DefaultFcpHost, config.SettingScopeUser), - ('FcpConnectionPort', 'UInt', fcp2.Client.DefaultFcpPort, config.SettingScopeUser), - ('FcpConnectionTimerTimeout', 'UInt', 500, config.SettingScopeExpert), - ('FcpConnectionTimerMaxDuration', 'UInt', 20, config.SettingScopeExpert), - ('FcpPollTimerTimeout', 'UInt', 200, config.SettingScopeExpert), + ('FcpAutoConnect', 'Bool', True), + ('FcpConnectionName', 'String', config.FcConnectionName), + ('FcpConnectionHost', 'String', fcp2.Client.DefaultFcpHost), + ('FcpConnectionPort', 'UInt', fcp2.Client.DefaultFcpPort), + ('FcpConnectionTimerTimeout', 'UInt', 500), + ('FcpConnectionTimerMaxDuration', 'UInt', 20), + ('FcpPollTimerTimeout', 'UInt', 200), - ('FproxyConnectionHost', 'String','127.0.0.1', config.SettingScopeUser), - ('FproxyConnectionPort', 'UInt', 8888, config.SettingScopeUser), + ('FproxyConnectionHost', 'String','127.0.0.1'), + ('FproxyConnectionPort', 'UInt', 8888), ) def setValues(self, **kws): Modified: trunk/fclient/fclient/impl/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-03 19:18:54 UTC (rev 871) @@ -25,13 +25,20 @@ # x. it may take a while untill the final DataFound message arrives when a request is % completed. feedback would be nice # x. DataFound for a request the file has been removed by the user. no idea what happens. have to test this # x. when the node is about to start up, looks like persistents may arrive or not. check - # x. how to get early information about mimetype/size? maybe use FcpClient.getFileInfo() - # x. show/hide header izems - # x. sort by header - # x. indicate over all time / dl speed - # x. indicate status / remove items by status - # x. ...whatevs - #************************************************************************************************************** +# x. how to get early information about mimetype/size? maybe use FcpClient.getFileInfo() +# x. show/hide header izems +# x. sort by header +# x. indicate over all time / dl speed +# x. indicate status / remove items by status +# x. item properties +# x. how to handle inserting huge number of dls? +# idea: insert with lowest priority to get the node to know them, increase priority when a slot in +# MaxSimultaneousDls (if set) is free. atatch progressBar no sooner as priority > MinDlPriority +# x. how to handle huge numbers of dls. the node will flood us on startup with persistents. looks +# like the only way to control the flood is to have one connection/dl. maybe wait for freenet devels +# to realize that this is a serious problem... +# x. byte amount postfixes must be transllated ++ use Kib or Kb or let the user decide? +#************************************************************************************************************** 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__)] @@ -134,7 +141,7 @@ self.action( name='ActionDownloadKeyToDisk', text=self.trUtf8('Download &key...'), - trigger=parent.onDownloadKey, + trigger=parent.onDlgDownloadKey, ) self.action( name='ActionRemoveSelectedDownloads', @@ -152,7 +159,7 @@ class DownloadsWidgetSettings(config.SettingsBase): - _key_ = config.IdViewCDownloadsWidget + _key_ = config.IdViewDownloadsWidget _settings_ = ( ) #********************************************************************************** @@ -209,8 +216,12 @@ def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): QtGui.QWidget.__init__(self, parent) self._isCreated = False + self.fcHeaderLabels = {} # fcpIdentifier --> treeItem + self.fcpRequests = {} + self.fcRequestStatus = {} + + self.setupUi(self) - self.setupUi(self) config.ObjectRegistry.register(self) self.fcSettings = DownloadsWidgetSettings(self).restore() self.fcActions = DownloadsWidgetActions(self) @@ -226,8 +237,6 @@ (config.fcpClient.events.RequestRemoved, self.onFcpRequestRemoved), ) config.fcpClient.events += self.fcpEvents - self.fcHeadeLabels = {} # fcpIdentifier --> treeItem - self.fcpRequests = {} ############################ ## private methods @@ -275,7 +284,7 @@ def retranslateUi(self, parent): Ui_ViewDownloadsWidget.retranslateUi(self, parent) tree = self.controlById(self.IdTree) - self.fcHeadeLabels = { + self.fcHeaderLabels = { self.HeaderIndexName: self.trUtf8('Name'), self.HeaderIndexSize: self.trUtf8('Size'), self.HeaderIndexMimeType: self.trUtf8('MimeType'), @@ -283,7 +292,15 @@ self.HeaderIndexProgress: self.trUtf8('Progress'), self.HeaderIndexElapsed: self.trUtf8('Elapsed'), } - tree.setHeaderLabels([i[1] for i in sorted(self.fcHeadeLabels.items())]) + tree.setHeaderLabels([i[1] for i in sorted(self.fcHeaderLabels.items())]) + + self.fcRequestStatus = { + None: self.trUtf8('Pending'), + fcp2.ConstRequestStatus.Started: self.trUtf8('Loading'), + fcp2.ConstRequestStatus.Completed: self.trUtf8('Complete'), + fcp2.ConstRequestStatus.Error: self.trUtf8('Error'), + } + #TODO: retranslate all tree items def closeEvent(self): self.viewClose() @@ -328,17 +345,23 @@ **kws ) item = self._createItemFromFcpRequest(fcpRequest) + item.setData( + self.HeaderIndexStatus, + QtCore.Qt.DisplayRole, + QtCore.QVariant(self.fcRequestStatus[None]), + ) def populateMenu(self, menu): menu.addAction(self.fcActions['ActionDownloadKeyToDisk']) return menu - ######################################### - ## event handlers - ######################################### - def onDownloadKey(self, action): - dlg = DlgDownloadKeyToDisk.DlgDownloadKeyToDisk(self, fcpKey=None) + + def execDlgDownloadKey(self, fcpKey=None): + """pops up the dialog to allow the user to download a key to disk + @param fcpKey: key to initialize the key with or None + """ + dlg = DlgDownloadKeyToDisk.DlgDownloadKeyToDisk(self, fcpKey=fcpKey) if dlg.exec_() == dlg.Accepted: self.downloadFile( dlg.fcpKey(), @@ -346,7 +369,13 @@ persistence=fcp2.ConstPersistence.Forever, handleFilenameCollision=True, ) - + + ######################################### + ## event handlers + ######################################### + def onDlgDownloadKey(self, action): + self.execDlgDownloadKey(fcpKey=None) + def onRemoveSelectedDownloads(self, action): tree = self.controlById(self.IdTree) selectedItems = tree.selectedItems() @@ -415,16 +444,24 @@ QtCore.Qt.DisplayRole, QtCore.QVariant(fcpRequest['MetadataContentType']) ) + item.setData( + self.HeaderIndexStatus, + QtCore.Qt.DisplayRole, + QtCore.QVariant(self.fcRequestStatus[fcp2.ConstRequestStatus.Completed]), + ) self._adjustStatusBar(item, 'complete') def onFcpRequestFailed(self, fcpEvent, fcpRequest): item = self.fcpRequests.get(rfcpRequest['Identifier'], None) if item is not None: self._adjustStatusBar(item, 'error') + item.setData( + self.HeaderIndexStatus, + QtCore.Qt.DisplayRole, + QtCore.QVariant(self.fcRequestStatus[fcp2.ConstRequestStatus.Error]), + ) - pass - #TODO: not tested def onFcpRequestModified(self, fcpEvent, fcpRequest): @@ -476,7 +513,12 @@ else: if requestData.get('ClientName', None) == self.objectName(): item = self._createItemFromFcpRequest(fcpRequest) - + item.setData( + self.HeaderIndexStatus, + QtCore.Qt.DisplayRole, + QtCore.QVariant(self.fcRequestStatus[fcp2.ConstRequestStatus.Started]), + ) + #********************************************************************************** # #********************************************************************************** @@ -493,7 +535,6 @@ viewWidget = View.ViewWidget(mainWindow) mainWindow.setCentralWidget(viewWidget) - viewWidget.addTopViews( ViewConnection.ViewConnectionWidget(None), ViewDownloadsWidget(None), Modified: trunk/fclient/fclient/impl/ViewLogger.py =================================================================== --- trunk/fclient/fclient/impl/ViewLogger.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/ViewLogger.py 2008-08-03 19:18:54 UTC (rev 871) @@ -100,17 +100,17 @@ _key_ = config.IdViewLoggerWidget _settings_ = ( - ('MaxLines', 'UInt', 1000, config.SettingScopeUser), - ('Verbosity', 'PyString', 'Info', config.SettingScopePrivate), + ('MaxLines', 'UInt', 1000), + ('Verbosity', 'PyString', 'Info'), #TODO: Chatty does not seem to work. check in fcp2.client - ('ColorFgVerbosityCRITICAL', 'QColor', QtGui.QColor('red'), config.SettingScopeUser), - ('ColorFgVerbosityERROR', 'QColor', QtGui.QColor('red'), config.SettingScopeUser), - ('ColorFgVerbosityWARNING', 'QColor', QtGui.QColor('red'), config.SettingScopeUser), - ('ColorFgVerbosityINFO', 'QColor', QtGui.QColor('black'), config.SettingScopeUser), - ('ColorFgVerbosityMESSAGE', 'QColor', QtGui.QColor('blue'), config.SettingScopeUser), - ('ColorFgVerbosityDEBUG', 'QColor', QtGui.QColor('slategray'), config.SettingScopeUser), - ('ColorFgVerbosityCHATTY', 'QColor', QtGui.QColor('lightslategray'), config.SettingScopeUser), + ('ColorFgVerbosityCRITICAL', 'QColor', QtGui.QColor('red')), + ('ColorFgVerbosityERROR', 'QColor', QtGui.QColor('red')), + ('ColorFgVerbosityWARNING', 'QColor', QtGui.QColor('red')), + ('ColorFgVerbosityINFO', 'QColor', QtGui.QColor('black')), + ('ColorFgVerbosityMESSAGE', 'QColor', QtGui.QColor('blue')), + ('ColorFgVerbosityDEBUG', 'QColor', QtGui.QColor('slategray')), + ('ColorFgVerbosityCHATTY', 'QColor', QtGui.QColor('lightslategray')), ) Modified: trunk/fclient/fclient/impl/config.py =================================================================== --- trunk/fclient/fclient/impl/config.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/config.py 2008-08-03 19:18:54 UTC (rev 871) @@ -41,7 +41,7 @@ IdViewWidget = 'ViewWidget' IdViewBrowserWidget = 'ViewBrowserWidget' IdViewConnectionWidget = 'ViewConnectionWidget' -IdViewCDownloadsWidget = 'ViewDownloadsWidget' +IdViewDownloadsWidget = 'ViewDownloadsWidget' IdViewLoggerWidget = 'ViewDownloadsWidget' IdViewLoggerWidget = 'ViewLoggerWidget' IdDlgPrefs = 'DlgPrefs' @@ -72,11 +72,6 @@ #********************************************************************************** # #********************************************************************************** -SettingScopeExpert = 0x1 -SettingScopePrivate = 0x2 -SettingScopeUser = 0x4 -SettingSkopeMask = SettingScopeExpert | SettingScopePrivate | SettingScopeUser - class SettingsBase(settings.SettingsBase): """application wide base class for settings""" @@ -103,17 +98,17 @@ class Settings(SettingsBase): _key_ = 'ConfigSettings' _settings_ = ( - ('DlgSingleAppErrorGeometry', 'ByteArray', QtCore.QByteArray(), SettingScopePrivate), + ('DlgSingleAppErrorGeometry', 'ByteArray', QtCore.QByteArray()), - ('Version', 'String', QtCore.QString(FcVersion), SettingScopePrivate), - ('SingleAppHost', 'String', QtCore.QString('localhost'), SettingScopeExpert), - ('SingleAppPort', 'UInt', 45663, SettingScopeExpert), + ('Version', 'String', QtCore.QString(FcVersion)), + ('SingleAppHost', 'String', QtCore.QString('localhost')), + ('SingleAppPort', 'UInt', 45663), - ('SettingsDir', 'String', QtCore.QString(FcSettingsDir), SettingScopeUser), # if not None, settings are stored locally in the app folder - ('SettingsAllUsers', 'Bool', False, SettingScopeUser), # store settings for all users? - ('IconTheme', 'String', QtCore.QString('crystal'), SettingScopeUser), #TODO: global icon theme? - ('IconSize', 'UInt', 32, SettingScopeUser), - ('DownloadDir', 'String', FcDownloadDir, SettingScopeUser), + ('SettingsDir', 'String', QtCore.QString(FcSettingsDir)), # if not None, settings are stored locally in the app folder + ('SettingsAllUsers', 'Bool', False), # store settings for all users? + ('IconTheme', 'String', QtCore.QString('crystal')), #TODO: global icon theme? + ('IconSize', 'UInt', 32), + ('DownloadDir', 'String', FcDownloadDir), ) SettingsBase._config_settings_ = Settings() Modified: trunk/fclient/fclient/impl/lib/fcp2/client.py =================================================================== --- trunk/fclient/fclient/impl/lib/fcp2/client.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/lib/fcp2/client.py 2008-08-03 19:18:54 UTC (rev 871) @@ -920,6 +920,7 @@ del initialRequest.params['Started'] initialRequest['RequestStatus'] |= consts.ConstRequestStatus.Restored + initialRequest['RequestStatus'] |= consts.ConstRequestStatus.Started self.events.RequestStarted(initialRequest) return True Modified: trunk/fclient/fclient/impl/lib/fcp2/consts.py =================================================================== --- trunk/fclient/fclient/impl/lib/fcp2/consts.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/lib/fcp2/consts.py 2008-08-03 19:18:54 UTC (rev 871) @@ -450,12 +450,13 @@ of the bitflags it picked up while running through the client. """ Null = 0x0 - Restored = 0x1 - Compressing = 0x2 - Compressed = 0x4 - Success = 0x8 - Error = 0x10 - Removed = 0x20 + Started = 0x1 + Restored = 0x2 + Compressing = 0x4 + Compressed = 0x8 + Success = 0x10 + Error = 0x20 + Removed = 0x40 Completed =0x10000000 RemovedFromQueue = 0x2000000 Modified: trunk/fclient/fclient/impl/lib/fcp2/key.py =================================================================== --- trunk/fclient/fclient/impl/lib/fcp2/key.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/lib/fcp2/key.py 2008-08-03 19:18:54 UTC (rev 871) @@ -351,7 +351,6 @@ edition = int(edition) return clss(d['keyData'], docName=d['docName'], edition=edition, tail=d['tail'], pManifest=bool(d['pManifest'])) - #**************************************************************************************************** # #**************************************************************************************************** Modified: trunk/fclient/fclient/impl/lib/numbers.py =================================================================== --- trunk/fclient/fclient/impl/lib/numbers.py 2008-08-03 08:21:56 UTC (rev 870) +++ trunk/fclient/fclient/impl/lib/numbers.py 2008-08-03 19:18:54 UTC (rev 871) @@ -8,7 +8,7 @@ #*************************************************************** class ByteSizeNames: Binary = ('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB') - Common = ('', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb') + Common = ('B', 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-07 10:33:31
|
Revision: 872 http://fclient.svn.sourceforge.net/fclient/?rev=872&view=rev Author: jUrner Date: 2008-08-07 10:33:37 +0000 (Thu, 07 Aug 2008) Log Message: ----------- add a sideBar to browser to display detailed load info Modified Paths: -------------- trunk/fclient/fclient/impl/ViewBrowser.py trunk/fclient/fclient/impl/config.py trunk/fclient/fclient/impl/res/stylesheets/default.css trunk/fclient/fclient/impl/tpls/Ui_ViewBrowserWidgetTpl.py trunk/fclient/fclient/impl/tpls/ViewBrowserWidgetTpl.ui Added Paths: ----------- trunk/fclient/fclient/impl/SideBarLoadDetails.py trunk/fclient/fclient/impl/tpls/SideBarLoadDetailsTpl.ui trunk/fclient/fclient/impl/tpls/Ui_SideBarLoadDetailsTpl.py Added: trunk/fclient/fclient/impl/SideBarLoadDetails.py =================================================================== --- trunk/fclient/fclient/impl/SideBarLoadDetails.py (rev 0) +++ trunk/fclient/fclient/impl/SideBarLoadDetails.py 2008-08-07 10:33:37 UTC (rev 872) @@ -0,0 +1,163 @@ +"""sideBar for the browser to show detailed information on page load""" +#******************************************************************************** +#TODO: +# +# x. how to adjust item colors via stylesheet? +# x. assumed we get a networkReplyError() signal when for example an image culd not be loaded. does not happen. check +# x. limit number of requests we keep track off? +# x. context menu actions for items like ...load in browser ..download key (...) +# x. save column widths +# +#******************************************************************************** + + +from __future__ import absolute_import +if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below + import os; __path__ = [os.path.dirname(__file__)] + +import posixpath +from PyQt4 import QtCore, QtGui + +from . import config +from .tpls.Ui_SideBarLoadDetailsTpl import Ui_SideBarLoadDetails +#********************************************************************************** +# +#********************************************************************************** +class SideBarLoadDetailsSettings(config.SettingsBase): + _key_ = config.IdSideBarLoadDetails + _settings_ = ( + ('ColorFgItem', 'QColor', QtGui.QColor('black')), + ('ColorBgItem', 'QColor', QtGui.QColor('white')), + ('ColorFgItemError', 'QColor', QtGui.QColor('black')), + ('ColorBgItemError', 'QColor', QtGui.QColor('red')), + + ) + +class SideBarLoadDetails(QtGui.QWidget, Ui_SideBarLoadDetails): + + IdTree = 'tree' + IdBtClose = 'btClose' + + + def __init__(self, parent=None, closeAction=None): + QtGui.QWidget.__init__(self, parent) + self.setupUi(self) + config.ObjectRegistry.register(self) + self.fcSettings = SideBarLoadDetailsSettings(self).restore() + + # setup tree + tree = self.controlById(self.IdTree) + tree.setUniformRowHeights(True) + tree.setRootIsDecorated(False) + + # setup close button + if closeAction is not None: + bt = self.controlById(self.IdBtClose) + bt.setDefaultAction(closeAction) + + ############################## + ## methods + ############################## + def addNetworkReply(self, indexReply, networkReplyData): + #TODO: better extraction of filename part + tree = self.controlById(self.IdTree) + n = tree.topLevelItemCount() + if indexReply < n: + return + + key = unicode(networkReplyData.url.toString()) + fname = posixpath.basename(posixpath.basename(key)) + if not fname: + fname = '/' + + item= QtGui.QTreeWidgetItem(tree) + item.setData( + 0, + QtCore.Qt.DisplayRole, + QtCore.QVariant('0%') + ) + item.setData( + 1, + QtCore.Qt.DisplayRole, + QtCore.QVariant(fname), + ) + if networkReplyData.bytesTotal < 1: + progress = '0%' + else: + progress = str(int((float(networkReplyData.bytesReceived) / networkReplyData.bytesTotal * 100))) + '%' + if item is not None: + item.setData( + 0, + QtCore.Qt.DisplayRole, + QtCore.QVariant(progress), + ) + item.setForeground(0, self.fcSettings.value('ColorFgItem')) + item.setBackground(0, self.fcSettings.value('ColorBgItem')) + + + def controlById(self, idControl): + return getattr(self, idControl) + + def setBrowser(self, browser): + tree = self.controlById(self.IdTree) + tree.clear() + # setup browser + if browser is not None: + self.connect(browser, QtCore.SIGNAL('networkRequestCreated(int, QObject*)'), self.addNetworkReply) + self.connect(browser, QtCore.SIGNAL('networkReplyProgress(int, QObject*)'), self.onBrowserNetworkReplyProgress) + self.connect(browser, QtCore.SIGNAL('networkReplyError(int, QObject*)'), self.onBrowserNetworkReplyError) + self.connect(browser, QtCore.SIGNAL('networkReplyFinished(int, QObject*)'), self.onBrowserNetworkReplyFinished) + self.connect(browser, QtCore.SIGNAL('loadStarted()'), self.onBrowserLoadStarted) + for indexReply, networkReplyData in enumerate(browser.networkGetReplies()): + self.addNetworkReply(indexReply, networkReplyData) + + def onSetCurrent(self, browserWidget, flag): + if flag: + self.setBrowser(browserWidget.currentBrowser()) + else: + self._items = {} + + ########################### + ## + ########################### + def retranslateUi(self, this): + Ui_SideBarLoadDetails.retranslateUi(self, this) + tree = self.controlById(self.IdTree) + tree.setHeaderLabels(( + self.trUtf8('Progress'), + self.trUtf8('Name'), + )) + + ############################## + ## event handlers + ############################## + def onBrowserLoadStarted(self): + tree = self.controlById(self.IdTree) + tree.clear() + + def onBrowserNetworkReplyProgress(self, indexReply, networkReplyData): + tree = self.controlById(self.IdTree) + item = tree.invisibleRootItem().child(indexReply) + if networkReplyData.bytesTotal < 1: + progress = '0%' + else: + progress = str(int((float(networkReplyData.bytesReceived) / networkReplyData.bytesTotal * 100))) + '%' + if item is not None: + item.setData( + 0, + QtCore.Qt.DisplayRole, + QtCore.QVariant(progress), + ) + + def onBrowserNetworkReplyError(self, indexReply, networkReplyData): + tree = self.controlById(self.IdTree) + item = tree.invisibleRootItem().child(indexReply) + item.setForeground(0, self.fcSettings.value('ColorFgItemError')) + item.setBackground(0, self.fcSettings.value('ColorBgItemError')) + + def onBrowserNetworkReplyFinished(self, indexReply, networkReplyData): + tree = self.controlById(self.IdTree) + item = tree.invisibleRootItem().child(indexReply) + + + Modified: trunk/fclient/fclient/impl/ViewBrowser.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser.py 2008-08-03 19:18:54 UTC (rev 871) +++ trunk/fclient/fclient/impl/ViewBrowser.py 2008-08-07 10:33:37 UTC (rev 872) @@ -37,8 +37,19 @@ # x. dropping. accept keys +1. what else to accept? # x. option to upload content from browser? "upload current page" / image ..whatevs # x. print contents -# x. save page + # x. a note on "save link". if it points to a html page, no media is saved, just the html +# +# x. save page ++ load progress details +# idea: we get pretty detailed information about page load via NetworkAccessManager. +# 1. collect all replies +# 2. request replies one by one via urllib if user wants to dl a page. <dl page to folder...> +# 3. provide detailed feedback for the user on page load. a global widget for all browsers +# should get too heavy. a toolDialog for each page is better maybe. not too hard to +# implement. downside is dialogs flapping around ++ feedback to what browser a +# dialog belongs. upside is: multiple pages can be easily monitored while loading. +# maybe a later version can provide a manager for the dialogs to bundle them +# x. close icon for ActionCloseSideBar #****************************************************************************************** """ @@ -59,37 +70,53 @@ from . import DlgPropsBrowserObject from . import DlgDownloadKeyToDisk +from . import SideBarLoadDetails + from .tpls.Ui_ViewBrowserWidgetTpl import Ui_ViewBrowserWidget #***************************************************************************************** # #***************************************************************************************** # to browse via fcp... -#from PyQt4 import QtNetwork -#class NetworkAccessManager(QtNetwork.QNetworkAccessManager): -# -# def __init__(self, parent): -# QtNetwork.QNetworkAccessManager.__init__(self, parent) -# -# def createRequest(self, operation, request, outgoingData): -# print 'createRequest', request.url() -# reply = QtNetwork.QNetworkAccessManager.createRequest(self, operation, request, outgoingData) -# #TODO: implement QNetworkReply() -# return reply +from PyQt4 import QtNetwork +class NetworkAccessManager(QtNetwork.QNetworkAccessManager): + + def __init__(self, parent): + QtNetwork.QNetworkAccessManager.__init__(self, parent) + + def createRequest(self, operation, request, outgoingData): + reply = QtNetwork.QNetworkAccessManager.createRequest(self, operation, request, outgoingData) + self.emit(QtCore.SIGNAL('networkRequestCreated(QNetworkReply*)'), reply) + + + #print 'createRequest', reply.url() + #self.connect(reply, QtCore.SIGNAL('downloadProgress(qint64, qint64)'), self.foo) + return reply + + def foo(self, *args): + print args - class Page(QtWebKit.QWebPage): def __init__(self, parent): QtWebKit.QWebPage.__init__(self, parent) - #self.setNetworkAccessManager(NetworkAccessManager(self)) - + self.setNetworkAccessManager(NetworkAccessManager(self)) #def acceptNavigationRequest(self, frame, request, typeRequest): # return True #***************************************************************************************** # #***************************************************************************************** +class NetworkReplyData(QtCore.QObject): + def __init__(self, parent, url): + QtCore.QObject.__init__(self, parent) + self.url = url + self.bytesReceived = 0 + self.bytesTotal = 0 + self.finished = False + self.errorCode = None + + class Browser(QtWebKit.QWebView): """ browser customized for freenet """ @@ -105,16 +132,44 @@ #NOTE: we store last progress made to set busy cursor accordingly self._lastProgress = 0 self._userData = userData - + self._networkGetReplies = [[], []] # (QNetworkReplies, urls) + self._networkReplySignals = ( + ('downloadProgress(qint64, qint64)', self.onNetworkReplyDownloadProgress), + ('error(int)', self.onNetworkReplyError), + ('finished()', self.onNetworkReplyFinished), + ) + # connect actions self.connect(self, QtCore.SIGNAL('loadStarted()'), self.onLoadStarted) self.connect(self, QtCore.SIGNAL('loadProgress(int)'), self.onLoadProgress) self.connect(self, QtCore.SIGNAL('loadFinished(bool)'), self.onLoadFinished) self.connect(self.pageAction(QtWebKit.QWebPage.Stop), QtCore.SIGNAL('triggered()'), self.onActionStopTriggered) - + ################################ ## methods ################################ + #TODO: impl in BrowserWidget + def lastProgress(self): + """returns the last progress made by the browser + @return: (int) last progress + """ + return self._lastProgress + + def networkGetReplies(self): + return self._networkGetReplies[1] + + def networkGetReply(self, indexReply): + return self._networkGetReplies[1][indexReply] + + def setUserData(self, userData): + self._userData = userData + + def userData(self): + return self._userData + + ################################ + ## overwritten methods + ################################ #def createWindow(self, typeWindow): # pass @@ -136,22 +191,22 @@ return QtWebKit.QWebView.setHtm(self, *args) def setPage(self, page): - """sets the contents of the browser without changing its url""" + """""" self._lastProgress = 0 + self.connect( + page.networkAccessManager(), + QtCore.SIGNAL('networkRequestCreated(QNetworkReply*)'), + self.onNetworkRequestCreated + ) + + self.emit(QtCore.SIGNAL('pageSet(QWebPage*)'), page) return QtWebKit.QWebView.setPage(self, page) - def setUserData(self, userData): - self._userData = userData - def mouseMoveEvent(self, event): + QtWebKit.QWebView.mouseMoveEvent(self, event) if self._lastProgress < self.MaxProgress: self.setCursor(QtCore.Qt.BusyCursor) - else: - QtWebKit.QWebView.mouseMoveEvent(self, event) - - def userData(self): - return self._userData - + ############################### ## event handlers ############################### @@ -168,16 +223,55 @@ def onLoadStarted(self): self._lastProgress = 0 - + self._networkGetReplies = [[], []] + def onLoadProgress(self, n): self._lastProgress = n - def onLoadFinished(self): - self._lastProgress = self.MaxProgress + def onLoadFinished(self, ok): + if ok: + self._lastProgress = self.MaxProgress self.onActionStopTriggered() def onPageDownloadRequested(self, networkRequest): self.emit(QtCore.SIGNAL('downloadRequested(const QNetworkRequest &)'), networkRequest) + + def onNetworkRequestCreated(self, reply): + if reply.operation() == NetworkAccessManager.GetOperation: + self._networkGetReplies[0].append(reply) + url = QtCore.QUrl(reply.url()) # copy url, qt nules it on return + networkReplyData = NetworkReplyData(self, url) + self._networkGetReplies[1].append(networkReplyData) + for signal, handler in self._networkReplySignals: + self.connect(reply, QtCore.SIGNAL(signal), handler) + self.emit(QtCore.SIGNAL('networkRequestCreated(int, QObject*)'), self._networkGetReplies[0].index(reply), networkReplyData) + + def onNetworkReplyDownloadProgress(self, bytesReceived, bytesTotal): + reply = self.sender() + i = self._networkGetReplies[0].index(reply) + networkReplyData = self._networkGetReplies[1][i] + networkReplyData.bytesReceived = bytesReceived + networkReplyData.bytesTotal = bytesTotal + self.emit(QtCore.SIGNAL('networkReplyProgress(int, QObject*)'), i, networkReplyData) + + def onNetworkReplyError(self, errorCode): + reply = self.sender() + i = self._networkGetReplies[0].index(reply) + networkReplyData = self._networkGetReplies[1][i] + networkReplyData.finished = True + networkReplyData.errorCode = errorCode + self.emit(QtCore.SIGNAL('networkReplyError(int, QObject*)'), i, networkReplyData) + #for signal, handler in self._networkReplySignals: + # self.disconnect(reply, QtCore.SIGNAL(signal), handler) + + def onNetworkReplyFinished(self): + reply = self.sender() + i = self._networkGetReplies[0].index(reply) + networkReplyData = self._networkGetReplies[1][i] + networkReplyData.finished = True + for signal, handler in self._networkReplySignals: + self.disconnect(reply, QtCore.SIGNAL(signal), handler) + self.emit(QtCore.SIGNAL('networkReplyFinished(int, QObject*)'), i, networkReplyData) #********************************************************************************** # @@ -246,6 +340,10 @@ ('TabProgressBarColor', 'QColor', QtGui.QColor('blue')), ('TabProgressBarAlpha', 'UInt', 55), + + ('SplitterPos', 'ByteArray', QtCore.QByteArray()), + ('LastSideBarAction', 'String', QtCore.QString('')), + ) def setValues(self, **kws): @@ -301,12 +399,19 @@ ) #TODO: shortcut self.action( - name='ActionOpenNewTab', - text=self.trUtf8('Open &new tab'), - trigger=parent.onOpenNewTab, + name='ActionCreateNewTab', + text=self.trUtf8('Create &new tab'), + trigger=parent.onCreateNewTab, ) #TODO: shortcut self.action( + name='ActionDuplicateTab', + text=self.trUtf8('&Duplicate tab'), + trigger=parent.onDuplicateTab, + ) + + #TODO: shortcut + self.action( name='ActionGoToFProxy', text=self.trUtf8('Go to f&Proxy homepage'), trigger=parent.onGoToFProxy, @@ -406,6 +511,35 @@ shortcut=QtGui.QKeySequence(QtGui.QKeySequence.FindPrevious), trigger=parent.onFindPrevious, ) + self.action( + name='ActionSavePage', + text=self.trUtf8('Save page..'), + isEnabled=True, + ##shortcut=QtGui.QKeySequence(QtGui.QKeySequence.FindPrevious), + trigger=parent.onSavePage, + ) + + # sideBars + group = self.group( + name='GroupSideBars', + isExclusive=True, + trigger=parent.onShowSidebar, + ) + self.action( + name='ActionShowSideBarLoadDetails', + group=group, + text=self.trUtf8('Load details'), + isEnabled=True, + isCheckable=True, + ) + + self.action( + name='ActionCloseCurrentSideBar', + text=self.trUtf8('Close sidebar'), + isEnabled=True, + trigger=parent.onCloseCurrentSideBar, + ) + def intertwineBrowserActions(self, browser=None): """intertwines Browser actions with BrowserWidget actions @@ -464,7 +598,7 @@ # to give feedback to the user on the navbar. downside is we have # to reimplement contextMenuEvent() :-( self.url = QtCore.QUrl() if url is None else url - + class BrowserTabBar(QtGui.QTabBar): """customized tabBar to show progress indicstor on tabs""" @@ -533,6 +667,9 @@ IdFrameAddressBar = 'frameAddressBar' IdEdAddressBar = 'edAddressBar' + IdTabSideBar = 'tabSideBar' + IdSplitter = 'splitter' + IdBtBack = 'btBack' IdBtForward = 'btForward' IdBtReload = 'btReload' @@ -549,6 +686,8 @@ def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): QtGui.QWidget.__init__(self, parent) + self.menuSideBars = QtGui.QMenu(self.trUtf8('Side bars')) #TODO: retranslate + self.setupUi(self) config.ObjectRegistry.register(self) @@ -572,10 +711,27 @@ self.connect(tabWidget, QtCore.SIGNAL('currentChanged(int)'), self.onTabCurrentChanged) self.connect(tabWidget, QtCore.SIGNAL('customContextMenuRequested(const QPoint &)'), self.onTabContextMenuEvent) - # setup addressbar + # setup sideBar + tabWidget = self.controlById(self.IdTabSideBar) + tabWidget.clear() # clear, setTabBar() seems to take over alreeady present tabs (qt-designer!) + tabWidget.setVisible(False) + tabWidget.tabBar().setVisible(False) + + # add sideBars + for action in self.fcActions['GroupSideBars'].actions(): + self.menuSideBars.addAction(action) + self.sideBarLoadDetails = SideBarLoadDetails.SideBarLoadDetails(tabWidget, closeAction=self.fcActions['ActionCloseCurrentSideBar']) + tabWidget.addTab(self.sideBarLoadDetails, self.trUtf8('Load details')) + + # setup splitter + splitter = self.controlById(self.IdSplitter) + splitter.restoreState(self.fcSettings.value('SplitterPos')) + self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved) + + # setup addressBar addressbar = self.controlById(self.IdEdAddressBar) self.connect(addressbar, QtCore.SIGNAL('returnPressed()'), self.onNavBarReturnPressed) - + # setup tool buttons self.controlById(self.IdBtBack).setDefaultAction(self.fcActions['ActionBack']) self.controlById(self.IdBtForward).setDefaultAction(self.fcActions['ActionForward']) @@ -595,9 +751,21 @@ frameFind = self.controlById(self.IdFrameFind) frameFind.setVisible(False) + # finally + #TODO: hopefuly the user will not play around with this setting + actionName = self.fcSettings.value('LastSideBarAction') + action = self.fcActions.get(actionName, None) + if action is not None: + action.trigger() + ######################################### ## private methods ######################################### + def _adjustCurrentBrowserDependendStuff(self): + self.fcActions.intertwineBrowserActions(self.currentBrowser()) + if self.sideBarLoadDetails.isVisible(): + self.sideBarLoadDetails.setBrowser(self.currentBrowser()) + #NOTE: to reduce flicker set min size to max size def _adjustTabText(self, qString): maxTabText = self.fcSettings.value('MaxTabText') @@ -755,7 +923,7 @@ settings.setAttribute(settings.JavascriptCanAccessClipboard, False) settings.setAttribute(settings.PluginsEnabled, False) settings.setAttribute(settings.AutoLoadImages, self.fcSettings.value('AutoLoadImages')) - + # connect browser signals self.connect(browser, QtCore.SIGNAL('loadStarted()'), self.onBrowserLoadStarted) self.connect(browser, QtCore.SIGNAL('loadProgress(int)'), self.onBrowserLoadProgress) @@ -782,6 +950,7 @@ self.connect(page, QtCore.SIGNAL('linkHovered(const QString &, const QString &, const QString &)'), self.onPageLinkHovered) tabWidget.addTab(browser, self._adjustTabText(title)) + self._adjustCurrentBrowserDependendStuff() return browser #TODO: rework. we need more then one menu @@ -794,12 +963,14 @@ menu.addAction(self.fcActions['ActionGoToHomePage']) menu.addAction(self.fcActions['ActionCloseCurrentTab']) menu.addAction(self.fcActions['ActionCloseAllTabs']) - menu.addAction(self.fcActions['ActionOpenNewTab']) + menu.addAction(self.fcActions['ActionCreateNewTab']) menu.addAction(self.fcActions['ActionZoomIn']) menu.addAction(self.fcActions['ActionZoomOut']) menu.addAction(self.fcActions['ActionFind']) menu.addAction(self.fcActions['ActionFindNext']) menu.addAction(self.fcActions['ActionFindPrevious']) + + menu.addMenu(self.menuSideBars) return menu ######################################### @@ -989,20 +1160,74 @@ # have to do it by hand to reset [BackIsClose] tabWidget = self.controlById(self.IdTabBrowsers) tabWidget.clear() - self.fcActions.intertwineBrowserActions(self.currentBrowser()) + self._adjustCurrentBrowserDependendStuff() def onCloseCurrentTab(self, action): tabWidget = self.controlById(self.IdTabBrowsers) i = tabWidget.currentIndex() if i > -1: tabWidget.removeTab(i) - self.fcActions.intertwineBrowserActions(self.currentBrowser()) + self._adjustCurrentBrowserDependendStuff() + + def onCloseCurrentSideBar(self, action): + tabWidget = self.controlById(self.IdTabSideBar) + sideBar = tabWidget.currentWidget() + sideBar.onSetCurrent(self, False) + tabWidget.setVisible(False) + checkedAction = self.fcActions['GroupSideBars'].checkedAction() + if checkedAction is not None: + checkedAction.setChecked(False) + self.fcSettings.setValues(LastSideBarAction=QtCore.QString('')) + + def onDuplicateTab(self, action): + tabWidget = self.controlById(self.IdTabBrowsers) + browser = self.currentBrowser() + print browser + lastBrowserState = browser.userData() + self.fcActions['ActionCreateNewTab'].trigger() + browser = tabWidget.widget(tabWidget.count() -1) + self.load(lastBrowserState.url, browser=browser) def onEdFindTextChanged(self, text): self.fcActions['ActionFindNext'].setEnabled(bool(text)) self.fcActions['ActionFindPrevious'].setEnabled(bool(text)) + def onFind(self, action): + frameFind = self.controlById(self.IdFrameFind) + ed = self.controlById(self.IdEdFind) + #ed.setText('fooBar') + + frameFind.setVisible(not frameFind.isVisible()) + #self.fcActions['ActionFindNext'].setEnabled() + #self.fcActions['ActionFindPrevious'].setEnabled() + if frameFind.isVisible(): + ed.setFocus(QtCore.Qt.OtherFocusReason) + ed.selectAll() + + #TODO: give feedback when no matching text was found + def onFindNext(self): + browser = self.currentBrowser() + if browser is not None: + page = browser.page() + ed = self.controlById(self.IdEdFind) + ck = self.controlById(self.IdCkFindCaseSensitive) + flags = page.FindWrapsAroundDocument + if ck.checkState() == QtCore.Qt.Checked: + flags |= page.FindCaseSensitively + if not browser.findText(ed.text(), flags): + pass + def onFindPrevious(self): + browser = self.currentBrowser() + if browser is not None: + page = browser.page() + ed = self.controlById(self.IdEdFind) + ck = self.controlById(self.IdCkFindCaseSensitive) + flags = page.FindWrapsAroundDocument | page.FindBackward + if ck.checkState() == QtCore.Qt.Checked: + flags |= page.FindCaseSensitively + browser.findText(ed.text(), flags) + #TODO: open in new tab option? def onGoToFProxy(self, action): url = QtCore.QUrl() @@ -1025,12 +1250,17 @@ self.load(qUrl, browser=browser) #TODO: we get no load progress feedback here? - #TODO: more choices for page to load - def onOpenNewTab(self, action): + #TODO: more choices for page to load + #TODO: we load fproxy in new page. this is because we enforce fproxy host/port on urls + # ...no way to distinguish in onDuplicateTab() between an empty page and fproxy page + # ...cos it relies on lastBrowserState.url + def onCreateNewTab(self, action): browser = self.newBrowser(title=self.trUtf8('Empty')) if self.fcSettings.value('OpenHomePageOnNewTabCreated'): homePage = self.fcSettings.value('HomePage') self.load(QtCore.QUrl(homePage), browser=browser) + else: + self.load(QtCore.QUrl(), browser=browser) def onPageLinkHovered(self, link, title, textContent): self.fcGlobalFeedback.setFeedback(QtCore.QString(link)) @@ -1041,62 +1271,50 @@ if browser is not None and act is browser.pageAction(browser.page().Back): self._adjustBackIsClose() - def onFind(self, action): - frameFind = self.controlById(self.IdFrameFind) - ed = self.controlById(self.IdEdFind) - #ed.setText('fooBar') - - frameFind.setVisible(not frameFind.isVisible()) - #self.fcActions['ActionFindNext'].setEnabled() - #self.fcActions['ActionFindPrevious'].setEnabled() - if frameFind.isVisible(): - ed.setFocus(QtCore.Qt.OtherFocusReason) - ed.selectAll() - - #TODO: give feedback when no matching text was found - def onFindNext(self): + def onSavePage(self, action): + # we have to cheat a bit here and reload the page to make shure the page has + # all QNetWorkReplies present browser = self.currentBrowser() - if browser is not None: - page = browser.page() - ed = self.controlById(self.IdEdFind) - ck = self.controlById(self.IdCkFindCaseSensitive) - flags = page.FindWrapsAroundDocument - if ck.checkState() == QtCore.Qt.Checked: - flags |= page.FindCaseSensitively - if not browser.findText(ed.text(), flags): - pass - def onFindPrevious(self): - browser = self.currentBrowser() - if browser is not None: - page = browser.page() - ed = self.controlById(self.IdEdFind) - ck = self.controlById(self.IdCkFindCaseSensitive) - flags = page.FindWrapsAroundDocument | page.FindBackward - if ck.checkState() == QtCore.Qt.Checked: - flags |= page.FindCaseSensitively - browser.findText(ed.text(), flags) + def onShowSidebar(self, action): + tabWidget = self.controlById(self.IdTabSideBar) + if action == self.fcActions['ActionShowSideBarLoadDetails']: + index = tabWidget.indexOf(self.sideBarLoadDetails) + self.sideBarLoadDetails.onSetCurrent(self, True) + else: + raise ValueError('No such sideBar') + self.fcSettings.setValues(LastSideBarAction=action.objectName()) + tabWidget.setCurrentIndex(index) + tabWidget.setVisible(True) + + def onSplitterMoved(self, pos, index): + splitter = self.controlById(self.IdSplitter) + self.fcSettings.setValues(SplitterPos=splitter.saveState()) def onTabContextMenuEvent(self, pt): menu = QtGui.QMenu() + browser = self.currentBrowser() tabWidget = self.controlById(self.IdTabBrowsers) pt = tabWidget.mapToGlobal(pt) pt2 = tabWidget.tabBar().mapFromGlobal(pt) i = tabWidget.tabBar().tabAt(pt2) + # setup menu actCloseBrowserUnderMouse = self.fcActions['ActionCloseBrowserUnderMouse'] actCloseBrowserUnderMouse.setEnabled(i >-1) menu.addAction(actCloseBrowserUnderMouse) + menu.addAction(self.fcActions['ActionCreateNewTab']) + menu.addAction(self.fcActions['ActionDuplicateTab']) menu.addAction(self.fcActions['ActionCloseAllTabs']) act = menu.exec_(pt) if act == actCloseBrowserUnderMouse: tabWidget.removeTab(i) - self.fcActions.intertwineBrowserActions(self.currentBrowser()) - + self._adjustCurrentBrowserDependendStuff() + def onTabCurrentChanged(self, i): tabWidget = self.controlById(self.IdTabBrowsers) browser = tabWidget.widget(i) - self.fcActions.intertwineBrowserActions(browser) + self._adjustCurrentBrowserDependendStuff() if browser is not None: lastBrowserState = browser.userData() addressBar = self.controlById(self.IdEdAddressBar) @@ -1132,6 +1350,10 @@ from .ViewConnection import ViewConnectionWidget from .ViewDownloads import ViewDownloadsWidget + + from .ViewBrowserDetails import ViewBrowserDetailsWidget + + app = QtGui.QApplication(sys.argv) mainWindow = MainWindow() @@ -1144,7 +1366,10 @@ browserWidget, ViewDownloadsWidget(mainWindow), ) - viewWidget.addBottomViews(ViewLoggerWidget(mainWindow)) + viewWidget.addBottomViews( + ViewLoggerWidget(mainWindow), + ViewBrowserDetailsWidget(mainWindow), + ) mainWindow.show() res = app.exec_() Modified: trunk/fclient/fclient/impl/config.py =================================================================== --- trunk/fclient/fclient/impl/config.py 2008-08-03 19:18:54 UTC (rev 871) +++ trunk/fclient/fclient/impl/config.py 2008-08-07 10:33:37 UTC (rev 872) @@ -46,6 +46,7 @@ IdViewLoggerWidget = 'ViewLoggerWidget' IdDlgPrefs = 'DlgPrefs' +IdSideBarLoadDetails = 'SideBarLoadDetails' class ObjectRegistry(weakref.WeakValueDictionary): """global object registry Modified: trunk/fclient/fclient/impl/res/stylesheets/default.css =================================================================== --- trunk/fclient/fclient/impl/res/stylesheets/default.css 2008-08-03 19:18:54 UTC (rev 871) +++ trunk/fclient/fclient/impl/res/stylesheets/default.css 2008-08-07 10:33:37 UTC (rev 872) @@ -13,6 +13,21 @@ **********************************************************************************************/ /* label style. sample: + MyHeader*/ +QLabel#labelHeader, +QLabel#labelHeader_2, +QLabel#labelHeader_3, +QLabel#labelHeader_4, +QLabel#labelHeader_5, +QLabel#labelHeader_6, +QLabel#labelHeader_7, +QLabel#labelHeader_8, +QLabel#labelHeader_9{ + font: bold; + } + + +/* label style. sample: Host: | 9999| */ QLabel#fieldHeader, Added: trunk/fclient/fclient/impl/tpls/SideBarLoadDetailsTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/SideBarLoadDetailsTpl.ui (rev 0) +++ trunk/fclient/fclient/impl/tpls/SideBarLoadDetailsTpl.ui 2008-08-07 10:33:37 UTC (rev 872) @@ -0,0 +1,47 @@ +<ui version="4.0" > + <class>SideBarLoadDetails</class> + <widget class="QWidget" name="SideBarLoadDetails" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>497</width> + <height>488</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="labelHeader" > + <property name="text" > + <string>Load details</string> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="btClose" > + <property name="text" > + <string>...</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0" > + <widget class="QTreeWidget" name="tree" > + <column> + <property name="text" > + <string>1</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> Added: trunk/fclient/fclient/impl/tpls/Ui_SideBarLoadDetailsTpl.py =================================================================== --- trunk/fclient/fclient/impl/tpls/Ui_SideBarLoadDetailsTpl.py (rev 0) +++ trunk/fclient/fclient/impl/tpls/Ui_SideBarLoadDetailsTpl.py 2008-08-07 10:33:37 UTC (rev 872) @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/SideBarLoadDetailsTpl.ui' +# +# Created: Thu Aug 7 11:44:00 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_SideBarLoadDetails(object): + def setupUi(self, SideBarLoadDetails): + SideBarLoadDetails.setObjectName("SideBarLoadDetails") + SideBarLoadDetails.resize(497, 488) + self.gridLayout = QtGui.QGridLayout(SideBarLoadDetails) + self.gridLayout.setObjectName("gridLayout") + self.horizontalLayout = QtGui.QHBoxLayout() + self.horizontalLayout.setObjectName("horizontalLayout") + self.labelHeader = QtGui.QLabel(SideBarLoadDetails) + self.labelHeader.setObjectName("labelHeader") + self.horizontalLayout.addWidget(self.labelHeader) + self.btClose = QtGui.QToolButton(SideBarLoadDetails) + self.btClose.setObjectName("btClose") + self.horizontalLayout.addWidget(self.btClose) + self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1) + self.tree = QtGui.QTreeWidget(SideBarLoadDetails) + self.tree.setObjectName("tree") + self.gridLayout.addWidget(self.tree, 1, 0, 1, 1) + + self.retranslateUi(SideBarLoadDetails) + QtCore.QMetaObject.connectSlotsByName(SideBarLoadDetails) + + def retranslateUi(self, SideBarLoadDetails): + SideBarLoadDetails.setWindowTitle(QtGui.QApplication.translate("SideBarLoadDetails", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.labelHeader.setText(QtGui.QApplication.translate("SideBarLoadDetails", "Load details", None, QtGui.QApplication.UnicodeUTF8)) + self.btClose.setText(QtGui.QApplication.translate("SideBarLoadDetails", "...", None, QtGui.QApplication.UnicodeUTF8)) + self.tree.headerItem().setText(0, QtGui.QApplication.translate("SideBarLoadDetails", "1", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + SideBarLoadDetails = QtGui.QWidget() + ui = Ui_SideBarLoadDetails() + ui.setupUi(SideBarLoadDetails) + SideBarLoadDetails.show() + sys.exit(app.exec_()) + Modified: trunk/fclient/fclient/impl/tpls/Ui_ViewBrowserWidgetTpl.py =================================================================== --- trunk/fclient/fclient/impl/tpls/Ui_ViewBrowserWidgetTpl.py 2008-08-03 19:18:54 UTC (rev 871) +++ trunk/fclient/fclient/impl/tpls/Ui_ViewBrowserWidgetTpl.py 2008-08-07 10:33:37 UTC (rev 872) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/impl/tpls/ViewBrowserWidgetTpl.ui' +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/ViewBrowserWidgetTpl.ui' # -# Created: Tue Jul 29 12:29:18 2008 +# Created: Thu Aug 7 09:08:51 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 @@ ViewBrowserWidget.setObjectName("ViewBrowserWidget") ViewBrowserWidget.resize(710, 794) self.gridLayout_4 = QtGui.QGridLayout(ViewBrowserWidget) + self.gridLayout_4.setMargin(0) + self.gridLayout_4.setSpacing(0) self.gridLayout_4.setObjectName("gridLayout_4") self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setSpacing(0) @@ -58,14 +60,38 @@ self.gridLayout.addWidget(self.edAddressBar, 0, 0, 1, 1) self.horizontalLayout.addWidget(self.frameAddressBar) self.gridLayout_4.addLayout(self.horizontalLayout, 0, 0, 1, 1) - self.tabBrowsers = QtGui.QTabWidget(ViewBrowserWidget) + self.splitter = QtGui.QSplitter(ViewBrowserWidget) + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.splitter.sizePolicy().hasHeightForWidth()) + self.splitter.setSizePolicy(sizePolicy) + self.splitter.setOrientation(QtCore.Qt.Horizontal) + self.splitter.setObjectName("splitter") + self.tabSideBar = QtGui.QTabWidget(self.splitter) + self.tabSideBar.setObjectName("tabSideBar") + self.tab_2 = QtGui.QWidget() + self.tab_2.setGeometry(QtCore.QRect(0, 0, 154, 736)) + self.tab_2.setObjectName("tab_2") + self.tabSideBar.addTab(self.tab_2, "") + self.tab_3 = QtGui.QWidget() + self.tab_3.setGeometry(QtCore.QRect(0, 0, 150, 712)) + self.tab_3.setObjectName("tab_3") + self.tabSideBar.addTab(self.tab_3, "") + self.widget = QtGui.QWidget(self.splitter) + self.widget.setObjectName("widget") + self.verticalLayout = QtGui.QVBoxLayout(self.widget) + self.verticalLayout.setSpacing(99) + self.verticalLayout.setMargin(0) + self.verticalLayout.setObjectName("verticalLayout") + self.tabBrowsers = QtGui.QTabWidget(self.widget) self.tabBrowsers.setObjectName("tabBrowsers") self.tab = QtGui.QWidget() - self.tab.setGeometry(QtCore.QRect(0, 0, 688, 672)) + self.tab.setGeometry(QtCore.QRect(0, 0, 540, 601)) self.tab.setObjectName("tab") self.tabBrowsers.addTab(self.tab, "") - self.gridLayout_4.addWidget(self.tabBrowsers, 1, 0, 1, 1) - self.frameFind = QtGui.QFrame(ViewBrowserWidget) + self.verticalLayout.addWidget(self.tabBrowsers) + self.frameFind = QtGui.QFrame(self.widget) self.frameFind.setFrameShape(QtGui.QFrame.StyledPanel) self.frameFind.setFrameShadow(QtGui.QFrame.Raised) self.frameFind.setObjectName("frameFind") @@ -97,7 +123,8 @@ spacerItem = QtGui.QSpacerItem(48, 25, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem) self.gridLayout_3.addLayout(self.horizontalLayout_2, 0, 0, 1, 1) - self.gridLayout_4.addWidget(self.frameFind, 2, 0, 1, 1) + self.verticalLayout.addWidget(self.frameFind) + self.gridLayout_4.addWidget(self.splitter, 1, 0, 1, 1) self.retranslateUi(ViewBrowserWidget) self.tabBrowsers.setCurrentIndex(0) @@ -109,6 +136,8 @@ self.btForward.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Forward", None, QtGui.QApplication.UnicodeUTF8)) self.btReload.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Reload", None, QtGui.QApplication.UnicodeUTF8)) self.btStop.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Stop", None, QtGui.QApplication.UnicodeUTF8)) + self.tabSideBar.setTabText(self.tabSideBar.indexOf(self.tab_2), QtGui.QApplication.translate("ViewBrowserWidget", "Tab 1", None, QtGui.QApplication.UnicodeUTF8)) + self.tabSideBar.setTabText(self.tabSideBar.indexOf(self.tab_3), QtGui.QApplication.translate("ViewBrowserWidget", "Tab 2", None, QtGui.QApplication.UnicodeUTF8)) self.tabBrowsers.setTabText(self.tabBrowsers.indexOf(self.tab), QtGui.QApplication.translate("ViewBrowserWidget", "Tab 1", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Find:", None, QtGui.QApplication.UnicodeUTF8)) self.btFindNext.setText(QtGui.QApplication.translate("ViewBrowserWidget", "Next", None, QtGui.QApplication.UnicodeUTF8)) Modified: trunk/fclient/fclient/impl/tpls/ViewBrowserWidgetTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/ViewBrowserWidgetTpl.ui 2008-08-03 19:18:54 UTC (rev 871) +++ trunk/fclient/fclient/impl/tpls/ViewBrowserWidgetTpl.ui 2008-08-07 10:33:37 UTC (rev 872) @@ -13,6 +13,12 @@ <string>Form</string> </property> <layout class="QGridLayout" name="gridLayout_4" > + <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" > @@ -105,102 +111,153 @@ </layout> </item> <item row="1" column="0" > - <widget class="QTabWidget" name="tabBrowsers" > - <property name="currentIndex" > - <number>0</number> + <widget class="QSplitter" name="splitter" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Expanding" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> - <widget class="QWidget" name="tab" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>688</width> - <height>672</height> - </rect> - </property> - <attribute name="title" > - <string>Tab 1</string> - </attribute> + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <widget class="QTabWidget" name="tabSideBar" > + <widget class="QWidget" name="tab_2" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>154</width> + <height>736</height> + </rect> + </property> + <attribute name="title" > + <string>Tab 1</string> + </attribute> + </widget> + <widget class="QWidget" name="tab_3" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>150</width> + <height>712</height> + </rect> + </property> + <attribute name="title" > + <string>Tab 2</string> + </attribute> + </widget> </widget> - </widget> - </item> - <item row="2" column="0" > - <widget class="QFrame" name="frameFind" > - <property name="frameShape" > - <enum>QFrame::StyledPanel</enum> - </property> - <property name="frameShadow" > - <enum>QFrame::Raised</enum> - </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_2" > - <property name="spacing" > - <number>6</number> - </property> - <item> - <widget class="QLabel" name="label" > - <property name="text" > - <string>Find:</string> + <widget class="QWidget" name="" > + <layout class="QVBoxLayout" name="verticalLayout" > + <property name="spacing" > + <number>99</number> + </property> + <property name="margin" > + <number>0</number> + </property> + <item> + <widget class="QTabWidget" name="tabBrowsers" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="tab" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>540</width> + <height>601</height> + </rect> </property> + <attribute name="title" > + <string>Tab 1</string> + </attribute> </widget> - </item> - <item> - <widget class="QLineEdit" name="edFind" > - <property name="dragEnabled" > - <bool>true</bool> + </widget> + </item> + <item> + <widget class="QFrame" name="frameFind" > + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + <layout class="QGridLayout" name="gridLayout_3" > + <property name="margin" > + <number>0</number> </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btFindNext" > - <property name="text" > - <string>Next</string> + <property name="spacing" > + <number>0</number> </property> - <property name="flat" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="btFindPrevious" > - <property name="text" > - <string>Previous</string> - </property> - <property name="flat" > - <bool>false</bool> - </property> - </widget> - </item> - <item> - <widget class="QCheckBox" name="ckFindCaseSensitive" > - <property name="text" > - <string>Case sensitive</string> - </property> - </widget> - </item> - <item> - <spacer name="horizontalSpacer" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0" > - <size> - <width>48</width> - <height>25</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> + <item row="0" column="0" > + <layout class="QHBoxLayout" name="horizontalLayout_2" > + <property name="spacing" > + <number>6</number> + </property> + <item> + <widget class="QLabel" name="label" > + <property name="text" > + <string>Find:</string> + </property> + </widget> + </item> + <item> + <widget class="QLineEdit" name="edFind" > + <property name="dragEnabled" > + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btFindNext" > + <property name="text" > + <string>Next</string> + </property> + <property name="flat" > + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btFindPrevious" > + <property name="text" > + <string>Previous</string> + </property> + <property name="flat" > + <bool>false</bool> + </property> + </widget> + </item> + <item> + <widget class="QCheckBox" name="ckFindCaseSensitive" > + <property name="text" > + <string>Case sensitive</string> + </property> + </widget> + </item> + <item> + <spacer name="horizontalSpacer" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0" > + <size> + <width>48</width> + <height>25</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </widget> </widget> </item> </layout> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-09 11:22:45
|
Revision: 881 http://fclient.svn.sourceforge.net/fclient/?rev=881&view=rev Author: jUrner Date: 2008-08-09 11:22:54 +0000 (Sat, 09 Aug 2008) Log Message: ----------- got a nice connection label on the statusBar now Modified Paths: -------------- trunk/fclient/fclient/impl/MainWindow.py trunk/fclient/fclient/impl/res/stylesheets/default.css Modified: trunk/fclient/fclient/impl/MainWindow.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow.py 2008-08-09 11:22:16 UTC (rev 880) +++ trunk/fclient/fclient/impl/MainWindow.py 2008-08-09 11:22:54 UTC (rev 881) @@ -21,6 +21,7 @@ _key_ = config.IdMainWindow _settings_ = ( ('Geometry', 'ByteArray', QtCore.QByteArray()), + ('ConnectionLabelFlashRate', 'UInt', 800), ) @@ -78,12 +79,78 @@ class StatusBar(QtGui.QStatusBar): - def __init__(self, parent): - QtGui.QStatusBar.__init__(self, parent) + + class DisconnectTimer(QtCore.QTimer): + + def __init__(self,statusBar): + QtCore.QTimer.__init__(self, statusBar) + self.connect(self, QtCore.SIGNAL('timeout()'), self.onNext) + + def start(self, n): + QtCore.QTimer.start(self, n) + + def onNext(self): + statusBar = self.parent() + if statusBar.connectionLabels['LabelConnectionConnected'].isVisible(): + self.stop() + else: + statusBar.connectionLabels['LabelConnectionDisonnectedOn'].setVisible( + not statusBar.connectionLabels['LabelConnectionDisonnectedOn'].isVisible() + ) + statusBar.connectionLabels['LabelConnectionDisonnectedOff'].setVisible( + not statusBar.connectionLabels['LabelConnectionDisonnectedOff'].isVisible() + ) + + def __init__(self, mainWindow): + QtGui.QStatusBar.__init__(self, mainWindow) self.setObjectName('StatusBar') #config.ObjectRegistry.register(self) - parent.setStatusBar(self) + mainWindow.setStatusBar(self) + + self._disconnectTimer = self.DisconnectTimer(self) + + # setup connection labels + self.fcpEvents = ( + (config.fcpClient.events.ClientConnected, self.onFcpClientConnected), + (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconnected), + ) + config.fcpClient.events += self.fcpEvents + self.connectionLabels = { + 'LabelConnectionConnected': QtGui.QLabel(self), + 'LabelConnectionDisonnectedOn': QtGui.QLabel(self), + 'LabelConnectionDisonnectedOff': QtGui.QLabel(self), + } + for objectName, label in self.connectionLabels.items(): + label.setObjectName(objectName) + label.setVisible(False) + self.addWidget(label, 0) + if config.fcpClient.isConnected(): + self.connectionLabels['LabelConnectionConnected'].show() + else : + self.connectionLabels['LabelConnectionDisonnectedOn'].show() + + self.retranslateUi(self) + + + def retranslateUi(self, this): + self.connectionLabels['LabelConnectionConnected'].setText(self.trUtf8('CONNECTED')) + self.connectionLabels['LabelConnectionDisonnectedOn'].setText(self.trUtf8('DISCONNECTED')) + self.connectionLabels['LabelConnectionDisonnectedOff'].setText(self.trUtf8('DISCONNECTED')) + + def onFcpClientConnected(self, event, msg): + self._disconnectTimer.stop() + for label in self.connectionLabels.values(): + label.hide() + self.connectionLabels['LabelConnectionConnected'].show() + + def onFcpClientDisconnected(self, event, msg): + for label in self.connectionLabels.values(): + label.hide() + self.connectionLabels['LabelConnectionDisonnectedOn'].show() + self._disconnectTimer.start(self.parent().fcSettings.value('ConnectionLabelFlashRate')) + + class TitleBar(QtCore.QObject): def __init__(self, parent): Modified: trunk/fclient/fclient/impl/res/stylesheets/default.css =================================================================== --- trunk/fclient/fclient/impl/res/stylesheets/default.css 2008-08-09 11:22:16 UTC (rev 880) +++ trunk/fclient/fclient/impl/res/stylesheets/default.css 2008-08-09 11:22:54 UTC (rev 881) @@ -95,3 +95,21 @@ background:red; } */ + + +QLabel#LabelConnectionConnected{ + color: green; + font: bold; + background: white; + } +QLabel#LabelConnectionDisonnectedOn{ + color: red; + font: bold; + background: white; + } +QLabel#LabelConnectionDisonnectedOff{ + color: lightsalmon; + font: bold; + background: white; + } + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-10 07:54:15
|
Revision: 886 http://fclient.svn.sourceforge.net/fclient/?rev=886&view=rev Author: jUrner Date: 2008-08-10 07:54:24 +0000 (Sun, 10 Aug 2008) Log Message: ----------- enable/disable actions depending on Fcp connected Modified Paths: -------------- trunk/fclient/fclient/impl/ViewBrowser.py trunk/fclient/fclient/impl/ViewDownloads.py Modified: trunk/fclient/fclient/impl/ViewBrowser.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser.py 2008-08-10 07:53:22 UTC (rev 885) +++ trunk/fclient/fclient/impl/ViewBrowser.py 2008-08-10 07:54:24 UTC (rev 886) @@ -101,8 +101,6 @@ def createRequest(self, operation, request, outgoingData): reply = QtNetwork.QNetworkAccessManager.createRequest(self, operation, request, outgoingData) self.emit(QtCore.SIGNAL('networkRequestCreated(QNetworkReply*)'), reply) - - #print 'createRequest', reply.url() #self.connect(reply, QtCore.SIGNAL('downloadProgress(qint64, qint64)'), self.foo) return reply @@ -948,7 +946,8 @@ act.setText(self.trUtf8('Open image in new tab')) act = browser.pageAction(page.OpenFrameInNewWindow) act.setText(self.trUtf8('Open frame in new tab')) - + + # customize page page.setLinkDelegationPolicy(page.DelegateAllLinks) @@ -1042,6 +1041,7 @@ menu.addAction(self.fcActions['ActionObjectProperties']) #TODO: QwebView assumes we can download queries - we can't + browser.pageAction(page.DownloadLinkToDisk).setEnabled(config.fcpClient.isConnected()) if browser.pageAction(page.DownloadLinkToDisk).isEnabled(): result = config.qStringToFcpKey(hitTestResult.linkUrl().toString()) if result is None: @@ -1303,17 +1303,19 @@ tabWidget = self.controlById(self.IdTabBrowsers) pt = tabWidget.mapToGlobal(pt) pt2 = tabWidget.tabBar().mapFromGlobal(pt) - i = tabWidget.tabBar().tabAt(pt2) + index = tabWidget.tabBar().tabAt(pt2) + # setup actions + self.fcActions['ActionCloseBrowserUnderMouse'].setEnabled(index >-1) + self.fcActions['ActionDuplicateTab'].setEnabled(index >-1) + # setup menu - actCloseBrowserUnderMouse = self.fcActions['ActionCloseBrowserUnderMouse'] - actCloseBrowserUnderMouse.setEnabled(i >-1) - menu.addAction(actCloseBrowserUnderMouse) + menu.addAction(self.fcActions['ActionCloseBrowserUnderMouse']) menu.addAction(self.fcActions['ActionCreateNewTab']) menu.addAction(self.fcActions['ActionDuplicateTab']) menu.addAction(self.fcActions['ActionCloseAllTabs']) act = menu.exec_(pt) - if act == actCloseBrowserUnderMouse: + if act == self.fcActions['ActionCloseBrowserUnderMouse']: tabWidget.removeTab(i) self._adjustCurrentBrowserDependendStuff() @@ -1344,7 +1346,7 @@ browser.setTextSizeMultiplier(browser.textSizeMultiplier() - 0.2) if browser.textSizeMultiplier() >= oldMultiplier: menu.addAction(self.fcActions['ActionZoomOut']).setEnabled(False) - + #********************************************************************************** # #********************************************************************************** Modified: trunk/fclient/fclient/impl/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-10 07:53:22 UTC (rev 885) +++ trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-10 07:54:24 UTC (rev 886) @@ -227,16 +227,18 @@ self.fcActions = DownloadsWidgetActions(self) self.fcViewObject = DownloadsViewObject(self) self.fcGlobalFeedback = DownloadsWidgetGlobalFeedback(self, idGlobalFeedback) - self.fcpEvents = ( + self.fcpClientEvents = ( + (config.fcpClient.events.ClientConnected, self.onFcpClientConnected), + (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconnected), (config.fcpClient.events.ConfigData, self.onFcpConfigData), - (config.fcpClient.events.RequestCompleted, self.onFcpRequestCompleted), - (config.fcpClient.events.RequestFailed, self.onFcpRequestFailed), - (config.fcpClient.events.RequestModified, self.onFcpRequestModified), - (config.fcpClient.events.RequestProgress, self.onFcpRequestProgress), - (config.fcpClient.events.RequestStarted, self.onFcpRequestStarted), - (config.fcpClient.events.RequestRemoved, self.onFcpRequestRemoved), + (config.fcpClient.events.RequestCompleted, self.onFcpClientRequestCompleted), + (config.fcpClient.events.RequestFailed, self.onFcpClientRequestFailed), + (config.fcpClient.events.RequestModified, self.onFcpClientRequestModified), + (config.fcpClient.events.RequestProgress, self.onFcpClientRequestProgress), + (config.fcpClient.events.RequestStarted, self.onFcpClientRequestStarted), + (config.fcpClient.events.RequestRemoved, self.onFcpClientRequestRemoved), ) - config.fcpClient.events += self.fcpEvents + config.fcpClient.events += self.fcpClientEvents ############################ ## private methods @@ -323,7 +325,7 @@ self.connect(tree, QtCore.SIGNAL('itemSelectionChanged() '), self.onTreeItemSelectionChanged) def viewClose(self): - config.fcpClient.events -= self.fcpEvents + config.fcpClient.events -= self.fcpClientEvents ######################################### ## methods @@ -428,11 +430,20 @@ ######################################### ## fcp event handlers ######################################### + def onFcpClientConnected(self, event, msg): + for action in self.fcActions: + action.setEnabled(True) + + + def onFcpClientDisconnected(self, event, msg): + for action in self.fcActions: + action.setEnabled(False) + def onFcpConfigData(self, fcpEvent, fcpRequest): pass - def onFcpRequestCompleted(self, fcpEvent, fcpRequest): + def onFcpClientRequestCompleted(self, fcpEvent, fcpRequest): item = self.fcpRequests.get(fcpRequest['Identifier'], None) if item is not None: item.setData( @@ -452,7 +463,7 @@ ) self._adjustStatusBar(item, 'complete') - def onFcpRequestFailed(self, fcpEvent, fcpRequest): + def onFcpClientRequestFailed(self, fcpEvent, fcpRequest): item = self.fcpRequests.get(rfcpRequest['Identifier'], None) if item is not None: self._adjustStatusBar(item, 'error') @@ -464,7 +475,7 @@ #TODO: not tested - def onFcpRequestModified(self, fcpEvent, fcpRequest): + def onFcpClientRequestModified(self, fcpEvent, fcpRequest): requestIdentifier = fcpRequest['Modified'].get(fcp2.ConstRequestModified.Identifier, None) if requestIdentifier is None: @@ -485,7 +496,7 @@ ) - def onFcpRequestProgress(self, fcpEvent, fcpRequest): + def onFcpClientRequestProgress(self, fcpEvent, fcpRequest): item = self.fcpRequests.get(fcpRequest['Identifier'], None) if item is not None: progressBar = self.tree.itemWidget(item, self.HeaderIndexProgress) @@ -502,10 +513,10 @@ ) - def onFcpRequestRemoved(self, fcpEvent, fcpRequest): + def onFcpClientRequestRemoved(self, fcpEvent, fcpRequest): pass - def onFcpRequestStarted(self, fcpEvent, fcpRequest): + def onFcpClientRequestStarted(self, fcpEvent, fcpRequest): if fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Restored: try: requestData = PersistentRequestData.load(fcpRequest['PersistentUserData']) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-11 17:56:46
|
Revision: 899 http://fclient.svn.sourceforge.net/fclient/?rev=899&view=rev Author: jUrner Date: 2008-08-11 17:56:50 +0000 (Mon, 11 Aug 2008) Log Message: ----------- started rewriting downloadsWidget to a more gemeral purpose requests widget Modified Paths: -------------- trunk/fclient/fclient/impl/ViewDownloads.py Added Paths: ----------- trunk/fclient/fclient/impl/tpls/Ui_ViewRequestsWidgetTpl.py trunk/fclient/fclient/impl/tpls/ViewRequestsWidgetTpl.ui Modified: trunk/fclient/fclient/impl/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-11 10:42:48 UTC (rev 898) +++ trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-11 17:56:50 UTC (rev 899) @@ -56,7 +56,7 @@ from . import DlgDownloadKeyToDisk -from .tpls.Ui_ViewDownloadsWidgetTpl import Ui_ViewDownloadsWidget +from .tpls.Ui_ViewRequestsWidgetTpl import Ui_ViewRequestsWidget #********************************************************************************** # #********************************************************************************** @@ -65,126 +65,6 @@ #********************************************************************************** # #********************************************************************************** -class DownloadsViewObject(config.ViewObject): - - def __init__(self, parent): - config.ViewObject. __init__(self, parent) - - self.name=parent.objectName() - self.displayName=self.trUtf8('Downloads') - self.icon=QtGui.QIcon() - -#********************************************************************************** -# -#********************************************************************************** -class DownloadsWidgetGlobalFeedback(config.GlobalFeedbackBase): - """wrapper for global statusbar widgets, menus""" - - def __init__(self, parent, idGlobalFeedback): - config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback) - - # menus - self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) - parent.populateMenu(menu) - self.menus.append(menu) - self.menuBar.addViewMenu(menu) - - # status bar widgets - self.labelStatus = None - self.progress = None - self.labelFeedbackWrap = None - #if self.statusBar is not None: - # self.labelStatus = QtGui.QLabel(QtCore.QString(), self.statusBar) - # self.statusBar.addWidget(self.labelStatus) - # - # self.progress = QtGui.QProgressBar(self.statusBar) - # self.progress.setRange(0, Browser.MaxProgress) - # self.progress.setValue(0) - # self.statusBar.addWidget(self.progress) - # - # label = QtGui.QLabel(self.statusBar) - # label.setFrameStyle(QtGui.QLabel.Sunken | QtGui.QLabel.Box) - # self.labelFeedbackWrap = pathlabelwrap.PathLabelWrap( - # label, - # path_module=config.CompactPathFcpKeyModule, - # ) - # self.statusBar.addWidget(self.labelFeedbackWrap.label, 1) - - - def setVisible(self, flag): - if self.menuBar is not None: - for menu in self.menus: - menu.children()[0].setEnabled(flag) - #if self.statusBar is not None: - # self.progress.setVisible(flag) - # self.labelStatus.setVisible(flag) - # self.labelFeedbackWrap.label.setVisible(flag) - - #def setProgress(self, n): - # if self.progress is not None: - # self.progress.setValue(n) - - #def setStatusMessage(self, qString): - # if self.labelStatus is not None: - # self.labelStatus.setText(qString) - - #def setFeedback(self, qString): - # if self.labelFeedbackWrap is not None: - # self.labelFeedbackWrap.setPath(unicode(qString)) - -class DownloadsWidgetActions(config.ActionsBase): - - def __init__(self, parent): - config.ActionsBase.__init__(self, parent) - - self.action( - name='ActionDownloadKeyToDisk', - text=self.trUtf8('Download &key...'), - trigger=parent.onDlgDownloadKey, - ) - self.action( - name='ActionRemoveSelectedDownloads', - text=self.trUtf8('Remove download'), - trigger=parent.onRemoveSelectedDownloads, - isEnabled=False, - ) - self.action( - name='ActionRestartSelectedDownloads', - text=self.trUtf8('Restart download'), - trigger=parent.onRestartSelectedDownloads, - isEnabled=False, - ) - - #TODO: enable/disable if items of that type are available? - group = self.group( - name='GroupRemoveGroup', - trigger=parent.onRemoveGroup, - ) - self.action( - name='ActionRemoveFailed', - group=group, - text=self.trUtf8('Failed'), - isEnabled=False, - ) - self.action( - name='ActionRemoveCompleted', - group=group, - text=self.trUtf8('Completed'), - isEnabled=False, - ) - -class DownloadsWidgetSettings(config.SettingsBase): - - - _key_ = config.IdViewDownloadsWidget - _settings_ = ( - ('MaxSimultaneousDownloads', 'UInt', 3), - ) -#********************************************************************************** -# -#********************************************************************************** class PersistentRequestData(pmstruct.PMStruct): _fields_ = ( ('ClientName', pmstruct.STRING), @@ -239,10 +119,52 @@ return self.item.status() status= QtCore.pyqtProperty("QString", _get_status) + +class RequestsWidgetActions(config.ActionsBase): + + def __init__(self, parent): + config.ActionsBase.__init__(self, parent) + + self.action( + name='ActionDownloadKeyToDisk', + text=self.trUtf8('Download &key...'), + trigger=parent.onDlgDownloadKey, + ) + self.action( + name='ActionRemoveSelectedDownloads', + text=self.trUtf8('Remove download'), + trigger=parent.onRemoveSelectedDownloads, + isEnabled=False, + ) + self.action( + name='ActionRestartSelectedDownloads', + text=self.trUtf8('Restart download'), + trigger=parent.onRestartSelectedDownloads, + isEnabled=False, + ) + + #TODO: enable/disable if items of that type are available? + group = self.group( + name='GroupRemoveGroup', + trigger=parent.onRemoveGroup, + ) + self.action( + name='ActionRemoveFailed', + group=group, + text=self.trUtf8('Failed'), + isEnabled=False, + ) + self.action( + name='ActionRemoveCompleted', + group=group, + text=self.trUtf8('Completed'), + isEnabled=False, + ) + #********************************************************************************** # #********************************************************************************** -class ViewDownloadsWidget(QtGui.QWidget, Ui_ViewDownloadsWidget): +class RequestsWidget(QtGui.QWidget, Ui_ViewRequestsWidget): IdTree = 'tree' @@ -250,17 +172,12 @@ QtGui.QWidget.__init__(self, parent) self._isCreated = False self.fcHeaderLabels = {} # fcpIdentifier --> treeItem + self.fcActions = RequestsWidgetActions(self) self.fcpRequests = {} self.fcRequestStatusNames = {} self.menuRemoveGroup = QtGui.QMenu(self) self.setupUi(self) - - config.ObjectRegistry.register(self) - self.fcSettings = DownloadsWidgetSettings(self).restore() - self.fcActions = DownloadsWidgetActions(self) - self.fcViewObject = DownloadsViewObject(self) - self.fcGlobalFeedback = DownloadsWidgetGlobalFeedback(self, idGlobalFeedback) self.fcpClientEvents = ( (config.fcpClient.events.ClientConnected, self.onFcpClientConnected), (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconnected), @@ -274,9 +191,6 @@ ) config.fcpClient.events += self.fcpClientEvents - # setup menus - for action in self.fcActions['GroupRemoveGroup'].actions(): - self.menuRemoveGroup.addAction(action) ############################ ## private methods @@ -357,7 +271,7 @@ ## ############################ def retranslateUi(self, parent): - Ui_ViewDownloadsWidget.retranslateUi(self, parent) + Ui_ViewRequestsWidget.retranslateUi(self, parent) tree = self.controlById(self.IdTree) root = tree.invisibleRootItem() @@ -515,21 +429,14 @@ parent = root parent.removeChild(item) + + # overwrite def onTreeCustomContextMenuRequested(self, pt): - tree = self.controlById(self.IdTree) - pt = tree.viewport().mapToGlobal(pt) + pass - menu = QtGui.QMenu(self) - menu.addAction(self.fcActions['ActionRemoveSelectedDownloads']) - menu.addAction(self.fcActions['ActionRestartSelectedDownloads']) - menu.addMenu(self.menuRemoveGroup) - menu.exec_(pt) - + # overwrite def onTreeItemSelectionChanged(self): - tree = self.controlById(self.IdTree) - hasSelectedItems = tree.selectionModel().hasSelection() - self.fcActions['ActionRemoveSelectedDownloads'].setEnabled(hasSelectedItems) - self.fcActions['ActionRestartSelectedDownloads'].setEnabled(hasSelectedItems) + pass ######################################### ## fcp event handlers @@ -611,9 +518,142 @@ if item is not None: self._adjustItemStatus(item) + #********************************************************************************** # #********************************************************************************** +class DownloadsWidgetGlobalFeedback(config.GlobalFeedbackBase): + """wrapper for global statusbar widgets, menus""" + + def __init__(self, parent, idGlobalFeedback): + config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback) + + # menus + self.menus = [] + if self.menuBar is not None and hasattr(parent, 'fcViewObject'): + menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + parent.populateMenu(menu) + self.menus.append(menu) + self.menuBar.addViewMenu(menu) + + # status bar widgets + self.labelStatus = None + self.progress = None + self.labelFeedbackWrap = None + #if self.statusBar is not None: + # self.labelStatus = QtGui.QLabel(QtCore.QString(), self.statusBar) + # self.statusBar.addWidget(self.labelStatus) + # + # self.progress = QtGui.QProgressBar(self.statusBar) + # self.progress.setRange(0, Browser.MaxProgress) + # self.progress.setValue(0) + # self.statusBar.addWidget(self.progress) + # + # label = QtGui.QLabel(self.statusBar) + # label.setFrameStyle(QtGui.QLabel.Sunken | QtGui.QLabel.Box) + # self.labelFeedbackWrap = pathlabelwrap.PathLabelWrap( + # label, + # path_module=config.CompactPathFcpKeyModule, + # ) + # self.statusBar.addWidget(self.labelFeedbackWrap.label, 1) + + + def setVisible(self, flag): + if self.menuBar is not None: + for menu in self.menus: + menu.children()[0].setEnabled(flag) + #if self.statusBar is not None: + # self.progress.setVisible(flag) + # self.labelStatus.setVisible(flag) + # self.labelFeedbackWrap.label.setVisible(flag) + + #def setProgress(self, n): + # if self.progress is not None: + # self.progress.setValue(n) + + #def setStatusMessage(self, qString): + # if self.labelStatus is not None: + # self.labelStatus.setText(qString) + + #def setFeedback(self, qString): + # if self.labelFeedbackWrap is not None: + # self.labelFeedbackWrap.setPath(unicode(qString)) + + + +class DownloadsViewObject(config.ViewObject): + + def __init__(self, parent): + config.ViewObject. __init__(self, parent) + + self.name=parent.objectName() + self.displayName=self.trUtf8('Downloads') + self.icon=QtGui.QIcon() + + +class DownloadsWidgetSettings(config.SettingsBase): + + + _key_ = config.IdViewDownloadsWidget + _settings_ = ( + ('MaxSimultaneousDownloads', 'UInt', 3), + ) + + +class ViewDownloadsWidget(RequestsWidget): + + def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + + self.menuRemoveGroup = None + + RequestsWidget.__init__(self, parent) + + self.setObjectName(config.IdViewDownloadsWidget) + config.ObjectRegistry.register(self) + self.fcSettings = DownloadsWidgetSettings(self).restore() + self.fcViewObject = DownloadsViewObject(self) + self.fcGlobalFeedback = DownloadsWidgetGlobalFeedback(self, idGlobalFeedback) + + # setup menus + self.menuRemoveGroup = QtGui.QMenu(self) + self.menuRemoveGroup.setTitle(self.trUtf8('Remove group')) + for action in self.fcActions['GroupRemoveGroup'].actions(): + self.menuRemoveGroup.addAction(action) + + + def hideEvent(self, event): + self.fcGlobalFeedback.setVisible(False) + RequestsWidget.hideEvent(self, event) + + def showEvent(self, event): + self.fcGlobalFeedback.setVisible(True) + RequestsWidget.showEvent(self, event) + + def retranslateUi(self, parent): + RequestsWidget.retranslateUi(self, parent) + if self.menuRemoveGroup is not None: + self.menuRemoveGroup.setTitle(self.trUtf8('Remove group')) + + def onTreeCustomContextMenuRequested(self, pt): + tree = self.controlById(self.IdTree) + pt = tree.viewport().mapToGlobal(pt) + + menu = QtGui.QMenu(self) + menu.addAction(self.fcActions['ActionRemoveSelectedDownloads']) + menu.addAction(self.fcActions['ActionRestartSelectedDownloads']) + menu.addMenu(self.menuRemoveGroup) + menu.exec_(pt) + + def onTreeItemSelectionChanged(self): + tree = self.controlById(self.IdTree) + hasSelectedItems = tree.selectionModel().hasSelection() + self.fcActions['ActionRemoveSelectedDownloads'].setEnabled(hasSelectedItems) + self.fcActions['ActionRestartSelectedDownloads'].setEnabled(hasSelectedItems) + + +#********************************************************************************** +# +#********************************************************************************** if __name__ == '__main__': import sys from . import View Added: trunk/fclient/fclient/impl/tpls/Ui_ViewRequestsWidgetTpl.py =================================================================== --- trunk/fclient/fclient/impl/tpls/Ui_ViewRequestsWidgetTpl.py (rev 0) +++ trunk/fclient/fclient/impl/tpls/Ui_ViewRequestsWidgetTpl.py 2008-08-11 17:56:50 UTC (rev 899) @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/tpls/ViewRequestsWidgetTpl.ui' +# +# Created: Mon Aug 11 19:50:32 2008 +# by: PyQt4 UI code generator 4.4.3-snapshot-20080705 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_ViewRequestsWidget(object): + def setupUi(self, ViewRequestsWidget): + ViewRequestsWidget.setObjectName("ViewRequestsWidget") + ViewRequestsWidget.resize(400, 300) + self.gridLayout = QtGui.QGridLayout(ViewRequestsWidget) + self.gridLayout.setMargin(0) + self.gridLayout.setSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.tree = QtGui.QTreeWidget(ViewRequestsWidget) + self.tree.setObjectName("tree") + self.gridLayout.addWidget(self.tree, 0, 0, 1, 1) + + self.retranslateUi(ViewRequestsWidget) + QtCore.QMetaObject.connectSlotsByName(ViewRequestsWidget) + + def retranslateUi(self, ViewRequestsWidget): + ViewRequestsWidget.setWindowTitle(QtGui.QApplication.translate("ViewRequestsWidget", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.tree.headerItem().setText(0, QtGui.QApplication.translate("ViewRequestsWidget", "1", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + ViewRequestsWidget = QtGui.QWidget() + ui = Ui_ViewRequestsWidget() + ui.setupUi(ViewRequestsWidget) + ViewRequestsWidget.show() + sys.exit(app.exec_()) + Added: trunk/fclient/fclient/impl/tpls/ViewRequestsWidgetTpl.ui =================================================================== --- trunk/fclient/fclient/impl/tpls/ViewRequestsWidgetTpl.ui (rev 0) +++ trunk/fclient/fclient/impl/tpls/ViewRequestsWidgetTpl.ui 2008-08-11 17:56:50 UTC (rev 899) @@ -0,0 +1,35 @@ +<ui version="4.0" > + <class>ViewRequestsWidget</class> + <widget class="QWidget" name="ViewRequestsWidget" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>400</width> + <height>300</height> + </rect> + </property> + <property name="windowTitle" > + <string>Form</string> + </property> + <layout class="QGridLayout" name="gridLayout" > + <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> + <property name="text" > + <string>1</string> + </property> + </column> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-11 18:14:31
|
Revision: 902 http://fclient.svn.sourceforge.net/fclient/?rev=902&view=rev Author: jUrner Date: 2008-08-11 18:14:30 +0000 (Mon, 11 Aug 2008) Log Message: ----------- isolating requests widget pt2 Modified Paths: -------------- trunk/fclient/fclient/impl/ViewDownloads.py Added Paths: ----------- trunk/fclient/fclient/impl/BaseRequestsWidget.py Added: trunk/fclient/fclient/impl/BaseRequestsWidget.py =================================================================== --- trunk/fclient/fclient/impl/BaseRequestsWidget.py (rev 0) +++ trunk/fclient/fclient/impl/BaseRequestsWidget.py 2008-08-11 18:14:30 UTC (rev 902) @@ -0,0 +1,523 @@ + +#************************************************************************************************************** +#TODO: +# +# x. prtty tricky to get dls right when the node or client may disconnect unexpectedly +# problem: dls that we send and that have not reached the node +# problem: what to do when the user wants to quit and we still have dls to push to the node +# +# solution would require keeping track of all requests +# a. keep identifiers of requests that reached the node (have to do it anyways) +# b. keep track of requests ahead of sending them to the node (feels not too good doubeling downloads.dat.gz) +# +# best idea seems to be to ignore the problem +# 1. wait till (if ever) freenet devels fdrop node keeping track of client requests +# +# 2. a box thrown to the user (x. do not show this message again) to inform him about pendings +# should be enough. maybe along with a separate widget or some separate color code for pendings +# +# x. performance +# start with a standard model and improve it over time. no need to set any hard +# limits. the user will find out by himself how many dls his machine can handle. +# have to be carefrul though when adding dls, like from a *.frdx to provide appropriate +# warnings +# x. it may take a while untill the final DataFound message arrives when a request is % completed. feedback would be nice +# x. DataFound for a request the file has been removed by the user. no idea what happens. have to test this +# x. when the node is about to start up, looks like persistents may arrive or not. check +# x. how to get early information about mimetype/size? maybe use FcpClient.getFileInfo() +# x. show/hide header izems +# x. sort by header +# x. indicate over all time / dl speed +# x. indicate status / remove items by status +# x. item properties +# x. how to handle inserting huge number of dls? +# idea: insert with lowest priority to get the node to know them, increase priority when a slot in +# MaxSimultaneousDls (if set) is free. atatch progressBar no sooner as priority > MinDlPriority +# x. how to handle huge numbers of dls. the node will flood us on startup with persistents. looks +# like the only way to control the flood is to have one connection/dl. maybe wait for freenet devels +# to realize that this is a serious problem... +# x. byte amount postfixes must be transllated ++ use Kib or Kb or let the user decide? +# x. sometimes groups of dls get not removed +#************************************************************************************************************** +from __future__ import absolute_import +if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below + import os; __path__ = [os.path.dirname(__file__)] + +import mimetypes +import os +from PyQt4 import QtCore, QtGui + +from . import config +from .lib import fcp2 +from .lib.fcp2.lib import pmstruct +from .lib.qt4ex import treewidgetwrap +from .lib import numbers + +from . import DlgDownloadKeyToDisk + +from .tpls.Ui_ViewRequestsWidgetTpl import Ui_ViewRequestsWidget +#********************************************************************************** +# +#********************************************************************************** +BLOCK_SIZE = 32768 # from CHKBlock.java + +#********************************************************************************** +# +#********************************************************************************** +class PersistentRequestData(pmstruct.PMStruct): + _fields_ = ( + ('ClientName', pmstruct.STRING), + ) + +#********************************************************************************** +# +#********************************************************************************** +class TreeItem(QtGui.QTreeWidgetItem): + + IndexName = 0 + IndexSize = 1 + IndexMimeType = 2 + IndexStatus = 3 + IndexProgress = 4 + IndexPriority = 5 + IndexElapsed = 6 + + ProgressBarName = 'downloadKey' + + StatusPending = 'pending' + StatusLoading = 'loading' + StatusComplete = 'complete' + StatusError = 'error' + StatusRemoved = 'removed' + + def __init__(self, fcpRequest, *params): + QtGui.QTreeWidgetItem.__init__(self, *params) + self.fcpRequest = fcpRequest + self.fcOldStatus = self.StatusPending + + def status(self): + if self.fcpRequest is None: + return self.StatusRemoved + elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Success: + return self.StatusComplete + elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Error: + return self.StatusError + elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Started: + return self.StatusLoading + else: + return self.StatusPending + +# exposes status property for stylesheets +class ProgressBar(QtGui.QProgressBar): + + def __init__(self, parent, item): + QtGui.QProgressBar.__init__(self, parent) + self.item = item + + def _get_status(self): + return self.item.status() + status= QtCore.pyqtProperty("QString", _get_status) + + +class RequestsWidgetActions(config.ActionsBase): + + def __init__(self, parent): + config.ActionsBase.__init__(self, parent) + + self.action( + name='ActionDownloadKeyToDisk', + text=self.trUtf8('Download &key...'), + trigger=parent.onDlgDownloadKey, + ) + self.action( + name='ActionRemoveSelectedDownloads', + text=self.trUtf8('Remove download'), + trigger=parent.onRemoveSelectedDownloads, + isEnabled=False, + ) + self.action( + name='ActionRestartSelectedDownloads', + text=self.trUtf8('Restart download'), + trigger=parent.onRestartSelectedDownloads, + isEnabled=False, + ) + + #TODO: enable/disable if items of that type are available? + group = self.group( + name='GroupRemoveGroup', + trigger=parent.onRemoveGroup, + ) + self.action( + name='ActionRemoveFailed', + group=group, + text=self.trUtf8('Failed'), + isEnabled=False, + ) + self.action( + name='ActionRemoveCompleted', + group=group, + text=self.trUtf8('Completed'), + isEnabled=False, + ) + +#********************************************************************************** +# +#********************************************************************************** +class RequestsWidget(QtGui.QWidget, Ui_ViewRequestsWidget): + + IdTree = 'tree' + + def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + QtGui.QWidget.__init__(self, parent) + self._isCreated = False + self.fcHeaderLabels = {} # fcpIdentifier --> treeItem + self.fcActions = RequestsWidgetActions(self) + self.fcpRequests = {} + self.fcRequestStatusNames = {} + self.menuRemoveGroup = QtGui.QMenu(self) + + self.setupUi(self) + self.fcpClientEvents = ( + (config.fcpClient.events.ClientConnected, self.onFcpClientConnected), + (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconnected), + (config.fcpClient.events.ConfigData, self.onFcpConfigData), + (config.fcpClient.events.RequestCompleted, self.onFcpClientRequestCompleted), + (config.fcpClient.events.RequestFailed, self.onFcpClientRequestFailed), + (config.fcpClient.events.RequestModified, self.onFcpClientRequestModified), + (config.fcpClient.events.RequestProgress, self.onFcpClientRequestProgress), + (config.fcpClient.events.RequestStarted, self.onFcpClientRequestStarted), + (config.fcpClient.events.RequestRemoved, self.onFcpClientRequestRemoved), + ) + config.fcpClient.events += self.fcpClientEvents + + + ############################ + ## private methods + ############################ + def _adjustItemStatus(self, item): + # to take Css styling into account we have to set a new statusBar for each state change + tree = self.controlById(self.IdTree) + oldProgressBar = progressBar = self.tree.itemWidget(item, TreeItem.IndexProgress) + itemStatus = item.status() + itemStatusChanged = itemStatus != item.fcOldStatus + if itemStatusChanged: + progressBar = ProgressBar(self.tree, item) + + # adjust statusBar and set a new one if necessary + # ..bit much work here, but necessary, cos Fcp might come up with + # ..a completed message without any prior progress notifications + if itemStatus == TreeItem.StatusPending: + progressBar.setRange(0, 0) + elif itemStatus == TreeItem.StatusLoading: + progressBar.setRange(0, item.fcpRequest['ProgressRequired']) + progressBar.setValue(item.fcpRequest['ProgressSucceeded']) + elif itemStatus == TreeItem.StatusComplete: + progressBar.setRange(0, 1) + progressBar.setValue(progressBar.maximum()) + elif itemStatus == TreeItem.StatusError: + progressBar.setMinimum(oldProgressBar.minimum()) + progressBar.setMaximum(oldProgressBar.maximum()) + progressBar.setValue(oldProgressBar.value()) + elif itemStatus == TreeItem.StatusRemoved: + pass + else: + raise ValueError('Unknown status: %r' % itemStatus) + if itemStatusChanged: + progressBar.setObjectName(TreeItem.ProgressBarName) + tree.setItemWidget(item, TreeItem.IndexProgress, progressBar) + item.setData( + TreeItem.IndexStatus, + QtCore.Qt.DisplayRole, + QtCore.QVariant(self.fcRequestStatusNames[itemStatus]), + ) + item.fcOldStatus = itemStatus + + def _createItemFromFcpRequest(self, fcpRequest): + tree = self.controlById(self.IdTree) + root = tree.invisibleRootItem() + item= TreeItem(fcpRequest, root) + progressBar = ProgressBar(self.tree, item) + + progressBar.setObjectName(TreeItem.ProgressBarName) + tree.setItemWidget(item, TreeItem.IndexProgress, progressBar) + fileName = fcpRequest['Filename'] + mimeType = mimetypes.guess_type(fileName)[0] + icon = config.fcResources.getIcon( + config.mimeTypeIconName(mimeType), + config.fcSettings.value('IconSize'), + config.fcSettings.value('IconTheme'), + ) + item.setIcon(0, icon) + item.setData( + TreeItem.IndexName, + QtCore.Qt.DisplayRole, + QtCore.QVariant(os.path.basename(fcpRequest['Filename'])) + ) + + #TODO: take a wild guess at the size. no other way to do it currently + estimatedSize = int((BLOCK_SIZE * fcpRequest['ProgressRequired']) + 1) + item.setData( + TreeItem.IndexSize, + QtCore.Qt.DisplayRole, + QtCore.QVariant(self.trUtf8('< ') + numbers.format_num_bytes(estimatedSize)), + ) + + self.fcpRequests[fcpRequest['Identifier']] = item + self._adjustItemStatus(item) + return item + + ############################ + ## + ############################ + def retranslateUi(self, parent): + Ui_ViewRequestsWidget.retranslateUi(self, parent) + tree = self.controlById(self.IdTree) + root = tree.invisibleRootItem() + + # adjust header labels + self.fcHeaderLabels = { + TreeItem.IndexName: self.trUtf8('Name'), + TreeItem.IndexSize: self.trUtf8('Size'), + TreeItem.IndexMimeType: self.trUtf8('MimeType'), + TreeItem.IndexStatus: self.trUtf8('Status'), + TreeItem.IndexPriority: self.trUtf8('Priority'), + TreeItem.IndexProgress: self.trUtf8('Progress'), + TreeItem.IndexElapsed: self.trUtf8('Elapsed'), + } + tree.setHeaderLabels([i[1] for i in sorted(self.fcHeaderLabels.items())]) + + # adjust status names and retranslate all items + self.fcRequestStatusNames = { + TreeItem.StatusPending: self.trUtf8('Pending'), + TreeItem.StatusLoading: self.trUtf8('Loading'), + TreeItem.StatusComplete: self.trUtf8('Complete'), + TreeItem.StatusError: self.trUtf8('Error'), + TreeItem.StatusRemoved: self.trUtf8('Removed'), + } + for item in treewidgetwrap.walkItem(root): + fcpRequest = getattr(item, 'fcpRequest', None) + if hasattr(item, 'fcpRequest'): + item.setText(TreeItem.IndexStatus, self.fcRequestStatusNames[item.status()]) + + # others + self.menuRemoveGroup.setTitle(self.trUtf8('Remove group')) + + def closeEvent(self): + self.viewClose() + + def hideEvent(self, event): + self.fcGlobalFeedback.setVisible(False) + + def showEvent(self, event): + self.fcGlobalFeedback.setVisible(True) + if not self._isCreated: + self._isCreated = True + + # setup tree + tree = self.controlById(self.IdTree) + tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + tree.setRootIsDecorated(False) + tree.setSelectionMode(tree.ExtendedSelection) + tree.setUniformRowHeights(True) + self.connect(tree, QtCore.SIGNAL('customContextMenuRequested(const QPoint &)'), self.onTreeCustomContextMenuRequested) + self.connect(tree, QtCore.SIGNAL('itemSelectionChanged() '), self.onTreeItemSelectionChanged) + + def viewClose(self): + config.fcpClient.events -= self.fcpClientEvents + + ######################################### + ## methods + ######################################### + def controlById(idGlobalFeedback, idControl): + return getattr(idGlobalFeedback, idControl) + + def downloadFile(self, fcpKey, fileName, **kws): + """""" + fileName = unicode(fileName) + fcpRequest = config.fcpClient.getFile( + fcpKey, + fileName, + persistentUserData=PersistentRequestData(ClientName=unicode(self.objectName())).dump(), + #TODO: browser sets this. ok or not? + #handleFilenameCollision=True, + handlePermanentRedirect=True, + **kws + ) + item = self._createItemFromFcpRequest(fcpRequest) + + def populateMenu(self, menu): + menu.addAction(self.fcActions['ActionDownloadKeyToDisk']) + return menu + + + def execDlgDownloadKey(self, fcpKey=None): + """pops up the dialog to allow the user to download a key to disk + @param fcpKey: key to initialize the key with or None + """ + dlg = DlgDownloadKeyToDisk.DlgDownloadKeyToDisk(self, fcpKey=fcpKey) + if dlg.exec_() == dlg.Accepted: + self.downloadFile( + dlg.fcpKey(), + dlg.fileName(), + persistence=fcp2.ConstPersistence.Forever, + handleFilenameCollision=True, + ) + + ######################################### + ## event handlers + ######################################### + def onDlgDownloadKey(self, action): + self.execDlgDownloadKey(fcpKey=None) + + def onRemoveSelectedDownloads(self, action): + tree = self.controlById(self.IdTree) + selectedItems = tree.selectedItems() + + # remove items + for item in selectedItems: + parent = item.parent() + if parent is None: + parent = tree.invisibleRootItem() + parent.removeChild(item) + + # cancel all requests + for item in selectedItems: + for tmp_item in treewidgetwrap.walkItem(item): + if tmp_item.fcpRequest is not None: # we may come across the same item multiple times + if tmp_item.fcpRequest['Identifier'] in self.fcpRequests: #TODO: should never be False?! check + del self.fcpRequests[tmp_item.fcpRequest['Identifier']] + config.fcpClient.removeRequest(tmp_item.fcpRequest) + tmp_item.fcpRequest = None + + def onRestartSelectedDownloads(self, action): + tree = self.controlById(self.IdTree) + for item in tree.selectedItems(): + if item.fcpRequest is None: + raise RuntimeError('fcpRequest is None. should not happen') + del self.fcpRequests[item.fcpRequest['Identifier']] + item.fcpRequest = config.fcpClient.resendRequest(item.fcpRequest) + self.fcpRequests[item.fcpRequest['Identifier']] = item + self._adjustItemStatus(item) + + def onRemoveGroup(self, action): + tree = self.controlById(self.IdTree) + root = tree.invisibleRootItem() + + if action == self.fcActions['ActionRemoveCompleted']: + flag = fcp2.ConstRequestStatus.Success + elif action == self.fcActions['ActionRemoveFailed']: + flag = fcp2.ConstRequestStatus.Error + else: + raise ValueError('Not implemented') + + for item in treewidgetwrap.walkItem(root, topdown=False): + fcpRequest = getattr(item, 'fcpRequest', None) + if fcpRequest is not None: + if fcpRequest['Identifier'] in self.fcpRequests: #TODO: should never be False?! check + del self.fcpRequests[fcpRequest['Identifier']] + + if fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Removed: + pass + elif not fcpRequest['RequestStatus'] & flag: + continue + else: + item.fcpRequest = None + config.fcpClient.removeRequest(fcpRequest) + parent = item.parent() + if parent is None: + parent = root + parent.removeChild(item) + + + # overwrite + def onTreeCustomContextMenuRequested(self, pt): + pass + + # overwrite + def onTreeItemSelectionChanged(self): + pass + + ######################################### + ## fcp event handlers + ######################################### + def onFcpClientConnected(self, event, msg): + for action in self.fcActions: + action.setEnabled(True) + + + def onFcpClientDisconnected(self, event, msg): + for action in self.fcActions: + action.setEnabled(False) + + def onFcpConfigData(self, fcpEvent, fcpRequest): + pass + + + def onFcpClientRequestCompleted(self, fcpEvent, fcpRequest): + item = self.fcpRequests.get(fcpRequest['Identifier'], None) + if item is not None: + item.setData( + TreeItem.IndexSize, + QtCore.Qt.DisplayRole, + QtCore.QVariant(numbers.format_num_bytes(fcpRequest['MetadataSize'])) + ) + item.setData( + TreeItem.IndexMimeType, + QtCore.Qt.DisplayRole, + QtCore.QVariant(fcpRequest['MetadataContentType']) + ) + self._adjustItemStatus(item) + + def onFcpClientRequestFailed(self, fcpEvent, fcpRequest): + item = self.fcpRequests.get(fcpRequest['Identifier'], None) + if item is not None: + self._adjustItemStatus(item) + + #TODO: not tested + def onFcpClientRequestModified(self, fcpEvent, fcpRequest): + + requestIdentifier = fcpRequest['Modified'].get(fcp2.ConstRequestModified.Identifier, None) + if requestIdentifier is None: + requestIdentifier = fcpRequest['Identifier'] + item = self.fcpRequests.get(requestIdentifier, None) + + if item is not None: + if fcp2.ConstRequestModified.Identifier in fcpRequest['Modified']: + newFcpIdentifier = fcpRequest['Identifier'] + del self.fcpRequests[requestIdentifier] + self.fcpRequests[newFcpIdentifier] = item + + if fcp2.ConstRequestModified.Filename in fcpRequest['Modified']: + item.setData( + TreeItem.IndexName, + QtCore.Qt.DisplayRole, + QtCore.QVariant(os.path.basename(fcpRequest['Filename'])) + ) + + + def onFcpClientRequestProgress(self, fcpEvent, fcpRequest): + item = self.fcpRequests.get(fcpRequest['Identifier'], None) + if item is not None: + self._adjustItemStatus(item) + + def onFcpClientRequestRemoved(self, fcpEvent, fcpRequest): + pass + + def onFcpClientRequestStarted(self, fcpEvent, fcpRequest): + if fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Restored: + try: + requestData = PersistentRequestData.load(fcpRequest['PersistentUserData']) + except pmstruct.PMStructError: + pass + else: + if requestData.get('ClientName', None) == self.objectName(): + item = self._createItemFromFcpRequest(fcpRequest) + else: + item = self.fcpRequests.get(fcpRequest['Identifier'], None) + if item is not None: + self._adjustItemStatus(item) + + +#********************************************************************************** +# +#********************************************************************************** Modified: trunk/fclient/fclient/impl/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-11 17:59:02 UTC (rev 901) +++ trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-11 18:14:30 UTC (rev 902) @@ -1,527 +1,17 @@ """""" -#************************************************************************************************************** -#TODO: -# -# x. prtty tricky to get dls right when the node or client may disconnect unexpectedly -# problem: dls that we send and that have not reached the node -# problem: what to do when the user wants to quit and we still have dls to push to the node -# -# solution would require keeping track of all requests -# a. keep identifiers of requests that reached the node (have to do it anyways) -# b. keep track of requests ahead of sending them to the node (feels not too good doubeling downloads.dat.gz) -# -# best idea seems to be to ignore the problem -# 1. wait till (if ever) freenet devels fdrop node keeping track of client requests -# -# 2. a box thrown to the user (x. do not show this message again) to inform him about pendings -# should be enough. maybe along with a separate widget or some separate color code for pendings -# -# x. performance -# start with a standard model and improve it over time. no need to set any hard -# limits. the user will find out by himself how many dls his machine can handle. -# have to be carefrul though when adding dls, like from a *.frdx to provide appropriate -# warnings -# x. it may take a while untill the final DataFound message arrives when a request is % completed. feedback would be nice -# x. DataFound for a request the file has been removed by the user. no idea what happens. have to test this -# x. when the node is about to start up, looks like persistents may arrive or not. check -# x. how to get early information about mimetype/size? maybe use FcpClient.getFileInfo() -# x. show/hide header izems -# x. sort by header -# x. indicate over all time / dl speed -# x. indicate status / remove items by status -# x. item properties -# x. how to handle inserting huge number of dls? -# idea: insert with lowest priority to get the node to know them, increase priority when a slot in -# MaxSimultaneousDls (if set) is free. atatch progressBar no sooner as priority > MinDlPriority -# x. how to handle huge numbers of dls. the node will flood us on startup with persistents. looks -# like the only way to control the flood is to have one connection/dl. maybe wait for freenet devels -# to realize that this is a serious problem... -# x. byte amount postfixes must be transllated ++ use Kib or Kb or let the user decide? -# x. sometimes groups of dls get not removed -#************************************************************************************************************** + from __future__ import absolute_import if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below import os; __path__ = [os.path.dirname(__file__)] + -import mimetypes -import os from PyQt4 import QtCore, QtGui -from . import config -from .lib import fcp2 -from .lib.fcp2.lib import pmstruct -from .lib.qt4ex import treewidgetwrap -from .lib import numbers - -from . import DlgDownloadKeyToDisk - -from .tpls.Ui_ViewRequestsWidgetTpl import Ui_ViewRequestsWidget -#********************************************************************************** +from .BaseRequestsWidget import RequestsWidget +#************************************************************************************ # -#********************************************************************************** -BLOCK_SIZE = 32768 # from CHKBlock.java - -#********************************************************************************** -# -#********************************************************************************** -class PersistentRequestData(pmstruct.PMStruct): - _fields_ = ( - ('ClientName', pmstruct.STRING), - ) - -#********************************************************************************** -# -#********************************************************************************** -class TreeItem(QtGui.QTreeWidgetItem): - - IndexName = 0 - IndexSize = 1 - IndexMimeType = 2 - IndexStatus = 3 - IndexProgress = 4 - IndexPriority = 5 - IndexElapsed = 6 - - ProgressBarName = 'downloadKey' - - StatusPending = 'pending' - StatusLoading = 'loading' - StatusComplete = 'complete' - StatusError = 'error' - StatusRemoved = 'removed' - - def __init__(self, fcpRequest, *params): - QtGui.QTreeWidgetItem.__init__(self, *params) - self.fcpRequest = fcpRequest - self.fcOldStatus = self.StatusPending - - def status(self): - if self.fcpRequest is None: - return self.StatusRemoved - elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Success: - return self.StatusComplete - elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Error: - return self.StatusError - elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Started: - return self.StatusLoading - else: - return self.StatusPending - -# exposes status property for stylesheets -class ProgressBar(QtGui.QProgressBar): - - def __init__(self, parent, item): - QtGui.QProgressBar.__init__(self, parent) - self.item = item - - def _get_status(self): - return self.item.status() - status= QtCore.pyqtProperty("QString", _get_status) - - -class RequestsWidgetActions(config.ActionsBase): - - def __init__(self, parent): - config.ActionsBase.__init__(self, parent) - - self.action( - name='ActionDownloadKeyToDisk', - text=self.trUtf8('Download &key...'), - trigger=parent.onDlgDownloadKey, - ) - self.action( - name='ActionRemoveSelectedDownloads', - text=self.trUtf8('Remove download'), - trigger=parent.onRemoveSelectedDownloads, - isEnabled=False, - ) - self.action( - name='ActionRestartSelectedDownloads', - text=self.trUtf8('Restart download'), - trigger=parent.onRestartSelectedDownloads, - isEnabled=False, - ) - - #TODO: enable/disable if items of that type are available? - group = self.group( - name='GroupRemoveGroup', - trigger=parent.onRemoveGroup, - ) - self.action( - name='ActionRemoveFailed', - group=group, - text=self.trUtf8('Failed'), - isEnabled=False, - ) - self.action( - name='ActionRemoveCompleted', - group=group, - text=self.trUtf8('Completed'), - isEnabled=False, - ) - -#********************************************************************************** -# -#********************************************************************************** -class RequestsWidget(QtGui.QWidget, Ui_ViewRequestsWidget): - - IdTree = 'tree' - - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): - QtGui.QWidget.__init__(self, parent) - self._isCreated = False - self.fcHeaderLabels = {} # fcpIdentifier --> treeItem - self.fcActions = RequestsWidgetActions(self) - self.fcpRequests = {} - self.fcRequestStatusNames = {} - self.menuRemoveGroup = QtGui.QMenu(self) - - self.setupUi(self) - self.fcpClientEvents = ( - (config.fcpClient.events.ClientConnected, self.onFcpClientConnected), - (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconnected), - (config.fcpClient.events.ConfigData, self.onFcpConfigData), - (config.fcpClient.events.RequestCompleted, self.onFcpClientRequestCompleted), - (config.fcpClient.events.RequestFailed, self.onFcpClientRequestFailed), - (config.fcpClient.events.RequestModified, self.onFcpClientRequestModified), - (config.fcpClient.events.RequestProgress, self.onFcpClientRequestProgress), - (config.fcpClient.events.RequestStarted, self.onFcpClientRequestStarted), - (config.fcpClient.events.RequestRemoved, self.onFcpClientRequestRemoved), - ) - config.fcpClient.events += self.fcpClientEvents - - - ############################ - ## private methods - ############################ - def _adjustItemStatus(self, item): - # to take Css styling into account we have to set a new statusBar for each state change - tree = self.controlById(self.IdTree) - oldProgressBar = progressBar = self.tree.itemWidget(item, TreeItem.IndexProgress) - itemStatus = item.status() - itemStatusChanged = itemStatus != item.fcOldStatus - if itemStatusChanged: - progressBar = ProgressBar(self.tree, item) - - # adjust statusBar and set a new one if necessary - # ..bit much work here, but necessary, cos Fcp might come up with - # ..a completed message without any prior progress notifications - if itemStatus == TreeItem.StatusPending: - progressBar.setRange(0, 0) - elif itemStatus == TreeItem.StatusLoading: - progressBar.setRange(0, item.fcpRequest['ProgressRequired']) - progressBar.setValue(item.fcpRequest['ProgressSucceeded']) - elif itemStatus == TreeItem.StatusComplete: - progressBar.setRange(0, 1) - progressBar.setValue(progressBar.maximum()) - elif itemStatus == TreeItem.StatusError: - progressBar.setMinimum(oldProgressBar.minimum()) - progressBar.setMaximum(oldProgressBar.maximum()) - progressBar.setValue(oldProgressBar.value()) - elif itemStatus == TreeItem.StatusRemoved: - pass - else: - raise ValueError('Unknown status: %r' % itemStatus) - if itemStatusChanged: - progressBar.setObjectName(TreeItem.ProgressBarName) - tree.setItemWidget(item, TreeItem.IndexProgress, progressBar) - item.setData( - TreeItem.IndexStatus, - QtCore.Qt.DisplayRole, - QtCore.QVariant(self.fcRequestStatusNames[itemStatus]), - ) - item.fcOldStatus = itemStatus - - def _createItemFromFcpRequest(self, fcpRequest): - tree = self.controlById(self.IdTree) - root = tree.invisibleRootItem() - item= TreeItem(fcpRequest, root) - progressBar = ProgressBar(self.tree, item) - - progressBar.setObjectName(TreeItem.ProgressBarName) - tree.setItemWidget(item, TreeItem.IndexProgress, progressBar) - fileName = fcpRequest['Filename'] - mimeType = mimetypes.guess_type(fileName)[0] - icon = config.fcResources.getIcon( - config.mimeTypeIconName(mimeType), - config.fcSettings.value('IconSize'), - config.fcSettings.value('IconTheme'), - ) - item.setIcon(0, icon) - item.setData( - TreeItem.IndexName, - QtCore.Qt.DisplayRole, - QtCore.QVariant(os.path.basename(fcpRequest['Filename'])) - ) - - #TODO: take a wild guess at the size. no other way to do it currently - estimatedSize = int((BLOCK_SIZE * fcpRequest['ProgressRequired']) + 1) - item.setData( - TreeItem.IndexSize, - QtCore.Qt.DisplayRole, - QtCore.QVariant(self.trUtf8('< ') + numbers.format_num_bytes(estimatedSize)), - ) - - self.fcpRequests[fcpRequest['Identifier']] = item - self._adjustItemStatus(item) - return item - - ############################ - ## - ############################ - def retranslateUi(self, parent): - Ui_ViewRequestsWidget.retranslateUi(self, parent) - tree = self.controlById(self.IdTree) - root = tree.invisibleRootItem() - - # adjust header labels - self.fcHeaderLabels = { - TreeItem.IndexName: self.trUtf8('Name'), - TreeItem.IndexSize: self.trUtf8('Size'), - TreeItem.IndexMimeType: self.trUtf8('MimeType'), - TreeItem.IndexStatus: self.trUtf8('Status'), - TreeItem.IndexPriority: self.trUtf8('Priority'), - TreeItem.IndexProgress: self.trUtf8('Progress'), - TreeItem.IndexElapsed: self.trUtf8('Elapsed'), - } - tree.setHeaderLabels([i[1] for i in sorted(self.fcHeaderLabels.items())]) - - # adjust status names and retranslate all items - self.fcRequestStatusNames = { - TreeItem.StatusPending: self.trUtf8('Pending'), - TreeItem.StatusLoading: self.trUtf8('Loading'), - TreeItem.StatusComplete: self.trUtf8('Complete'), - TreeItem.StatusError: self.trUtf8('Error'), - TreeItem.StatusRemoved: self.trUtf8('Removed'), - } - for item in treewidgetwrap.walkItem(root): - fcpRequest = getattr(item, 'fcpRequest', None) - if hasattr(item, 'fcpRequest'): - item.setText(TreeItem.IndexStatus, self.fcRequestStatusNames[item.status()]) - - # others - self.menuRemoveGroup.setTitle(self.trUtf8('Remove group')) - - def closeEvent(self): - self.viewClose() - - def hideEvent(self, event): - self.fcGlobalFeedback.setVisible(False) - - def showEvent(self, event): - self.fcGlobalFeedback.setVisible(True) - if not self._isCreated: - self._isCreated = True - - # setup tree - tree = self.controlById(self.IdTree) - tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) - tree.setRootIsDecorated(False) - tree.setSelectionMode(tree.ExtendedSelection) - tree.setUniformRowHeights(True) - self.connect(tree, QtCore.SIGNAL('customContextMenuRequested(const QPoint &)'), self.onTreeCustomContextMenuRequested) - self.connect(tree, QtCore.SIGNAL('itemSelectionChanged() '), self.onTreeItemSelectionChanged) - - def viewClose(self): - config.fcpClient.events -= self.fcpClientEvents - - ######################################### - ## methods - ######################################### - def controlById(idGlobalFeedback, idControl): - return getattr(idGlobalFeedback, idControl) - - def downloadFile(self, fcpKey, fileName, **kws): - """""" - fileName = unicode(fileName) - fcpRequest = config.fcpClient.getFile( - fcpKey, - fileName, - persistentUserData=PersistentRequestData(ClientName=unicode(self.objectName())).dump(), - #TODO: browser sets this. ok or not? - #handleFilenameCollision=True, - handlePermanentRedirect=True, - **kws - ) - item = self._createItemFromFcpRequest(fcpRequest) - - def populateMenu(self, menu): - menu.addAction(self.fcActions['ActionDownloadKeyToDisk']) - return menu - - - def execDlgDownloadKey(self, fcpKey=None): - """pops up the dialog to allow the user to download a key to disk - @param fcpKey: key to initialize the key with or None - """ - dlg = DlgDownloadKeyToDisk.DlgDownloadKeyToDisk(self, fcpKey=fcpKey) - if dlg.exec_() == dlg.Accepted: - self.downloadFile( - dlg.fcpKey(), - dlg.fileName(), - persistence=fcp2.ConstPersistence.Forever, - handleFilenameCollision=True, - ) - - ######################################### - ## event handlers - ######################################### - def onDlgDownloadKey(self, action): - self.execDlgDownloadKey(fcpKey=None) - - def onRemoveSelectedDownloads(self, action): - tree = self.controlById(self.IdTree) - selectedItems = tree.selectedItems() - - # remove items - for item in selectedItems: - parent = item.parent() - if parent is None: - parent = tree.invisibleRootItem() - parent.removeChild(item) - - # cancel all requests - for item in selectedItems: - for tmp_item in treewidgetwrap.walkItem(item): - if tmp_item.fcpRequest is not None: # we may come across the same item multiple times - if tmp_item.fcpRequest['Identifier'] in self.fcpRequests: #TODO: should never be False?! check - del self.fcpRequests[tmp_item.fcpRequest['Identifier']] - config.fcpClient.removeRequest(tmp_item.fcpRequest) - tmp_item.fcpRequest = None - - def onRestartSelectedDownloads(self, action): - tree = self.controlById(self.IdTree) - for item in tree.selectedItems(): - if item.fcpRequest is None: - raise RuntimeError('fcpRequest is None. should not happen') - del self.fcpRequests[item.fcpRequest['Identifier']] - item.fcpRequest = config.fcpClient.resendRequest(item.fcpRequest) - self.fcpRequests[item.fcpRequest['Identifier']] = item - self._adjustItemStatus(item) - - def onRemoveGroup(self, action): - tree = self.controlById(self.IdTree) - root = tree.invisibleRootItem() - - if action == self.fcActions['ActionRemoveCompleted']: - flag = fcp2.ConstRequestStatus.Success - elif action == self.fcActions['ActionRemoveFailed']: - flag = fcp2.ConstRequestStatus.Error - else: - raise ValueError('Not implemented') - - for item in treewidgetwrap.walkItem(root, topdown=False): - fcpRequest = getattr(item, 'fcpRequest', None) - if fcpRequest is not None: - if fcpRequest['Identifier'] in self.fcpRequests: #TODO: should never be False?! check - del self.fcpRequests[fcpRequest['Identifier']] - - if fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Removed: - pass - elif not fcpRequest['RequestStatus'] & flag: - continue - else: - item.fcpRequest = None - config.fcpClient.removeRequest(fcpRequest) - parent = item.parent() - if parent is None: - parent = root - parent.removeChild(item) - - - # overwrite - def onTreeCustomContextMenuRequested(self, pt): - pass - - # overwrite - def onTreeItemSelectionChanged(self): - pass - - ######################################### - ## fcp event handlers - ######################################### - def onFcpClientConnected(self, event, msg): - for action in self.fcActions: - action.setEnabled(True) - - - def onFcpClientDisconnected(self, event, msg): - for action in self.fcActions: - action.setEnabled(False) - - def onFcpConfigData(self, fcpEvent, fcpRequest): - pass - - - def onFcpClientRequestCompleted(self, fcpEvent, fcpRequest): - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - item.setData( - TreeItem.IndexSize, - QtCore.Qt.DisplayRole, - QtCore.QVariant(numbers.format_num_bytes(fcpRequest['MetadataSize'])) - ) - item.setData( - TreeItem.IndexMimeType, - QtCore.Qt.DisplayRole, - QtCore.QVariant(fcpRequest['MetadataContentType']) - ) - self._adjustItemStatus(item) - - def onFcpClientRequestFailed(self, fcpEvent, fcpRequest): - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - self._adjustItemStatus(item) - - #TODO: not tested - def onFcpClientRequestModified(self, fcpEvent, fcpRequest): - - requestIdentifier = fcpRequest['Modified'].get(fcp2.ConstRequestModified.Identifier, None) - if requestIdentifier is None: - requestIdentifier = fcpRequest['Identifier'] - item = self.fcpRequests.get(requestIdentifier, None) - - if item is not None: - if fcp2.ConstRequestModified.Identifier in fcpRequest['Modified']: - newFcpIdentifier = fcpRequest['Identifier'] - del self.fcpRequests[requestIdentifier] - self.fcpRequests[newFcpIdentifier] = item - - if fcp2.ConstRequestModified.Filename in fcpRequest['Modified']: - item.setData( - TreeItem.IndexName, - QtCore.Qt.DisplayRole, - QtCore.QVariant(os.path.basename(fcpRequest['Filename'])) - ) - - - def onFcpClientRequestProgress(self, fcpEvent, fcpRequest): - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - self._adjustItemStatus(item) - - def onFcpClientRequestRemoved(self, fcpEvent, fcpRequest): - pass - - def onFcpClientRequestStarted(self, fcpEvent, fcpRequest): - if fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Restored: - try: - requestData = PersistentRequestData.load(fcpRequest['PersistentUserData']) - except pmstruct.PMStructError: - pass - else: - if requestData.get('ClientName', None) == self.objectName(): - item = self._createItemFromFcpRequest(fcpRequest) - else: - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - self._adjustItemStatus(item) - - -#********************************************************************************** -# -#********************************************************************************** +#************************************************************************************ class DownloadsWidgetGlobalFeedback(config.GlobalFeedbackBase): """wrapper for global statusbar widgets, menus""" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-12 08:41:49
|
Revision: 903 http://fclient.svn.sourceforge.net/fclient/?rev=903&view=rev Author: jUrner Date: 2008-08-12 08:41:55 +0000 (Tue, 12 Aug 2008) Log Message: ----------- fix: tell GET and POST requests apart Modified Paths: -------------- trunk/fclient/fclient/impl/SideBarLoadDetails.py trunk/fclient/fclient/impl/ViewBrowser.py Modified: trunk/fclient/fclient/impl/SideBarLoadDetails.py =================================================================== --- trunk/fclient/fclient/impl/SideBarLoadDetails.py 2008-08-11 18:14:30 UTC (rev 902) +++ trunk/fclient/fclient/impl/SideBarLoadDetails.py 2008-08-12 08:41:55 UTC (rev 903) @@ -173,7 +173,7 @@ self.baseUrl = None # setup browser if browser is not None: - self.connect(browser, QtCore.SIGNAL('networkRequestCreated(int, QObject*)'), self.addNetworkReply) + self.connect(browser, QtCore.SIGNAL('networkGetRequestCreated(int, QObject*)'), self.addNetworkReply) self.connect(browser, QtCore.SIGNAL('networkReplyProgress(int, QObject*)'), self.onBrowserNetworkReplyProgress) self.connect(browser, QtCore.SIGNAL('networkReplyError(int, QObject*)'), self.onBrowserNetworkReplyError) self.connect(browser, QtCore.SIGNAL('networkReplyFinished(int, QObject*)'), self.onBrowserNetworkReplyFinished) Modified: trunk/fclient/fclient/impl/ViewBrowser.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser.py 2008-08-11 18:14:30 UTC (rev 902) +++ trunk/fclient/fclient/impl/ViewBrowser.py 2008-08-12 08:41:55 UTC (rev 903) @@ -257,7 +257,7 @@ self._networkGetReplies[1].append(networkReplyData) for signal, handler in self._networkReplySignals: self.connect(reply, QtCore.SIGNAL(signal), handler) - self.emit(QtCore.SIGNAL('networkRequestCreated(int, QObject*)'), self._networkGetReplies[0].index(reply), networkReplyData) + self.emit(QtCore.SIGNAL('networkGetRequestCreated(int, QObject*)'), self._networkGetReplies[0].index(reply), networkReplyData) def onNetworkReplyDownloadProgress(self, bytesReceived, bytesTotal): reply = self.sender() @@ -1003,6 +1003,7 @@ #TODO: find a better time to fire up the browser. how do we know when the gui is up and running? QtGui.QApplication.instance().processEvents() self.newBrowser(title=self.trUtf8('Waiting for fproxy')) + QtGui.QApplication.instance().processEvents() self.fcActions['ActionGoToHomePage'].trigger() def viewClose(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-12 08:42:40
|
Revision: 904 http://fclient.svn.sourceforge.net/fclient/?rev=904&view=rev Author: jUrner Date: 2008-08-12 08:42:46 +0000 (Tue, 12 Aug 2008) Log Message: ----------- bit more work to impl a genaral purpose requests widget Modified Paths: -------------- trunk/fclient/fclient/impl/BaseRequestsWidget.py trunk/fclient/fclient/impl/ViewDownloads.py Modified: trunk/fclient/fclient/impl/BaseRequestsWidget.py =================================================================== --- trunk/fclient/fclient/impl/BaseRequestsWidget.py 2008-08-12 08:41:55 UTC (rev 903) +++ trunk/fclient/fclient/impl/BaseRequestsWidget.py 2008-08-12 08:42:46 UTC (rev 904) @@ -89,6 +89,8 @@ StatusComplete = 'complete' StatusError = 'error' StatusRemoved = 'removed' + StatusCompressing = 'compressing' + ##StatusCompressed = 'compressed' #TODO: no way to distinguish compressed an loading def __init__(self, fcpRequest, *params): QtGui.QTreeWidgetItem.__init__(self, *params) @@ -102,8 +104,16 @@ return self.StatusComplete elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Error: return self.StatusError + + #TODO: more or less aguess ..have to check this in detail elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Started: - return self.StatusLoading + if self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Compressing: + if self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Compressed: + return self.StatusLoading + else: + return self.compressing + else: + return self.StatusLoading else: return self.StatusPending @@ -187,6 +197,8 @@ (config.fcpClient.events.RequestProgress, self.onFcpClientRequestProgress), (config.fcpClient.events.RequestStarted, self.onFcpClientRequestStarted), (config.fcpClient.events.RequestRemoved, self.onFcpClientRequestRemoved), + (config.fcpClient.events.RequestCompressionStarted, self.onFcpClientRequestCompressionStarted), + (config.fcpClient.events.RequestCompressionCompleted, self.onFcpClientRequestCompressionCompleted), ) config.fcpClient.events += self.fcpClientEvents @@ -220,6 +232,8 @@ progressBar.setValue(oldProgressBar.value()) elif itemStatus == TreeItem.StatusRemoved: pass + elif itemStatus == TreeItem.StatusCompressing: + progressBar.setRange(0, 0) else: raise ValueError('Unknown status: %r' % itemStatus) if itemStatusChanged: @@ -232,40 +246,6 @@ ) item.fcOldStatus = itemStatus - def _createItemFromFcpRequest(self, fcpRequest): - tree = self.controlById(self.IdTree) - root = tree.invisibleRootItem() - item= TreeItem(fcpRequest, root) - progressBar = ProgressBar(self.tree, item) - - progressBar.setObjectName(TreeItem.ProgressBarName) - tree.setItemWidget(item, TreeItem.IndexProgress, progressBar) - fileName = fcpRequest['Filename'] - mimeType = mimetypes.guess_type(fileName)[0] - icon = config.fcResources.getIcon( - config.mimeTypeIconName(mimeType), - config.fcSettings.value('IconSize'), - config.fcSettings.value('IconTheme'), - ) - item.setIcon(0, icon) - item.setData( - TreeItem.IndexName, - QtCore.Qt.DisplayRole, - QtCore.QVariant(os.path.basename(fcpRequest['Filename'])) - ) - - #TODO: take a wild guess at the size. no other way to do it currently - estimatedSize = int((BLOCK_SIZE * fcpRequest['ProgressRequired']) + 1) - item.setData( - TreeItem.IndexSize, - QtCore.Qt.DisplayRole, - QtCore.QVariant(self.trUtf8('< ') + numbers.format_num_bytes(estimatedSize)), - ) - - self.fcpRequests[fcpRequest['Identifier']] = item - self._adjustItemStatus(item) - return item - ############################ ## ############################ @@ -293,6 +273,8 @@ TreeItem.StatusComplete: self.trUtf8('Complete'), TreeItem.StatusError: self.trUtf8('Error'), TreeItem.StatusRemoved: self.trUtf8('Removed'), + TreeItem.StatusCompressing: self.trUtf8('Compressing'), + ##TreeItem.StatusCompressed: self.trUtf8('Compressed'), #TODO: no way to distinguish compressed an loading } for item in treewidgetwrap.walkItem(root): fcpRequest = getattr(item, 'fcpRequest', None) @@ -328,28 +310,57 @@ ######################################### ## methods ######################################### + #TODO: much... + def addFcpRequest(self, fcpRequest): + """ + @note: if you add a newly created request, make shure to set the requests PersistentUserData + to the result of the call to L{persistentFcpRequestData} + """ + tree = self.controlById(self.IdTree) + root = tree.invisibleRootItem() + item= TreeItem(fcpRequest, root) + progressBar = ProgressBar(self.tree, item) + + progressBar.setObjectName(TreeItem.ProgressBarName) + tree.setItemWidget(item, TreeItem.IndexProgress, progressBar) + fileName = fcpRequest['Filename'] + mimeType = mimetypes.guess_type(fileName)[0] + icon = config.fcResources.getIcon( + config.mimeTypeIconName(mimeType), + config.fcSettings.value('IconSize'), + config.fcSettings.value('IconTheme'), + ) + item.setIcon(0, icon) + item.setData( + TreeItem.IndexName, + QtCore.Qt.DisplayRole, + QtCore.QVariant(os.path.basename(fcpRequest['Filename'])) + ) + + #TODO: take a wild guess at the size. no other way to do it currently + estimatedSize = int((BLOCK_SIZE * fcpRequest['ProgressRequired']) + 1) + item.setData( + TreeItem.IndexSize, + QtCore.Qt.DisplayRole, + QtCore.QVariant(self.trUtf8('< ') + numbers.format_num_bytes(estimatedSize)), + ) + + self.fcpRequests[fcpRequest['Identifier']] = item + self._adjustItemStatus(item) + return item + + self.fcpRequests[fcpRequest['Identifier']] = item + self._adjustItemStatus(item) + return item + + def controlById(idGlobalFeedback, idControl): return getattr(idGlobalFeedback, idControl) - def downloadFile(self, fcpKey, fileName, **kws): - """""" - fileName = unicode(fileName) - fcpRequest = config.fcpClient.getFile( - fcpKey, - fileName, - persistentUserData=PersistentRequestData(ClientName=unicode(self.objectName())).dump(), - #TODO: browser sets this. ok or not? - #handleFilenameCollision=True, - handlePermanentRedirect=True, - **kws - ) - item = self._createItemFromFcpRequest(fcpRequest) - + # overwrite def populateMenu(self, menu): - menu.addAction(self.fcActions['ActionDownloadKeyToDisk']) return menu - def execDlgDownloadKey(self, fcpKey=None): """pops up the dialog to allow the user to download a key to disk @param fcpKey: key to initialize the key with or None @@ -363,6 +374,9 @@ handleFilenameCollision=True, ) + def persistentFcpRequestData(self): + return PersistentRequestData(ClientName=unicode(self.objectName())).dump() + ######################################### ## event handlers ######################################### @@ -456,6 +470,7 @@ def onFcpClientRequestCompleted(self, fcpEvent, fcpRequest): item = self.fcpRequests.get(fcpRequest['Identifier'], None) if item is not None: + mimeType = fcpRequest['MetadataContentType'] item.setData( TreeItem.IndexSize, QtCore.Qt.DisplayRole, @@ -464,10 +479,26 @@ item.setData( TreeItem.IndexMimeType, QtCore.Qt.DisplayRole, - QtCore.QVariant(fcpRequest['MetadataContentType']) + QtCore.QVariant(mimeType) ) + icon = config.fcResources.getIcon( + config.mimeTypeIconName(mimeType), + config.fcSettings.value('IconSize'), + config.fcSettings.value('IconTheme'), + ) + item.setIcon(0, icon) self._adjustItemStatus(item) + def onFcpClientRequestCompressionStarted(self, fcpEvent, fcpRequest): + item = self.fcpRequests.get(fcpRequest['Identifier'], None) + if item is not None: + self._adjustItemStatus(item) + + def onFcpClientRequestCompressionCompleted(self, fcpEvent, fcpRequest): + item = self.fcpRequests.get(fcpRequest['Identifier'], None) + if item is not None: + self._adjustItemStatus(item) + def onFcpClientRequestFailed(self, fcpEvent, fcpRequest): item = self.fcpRequests.get(fcpRequest['Identifier'], None) if item is not None: @@ -511,7 +542,7 @@ pass else: if requestData.get('ClientName', None) == self.objectName(): - item = self._createItemFromFcpRequest(fcpRequest) + item = self.addFcpRequest(fcpRequest) else: item = self.fcpRequests.get(fcpRequest['Identifier'], None) if item is not None: Modified: trunk/fclient/fclient/impl/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-12 08:41:55 UTC (rev 903) +++ trunk/fclient/fclient/impl/ViewDownloads.py 2008-08-12 08:42:46 UTC (rev 904) @@ -8,6 +8,7 @@ from PyQt4 import QtCore, QtGui +from . import config from .BaseRequestsWidget import RequestsWidget #************************************************************************************ # @@ -111,6 +112,9 @@ self.menuRemoveGroup.addAction(action) + ################################### + ## overwritten methods + ################################### def hideEvent(self, event): self.fcGlobalFeedback.setVisible(False) RequestsWidget.hideEvent(self, event) @@ -119,11 +123,35 @@ self.fcGlobalFeedback.setVisible(True) RequestsWidget.showEvent(self, event) + def populateMenu(self, menu): + menu.addAction(self.fcActions['ActionDownloadKeyToDisk']) + return menu + def retranslateUi(self, parent): RequestsWidget.retranslateUi(self, parent) if self.menuRemoveGroup is not None: self.menuRemoveGroup.setTitle(self.trUtf8('Remove group')) + ################################### + ## methods + ################################### + def downloadFile(self, fcpKey, fileName, **kws): + """""" + fileName = unicode(fileName) + fcpRequest = config.fcpClient.getFile( + fcpKey, + fileName, + persistentUserData = self.persistentFcpRequestData(), + #TODO: browser sets this. ok or not? + #handleFilenameCollision=True, + handlePermanentRedirect=True, + **kws + ) + item = self.addFcpRequest(fcpRequest) + + ################################### + ## event handlers + ################################### def onTreeCustomContextMenuRequested(self, pt): tree = self.controlById(self.IdTree) pt = tree.viewport().mapToGlobal(pt) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 08:13:49
|
Revision: 916 http://fclient.svn.sourceforge.net/fclient/?rev=916&view=rev Author: jUrner Date: 2008-08-16 08:13:58 +0000 (Sat, 16 Aug 2008) Log Message: ----------- fixes for downloads widget Modified Paths: -------------- trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py Removed Paths: ------------- trunk/fclient/fclient/impl/BaseRequestsWidget.py Deleted: trunk/fclient/fclient/impl/BaseRequestsWidget.py =================================================================== --- trunk/fclient/fclient/impl/BaseRequestsWidget.py 2008-08-16 08:10:49 UTC (rev 915) +++ trunk/fclient/fclient/impl/BaseRequestsWidget.py 2008-08-16 08:13:58 UTC (rev 916) @@ -1,554 +0,0 @@ - -#************************************************************************************************************** -#TODO: -# -# x. prtty tricky to get dls right when the node or client may disconnect unexpectedly -# problem: dls that we send and that have not reached the node -# problem: what to do when the user wants to quit and we still have dls to push to the node -# -# solution would require keeping track of all requests -# a. keep identifiers of requests that reached the node (have to do it anyways) -# b. keep track of requests ahead of sending them to the node (feels not too good doubeling downloads.dat.gz) -# -# best idea seems to be to ignore the problem -# 1. wait till (if ever) freenet devels fdrop node keeping track of client requests -# -# 2. a box thrown to the user (x. do not show this message again) to inform him about pendings -# should be enough. maybe along with a separate widget or some separate color code for pendings -# -# x. performance -# start with a standard model and improve it over time. no need to set any hard -# limits. the user will find out by himself how many dls his machine can handle. -# have to be carefrul though when adding dls, like from a *.frdx to provide appropriate -# warnings -# x. it may take a while untill the final DataFound message arrives when a request is % completed. feedback would be nice -# x. DataFound for a request the file has been removed by the user. no idea what happens. have to test this -# x. when the node is about to start up, looks like persistents may arrive or not. check -# x. how to get early information about mimetype/size? maybe use FcpClient.getFileInfo() -# x. show/hide header izems -# x. sort by header -# x. indicate over all time / dl speed -# x. indicate status / remove items by status -# x. item properties -# x. how to handle inserting huge number of dls? -# idea: insert with lowest priority to get the node to know them, increase priority when a slot in -# MaxSimultaneousDls (if set) is free. atatch progressBar no sooner as priority > MinDlPriority -# x. how to handle huge numbers of dls. the node will flood us on startup with persistents. looks -# like the only way to control the flood is to have one connection/dl. maybe wait for freenet devels -# to realize that this is a serious problem... -# x. byte amount postfixes must be transllated ++ use Kib or Kb or let the user decide? -# x. sometimes groups of dls get not removed -#************************************************************************************************************** -from __future__ import absolute_import -if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below - import os; __path__ = [os.path.dirname(__file__)] - -import mimetypes -import os -from PyQt4 import QtCore, QtGui - -from . import config -from .lib import fcp2 -from .lib.fcp2.lib import pmstruct -from .lib.qt4ex import treewidgetwrap -from .lib import numbers - -from . import DlgDownloadKeyToDisk - -from .tpls.Ui_ViewRequestsWidgetTpl import Ui_ViewRequestsWidget -#********************************************************************************** -# -#********************************************************************************** -BLOCK_SIZE = 32768 # from CHKBlock.java - -#********************************************************************************** -# -#********************************************************************************** -class PersistentRequestData(pmstruct.PMStruct): - _fields_ = ( - ('ClientName', pmstruct.STRING), - ) - -#********************************************************************************** -# -#********************************************************************************** -class TreeItem(QtGui.QTreeWidgetItem): - - IndexName = 0 - IndexSize = 1 - IndexMimeType = 2 - IndexStatus = 3 - IndexProgress = 4 - IndexPriority = 5 - IndexElapsed = 6 - - ProgressBarName = 'downloadKey' - - StatusPending = 'pending' - StatusLoading = 'loading' - StatusComplete = 'complete' - StatusError = 'error' - StatusRemoved = 'removed' - StatusCompressing = 'compressing' - ##StatusCompressed = 'compressed' #TODO: no way to distinguish compressed an loading - - def __init__(self, fcpRequest, *params): - QtGui.QTreeWidgetItem.__init__(self, *params) - self.fcpRequest = fcpRequest - self.fcOldStatus = self.StatusPending - - def status(self): - if self.fcpRequest is None: - return self.StatusRemoved - elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Success: - return self.StatusComplete - elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Error: - return self.StatusError - - #TODO: more or less aguess ..have to check this in detail - elif self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Started: - if self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Compressing: - if self.fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Compressed: - return self.StatusLoading - else: - return self.compressing - else: - return self.StatusLoading - else: - return self.StatusPending - -# exposes status property for stylesheets -class ProgressBar(QtGui.QProgressBar): - - def __init__(self, parent, item): - QtGui.QProgressBar.__init__(self, parent) - self.item = item - - def _get_status(self): - return self.item.status() - status= QtCore.pyqtProperty("QString", _get_status) - - -class RequestsWidgetActions(config.ActionsBase): - - def __init__(self, parent): - config.ActionsBase.__init__(self, parent) - - self.action( - name='ActionDownloadKeyToDisk', - text=self.trUtf8('Download &key...'), - trigger=parent.onDlgDownloadKey, - ) - self.action( - name='ActionRemoveSelectedDownloads', - text=self.trUtf8('Remove download'), - trigger=parent.onRemoveSelectedDownloads, - isEnabled=False, - ) - self.action( - name='ActionRestartSelectedDownloads', - text=self.trUtf8('Restart download'), - trigger=parent.onRestartSelectedDownloads, - isEnabled=False, - ) - - #TODO: enable/disable if items of that type are available? - group = self.group( - name='GroupRemoveGroup', - trigger=parent.onRemoveGroup, - ) - self.action( - name='ActionRemoveFailed', - group=group, - text=self.trUtf8('Failed'), - isEnabled=False, - ) - self.action( - name='ActionRemoveCompleted', - group=group, - text=self.trUtf8('Completed'), - isEnabled=False, - ) - -#********************************************************************************** -# -#********************************************************************************** -class RequestsWidget(QtGui.QWidget, Ui_ViewRequestsWidget): - - IdTree = 'tree' - - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): - QtGui.QWidget.__init__(self, parent) - self._isCreated = False - self.fcHeaderLabels = {} # fcpIdentifier --> treeItem - self.fcActions = RequestsWidgetActions(self) - self.fcpRequests = {} - self.fcRequestStatusNames = {} - self.menuRemoveGroup = QtGui.QMenu(self) - - self.setupUi(self) - self.fcpClientEvents = ( - (config.fcpClient.events.ClientConnected, self.onFcpClientConnected), - (config.fcpClient.events.ClientDisconnected, self.onFcpClientDisconnected), - (config.fcpClient.events.ConfigData, self.onFcpConfigData), - (config.fcpClient.events.RequestCompleted, self.onFcpClientRequestCompleted), - (config.fcpClient.events.RequestFailed, self.onFcpClientRequestFailed), - (config.fcpClient.events.RequestModified, self.onFcpClientRequestModified), - (config.fcpClient.events.RequestProgress, self.onFcpClientRequestProgress), - (config.fcpClient.events.RequestStarted, self.onFcpClientRequestStarted), - (config.fcpClient.events.RequestRemoved, self.onFcpClientRequestRemoved), - (config.fcpClient.events.RequestCompressionStarted, self.onFcpClientRequestCompressionStarted), - (config.fcpClient.events.RequestCompressionCompleted, self.onFcpClientRequestCompressionCompleted), - ) - config.fcpClient.events += self.fcpClientEvents - - - ############################ - ## private methods - ############################ - def _adjustItemStatus(self, item): - # to take Css styling into account we have to set a new statusBar for each state change - tree = self.controlById(self.IdTree) - oldProgressBar = progressBar = self.tree.itemWidget(item, TreeItem.IndexProgress) - itemStatus = item.status() - itemStatusChanged = itemStatus != item.fcOldStatus - if itemStatusChanged: - progressBar = ProgressBar(self.tree, item) - - # adjust statusBar and set a new one if necessary - # ..bit much work here, but necessary, cos Fcp might come up with - # ..a completed message without any prior progress notifications - if itemStatus == TreeItem.StatusPending: - progressBar.setRange(0, 0) - elif itemStatus == TreeItem.StatusLoading: - progressBar.setRange(0, item.fcpRequest['ProgressRequired']) - progressBar.setValue(item.fcpRequest['ProgressSucceeded']) - elif itemStatus == TreeItem.StatusComplete: - progressBar.setRange(0, 1) - progressBar.setValue(progressBar.maximum()) - elif itemStatus == TreeItem.StatusError: - progressBar.setMinimum(oldProgressBar.minimum()) - progressBar.setMaximum(oldProgressBar.maximum()) - progressBar.setValue(oldProgressBar.value()) - elif itemStatus == TreeItem.StatusRemoved: - pass - elif itemStatus == TreeItem.StatusCompressing: - progressBar.setRange(0, 0) - else: - raise ValueError('Unknown status: %r' % itemStatus) - if itemStatusChanged: - progressBar.setObjectName(TreeItem.ProgressBarName) - tree.setItemWidget(item, TreeItem.IndexProgress, progressBar) - item.setData( - TreeItem.IndexStatus, - QtCore.Qt.DisplayRole, - QtCore.QVariant(self.fcRequestStatusNames[itemStatus]), - ) - item.fcOldStatus = itemStatus - - ############################ - ## - ############################ - def retranslateUi(self, parent): - Ui_ViewRequestsWidget.retranslateUi(self, parent) - tree = self.controlById(self.IdTree) - root = tree.invisibleRootItem() - - # adjust header labels - self.fcHeaderLabels = { - TreeItem.IndexName: self.trUtf8('Name'), - TreeItem.IndexSize: self.trUtf8('Size'), - TreeItem.IndexMimeType: self.trUtf8('MimeType'), - TreeItem.IndexStatus: self.trUtf8('Status'), - TreeItem.IndexPriority: self.trUtf8('Priority'), - TreeItem.IndexProgress: self.trUtf8('Progress'), - TreeItem.IndexElapsed: self.trUtf8('Elapsed'), - } - tree.setHeaderLabels([i[1] for i in sorted(self.fcHeaderLabels.items())]) - - # adjust status names and retranslate all items - self.fcRequestStatusNames = { - TreeItem.StatusPending: self.trUtf8('Pending'), - TreeItem.StatusLoading: self.trUtf8('Loading'), - TreeItem.StatusComplete: self.trUtf8('Complete'), - TreeItem.StatusError: self.trUtf8('Error'), - TreeItem.StatusRemoved: self.trUtf8('Removed'), - TreeItem.StatusCompressing: self.trUtf8('Compressing'), - ##TreeItem.StatusCompressed: self.trUtf8('Compressed'), #TODO: no way to distinguish compressed an loading - } - for item in treewidgetwrap.walkItem(root): - fcpRequest = getattr(item, 'fcpRequest', None) - if hasattr(item, 'fcpRequest'): - item.setText(TreeItem.IndexStatus, self.fcRequestStatusNames[item.status()]) - - # others - self.menuRemoveGroup.setTitle(self.trUtf8('Remove group')) - - def closeEvent(self): - self.viewClose() - - def hideEvent(self, event): - self.fcGlobalFeedback.setVisible(False) - - def showEvent(self, event): - self.fcGlobalFeedback.setVisible(True) - if not self._isCreated: - self._isCreated = True - - # setup tree - tree = self.controlById(self.IdTree) - tree.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) - tree.setRootIsDecorated(False) - tree.setSelectionMode(tree.ExtendedSelection) - tree.setUniformRowHeights(True) - self.connect(tree, QtCore.SIGNAL('customContextMenuRequested(const QPoint &)'), self.onTreeCustomContextMenuRequested) - self.connect(tree, QtCore.SIGNAL('itemSelectionChanged() '), self.onTreeItemSelectionChanged) - - def viewClose(self): - config.fcpClient.events -= self.fcpClientEvents - - ######################################### - ## methods - ######################################### - #TODO: much... - def addFcpRequest(self, fcpRequest): - """ - @note: if you add a newly created request, make shure to set the requests PersistentUserData - to the result of the call to L{persistentFcpRequestData} - """ - tree = self.controlById(self.IdTree) - root = tree.invisibleRootItem() - item= TreeItem(fcpRequest, root) - progressBar = ProgressBar(self.tree, item) - - progressBar.setObjectName(TreeItem.ProgressBarName) - tree.setItemWidget(item, TreeItem.IndexProgress, progressBar) - fileName = fcpRequest['Filename'] - mimeType = mimetypes.guess_type(fileName)[0] - icon = config.fcResources.getIcon( - config.mimeTypeIconName(mimeType), - config.fcSettings.value('IconSize'), - config.fcSettings.value('IconTheme'), - ) - item.setIcon(0, icon) - item.setData( - TreeItem.IndexName, - QtCore.Qt.DisplayRole, - QtCore.QVariant(os.path.basename(fcpRequest['Filename'])) - ) - - #TODO: take a wild guess at the size. no other way to do it currently - estimatedSize = int((BLOCK_SIZE * fcpRequest['ProgressRequired']) + 1) - item.setData( - TreeItem.IndexSize, - QtCore.Qt.DisplayRole, - QtCore.QVariant(self.trUtf8('< ') + numbers.format_num_bytes(estimatedSize)), - ) - - self.fcpRequests[fcpRequest['Identifier']] = item - self._adjustItemStatus(item) - return item - - self.fcpRequests[fcpRequest['Identifier']] = item - self._adjustItemStatus(item) - return item - - - def controlById(idGlobalFeedback, idControl): - return getattr(idGlobalFeedback, idControl) - - # overwrite - def populateMenu(self, menu): - return menu - - def execDlgDownloadKey(self, fcpKey=None): - """pops up the dialog to allow the user to download a key to disk - @param fcpKey: key to initialize the key with or None - """ - dlg = DlgDownloadKeyToDisk.DlgDownloadKeyToDisk(self, fcpKey=fcpKey) - if dlg.exec_() == dlg.Accepted: - self.downloadFile( - dlg.fcpKey(), - dlg.fileName(), - persistence=fcp2.ConstPersistence.Forever, - handleFilenameCollision=True, - ) - - def persistentFcpRequestData(self): - return PersistentRequestData(ClientName=unicode(self.objectName())).dump() - - ######################################### - ## event handlers - ######################################### - def onDlgDownloadKey(self, action): - self.execDlgDownloadKey(fcpKey=None) - - def onRemoveSelectedDownloads(self, action): - tree = self.controlById(self.IdTree) - selectedItems = tree.selectedItems() - - # remove items - for item in selectedItems: - parent = item.parent() - if parent is None: - parent = tree.invisibleRootItem() - parent.removeChild(item) - - # cancel all requests - for item in selectedItems: - for tmp_item in treewidgetwrap.walkItem(item): - if tmp_item.fcpRequest is not None: # we may come across the same item multiple times - if tmp_item.fcpRequest['Identifier'] in self.fcpRequests: #TODO: should never be False?! check - del self.fcpRequests[tmp_item.fcpRequest['Identifier']] - config.fcpClient.removeRequest(tmp_item.fcpRequest) - tmp_item.fcpRequest = None - - def onRestartSelectedDownloads(self, action): - tree = self.controlById(self.IdTree) - for item in tree.selectedItems(): - if item.fcpRequest is None: - raise RuntimeError('fcpRequest is None. should not happen') - del self.fcpRequests[item.fcpRequest['Identifier']] - item.fcpRequest = config.fcpClient.resendRequest(item.fcpRequest) - self.fcpRequests[item.fcpRequest['Identifier']] = item - self._adjustItemStatus(item) - - def onRemoveGroup(self, action): - tree = self.controlById(self.IdTree) - root = tree.invisibleRootItem() - - if action == self.fcActions['ActionRemoveCompleted']: - flag = fcp2.ConstRequestStatus.Success - elif action == self.fcActions['ActionRemoveFailed']: - flag = fcp2.ConstRequestStatus.Error - else: - raise ValueError('Not implemented') - - for item in treewidgetwrap.walkItem(root, topdown=False): - fcpRequest = getattr(item, 'fcpRequest', None) - if fcpRequest is not None: - if fcpRequest['Identifier'] in self.fcpRequests: #TODO: should never be False?! check - del self.fcpRequests[fcpRequest['Identifier']] - - if fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Removed: - pass - elif not fcpRequest['RequestStatus'] & flag: - continue - else: - item.fcpRequest = None - config.fcpClient.removeRequest(fcpRequest) - parent = item.parent() - if parent is None: - parent = root - parent.removeChild(item) - - - # overwrite - def onTreeCustomContextMenuRequested(self, pt): - pass - - # overwrite - def onTreeItemSelectionChanged(self): - pass - - ######################################### - ## fcp event handlers - ######################################### - def onFcpClientConnected(self, event, msg): - for action in self.fcActions: - action.setEnabled(True) - - - def onFcpClientDisconnected(self, event, msg): - for action in self.fcActions: - action.setEnabled(False) - - def onFcpConfigData(self, fcpEvent, fcpRequest): - pass - - - def onFcpClientRequestCompleted(self, fcpEvent, fcpRequest): - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - mimeType = fcpRequest['MetadataContentType'] - item.setData( - TreeItem.IndexSize, - QtCore.Qt.DisplayRole, - QtCore.QVariant(numbers.format_num_bytes(fcpRequest['MetadataSize'])) - ) - item.setData( - TreeItem.IndexMimeType, - QtCore.Qt.DisplayRole, - QtCore.QVariant(mimeType) - ) - icon = config.fcResources.getIcon( - config.mimeTypeIconName(mimeType), - config.fcSettings.value('IconSize'), - config.fcSettings.value('IconTheme'), - ) - item.setIcon(0, icon) - self._adjustItemStatus(item) - - def onFcpClientRequestCompressionStarted(self, fcpEvent, fcpRequest): - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - self._adjustItemStatus(item) - - def onFcpClientRequestCompressionCompleted(self, fcpEvent, fcpRequest): - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - self._adjustItemStatus(item) - - def onFcpClientRequestFailed(self, fcpEvent, fcpRequest): - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - self._adjustItemStatus(item) - - #TODO: not tested - def onFcpClientRequestModified(self, fcpEvent, fcpRequest): - - requestIdentifier = fcpRequest['Modified'].get(fcp2.ConstRequestModified.Identifier, None) - if requestIdentifier is None: - requestIdentifier = fcpRequest['Identifier'] - item = self.fcpRequests.get(requestIdentifier, None) - - if item is not None: - if fcp2.ConstRequestModified.Identifier in fcpRequest['Modified']: - newFcpIdentifier = fcpRequest['Identifier'] - del self.fcpRequests[requestIdentifier] - self.fcpRequests[newFcpIdentifier] = item - - if fcp2.ConstRequestModified.Filename in fcpRequest['Modified']: - item.setData( - TreeItem.IndexName, - QtCore.Qt.DisplayRole, - QtCore.QVariant(os.path.basename(fcpRequest['Filename'])) - ) - - - def onFcpClientRequestProgress(self, fcpEvent, fcpRequest): - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - self._adjustItemStatus(item) - - def onFcpClientRequestRemoved(self, fcpEvent, fcpRequest): - pass - - def onFcpClientRequestStarted(self, fcpEvent, fcpRequest): - if fcpRequest['RequestStatus'] & fcp2.ConstRequestStatus.Restored: - try: - requestData = PersistentRequestData.load(fcpRequest['PersistentUserData']) - except pmstruct.PMStructError: - pass - else: - if requestData.get('ClientName', None) == self.objectName(): - item = self.addFcpRequest(fcpRequest) - else: - item = self.fcpRequests.get(fcpRequest['Identifier'], None) - if item is not None: - self._adjustItemStatus(item) - - -#********************************************************************************** -# -#********************************************************************************** Modified: trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-16 08:10:49 UTC (rev 915) +++ trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-16 08:13:58 UTC (rev 916) @@ -16,7 +16,7 @@ from PyQt4 import QtCore, QtGui from .. import config -from ..BaseRequestsWidget import RequestsWidget +from ..BaseRequestsWidget import BaseRequestsWidget #************************************************************************************ # #************************************************************************************ @@ -98,13 +98,13 @@ ) -class ViewDownloadsWidget(RequestsWidget): +class ViewDownloadsWidget(BaseRequestsWidget.RequestsWidget): def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): self.menuRemoveGroup = None - RequestsWidget.__init__(self, parent) + BaseRequestsWidget.RequestsWidget.__init__(self, parent) self.setObjectName(config.IdViewDownloadsWidget) config.ObjectRegistry.register(self) @@ -124,18 +124,18 @@ ################################### def hideEvent(self, event): self.fcGlobalFeedback.setVisible(False) - RequestsWidget.hideEvent(self, event) + BaseRequestsWidget.RequestsWidget.hideEvent(self, event) def showEvent(self, event): self.fcGlobalFeedback.setVisible(True) - RequestsWidget.showEvent(self, event) + BaseRequestsWidget.RequestsWidget.showEvent(self, event) def populateMenu(self, menu): menu.addAction(self.fcActions['ActionDownloadKeyToDisk']) return menu def retranslateUi(self, parent): - RequestsWidget.retranslateUi(self, parent) + BaseRequestsWidget.RequestsWidget.retranslateUi(self, parent) if self.menuRemoveGroup is not None: self.menuRemoveGroup.setTitle(self.trUtf8('Remove group')) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 10:57:27
|
Revision: 930 http://fclient.svn.sourceforge.net/fclient/?rev=930&view=rev Author: jUrner Date: 2008-08-16 10:57:37 +0000 (Sat, 16 Aug 2008) Log Message: ----------- isolated view Added Paths: ----------- trunk/fclient/fclient/impl/ViewView/ trunk/fclient/fclient/impl/ViewView/Ui_ViewWidget.py trunk/fclient/fclient/impl/ViewView/View.py trunk/fclient/fclient/impl/ViewView/ViewObject.py trunk/fclient/fclient/impl/ViewView/ViewWidget.ui trunk/fclient/fclient/impl/ViewView/__init__.py trunk/fclient/fclient/impl/ViewView/_fix_mexec.py Added: trunk/fclient/fclient/impl/ViewView/Ui_ViewWidget.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/Ui_ViewWidget.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/Ui_ViewWidget.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/fclient/trunk/fclient/fclient/impl/ViewView/ViewWidget.ui' +# +# Created: Sat Aug 16 11:03:09 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_ViewWidget(object): + def setupUi(self, ViewWidget): + ViewWidget.setObjectName("ViewWidget") + ViewWidget.resize(530, 237) + self.gridLayout = QtGui.QGridLayout(ViewWidget) + self.gridLayout.setMargin(0) + self.gridLayout.setSpacing(0) + self.gridLayout.setObjectName("gridLayout") + self.splitter = QtGui.QSplitter(ViewWidget) + self.splitter.setOrientation(QtCore.Qt.Vertical) + self.splitter.setObjectName("splitter") + self.tabTop = QtGui.QTabWidget(self.splitter) + self.tabTop.setObjectName("tabTop") + self.tab = QtGui.QWidget() + self.tab.setGeometry(QtCore.QRect(0, 0, 526, 72)) + self.tab.setObjectName("tab") + self.tabTop.addTab(self.tab, "") + self.tabBottom = QtGui.QTabWidget(self.splitter) + self.tabBottom.setObjectName("tabBottom") + self.tab_3 = QtGui.QWidget() + self.tab_3.setGeometry(QtCore.QRect(0, 0, 526, 103)) + self.tab_3.setObjectName("tab_3") + self.tabBottom.addTab(self.tab_3, "") + self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) + + self.retranslateUi(ViewWidget) + self.tabTop.setCurrentIndex(0) + self.tabBottom.setCurrentIndex(0) + QtCore.QMetaObject.connectSlotsByName(ViewWidget) + + def retranslateUi(self, ViewWidget): + ViewWidget.setWindowTitle(QtGui.QApplication.translate("ViewWidget", "Form", None, QtGui.QApplication.UnicodeUTF8)) + self.tabTop.setTabText(self.tabTop.indexOf(self.tab), QtGui.QApplication.translate("ViewWidget", "Tab 1", None, QtGui.QApplication.UnicodeUTF8)) + self.tabBottom.setTabText(self.tabBottom.indexOf(self.tab_3), QtGui.QApplication.translate("ViewWidget", "Tab 1", None, QtGui.QApplication.UnicodeUTF8)) + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + ViewWidget = QtGui.QWidget() + ui = Ui_ViewWidget() + ui.setupUi(ViewWidget) + ViewWidget.show() + sys.exit(app.exec_()) + Added: trunk/fclient/fclient/impl/ViewView/View.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/View.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/View.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,320 @@ +#*************************************************************************** +#TODO: +# +# x. shortcuts for "Go to" menus and items +# x. detatch tabs +# +#*************************************************************************** +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtCore, QtGui + + +from .. import config +from ..lib import fcp2 +from .Ui_ViewWidget import Ui_ViewWidget +#********************************************************************************** +# +#********************************************************************************** +class ViewActions(config.ActionsBase): + + def __init__(self, parent): + config.ActionsBase.__init__(self, parent) + + self.action( + name='ActionShowTopTabBar', + text=self.trUtf8('Show top &tabs'), + trigger=parent.onActionShowTabsTop, + isCheckable=True, + isChecked=True, + ) + self.action( + name='ActionShowBottomTabBar', + text=self.trUtf8('Show bottom &tabs'), + trigger=parent.onActionShowTabsBottom, + isCheckable=True, + isChecked=True, + ) + +class GlobalFeedback(config.GlobalFeedbackBase): + """wrapper for global statusbar widgets, menus""" + + def __init__(self, parent, idGlobalFeedback): + config.GlobalFeedbackBase.__init__(self, parent, idGlobalFeedback) + + # menus + self.menu = None + if self.menuBar is not None and hasattr(parent, 'fcViewObject'): + self.menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + parent.populateMenu(self.menu) + self.menuBar.addViewMenu(self.menu) + + def setVisible(self, flag): + if self.menu is not None: + self.menu.children()[0].setEnabled(flag) + + +class Settings(config.SettingsBase): + _key_ = config.IdViewWidget + _settings_ = ( + ('LastViewTop', 'String', QtCore.QString('')), + ('LastViewBottom', 'String', QtCore.QString('')), + ('SplitterPos', 'ByteArray', QtCore.QByteArray()), + ('ShowTopTabBar', 'Bool', True), + ('ShowBottomTabBar', 'Bool', True), + ) + + +class ViewData(object): + """data structure to hold data for a view""" + + def __init__(self, tab, view): + self.tab = tab + self.view = view + self.actions = { + 'ActionGoTo': None, + } + +#*********************************************************************** +# +#*********************************************************************** +class ViewWidget(QtGui.QWidget, Ui_ViewWidget): + + IdSplitter = 'splitter' + IdTabTop = 'tabTop' + IdTabBottom = 'tabBottom' + + def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + QtGui.QWidget.__init__(self, parent) + + # setup ui + self.isCreated = False + self.menuGoToTopView = QtGui.QMenu(self) + self.menuGoToBottomView = QtGui.QMenu(self) + self.setupUi(self) + + # setup ... + self.fcActions = ViewActions(self) + self.fcSettings = Settings().restore() + self.fcGlobalFeedback = GlobalFeedback(self, idGlobalFeedback) + + # setup views + self.viewData = {} # viewName --> ViewData + self.actionGroupGoToTopView = QtGui.QActionGroup(self.menuGoToTopView) + self.actionGroupGoToTopView.setExclusive(True) + self.actionGroupGoToBottomView = QtGui.QActionGroup(self.menuGoToBottomView) + self.actionGroupGoToBottomView.setExclusive(True) + + # setup tab widgets + tabWidgetTop = self.controlById(self.IdTabTop) + tabWidgetTop.removeTab(0) + tabWidgetBottom = self.controlById(self.IdTabBottom) + tabWidgetBottom.removeTab(0) + + # setup splitter + splitter = self.controlById(self.IdSplitter) + splitter.restoreState(self.fcSettings.value('SplitterPos')) + self.connect(splitter, QtCore.SIGNAL('splitterMoved(int, int)'), self.onSplitterMoved) + + ################################### + ## private methods + ################################### + def _addViews(self, toTop, *views): + """private method to add one or more views ro bottom or top tabs""" + tabWidget = self.controlById(self.IdTabTop) if toTop else self.controlById(self.IdTabBottom) + for view in views: + viewName = view.name() + if not viewName: + raise ValueError('view must have a name') + if viewName in self.viewData: + raise ValueError('view with that name is already present: %s' % viewName) + view.widget().setParent(tabWidget) + index = tabWidget.addTab(view.widget(), view.icon(), view.displayName()) + self.viewData[viewName] = viewData = ViewData(tabWidget, view) + tabWidget.tabBar().setTabData(index, QtCore.QVariant(viewName)) + + # add some actions dynamically + menu = self.menuGoToTopView if toTop else self.menuGoToBottomView + actionGroup = self.actionGroupGoToTopView if toTop else self.actionGroupGoToBottomView + act = QtGui.QAction(actionGroup) + act.setObjectName(viewName) + act.setText(view.displayName()) + act.setCheckable(True) + self.connect(act, QtCore.SIGNAL('triggered()'), self.onActionGoToView) + viewData.actions['ActionGoTo'] = act + menu.addAction(act) + actionGroup.addAction(act) + #tab.tabBar().setVisible(tab.count() > 1) + + ################################### + ## overwritten methods + ################################### + def retranslateUi(self, me): + Ui_ViewWidget.retranslateUi(self, me) + self.menuGoToTopView.setTitle(self.trUtf8('Top go to')) + self.menuGoToBottomView.setTitle(self.trUtf8('Bottom go to')) + + ################################### + ## methods + ################################### + def addBottomViews(self, *views): + """adds one or more L{View}s to the bottom area of the view widget""" + return self._addViews(False, *views) + + def addTopViews(self, *views): + """adds one or more L{View}s to the top area of the view widget""" + return self._addViews(True, *views) + + def controlById(self, idControl): + return getattr(self, idControl) + + def currentView(self, top=True): + """returns the name of the current view + @param top: if True, returns the name of the current view on the top tabWidget, else the name + of current view on the bottom tabWidget + @return: (QString) name or None + """ + tabWidget = self.controlById(self.IdTabTop) if top else self.controlById(self.IdTabBottom) + index = tabWidget.currentIndex() + if index > -1: + return tabWidget.tabBar().tabData(index).toString() + return None + + def populateMenu(self, menu): + """populates a menu with actions the view widget defines""" + menu.addAction(self.fcActions['ActionShowTopTabBar']) + menu.addAction(self.fcActions['ActionShowBottomTabBar']) + menu.addSeparator() + menu.addMenu(self.menuGoToTopView) + menu.addMenu(self.menuGoToBottomView) + return menu + + def setCurrentView(self, name): + """sets the current view on the tabWidgtes given the views name + @return: Lname of the current view or None + """ + viewData = self.viewData.get(name, None) + if viewData is not None: + viewData.tab.setCurrentWidget(viewData.view.widget()) + return name + return None + + def viewDataFromName(self, name): + """returns L{ViewData} associated to a view + @param name: (QString) name of the view + @return: L{ViewData} or None + """ + viewData = self.viewData.get(name, None) + if viewData is not None: + return viewData + return None + + ######################################################### + ## overwritten events + ######################################################### + def closeEvent(self, event): + for viewData in self.viewData.values(): + viewData.view.close() + + def hideEvent(self, event): + self.fcGlobalFeedback.setVisible(False) + + def showEvent(self, event): + self.fcGlobalFeedback.setVisible(True) + if self.isCreated: + return + self.isCreated = True + + # restore last selected views (could be costy, so do it here) + tabWidgetTop = self.controlById(self.IdTabTop) + viewName = self.fcSettings.value('LastViewTop') + viewName = self.setCurrentView(viewName) + if viewName is None: + viewName = self.currentView(top=True) + if viewName is not None: + viewData = self.viewDataFromName(viewName) + viewData.actions['ActionGoTo'].setChecked(True) + + tabWidgetBottom = self.controlById(self.IdTabBottom) + viewName = self.fcSettings.value('LastViewBottom') + viewName = self.setCurrentView(viewName) + if viewName is None: + viewName = self.currentView(top=False) + if viewName is not None: + viewData = self.viewDataFromName(viewName) + viewData.actions['ActionGoTo'].setChecked(True) + + # finally connect... not to overwrite settings + self.connect(tabWidgetTop, QtCore.SIGNAL('currentChanged(int)'), self.onTabTopCurrentChanged) + self.connect(tabWidgetBottom, QtCore.SIGNAL('currentChanged(int)'), self.onTabBottomCurrentChanged) + + # adjust tabWidgets + showTopTabBar = self.fcSettings.value('ShowTopTabBar') + self.fcActions['ActionShowTopTabBar'].setChecked(showTopTabBar) + tabWidgetTop.tabBar().setVisible(showTopTabBar) + + showBottomTabBar = self.fcSettings.value('ShowBottomTabBar') + self.fcActions['ActionShowBottomTabBar'].setChecked(showBottomTabBar) + tabWidgetBottom.tabBar().setVisible(showBottomTabBar) + + + ################################## + ## event handlers + ################################## + def onActionGoToView(self): + act = self.sender() + viewData = self.viewData[act.objectName()] + viewData.tab.setCurrentWidget(viewData.view) + + def onActionShowTabsBottom(self, action): + tabWidgetTop = self.controlById(self.IdTabBottom) + tabWidgetTop.tabBar().setVisible(action.isChecked()) + self.fcSettings.setValues(ShowBottomTabBar=action.isChecked()) + + def onActionShowTabsTop(self, action): + tabWidgetTop = self.controlById(self.IdTabTop) + tabWidgetTop.tabBar().setVisible(action.isChecked()) + self.fcSettings.setValues(ShowTopTabBar=action.isChecked()) + + def onSplitterMoved(self, pos, index): + splitter = self.controlById(self.IdSplitter) + self.fcSettings.setValues(SplitterPos=splitter.saveState()) + + def onTabTopCurrentChanged(self, index): + viewName = self.currentView(top=True) + viewData = self.viewData[viewName] + viewData.actions['ActionGoTo'].setChecked(True) + self.fcSettings.setValues(LastViewTop=viewName) + + def onTabBottomCurrentChanged(self, index): + viewName = self.currentView(top=False) + viewData = self.viewData[viewName] + viewData.actions['ActionGoTo'].setChecked(True) + self.fcSettings.setValues(LastViewTop=viewName) + +#********************************************************************************** +# +#********************************************************************************** +if __name__ == '__main__': + import sys + + app = QtGui.QApplication(sys.argv) + w = ViewWidget(None) + w.show() + res = app.exec_() + sys.exit(res) + + + + Added: trunk/fclient/fclient/impl/ViewView/ViewObject.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/ViewObject.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/ViewObject.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,51 @@ +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +from PyQt4 import QtGui + +from .. import config +from .. import ViewObject + +from . import View +#************************************************************************************ +# +#************************************************************************************ +class ViewObjectView(ViewObject.ViewObject): + + def __init__(self, parentView=None): + ViewObject.ViewObject.__init__(self, parentView) + self._widget = None + + def close(self): + pass + + def create(self): + self._widget = View.ViewWidget(self.parentWidget()) + return self.widget() + + def displayName(self): + return self.trUtf8('View') + + def icon(self): + return QtGui.QIcon() + + def name(self): + return config.IdViewObjectView + + def prefsPage(self): + pass + + + def widget(self): + return self._widget + Added: trunk/fclient/fclient/impl/ViewView/ViewWidget.ui =================================================================== --- trunk/fclient/fclient/impl/ViewView/ViewWidget.ui (rev 0) +++ trunk/fclient/fclient/impl/ViewView/ViewWidget.ui 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,69 @@ +<ui version="4.0" > + <class>ViewWidget</class> + <widget class="QWidget" name="ViewWidget" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>530</width> + <height>237</height> + </rect> + </property> + <property name="windowTitle" > + <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="QSplitter" name="splitter" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + <widget class="QTabWidget" name="tabTop" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="tab" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>526</width> + <height>72</height> + </rect> + </property> + <attribute name="title" > + <string>Tab 1</string> + </attribute> + </widget> + </widget> + <widget class="QTabWidget" name="tabBottom" > + <property name="currentIndex" > + <number>0</number> + </property> + <widget class="QWidget" name="tab_3" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>526</width> + <height>103</height> + </rect> + </property> + <attribute name="title" > + <string>Tab 1</string> + </attribute> + </widget> + </widget> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections/> +</ui> Added: trunk/fclient/fclient/impl/ViewView/__init__.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/__init__.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/__init__.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1 @@ + Added: trunk/fclient/fclient/impl/ViewView/_fix_mexec.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/_fix_mexec.py (rev 0) +++ trunk/fclient/fclient/impl/ViewView/_fix_mexec.py 2008-08-16 10:57:37 UTC (rev 930) @@ -0,0 +1,99 @@ +'''in python 2.5 relative impports are srsly broken ..fix this to make relative imports work +when executing a module as main (-m), including relative imports up to the root package + +see: [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] + +@note: root package is the highest available package in the package hirarchy. +don't look at __name__ too closely. it gets adjusted for a module to just "do the right +thing" in __name__ == '__main__' comparisons +@note: this patch does not work if relative imports are done in __init__.py. no idea why +and to be honest, I don't wanna* know.. +@note: this is more or less a hack. so it may have unwanted side effects for example +when importing parent packages. use at your own risk. could improve this module +by adding a __main__.py to stop at this level or by fixing the __init__.py bug, but +I don't think its worth it. see what python2.6 or 3k brings.. + +usage:: + + # place this at the top a module, before doing any relative imports + from fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + from ...foo import bar + + + +##<-- copy and paste code, assuming _fix_mexec resides in the current dir.. + +# some fixes for relative imports +# see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) +# see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a +# ...package containing relative imports +from __future__ import absolute_import +if __name__ == '__main__': + import os + __path__ = [os.path.dirname(__file__)] + from ._fix_mexec import fix_mexec + fix_mexec(__name__, __file__) + del fix_mexec + + +##--> copy and paste code +''' + +import imp, os, sys +#******************************************************************************** +# +#******************************************************************************** +class MainName(str): + def __eq__(self, other): + if other == '__main__': return True + return str.__eq__(self, other) + def __ne__(self, other): + if other == '__main__': return False + return str.__ne__(self, other) + + +def fix_mexec(_name_, _file_): + """bugfix for relative imports not working + @param _name_: __name__ of the module + @param _file_: __file__ of the module + + @note: not complete: relies on __init__.py, .pyo (...) is ignored currently + """ + if _name_ == '__main__': + out = [] + # find allparent packages + p = os.path.dirname(os.path.abspath(_file_)) + prev = p + while True: + pkg = os.path.join(p, '__init__.py') + if os.path.isfile(pkg): + out.append([pkg, os.path.basename(p)]) + else: + break + prev = p + p = os.path.dirname(p) + if p == prev: + break + out.reverse() + + # adjust sub package names an import parent modules + name = None + for n, (fpath, name) in enumerate(out): + if n > 0: + name = out[n][1] = out[n -1][1] + '.' + out[n][1] + m = imp.load_source(name, fpath) + m.__path__ = [os.path.dirname(fpath)] + + # adjust name of the __main__ module + if name is not None: + m = sys.modules.pop('__main__') + # 'foo.bar..__main__' does not work for some reason. 'foo.bar' seems to work as expected + ##m.__name__ = _Name_(name + '.' + '__main__') + m.__name__ = MainName(name) + sys.modules[m.__name__] = m + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-16 19:16:32
|
Revision: 931 http://fclient.svn.sourceforge.net/fclient/?rev=931&view=rev Author: jUrner Date: 2008-08-16 19:16:39 +0000 (Sat, 16 Aug 2008) Log Message: ----------- fixes related to the latest restructuring of the package Modified Paths: -------------- trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py trunk/fclient/fclient/impl/MainWindow/Settings.py trunk/fclient/fclient/impl/ViewBrowser/GlobalFeedback.py trunk/fclient/fclient/impl/ViewBrowser/Settings.py trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py trunk/fclient/fclient/impl/ViewBrowser/prefs/PrefsBrowserWidget.py trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py trunk/fclient/fclient/impl/ViewView/View.py trunk/fclient/fclient/impl/config.py Modified: trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py =================================================================== --- trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py 2008-08-16 19:16:39 UTC (rev 931) @@ -184,7 +184,7 @@ IdTree = 'tree' - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) self._isCreated = False self.fcHeaderLabels = {} # fcpIdentifier --> treeItem Modified: trunk/fclient/fclient/impl/MainWindow/Settings.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow/Settings.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/MainWindow/Settings.py 2008-08-16 19:16:39 UTC (rev 931) @@ -18,7 +18,7 @@ #********************************************************************************** class Settings(config.SettingsBase): - _key_ = config.IdMainWindow + _key_ = config.IdViewObjectMainWindow _settings_ = ( ('Geometry', 'ByteArray', QtCore.QByteArray()), ('ConnectionLabelFlashRate', 'UInt', 800), Modified: trunk/fclient/fclient/impl/ViewBrowser/GlobalFeedback.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/GlobalFeedback.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/GlobalFeedback.py 2008-08-16 19:16:39 UTC (rev 931) @@ -27,8 +27,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectBrowser, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -55,4 +56,4 @@ def setFeedback(self, qString): if self.labelFeedbackWrap is not None: - self.labelFeedbackWrap.setPath(unicode(qString)) \ No newline at end of file + self.labelFeedbackWrap.setPath(unicode(qString)) Modified: trunk/fclient/fclient/impl/ViewBrowser/Settings.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/Settings.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/Settings.py 2008-08-16 19:16:39 UTC (rev 931) @@ -17,7 +17,7 @@ # #********************************************************************************** class Settings(config.SettingsBase): - _key_ = config.IdViewBrowserWidget + _key_ = config.IdViewObjectBrowser _settings_ = ( ('OpenLinksInNewTab', 'Bool', False), ('OpenAddressBarInNewTab', 'Bool', False), Modified: trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/SideBars/SideBarLoadDetails.py 2008-08-16 19:16:39 UTC (rev 931) @@ -29,7 +29,7 @@ # #********************************************************************************** class SideBarLoadDetailsSettings(config.SettingsBase): - _key_ = config.IdSideBarLoadDetails + _key_ = 'SideBarLoadDetails' _settings_ = ( ('ColorFgItem', 'QColor', QtGui.QColor('black')), ('ColorBgItem', 'QColor', QtGui.QColor('white')), Modified: trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/ViewBrowser.py 2008-08-16 19:16:39 UTC (rev 931) @@ -105,7 +105,7 @@ ForcedMinBrowserTabText = 5 # forced minimum number of chars on browser tabBar - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) self.menuSideBars = QtGui.QMenu(self.trUtf8('Side bars')) #TODO: retranslate @@ -722,7 +722,7 @@ menu.addAction(self.fcActions['ActionCloseAllTabs']) act = menu.exec_(pt) if act == self.fcActions['ActionCloseBrowserUnderMouse']: - tabWidget.removeTab(i) + tabWidget.removeTab(index) self._adjustCurrentBrowserDependendStuff() def onTabCurrentChanged(self, i): Modified: trunk/fclient/fclient/impl/ViewBrowser/prefs/PrefsBrowserWidget.py =================================================================== --- trunk/fclient/fclient/impl/ViewBrowser/prefs/PrefsBrowserWidget.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewBrowser/prefs/PrefsBrowserWidget.py 2008-08-16 19:16:39 UTC (rev 931) @@ -37,10 +37,11 @@ self.setupUi(self) - browserWidget = config.ObjectRegistry.get(config.IdViewBrowserWidget, None) - if browserWidget is None: + browserView = config.ObjectRegistry.get(config.IdViewObjectBrowser, None) + if browserView is None: self.setEnabled(False) else: + browserWidget = browserView.widget() self.fcSettingsControler = settings.SettingsControler(browserWidget.fcSettings, parent=self) if page is not None: page.connect(self.fcSettingsControler, QtCore.SIGNAL('isDirty(bool)'), page.setDirty) Modified: trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-16 19:16:39 UTC (rev 931) @@ -36,8 +36,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectConnection, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -55,7 +56,7 @@ class Settings(config.SettingsBase): - _key_ = config.IdViewConnectionWidget + _key_ = config.IdViewObjectConnection _settings_ = ( ('FcpAutoConnect', 'Bool', True), ('FcpConnectionName', 'String', config.FcConnectionName), @@ -155,7 +156,7 @@ IdFproxySpinConnectionPort = 'spinFproxyConnectionPort' - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) self.setupUi(self) Modified: trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewConnection/prefs/PrefsConnectionWidget.py 2008-08-16 19:16:39 UTC (rev 931) @@ -46,10 +46,11 @@ self.fcSettingsControler = None # - connectionWidget = config.ObjectRegistry.get(config.IdViewConnectionWidget, None) - if connectionWidget is None: + connectionView = config.ObjectRegistry.get(config.IdViewObjectConnection, None) + if connectionView is None: self.setEnabled(False) else: + connectionWidget = connectionView.widget() self.fcSettingsControler = settings.SettingsControler(connectionWidget.fcSettings, parent=self) if page is not None: page.connect(self.fcSettingsControler, QtCore.SIGNAL('isDirty(bool)'), page.setDirty) Modified: trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-16 19:16:39 UTC (rev 931) @@ -28,8 +28,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectDownloads, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -81,7 +82,7 @@ class DownloadsWidgetSettings(config.SettingsBase): - _key_ = config.IdViewDownloadsWidget + _key_ = config.IdViewObjectDownloads _settings_ = ( ('MaxSimultaneousDownloads', 'UInt', 3), ) @@ -89,13 +90,11 @@ class ViewDownloadsWidget(BaseRequestsWidget.RequestsWidget): - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): self.menuRemoveGroup = None BaseRequestsWidget.RequestsWidget.__init__(self, parent) - - self.setObjectName(config.IdViewDownloadsWidget) self.fcSettings = DownloadsWidgetSettings(self).restore() self.fcGlobalFeedback = DownloadsWidgetGlobalFeedback(self, idGlobalFeedback) Modified: trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py =================================================================== --- trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewLogger/ViewLogger.py 2008-08-16 19:16:39 UTC (rev 931) @@ -84,8 +84,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectLogger, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -106,7 +107,7 @@ PrefixVerbosityColorFg = 'ColorFgVerbosity' - _key_ = config.IdViewLoggerWidget + _key_ = config.IdViewObjectLogger _settings_ = ( ('MaxLines', 'UInt', 1000), ('Verbosity', 'PyString', 'Info'), @@ -141,7 +142,7 @@ IdEdLogger = 'edLogger' - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) self._isCreated = False self._mainWindowMenus = {} #TODO: wrap along with toolbars to a handy class MainWindowStuff Modified: trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py =================================================================== --- trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-16 19:16:39 UTC (rev 931) @@ -29,8 +29,9 @@ # menus self.menus = [] - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectUploads, None) + menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(menu) self.menus.append(menu) self.menuBar.addViewMenu(menu) @@ -82,20 +83,18 @@ class UploadsWidgetSettings(config.SettingsBase): - _key_ = config.IdViewUploadsWidget + _key_ = config.IdViewObjectUploads _settings_ = ( ) class ViewUploadsWidget(BaseRequestsWidget.RequestsWidget): - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): self.menuRemoveGroup = None BaseRequestsWidget.RequestsWidget.__init__(self, parent) - - self.setObjectName(config.IdViewUploadsWidget) self.fcSettings = UploadsWidgetSettings(self).restore() self.fcGlobalFeedback = UploadsWidgetGlobalFeedback(self, idGlobalFeedback) Modified: trunk/fclient/fclient/impl/ViewView/View.py =================================================================== --- trunk/fclient/fclient/impl/ViewView/View.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/ViewView/View.py 2008-08-16 19:16:39 UTC (rev 931) @@ -55,8 +55,9 @@ # menus self.menu = None - if self.menuBar is not None and hasattr(parent, 'fcViewObject'): - self.menu = QtGui.QMenu(parent.fcViewObject.displayName, self.menuBar) + if self.menuBar is not None: + viewObject = config.ObjectRegistry.get(config.IdViewObjectView, None) + self.menu = QtGui.QMenu(viewObject.displayName(), self.menuBar) parent.populateMenu(self.menu) self.menuBar.addViewMenu(self.menu) @@ -66,7 +67,7 @@ class Settings(config.SettingsBase): - _key_ = config.IdViewWidget + _key_ = config.IdViewObjectView _settings_ = ( ('LastViewTop', 'String', QtCore.QString('')), ('LastViewBottom', 'String', QtCore.QString('')), @@ -95,7 +96,7 @@ IdTabTop = 'tabTop' IdTabBottom = 'tabBottom' - def __init__(self, parent, idGlobalFeedback=config.IdMainWindow): + def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) # setup ui Modified: trunk/fclient/fclient/impl/config.py =================================================================== --- trunk/fclient/fclient/impl/config.py 2008-08-16 10:57:37 UTC (rev 930) +++ trunk/fclient/fclient/impl/config.py 2008-08-16 19:16:39 UTC (rev 931) @@ -34,23 +34,8 @@ FcDefaultStyleSheet = os.path.join(unicode(FcResDir), 'stylesheets', 'default.css') del _implDir, _fclientDir #********************************************************************************** -# looks like QObject.findChild() does not always work. docs mention troubles -# with MSVC 6 where you should use qFindChild(). can not test this. so keep -# a dict for lookups... +# view ids guaranteed always being present #********************************************************************************** -IdMainWindow = 'MainWindow' -IdViewWidget = 'ViewWidget' -IdViewBrowserWidget = 'ViewBrowserWidget' -IdViewConnectionWidget = 'ViewConnectionWidget' -IdViewDownloadsWidget = 'ViewDownloadsWidget' -IdViewLoggerWidget = 'ViewDownloadsWidget' -IdViewLoggerWidget = 'ViewLoggerWidget' -IdViewUploadsWidget = 'ViewUploadsWidget' -IdDlgPrefs = 'DlgPrefs' - -IdSideBarLoadDetails = 'SideBarLoadDetails' - -##### IdViewObjectBrowser = QtCore.QString('ViewObjectBrowser') IdViewObjectConnection = QtCore.QString('ViewObjectConnection') IdViewObjectDownloads = QtCore.QString('ViewObjectDownloads') @@ -59,7 +44,9 @@ IdViewObjectUploads = QtCore.QString('ViewObjectUploads') IdViewObjectView = QtCore.QString('ViewObjectView') +IdDlgPrefs = 'DlgPrefs' #TODO: turn into view object? + class ObjectRegistry(weakref.WeakValueDictionary): """global object registry @@ -144,20 +131,21 @@ def __init__(self, parent, idGlobalFeedback): - self.id = idGlobalFeedback + self.idGlobalFeedback = idGlobalFeedback self.menuBar = None self.statusBar = None self.titleBar = None - feedbackParent = ObjectRegistry.get(idGlobalFeedback, None) - if feedbackParent is not None: - mthd = getattr(feedbackParent, 'menuBar', None) + feedbackView = ObjectRegistry.get(idGlobalFeedback, None) + if feedbackView is not None: + feedbackWidget = feedbackView.widget() + mthd = getattr(feedbackWidget, 'menuBar', None) if mthd is not None: self.menuBar = mthd() - mthd = getattr(feedbackParent, 'statusBar', None) + mthd = getattr(feedbackWidget, 'statusBar', None) if mthd is not None: self.statusBar = mthd() - mthd = getattr(feedbackParent, 'titleBar', None) + mthd = getattr(feedbackWidget, 'titleBar', None) if mthd is not None: self.titleBar = mthd() This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-19 07:38:28
|
Revision: 943 http://fclient.svn.sourceforge.net/fclient/?rev=943&view=rev Author: jUrner Date: 2008-08-19 07:38:38 +0000 (Tue, 19 Aug 2008) Log Message: ----------- persistent dls where not resored. fixed Modified Paths: -------------- trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py Modified: trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py =================================================================== --- trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py 2008-08-19 07:37:55 UTC (rev 942) +++ trunk/fclient/fclient/impl/BaseRequestsWidget/BaseRequestsWidget.py 2008-08-19 07:38:38 UTC (rev 943) @@ -181,7 +181,16 @@ # #********************************************************************************** class RequestsWidget(QtGui.QWidget, Ui_ViewRequestsWidget): + """base class for upload/download widgets + @note: make shure objectName() of each derrived subclass is unique. it is used to associate persistent + requests to the individual widget + + + + """ + + IdTree = 'tree' def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): @@ -548,6 +557,7 @@ except pmstruct.PMStructError: pass else: + print requestData.get('ClientName', None), self.objectName() if requestData.get('ClientName', None) == self.objectName(): item = self.addFcpRequest(fcpRequest) else: Modified: trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py =================================================================== --- trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-19 07:37:55 UTC (rev 942) +++ trunk/fclient/fclient/impl/ViewDownloads/ViewDownloads.py 2008-08-19 07:38:38 UTC (rev 943) @@ -95,6 +95,7 @@ self.menuRemoveGroup = None BaseRequestsWidget.RequestsWidget.__init__(self, parent) + self.setObjectName('ViewDownloadsWidget') self.fcSettings = DownloadsWidgetSettings(self).restore() self.fcGlobalFeedback = DownloadsWidgetGlobalFeedback(self, idGlobalFeedback) Modified: trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py =================================================================== --- trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-19 07:37:55 UTC (rev 942) +++ trunk/fclient/fclient/impl/ViewUploads/ViewUploads.py 2008-08-19 07:38:38 UTC (rev 943) @@ -95,6 +95,7 @@ self.menuRemoveGroup = None BaseRequestsWidget.RequestsWidget.__init__(self, parent) + self.setObjectName('ViewUploadsWidget') self.fcSettings = UploadsWidgetSettings(self).restore() self.fcGlobalFeedback = UploadsWidgetGlobalFeedback(self, idGlobalFeedback) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2008-08-22 13:03:21
|
Revision: 960 http://fclient.svn.sourceforge.net/fclient/?rev=960&view=rev Author: jUrner Date: 2008-08-22 13:03:28 +0000 (Fri, 22 Aug 2008) Log Message: ----------- add a context menu to connection label on statusbar to easily connect/disconnect to the node Modified Paths: -------------- trunk/fclient/fclient/impl/MainWindow/StatusBar.py trunk/fclient/fclient/impl/ViewConnection/Actions.py trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py Modified: trunk/fclient/fclient/impl/MainWindow/StatusBar.py =================================================================== --- trunk/fclient/fclient/impl/MainWindow/StatusBar.py 2008-08-22 13:01:31 UTC (rev 959) +++ trunk/fclient/fclient/impl/MainWindow/StatusBar.py 2008-08-22 13:03:28 UTC (rev 960) @@ -1,4 +1,9 @@ - +#*************************************************************************************************** +#TODO +# +# x. maybe move connection labels to ViewConnection +# +#*************************************************************************************************** # some fixes for relative imports # see --> [http://bugs.python.org/issue1510172] absolute/rellative import not working (works only current dir and below) # see --> [http://mail.python.org/pipermail/python-ideas/2007-February/000232.html] PEP for executing a module in a @@ -63,6 +68,9 @@ for objectName, label in self.connectionLabels.items(): label.setObjectName(objectName) label.setVisible(False) + label.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) + self.connect(label, QtCore.SIGNAL('customContextMenuRequested( const QPoint &)'), self.onConnectionLabelConextMenuRequested) + self.addWidget(label, 0) if config.fcpClient.isConnected(): self.connectionLabels['LabelConnectionConnected'].show() @@ -77,6 +85,18 @@ self.connectionLabels['LabelConnectionDisonnectedOn'].setText(self.trUtf8('DISCONNECTED')) self.connectionLabels['LabelConnectionDisonnectedOff'].setText(self.trUtf8('DISCONNECTED')) + + def onConnectionLabelConextMenuRequested(self, pt): + label = self.sender() + pt = label.mapToGlobal(pt) + voConnection = config.ObjectRegistry.get(config.IdViewObjectConnection, None) + if voConnection is not None: + actions = voConnection.widget().fcActions + menu = QtGui.QMenu(self) + menu.addAction(actions['ActionConnect']) + menu.addAction(actions['ActionDisconnect']) + menu.exec_(pt) + def onFcpClientConnected(self, event, msg): self._disconnectTimer.stop() for label in self.connectionLabels.values(): @@ -88,3 +108,5 @@ label.hide() self.connectionLabels['LabelConnectionDisonnectedOn'].show() self._disconnectTimer.start(self.parent().fcSettings.value('ConnectionLabelFlashRate')) + + Modified: trunk/fclient/fclient/impl/ViewConnection/Actions.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/Actions.py 2008-08-22 13:01:31 UTC (rev 959) +++ trunk/fclient/fclient/impl/ViewConnection/Actions.py 2008-08-22 13:03:28 UTC (rev 960) @@ -17,4 +17,35 @@ # #********************************************************************************** class Actions(config.ActionsBase): - pass + + def __init__(self, parent): + config.ActionsBase.__init__(self, parent) + + group = self.group( + name='GroupConnection', + isExclusive=True, + trigger=parent.onGroupConnection, + ) + self.action( + name='ActionConnect', + group=group, + isEnabled=True, + isCheckable=True, + isChecked=False, + ) + self.action( + name='ActionDisconnect', + group=group, + isEnabled=True, + isCheckable=True, + isChecked=True, + ) + + + def retranslateUi(self, parent): + self['ActionConnect'].setText(self.trUtf8('Connect')) + self['ActionDisconnect'].setText(self.trUtf8('Disconnect')) + + + + Modified: trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py =================================================================== --- trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-22 13:01:31 UTC (rev 959) +++ trunk/fclient/fclient/impl/ViewConnection/ViewConnection.py 2008-08-22 13:03:28 UTC (rev 960) @@ -86,6 +86,7 @@ def __init__(self, parent, idGlobalFeedback=config.IdViewObjectMainWindow): QtGui.QWidget.__init__(self, parent) + self.fcActions = Actions.Actions(self) self.setupUi(self) # adjust spin box ranges @@ -96,7 +97,6 @@ self._isCreated = False self.fcSettings = Settings.Settings(self).restore() - self.fcActions = Actions.Actions(self) self.fcGlobalFeedback = GlobalFeedback.GlobalFeedback(self,idGlobalFeedback) self._connectionTimer = ConnectionTimer(self) @@ -175,10 +175,11 @@ Ui_ViewConnectionWidget.retranslateUi(self, w) bt = self.controlById(self.IdBtConnect) bt.setText(self.trUtf8('Disconnect') if self.connected() else self.trUtf8('Connect')) + self.fcActions.retranslateUi(self) ######################################### - ## event onrs + ## event handlers ######################################### def onBtConnectClicked(self, isChecked): bt = self.controlById(self.IdBtConnect) @@ -192,8 +193,10 @@ if config.fcpClient.isConnected(): self._pollTimer.stop() config.fcpClient.close() - + def onGroupConnection(self, action): + self.setConnected(action == self.fcActions['ActionConnect']) + def onCkFcpAutoConnectStateChanged(self, state): self.fcSettings.setValues(FcpAutoConnect=state == QtCore.Qt.Checked) @@ -216,9 +219,12 @@ bt = self.controlById(self.IdBtConnect) if bt.isChecked(): bt.click() + self.fcActions['ActionDisconnect'].setChecked(True) + def onFcpClientConected(self, event, msg): self._pollTimer.start(self.fcSettings) + self.fcActions['ActionConnect'].setChecked(True) #********************************************************************************** # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |