SF.net SVN: fclient:[931] trunk/fclient/fclient/impl
Status: Pre-Alpha
Brought to you by:
jurner
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. |