Thread: SF.net SVN: fclient:[664] trunk/fclient/src/fclient/config.py
Status: Pre-Alpha
Brought to you by:
jurner
|
From: <jU...@us...> - 2008-07-18 02:53:10
|
Revision: 664
http://fclient.svn.sourceforge.net/fclient/?rev=664&view=rev
Author: jUrner
Date: 2008-07-18 02:53:20 +0000 (Fri, 18 Jul 2008)
Log Message:
-----------
config seems to be a good place for ViewObject()
Modified Paths:
--------------
trunk/fclient/src/fclient/config.py
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-17 16:07:27 UTC (rev 663)
+++ trunk/fclient/src/fclient/config.py 2008-07-18 02:53:20 UTC (rev 664)
@@ -127,5 +127,13 @@
pass
+class ViewObject(QtCore.QObject):
+ """base class for view objects"""
+ def __init__(self, parent):
+ QtCore.QObject.__init__(self, parent)
+
+ self.name = '' #unique name of the view
+ self.displayName = '' # name as shown t the user
+ self.icon = None # QIcon associated to the view
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-19 06:36:21
|
Revision: 671
http://fclient.svn.sourceforge.net/fclient/?rev=671&view=rev
Author: jUrner
Date: 2008-07-19 06:36:29 +0000 (Sat, 19 Jul 2008)
Log Message:
-----------
naming
Modified Paths:
--------------
trunk/fclient/src/fclient/config.py
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-19 06:36:05 UTC (rev 670)
+++ trunk/fclient/src/fclient/config.py 2008-07-19 06:36:29 UTC (rev 671)
@@ -109,12 +109,13 @@
class GlobalFeedbackBase(object):
"""application wide base class for feedback (statusbar widgets, menus)"""
- def __init__(self, parent, idFeedbackParent):
+ def __init__(self, parent, idGlobalFeedback):
+ self.id = idGlobalFeedback
self.menuBar = None
self.statusBar = None
- feedbackParent = ObjectRegistry.get(idFeedbackParent, None)
+ feedbackParent = ObjectRegistry.get(idGlobalFeedback, None)
if feedbackParent is not None:
mthd = getattr(feedbackParent, 'menuBar', None)
if mthd is not None:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-19 08:59:28
|
Revision: 678
http://fclient.svn.sourceforge.net/fclient/?rev=678&view=rev
Author: jUrner
Date: 2008-07-19 08:59:28 +0000 (Sat, 19 Jul 2008)
Log Message:
-----------
added icon theme support
Modified Paths:
--------------
trunk/fclient/src/fclient/config.py
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-19 07:49:30 UTC (rev 677)
+++ trunk/fclient/src/fclient/config.py 2008-07-19 08:59:28 UTC (rev 678)
@@ -10,7 +10,7 @@
from PyQt4 import QtCore
from .lib import fcp2
-from .lib.qt4ex.lib import actions, settings
+from .lib.qt4ex.lib import actions, settings, resources
#**********************************************************************************
#
#**********************************************************************************
@@ -22,7 +22,10 @@
FclientCopyright = '(c) 2008 Juergen Urner'
FclientHomepage = 'http://fclient.sourceforge.net/'
-SettingsDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'settings')
+FclientDir = os.path.dirname(os.path.abspath(__file__))
+FclientDocDir = os.path.join(FclientDir, 'doc')
+FclientResDir = os.path.join(FclientDir, 'res')
+FclientSettingsDir = os.path.join(FclientDir, 'settings')
#**********************************************************************************
# 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
@@ -88,8 +91,9 @@
class Settings(SettingsBase):
_key_ = 'ConfigSettings'
_settings_ = (
- ('SettingsDir', 'String', QtCore.QString(SettingsDir), SettingScopeUser), # if not None, settings are stored locally in the app folder
- ('SettingsAllUsers', 'Bool', False, SettingScopeUser), # store settings for all users?
+ ('SettingsDir', 'String', QtCore.QString(FclientSettingsDir), SettingScopeUser), # if not None, settings are stored locally in the app folder
+ ('SettingsAllUsers', 'Bool', False, SettingScopeUser), # store settings for all users?
+ ('IconTheme', 'String', 'crystal', SettingScopeUser),
)
SettingsBase._config_settings_ = Settings()
@@ -98,6 +102,7 @@
#**********************************************************************************
fcpClient = fcp2.Client() # global fcp client
settings = Settings(None) # global settings class
+resources = resources.Resources([FclientResDir, ], )
#**********************************************************************************
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-25 07:10:12
|
Revision: 726
http://fclient.svn.sourceforge.net/fclient/?rev=726&view=rev
Author: jUrner
Date: 2008-07-25 07:10:20 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
many changes
Modified Paths:
--------------
trunk/fclient/src/fclient/config.py
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-25 07:09:37 UTC (rev 725)
+++ trunk/fclient/src/fclient/config.py 2008-07-25 07:10:20 UTC (rev 726)
@@ -4,9 +4,8 @@
if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below
import os; __path__ = [os.path.dirname(__file__)]
-import atexit
import os
-import weakref
+import weakref
from PyQt4 import QtCore
from .lib import fcp2
@@ -22,11 +21,14 @@
FclientCopyright = '(c) 2008 Juergen Urner'
FclientHomepage = 'http://fclient.sourceforge.net/'
-FclientDir = os.path.dirname(os.path.abspath(__file__))
-FclientDocDir = os.path.join(FclientDir, 'doc')
-FclientDownloadsDir = os.path.join(FclientDir, 'downloads')
-FclientResDir = os.path.join(FclientDir, 'res')
-FclientSettingsDir = os.path.join(FclientDir, 'settings')
+_ = os.path.dirname(os.path.abspath(__file__))
+FclientDir = QtCore.QString(_)
+FclientDocDir = QtCore.QString(os.path.join(_, 'doc'))
+FclientDownloadDir = QtCore.QString(os.path.join(_, 'downloads'))
+FclientResDir = QtCore.QString(os.path.join(_, 'res'))
+FclientSettingsDir = QtCore.QString(os.path.join(_, 'settings'))
+del _
+
#**********************************************************************************
# 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
@@ -100,16 +102,23 @@
('SettingsDir', 'String', QtCore.QString(FclientSettingsDir), SettingScopeUser), # if not None, settings are stored locally in the app folder
('SettingsAllUsers', 'Bool', False, SettingScopeUser), # store settings for all users?
('IconTheme', 'String', 'crystal', SettingScopeUser),
- ('DownloadsDir', 'String', FclientDownloadsDir, SettingScopeUser),
+ ('DownloadDir', 'String', FclientDownloadDir, SettingScopeUser),
+
+ ('FcpAutoConnect', 'Bool', True, SettingScopeUser),
+ ('FcpConnectionName', 'String', '', SettingScopeUser), #TODO: not implemented
+ ('FcpConnectionHost', 'String', fcp2.Client.DefaultFcpHost, SettingScopeUser),
+ ('FcpConnectionPort', 'UInt', fcp2.Client.DefaultFcpPort, SettingScopeUser),
+ ('FproxyConnectionHost', 'String','127.0.0.1', SettingScopeUser),
+ ('FproxyConnectionPort', 'UInt', 8888, SettingScopeUser),
)
SettingsBase._config_settings_ = Settings()
#**********************************************************************************
#
#**********************************************************************************
-fcpClient = fcp2.Client() # global fcp client
-settings = Settings(None) # global settings class
-resources = resources.Resources([FclientResDir, ], )
+fcpClient = fcp2.Client() # global fcp client
+settings = Settings(None).restore() # global settings class
+resources = resources.Resources([FclientResDir, ], ) # access to global resources
#**********************************************************************************
#
@@ -149,4 +158,42 @@
self.name = '' #unique name of the view
self.displayName = '' # name as shown t the user
self.icon = None # QIcon associated to the view
-
\ No newline at end of file
+
+
+#********************************************************************************
+#
+#********************************************************************************
+#TODO: maybe find a better place
+def qStringToFcpKey(qString):
+ """converts a qString to a fcp key
+ @return: fcp key or None if the key could not be converted
+ """
+ string = unicode(qString)
+ try:
+ key = fcp2.Key(string)
+ except fcp2.ErrorKey:
+ pass
+ else:
+ return key
+ return None
+
+
+def guessFileNameFromKey(fcpKey, default=None):
+ """guesses the filename from a key
+ @param fcpKey: fcp key to guess the filename for
+ @paran default: what to return when no filename could be guessed?
+ @return: (QString) filename or or default if no filename was found
+ """
+ key = fcpKey.toString().rstrip('/')
+ filename = ''
+ if fcpKey.KeyType == fcp2.ConstKeyType.KSK:
+ if fcpKey.docName is not None:
+ filename = os.path.basename(fcpKey.docName)
+ else:
+ filename = os.path.basename(key)
+ if filename == key:
+ filename = ''
+ if filename:
+ return QtCore.QString(filename)
+ return default
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-27 11:09:53
|
Revision: 756
http://fclient.svn.sourceforge.net/fclient/?rev=756&view=rev
Author: jUrner
Date: 2008-07-27 11:10:03 +0000 (Sun, 27 Jul 2008)
Log Message:
-----------
add connection name
Modified Paths:
--------------
trunk/fclient/src/fclient/config.py
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-27 11:09:32 UTC (rev 755)
+++ trunk/fclient/src/fclient/config.py 2008-07-27 11:10:03 UTC (rev 756)
@@ -20,6 +20,7 @@
FclientLicence = 'MIT'
FclientCopyright = '(c) 2008 Juergen Urner'
FclientHomepage = 'http://fclient.sourceforge.net/'
+FclientConnectionName = QtCore.QString(FclientAppName + ':{08625b10-2b44-4689-b1bf-8baf208b9641}')
_ = os.path.dirname(os.path.abspath(__file__))
FclientDir = QtCore.QString(_)
@@ -105,7 +106,7 @@
('DownloadDir', 'String', FclientDownloadDir, SettingScopeUser),
('FcpAutoConnect', 'Bool', True, SettingScopeUser),
- ('FcpConnectionName', 'String', '', SettingScopeUser), #TODO: not implemented
+ ('FcpConnectionName', 'String', FclientConnectionName, SettingScopeExpert), #TODO: not implemented
('FcpConnectionHost', 'String', fcp2.Client.DefaultFcpHost, SettingScopeUser),
('FcpConnectionPort', 'UInt', fcp2.Client.DefaultFcpPort, SettingScopeUser),
('FproxyConnectionHost', 'String','127.0.0.1', SettingScopeUser),
@@ -213,4 +214,5 @@
r = clss.KeyPattern.match(key)
if r is None:
return key, ''
- return r.group(1), r.group(2)
\ No newline at end of file
+ return r.group(1), r.group(2)
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|