fclient-commit Mailing List for fclient (Page 14)
Status: Pre-Alpha
Brought to you by:
jurner
You can subscribe to this list here.
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(23) |
Nov
(54) |
Dec
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
(17) |
Feb
(209) |
Mar
(63) |
Apr
(31) |
May
(7) |
Jun
(39) |
Jul
(390) |
Aug
(122) |
Sep
(6) |
Oct
|
Nov
|
Dec
|
|
From: <jU...@us...> - 2008-07-15 23:51:43
|
Revision: 637
http://fclient.svn.sourceforge.net/fclient/?rev=637&view=rev
Author: jUrner
Date: 2008-07-15 16:51:52 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
no need to set verbosity anymore
Modified Paths:
--------------
trunk/fclient/src/fclient/config.py
Modified: trunk/fclient/src/fclient/config.py
===================================================================
--- trunk/fclient/src/fclient/config.py 2008-07-15 23:51:04 UTC (rev 636)
+++ trunk/fclient/src/fclient/config.py 2008-07-15 23:51:52 UTC (rev 637)
@@ -98,7 +98,7 @@
#**********************************************************************************
#
#**********************************************************************************
-fcpClient = fcp2.Client(debugVerbosity=fcp2.ConstDebugVerbosity.Debug) # global fcp client
+fcpClient = fcp2.Client() # global fcp client
settings = Settings(None) # global settings class
#**********************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 23:51:02
|
Revision: 636
http://fclient.svn.sourceforge.net/fclient/?rev=636&view=rev
Author: jUrner
Date: 2008-07-15 16:51:04 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
some smaller fixes
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/client.py
Modified: trunk/fclient/src/fclient/lib/fcp2/client.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-15 23:49:14 UTC (rev 635)
+++ trunk/fclient/src/fclient/lib/fcp2/client.py 2008-07-15 23:51:04 UTC (rev 636)
@@ -210,7 +210,6 @@
import atexit
import copy
-import logging
import random
import subprocess
import time
@@ -284,7 +283,8 @@
for event in self.events:
event += self._captureEvent
- self.setDebugVerbosity(consts.ConstDebugVerbosity.Warning if debugVerbosity is None else debugVerbosity)
+ if not debugVerbosity is None:
+ self.setDebugVerbosity(debugVerbosity)
atexit.register(self.close)
###############################################################
@@ -299,7 +299,7 @@
consts.ConstLogger.Event.debug(consts.ConstLogMessages.EventTriggered + event.name)
- def _close(self, msg):
+ def _close(self, msg=None):
"""Closes the client
@param msg: message to pass to the ClientDisconnected event or None to not inform listeners
@@ -413,7 +413,9 @@
"""Closes the client
@note: make shure to call close() when done with the client
"""
- msg = message.MsgClientDisconnected(
+ msg = None
+ if self.isConnected():
+ msg = message.MsgClientDisconnected(
DisconnectReason=consts.ConstDisconnectReason.Close,
)
self._close(msg)
@@ -538,8 +540,13 @@
@param debugVerbosity: L{consts.ConstDebugVerbosity}
"""
consts.ConstLogger.Client.setLevel(debugVerbosity)
-
+
+ def getNodeHelloMessage(self):
+ """returns the node hello message the client received or None if no message has arrived yet """
+ return self._nodeHelloMessage
+
+
def newIdentifier(self, identifiers=None):
"""Creates a new identifier to be used as request identifer or whatever
@param identifiers: if desired any iterable containing identifiers to enshure the identifier is unique within the iterable
@@ -852,7 +859,7 @@
return True
# check if it is one of our requests for key information
- if code == consts.ConstFetchError.TooBig and initialRequest['RequestType'] == consts.ConstRequestType.GetKeyInfo:
+ if code == consts.ConstFetchError.TooBig and initialRequest['RequestType'] & consts.ConstRequestType.GetKeyInfo:
initialRequest['MetadataContentType'] = msg.get('ExpectedMetadata.ContentType', '')
initialRequest['DataLength'] = msg.get('ExpectedDataLength', -1)
initialRequest['RequestStatus'] |= consts.ConstRequestStatus.Success
@@ -877,7 +884,6 @@
)
return True
- requestType = msg['RequestType']
if msg == message.MsgPersistentGet:
initialRequest = message.MsgClientGet()
elif msg == message.MsgPersistentPut:
@@ -1084,7 +1090,7 @@
insertURI = msg['InsertURI']
requestURI = msg['RequestURI']
- if initialRequest['RequestType'] == consts.ConstRequestType.GenerateUSKKeypair:
+ if initialRequest['RequestType'] & consts.ConstRequestType.GenerateUSKKeypair:
insertURI = key.KeyUSK(insertURI.keyData, docName=insertURI.docName)
insertURI = key.KeyUSK(insertURI.keyData, docName=insertURI.docName)
requestURI = key.KeyUSK(requestURI.keyData, docName=requestURI.docName)
@@ -1214,13 +1220,13 @@
#########################################################
def getConfig(self,
withCurrent=True,
- withDefaults=True,
- withExpertFlag=True,
- withForceWriteFlag=True,
- withSortOrder=True,
- withShortDescription=True,
- withLongDescription=True,
- withDataTypes=True,
+ withDefaults=False,
+ withExpertFlag=False,
+ withForceWriteFlag=False,
+ withSortOrder=False,
+ withShortDescription=False,
+ withLongDescription=False,
+ withDataTypes=False,
):
"""
@event: ConfigData(event, msg)
@@ -1546,9 +1552,9 @@
# find out wich message to use
if requestType & (consts.ConstRequestType.PutData | consts.ConstRequestType.PutFile | consts.ConstRequestType.PutRedirect):
msgClass = message.MsgClientPut
- elif requestType == consts.ConstRequestType.PutDir:
+ elif requestType & consts.ConstRequestType.PutDir:
msgClass = message.MsgClientPutDiskDir
- elif requestType == consts.ConstRequestType.PutMultiple:
+ elif requestType & consts.ConstRequestType.PutMultiple:
msgClass = message.MsgClientPutComplexDir
else:
raise ValueError('Unsupported request type')
@@ -1573,12 +1579,12 @@
msg[param] = value
if data is not None:
- if requestType != consts.ConstRequestType.PutData:
+ if not requestType & consts.ConstRequestType.PutData:
raise ValueError('Data can only be passed along with putData uploads')
msg.data = data
if items is not None:
- if requestType != consts.ConstRequestType.PutMultiple:
+ if not requestType & consts.ConstRequestType.PutMultiple:
raise ValueError('Items can only be passed along with PutMultiple uploads')
uploadTypeMapping = {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 23:49:19
|
Revision: 635
http://fclient.svn.sourceforge.net/fclient/?rev=635&view=rev
Author: jUrner
Date: 2008-07-15 16:49:14 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
whitespace
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/config.py
Modified: trunk/fclient/src/fclient/lib/fcp2/config.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/config.py 2008-07-15 23:48:31 UTC (rev 634)
+++ trunk/fclient/src/fclient/lib/fcp2/config.py 2008-07-15 23:49:14 UTC (rev 635)
@@ -412,8 +412,7 @@
parent.children[component] = item
parent = item
parent.values[paramClass] = (value, paramType)
-
-
+
def removeParamClass(self, key):
"""Removes the paramClass component if necessary
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 23:48:43
|
Revision: 634
http://fclient.svn.sourceforge.net/fclient/?rev=634&view=rev
Author: jUrner
Date: 2008-07-15 16:48:31 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
put in in, kick it out. logging.NOTSET. logging docks suck
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/consts.py
Modified: trunk/fclient/src/fclient/lib/fcp2/consts.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/consts.py 2008-07-15 23:47:21 UTC (rev 633)
+++ trunk/fclient/src/fclient/lib/fcp2/consts.py 2008-07-15 23:48:31 UTC (rev 634)
@@ -108,6 +108,7 @@
Error = logging.ERROR
Critical = logging.CRITICAL
Quiet = 1000000
+ Notset = logging.NOTSET
class ConstDisconnectReason(_BaseBitFlags):
"""Reasons for client disconnect
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 23:47:21
|
Revision: 633
http://fclient.svn.sourceforge.net/fclient/?rev=633&view=rev
Author: jUrner
Date: 2008-07-15 16:47:21 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
looks like edition number is not mandatory for SSKs
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/key.py
Modified: trunk/fclient/src/fclient/lib/fcp2/key.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/key.py 2008-07-15 23:46:02 UTC (rev 632)
+++ trunk/fclient/src/fclient/lib/fcp2/key.py 2008-07-15 23:47:21 UTC (rev 633)
@@ -196,7 +196,7 @@
(?P<extra>[a-z0-9\-~]+?)
)
(
- / (?: (?P<docName>[^/]+?)) - (?: (?P<edition>[\d]+))
+ / (?: (?P<docName>[^/]+?)) (- (?P<edition>[\d]+) )?
(/ (?P<tail>.+?))?
)?
(?P<pManifest> /)?
@@ -225,9 +225,11 @@
else:
out = [self.KeyType + self.keyData, ]
if self.docName is not None:
+ #FIX: i guess from node.config that SSKs do not need an edition number
if self.edition is None:
- raise ValueError('no edition number specified')
- out.append(urllib.quote(self.docName + '-' + str(self.edition)))
+ out.append(urllib.quote(self.docName))
+ else:
+ out.append(urllib.quote(self.docName + '-' + str(self.edition)))
if self.tail is not None:
out.append(urllib.quote(self.tail))
result = posixpath.join(*out)
@@ -246,8 +248,7 @@
if edition is not None:
edition = int(edition)
return clss(d['keyData'], docName=d['docName'], edition=edition, tail=d['tail'], pManifest=bool(d['pManifest']))
-
-
+
#TODO: current impl is to not allow slashes in KSKs. have to check if the node enforces this
class KeyKSK(_KeyBase):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 23:45:56
|
Revision: 632
http://fclient.svn.sourceforge.net/fclient/?rev=632&view=rev
Author: jUrner
Date: 2008-07-15 16:46:02 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
handle IPlist and Ip
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/types.py
Modified: trunk/fclient/src/fclient/lib/fcp2/types.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/types.py 2008-07-15 23:45:14 UTC (rev 631)
+++ trunk/fclient/src/fclient/lib/fcp2/types.py 2008-07-15 23:46:02 UTC (rev 632)
@@ -154,8 +154,21 @@
class TypeUri(Type): pass
class TypeIP(Type): pass
-class TypeIPList(Type): pass
-class TypeIPort(Type): pass
+class TypeIPList(Type):
+
+ @classmethod
+ def pythonToFcp(clss, value):
+ return ','.join(value)
+
+ @classmethod
+ def fcpToPython(clss, value):
+ return [i.strip() for i in value.split(',')]
+
+#TODO: i assume the node makes shure it can not be '' or < 0
+class TypeIPort(TypeInt):
+ pass
+
+
class TypeStringList(Type): pass
class TypeDirname(Type): pass
class TypeFilename(Type): pass
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 23:45:19
|
Revision: 631
http://fclient.svn.sourceforge.net/fclient/?rev=631&view=rev
Author: jUrner
Date: 2008-07-15 16:45:14 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
added PyString ++ bit of this and that
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/lib/settings.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/lib/settings.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/lib/settings.py 2008-07-15 23:44:05 UTC (rev 630)
+++ trunk/fclient/src/fclient/lib/qt4ex/lib/settings.py 2008-07-15 23:45:14 UTC (rev 631)
@@ -144,6 +144,7 @@
def restore(self):
"""restores settings from disk
+ @return: this object
@note: values are restored in settings order
@note: the method tries first to find a method to<DesiredType> . if present the method
will be called with three arguments (QSettings,settingName, variant). the method should
@@ -184,14 +185,18 @@
finally:
settings.endGroup()
self.finalizeSettingsObject(settings)
+ return self
def restoreDefaults(self, *names):
"""restores default values for settings
@param names: names to restore defaults for or no name to restore defaults of all settings
+ @return: (dict) name --> value of restored values
"""
names = names if names else self._settingsOrder
- return self.setValues(**dict([(name, self.default(name)) for name in names]))
+ d = dict([(name, self.default(name)) for name in names])
+ self.setValues(**d)
+ return d
def setDefault(self, name, value):
@@ -364,5 +369,23 @@
def toQPixmapXpm(self, settings, name, v): return self._toPixmap(settings, name, v)
def fromQPixmapXpm(self, settings, name, value): return self._fromPixmap(settings, name, value, 'XPM')
+
+
+ def fromPyString(self, settings, name, value):
+ if value is not None:
+ return QtCore.QVariant(value), True
+ return QtCore.QVariant(), False
+
+ def toPyString(elf, settings, name, v):
+ if v.isValid():
+ string = v.toString()
+ try:
+ string = str(string)
+ except UnicodeEncodeError:
+ pass
+ else:
+ return string, True
+ return None, False
+
\ 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-15 23:43:59
|
Revision: 630
http://fclient.svn.sourceforge.net/fclient/?rev=630&view=rev
Author: jUrner
Date: 2008-07-15 16:44:05 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
new class to tame actions a bit
Added Paths:
-----------
trunk/fclient/src/fclient/lib/qt4ex/lib/actions.py
Added: trunk/fclient/src/fclient/lib/qt4ex/lib/actions.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/lib/actions.py (rev 0)
+++ trunk/fclient/src/fclient/lib/qt4ex/lib/actions.py 2008-07-15 23:44:05 UTC (rev 630)
@@ -0,0 +1,114 @@
+#TODO: not yet completely implemented
+
+
+from PyQt4 import QtCore, QtGui
+#******************************************************************************
+#
+#******************************************************************************
+class Action(QtGui.QAction):
+
+ def __init__(self, text, parent, userData=None):
+ QtGui.QAction.__init__(self, text, parent)
+ self._userData = userData
+
+ def userData(self):
+ return self._userData
+
+ def setUserData(self, data):
+ self._userData = data
+
+
+#******************************************************************************
+#
+#******************************************************************************
+
+class ActionsBase(QtCore.QObject):
+
+ def __init__(self, parent):
+ QtCore.QObject.__init__(self, parent)
+ self._actions = []
+ self._actionNames = []
+ self._dummyGroups = [] # cheat a bit to always trigger SIGNAL('triggered(QAction*)')
+
+ def action(self,
+ name=None,
+ text=None,
+ group=None,
+ trigger=None,
+ isCheckable=False,
+ isChecked=False,
+ isEnabled=True,
+ userData=None,
+ ):
+ if group is None:
+ group = QtGui.QActionGroup(self.parent())
+ self._dummyGroups.append(group) #TODO: is this necessary?
+ act = Action(text, group, userData=userData)
+ group.addAction(act)
+ if trigger is not None:
+ self.parent().connect(group, QtCore.SIGNAL('triggered(QAction*)'), trigger)
+ else:
+ act = Action(text, group, userData=userData)
+ group.addAction(act)
+
+ act.setObjectName(name)
+ if isCheckable:
+ act.setCheckable(True)
+ act.setChecked(isChecked)
+ act.setEnabled(isEnabled)
+
+ self._registerAction(name, act)
+ return act
+
+
+ def group(self, parent=None, name=None, trigger=None, isExclusive=False):
+ if parent is None:
+ parent = self.parent()
+ group = QtGui.QActionGroup(parent)
+ group.setObjectName(name)
+ if trigger is not None:
+ self.parent().connect(group, QtCore.SIGNAL('triggered(QAction*)'), trigger)
+ group.setExclusive(isExclusive)
+
+ self._registerAction(name, group)
+ return group
+
+
+ def _registerAction(self, name, obj):
+ if name in self._actionNames:
+ raise valueError('action with that name already exists: %r' % name)
+ self._actionNames.append(name)
+ self._actions.append(obj)
+
+
+ def __getitem__(self, name):
+ return self._actions[self._actionNames.index(name)]
+
+
+ def get(self, name, default=None):
+ if name in self._actionNames:
+ return self[name]
+ return default
+
+
+
+def foo(a):
+ print a
+
+ gr = QtGui.QActionGroup(None)
+ gr.connect(gr, QtCore.SIGNAL('triggered(QAction*)'), foo)
+
+
+ a = QtGui.QAction(gr)
+ gr.addAction(a)
+
+ a.trigger()
+
+
+
+
+
+
+
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 14:53:16
|
Revision: 629
http://fclient.svn.sourceforge.net/fclient/?rev=629&view=rev
Author: jUrner
Date: 2008-07-15 07:52:39 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
message params without '=value' where not handled
msg.data was None if DataLenght was None. fix to ''
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/iohandler.py
Modified: trunk/fclient/src/fclient/lib/fcp2/iohandler.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/iohandler.py 2008-07-15 14:48:13 UTC (rev 628)
+++ trunk/fclient/src/fclient/lib/fcp2/iohandler.py 2008-07-15 14:52:39 UTC (rev 629)
@@ -297,7 +297,10 @@
msg = msgClass()
# process param --> value fields
- params = dict([line.split('=', 1) for line in p])
+ try:
+ params = dict([line.split('=', 1) for line in p])
+ except ValueError: # param not followed by =
+ raise consts.ErrorMessageParse('Invalid message parameters in: %s": ' % chunk, consts.ConstLogger.IOHandler.error)
if not msg._restoreParams(params):
#HACK:
if hackyInvalidMessageCallback is not None:
@@ -306,6 +309,7 @@
# get associated data if necessary
if mayHaveData:
+ msg.data = ''
n = msg._getDataLength()
if not isinstance(n, (int, long)):
#HACK:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-15 14:48:53
|
Revision: 628
http://fclient.svn.sourceforge.net/fclient/?rev=628&view=rev
Author: jUrner
Date: 2008-07-15 07:48:13 -0700 (Tue, 15 Jul 2008)
Log Message:
-----------
whitespace
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/fcp2/consts.py
Modified: trunk/fclient/src/fclient/lib/fcp2/consts.py
===================================================================
--- trunk/fclient/src/fclient/lib/fcp2/consts.py 2008-07-13 14:21:18 UTC (rev 627)
+++ trunk/fclient/src/fclient/lib/fcp2/consts.py 2008-07-15 14:48:13 UTC (rev 628)
@@ -237,6 +237,7 @@
logging.addLevelName(ConstDebugVerbosity.Message, 'MESSAGE')
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG)
+
class ConstLogMessages:
"""Strings used for log infos"""
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:21:29
|
Revision: 627
http://fclient.svn.sourceforge.net/fclient/?rev=627&view=rev
Author: jUrner
Date: 2008-07-13 07:21:18 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
add qt *.pro
Added Paths:
-----------
trunk/fclient/src/fclient/lib/qt4ex/qt4ex.pro
Added: trunk/fclient/src/fclient/lib/qt4ex/qt4ex.pro
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/qt4ex.pro (rev 0)
+++ trunk/fclient/src/fclient/lib/qt4ex/qt4ex.pro 2008-07-13 14:21:18 UTC (rev 627)
@@ -0,0 +1,36 @@
+SOURCES = mrumenu.py \
+ tablewidget.py \
+ areatips.py \
+ treewidgetwrap.py \
+ checkarraywrap.py \
+ dragtool.py \
+ dlgabout.py \
+ dlgfindreplace.py \
+ colorbutton.py \
+ __init__.py \
+ editboxwrap.py \
+ toolbarwrap.py \
+ labelwrap.py \
+ dlgpreferences.py \
+ lib/tools.py \
+ lib/language.py \
+ lib/assistant.py \
+ lib/resources.py \
+ lib/__init__.py \
+ lib/settings.py \
+ tpls/Ui_DlgAbout.py \
+ tpls/__init__.py \
+ tpls/Ui_DlgFindReplace.py \
+ tpls/Ui_DlgPreferencesTree.py \
+ scripts/manifest.py \
+ scripts/qtpro.py \
+ scripts/__init__.py \
+ scripts/update_project.py \
+ scripts/pylupdate.py
+
+FORMS = tpls/DlgPreferencesTree.ui \
+ tpls/DlgFindReplace.ui \
+ tpls/DlgAbout.ui
+
+TRANSLATIONS = lang/qt4ex_en.ts \
+ lang/qt4ex_de.ts
\ 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-13 14:20:24
|
Revision: 626
http://fclient.svn.sourceforge.net/fclient/?rev=626&view=rev
Author: jUrner
Date: 2008-07-13 07:20:33 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
continued impl widget
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewLogger.py
Modified: trunk/fclient/src/fclient/Ui_ViewLogger.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewLogger.py 2008-07-13 14:20:28 UTC (rev 625)
+++ trunk/fclient/src/fclient/Ui_ViewLogger.py 2008-07-13 14:20:33 UTC (rev 626)
@@ -29,105 +29,144 @@
#TODO: more here...
class TextEditActionClear(QtGui.QAction):
- def __init__(self, menu, ed):
+ def __init__(self, ed):
QtGui.QAction.__init__(self, ed)
self.setText(self.trUtf8('Clear'))
##self.setShortcut(self.trUtf8("del"))
self.connect(self, QtCore.SIGNAL('triggered(bool)'), self.handleTriggered)
- self.connect(menu, QtCore.SIGNAL('aboutToShow()'), self.handleMenuAboutToShow)
+ self.connect(ed, QtCore.SIGNAL('textChanged()'), self.handleEdTextChanged)
self.ed = ed
+ self.handleEdTextChanged()
- def handleMenuAboutToShow(self):
+ def handleEdTextChanged(self):
self.setEnabled(not self.ed.document().isEmpty())
def handleTriggered(self, isChecked):
self.ed.clear()
+
+#***********************************************************************
+#
+#***********************************************************************
+class MyLoggingHandler(logging.Handler):
+ def __init__(self, myLogf, *args, **kwargs):
+ logging.Handler.__init__(self, *args, **kwargs)
+ self.myLogf = myLogf
+
+ def emit(self, record):
+ self.myLogf(
+ '%s:%s:%s' % (record.levelname, record.name, record.getMessage())
+ )
-
#***********************************************************************
#
#***********************************************************************
class ViewLoggerWidget(QtGui.QWidget, Ui_ViewLoggerWidget):
IdEddLogger = 'edLogger'
-
- class MyLoggingHandler(logging.Handler):
-
- def __init__(self, myLogf, *args, **kwargs):
- logging.Handler.__init__(self, *args, **kwargs)
- self.myLogf = myLogf
-
- def emit(self, record):
- self.myLogf(
- '%s:%s:%s' % (record.levelname, record.name, record.getMessage())
- )
- def __init__(self, parent, cfg=None, level=logging.NOTSET):
+ def __init__(self, parent, level=logging.NOTSET):
QtGui.QWidget.__init__(self, parent)
+ self._acts = []
+ self._isCreated = False
+ self._mainWindowMenus = []
+
self.settings = Settings()
-
+
self.setupUi(self)
config.ObjectRegistry.register(self)
+ #NOTE: do not move to showEvent(). we want to be up and alive as soon as possible
+ # to catch logs
self.settings.restore()
ed = self.controlById(self.IdEddLogger)
ed.document().setMaximumBlockCount(self.settings.value('MaxLines'))
ed.contextMenuEvent = self.edLoggerContextMenuEvent
- self.loggingHandler = self.MyLoggingHandler(self.addMessage)
+ self.loggingHandler = MyLoggingHandler(self.addMessage)
logging.getLogger('').addHandler(self.loggingHandler)
+ # atatch menus to main window if present. have to do it in __init__ to reserve order
+ menuBarWrap = config.ObjectRegistry.get(config.IdMainWindowMenuBarWrap, None)
+ if menuBarWrap is not None:
+ menu = QtGui.QMenu(self.viewDisplayName(), menuBarWrap.menuBar())
+ for act in self.acts():
+ menu.addAction(act)
+ self._mainWindowMenus = (
+ menuBarWrap.addViewMenu(menu),
+ )
+
+ #########################################
+ ## methods
+ #########################################
+ def acts(self):
+ if not self._acts:
+ self._acts = (
+ TextEditActionClear(self.controlById(self.IdEddLogger)),
+ )
+ return self._acts
- def controlById(self, idControl):
- return getattr(self, idControl)
-
+
def addMessage(self, text):
ed = self.controlById(self.IdEddLogger)
ed.append(text)
-
-#########################################
+
+ def controlById(self, idControl):
+ return getattr(self, idControl)
+
+ #########################################
+ ##view methods
+ #########################################
+ def viewClose(self):
+ pass
+
+ def viewDisplayName(self):
+ return self.trUtf8('Logger')
+
+ def viewHandleCurrentChanged(self, isCurrent):
+ pass
+ #for menu in self._mainWindowMenus:
+ # menu.setVisible(isCurrent)
+
+ def viewIcon(self):
+ return QtGui.QIcon()
+
+ def viewName(self):
+ return self.objectName()
+
+ #########################################
## overwritten events
#########################################
def edLoggerContextMenuEvent(self, event):
"""customize context menu of the logger QTextEdit"""
ed = self.controlById(self.IdEddLogger)
menu = ed.createStandardContextMenu()
+ for act in self.acts():
+ menu.addAction(act)
+ menu.exec_(event.globalPos())
- act = TextEditActionClear(menu, ed)
- menu.addAction(act)
+ def showEvent(self, event):
+ if self._isCreated:
+ return
+ self._isCreated = True
- menu.exec_(event.globalPos())
-
-
#**********************************************************************************
#
#**********************************************************************************
-class ViewLogger(Ui_View.View):
+if __name__ == '__main__':
+ import sys
+ from . import Ui_ViewLogger
- def __init__(self):
- self._widget = None
+ app = QtGui.QApplication(sys.argv)
+ w = ViewLoggerWidget(None)
- def displayName(self):
- return QtGui.QApplication.translate("ViewLogger", "Logger", None, QtGui.QApplication.UnicodeUTF8)
-
- def icon(self):
- return QtGui.QIcon()
-
- def objectName(self):
- return 'ViewLogger'
-
-
- def widget(self, parent):
- if self._widget is None:
- self._widget = ViewLoggerWidget(parent)
- return self._widget
-
- def close(self):
- pass
+ w.show()
+ res = app.exec_()
+ sys.exit(res)
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:20:18
|
Revision: 625
http://fclient.svn.sourceforge.net/fclient/?rev=625&view=rev
Author: jUrner
Date: 2008-07-13 07:20:28 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
continued impl widget
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_ViewConnection.py
Modified: trunk/fclient/src/fclient/Ui_ViewConnection.py
===================================================================
--- trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-13 14:20:18 UTC (rev 624)
+++ trunk/fclient/src/fclient/Ui_ViewConnection.py 2008-07-13 14:20:28 UTC (rev 625)
@@ -65,37 +65,80 @@
def __init__(self, parent, cfg=None):
QtGui.QWidget.__init__(self, parent)
+ self._acts = []
self._isCreated = False
self._connectionTimer = ConnectionTimer(self)
+ self._eventHandlers = (
+ (config.fcpClient.events.ClientDisconnected, self.handleFcpClientDisconected),
+ )
+ self._mainWindowMenus = ()
self.settings = Settings()
self.setupUi(self)
config.ObjectRegistry.register(self)
+ # atatch menus to main window if present. have to do it in __init__ to reserve order
+ menuBarWrap = config.ObjectRegistry.get(config.IdMainWindowMenuBarWrap, None)
+ if menuBarWrap is not None:
+ menu = QtGui.QMenu(self.viewDisplayName(), menuBarWrap.menuBar())
+ for act in self.acts():
+ menu.addAction(act)
+ self._mainWindowMenus = (
+ menuBarWrap.addViewMenu(menu),
+ )
+
#########################################
- ##
+ ## methods
#########################################
+ def close(self):
+ config.fcpClient.events -= self._eventHandlers
+
def controlById(self, idControl):
return getattr(self, idControl)
+ def displayName(self):
+ return self.trUft8('Connection')
+
+ def acts(self):
+ if not self._acts:
+ self._acts = (
+ )
+ return self._acts
+
#########################################
+ ## view methods
+ #########################################
+ def viewClose(self):
+ self.close()
+
+ def viewDisplayName(self):
+ return self.trUtf8('Connection')
+
+ def viewHandleCurrentChanged(self, isCurrent):
+ for menu in self._mainWindowMenus:
+ menu.children()[0].setVisible(isCurrent)
+
+ def viewIcon(self):
+ return QtGui.QIcon()
+
+ def viewName(self):
+ return self.objectName()
+
+ #########################################
## overwritten events
#########################################
+ def closeEvent(self, event):
+ self.close()
+
def showEvent(self, event):
- QtGui.QWidget.showEvent(self, event)
if self._isCreated:
return
self._isCreated = True
self.settings.restore()
+ config.fcpClient.events += self._eventHandlers
- #TODO: when on a tab closeEvent() is never called. how to disconnect on close?
- # maybe fcp2.events should use weakrefs?
- config.fcpClient.events += (
- (config.fcpClient.events.ClientDisconnected, self.handleFcpClientDisconected),
- )
-
# setup host / port boxes
edHost = self.controlById(self.IdEdConnectionHost)
edHost.setText(self.settings.value('ConnectionHost'))
@@ -114,8 +157,11 @@
self.connect(bt, QtCore.SIGNAL('clicked(bool)'), self.handleBtConnectClicked)
if doAutoConnect:
self.controlById(self.IdBtConnect).click()
-
- #########################################
+
+
+
+
+ ########################################
## overwritten methods
#########################################
def retranslateUi(self, w):
@@ -154,40 +200,14 @@
#**********************************************************************************
#
#**********************************************************************************
-class ViewConnection(Ui_View.View):
-
- def __init__(self):
- self._widget = None
-
- def displayName(self):
- return QtGui.QApplication.translate("ViewConnectionWidget", "Connection", None, QtGui.QApplication.UnicodeUTF8)
-
- def icon(self):
- return QtGui.QIcon()
-
- def objectName(self):
- return 'ViewConnection'
-
- def widget(self, parent):
- if self._widget is None:
- self._widget = ViewConnectionWidget(parent)
- return self._widget
-
- def close(self):
- pass
-
-#**********************************************************************************
-#
-#**********************************************************************************
if __name__ == '__main__':
import sys
from . import Ui_ViewLogger
app = QtGui.QApplication(sys.argv)
-
w = Ui_View.ViewWidget(None)
- w.addViews(True, ViewConnection())
- w.addViews(False, Ui_ViewLogger.ViewLogger())
+ w.addTopViews(ViewConnectionWidget(None))
+ w.addBottomViews(Ui_ViewLogger.ViewLoggerWidget(None))
w.show()
res = app.exec_()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:20:11
|
Revision: 624
http://fclient.svn.sourceforge.net/fclient/?rev=624&view=rev
Author: jUrner
Date: 2008-07-13 07:20:18 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
continued impl view widget
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_View.py
Modified: trunk/fclient/src/fclient/Ui_View.py
===================================================================
--- trunk/fclient/src/fclient/Ui_View.py 2008-07-13 14:19:49 UTC (rev 623)
+++ trunk/fclient/src/fclient/Ui_View.py 2008-07-13 14:20:18 UTC (rev 624)
@@ -24,7 +24,9 @@
class Settings(config.SettingsBase):
_key_ = config.IdViewWidget
_settings_ = (
- ('LastView', 'String', '', config.SettingScopePrivate),
+ ('LastViewTop', 'String', '', config.SettingScopePrivate),
+ ('LastViewBottom', 'String', '', config.SettingScopePrivate),
+ ('SplitterPos', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate),
)
#***********************************************************************
@@ -32,51 +34,127 @@
#***********************************************************************
class ViewWidget(QtGui.QWidget, Ui_ViewWidget):
+ IdSplitter = 'Splitter'
IdTabTop = 'tabTop'
IdTabBottom = 'tabBottom'
+
-
-
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
-
+
+ self._isCreated = False
self.settings = Settings()
self.views = {}
-
+
self.setupUi(self)
config.ObjectRegistry.register(self)
self.settings.restore()
+ # setup tab widgets
tabTop = self.controlById(self.IdTabTop)
tabTop.removeTab(0)
tabBottom = self.controlById(self.IdTabBottom)
tabBottom.removeTab(0)
+ self.connect(tabTop, QtCore.SIGNAL('currentChanged(int)'), self.handleTabTopCurrentChanged)
+ self.connect(tabBottom, QtCore.SIGNAL('currentChanged(int)'), self.handleTabBottomCurrentChanged)
+
+ # setup splitter
+ splitter = self.controlById(self.IdSplitter)
+ splitter.restoreState(self.settings.value('SplitterPos'))
def controlById(self, idControl):
return getattr(self, idControl)
- def addViews(self, toTop, *views):
+ def _addViews(self, toTop, *views):
tab = self.controlById(self.IdTabTop) if toTop else self.controlById(self.IdTabBottom)
for view in views:
- ido = str(view.objectName())
- if ido in self.views:
- raise ValueError('view is already present: %s' % ido)
- i = tab.addTab(view.widget(tab), view.icon(), view.displayName())
- self.views[ido] = (i, tab, view)
+ name = view.viewName()
+ if not name:
+ raise ValueError('view must have a name')
+ if name in self.views:
+ raise ValueError('view with that name is already present: %s' % name)
+ view.setParent(tab)
+ i = tab.addTab(view, view.viewIcon(), view.viewDisplayName())
+ self.views[name] = (tab, view)
+
+ def addBottomViews(self, *views):
+ return self._addViews(False, *views)
+
+ def addTopViews(self, *views):
+ return self._addViews(True, *views)
+
+
def viewFromName(self, name):
- return self.views[uuid]
-
- def setCurrentView(self, view):
- index, tab, view = view
+ result = self.views.get(name, None)
+ if result is not None:
+ return result[1]
+ return None
+
+ #TODO: ...
+ #def setCurrentView(self, view):
+ # index, tab, view = view
+
+ #########################################################
+ ##
+ #########################################################
def closeEvent(self, event):
- for i, tab, view in self.views.values():
- view.close()
+ splitter = self.controlById(self.IdSplitter)
+ self.settings.setValues(SplitterPos=splitter.saveState())
+ for tab, view in self.views.values():
+ view.viewClose()
+
+
+ def showEvent(self, event):
+ if self._isCreated:
+ return
+ self._isCreated = True
+ # restore current views
+ tabs = (
+ (self.controlById(self.IdTabTop), 'LastViewTop'),
+ (self.controlById(self.IdTabBottom), 'LastViewBottom'),
+ )
+ for tab, nameSetting in tabs:
+ lastName = self.settings.value(nameSetting)
+ if lastName:
+ lastView = self.viewFromName(lastName)
+ if lastView is not None:
+ tab.setCurrentWidget(lastView)
+
+ # inform views about their current status
+ for tab, view in self.views.values():
+ view.viewHandleCurrentChanged(tab.currentWidget() == view)
+
+ #########################################################
+ ##
+ #########################################################
+ def _handleTabCurrentChanged(self, index, isTop=True):
+ lastName = self.settings.value('LastViewTop' if isTop else 'LastViewBottom')
+ if lastName:
+ lastView = self.viewFromName(lastName)
+ if lastView is not None:
+ lastView.viewHandleCurrentChanged(False)
+ tab = self.controlById(self.IdTabTop if isTop else self.IdTabBottom)
+ view = tab.currentWidget()
+ if isTop:
+ self.settings.setValues(LastViewTop=view.viewName())
+ else:
+ self.settings.setValues(LastViewBottom=view.viewName())
+ view.viewHandleCurrentChanged(True)
+
+
+ def handleTabTopCurrentChanged(self, index):
+ return self._handleTabCurrentChanged(index, isTop=True)
+
+
+ def handleTabBottomCurrentChanged(self, index):
+ return self._handleTabCurrentChanged(index, isTop=False)
+
#**********************************************************************************
#
#**********************************************************************************
@@ -88,34 +166,29 @@
def __init__(self):
raise NotImplemetedError()
- def displayName(self):
+ def viewClose(self):
+ """called when the view is about to be closed"""
+
+ def viewDisplayName(self):
"""should return the user visible name of the view
@return: (QString)
"""
raise NotImplemetedError()
- def icon(self):
+ def viewHandleCurrentChanged(self, isCurrent):
+ """called when the view is set to be the current view or looses its current view status"""
+
+ def viewIcon(self):
"""should return the icon associated to the view
@return: (QIcon)
"""
raise NotImplemetedError()
- def objectName(self):
+ def viewName(self):
"""should return the internally used id of the view
@return: (str) id
"""
raise NotImplemetedError()
-
- def widget(self, parent):
- """should return the widget contained in the view
- @param parent: (QWidget) parent
- @return: (QWidget)
- note: if the widget is not already created _now_ is the right time to create it
- """
- raise NotImplemetedError()
-
- def close(self):
- """called when the view is about to be closed"""
#**********************************************************************************
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:19:41
|
Revision: 623
http://fclient.svn.sourceforge.net/fclient/?rev=623&view=rev
Author: jUrner
Date: 2008-07-13 07:19:49 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
adapt to Qt4Ex changes
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_PrefsGlobal.py
Modified: trunk/fclient/src/fclient/Ui_PrefsGlobal.py
===================================================================
--- trunk/fclient/src/fclient/Ui_PrefsGlobal.py 2008-07-13 14:19:40 UTC (rev 622)
+++ trunk/fclient/src/fclient/Ui_PrefsGlobal.py 2008-07-13 14:19:49 UTC (rev 623)
@@ -7,7 +7,7 @@
from PyQt4 import QtGui
from . import config
-from .lib.qt4ex.dlgs import dlgpreferences
+from .lib.qt4ex import dlgpreferences
from .tpls.Ui_PrefsGlobalWidgetTpl import Ui_PrefsGlobalWidget
#**********************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:19:30
|
Revision: 622
http://fclient.svn.sourceforge.net/fclient/?rev=622&view=rev
Author: jUrner
Date: 2008-07-13 07:19:40 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
adapt to Qt4Ex changes
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_Prefs.py
Modified: trunk/fclient/src/fclient/Ui_Prefs.py
===================================================================
--- trunk/fclient/src/fclient/Ui_Prefs.py 2008-07-13 14:19:10 UTC (rev 621)
+++ trunk/fclient/src/fclient/Ui_Prefs.py 2008-07-13 14:19:40 UTC (rev 622)
@@ -5,7 +5,7 @@
from PyQt4 import QtGui
-from .lib.qt4ex.dlgs import dlgpreferences
+from .lib.qt4ex import dlgpreferences
from .Ui_PrefsGlobal import PrefsPageGlobal
#**********************************************************************************
#
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:19:04
|
Revision: 621
http://fclient.svn.sourceforge.net/fclient/?rev=621&view=rev
Author: jUrner
Date: 2008-07-13 07:19:10 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
templates for browser widget
Added Paths:
-----------
trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py
trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui
Added: trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py (rev 0)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewBrowserWidgetTpl.py 2008-07-13 14:19:10 UTC (rev 621)
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+
+# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui'
+#
+# Created: Sun Jul 13 14:59:28 2008
+# by: PyQt4 UI code generator 4.3.3
+#
+# WARNING! All changes made in this file will be lost!
+
+from PyQt4 import QtCore, QtGui
+
+class Ui_ViewBrowserWidget(object):
+ def setupUi(self, ViewBrowserWidget):
+ ViewBrowserWidget.setObjectName("ViewBrowserWidget")
+ ViewBrowserWidget.resize(QtCore.QSize(QtCore.QRect(0,0,533,356).size()).expandedTo(ViewBrowserWidget.minimumSizeHint()))
+
+ self.retranslateUi(ViewBrowserWidget)
+ QtCore.QMetaObject.connectSlotsByName(ViewBrowserWidget)
+
+ def retranslateUi(self, ViewBrowserWidget):
+ ViewBrowserWidget.setWindowTitle(QtGui.QApplication.translate("ViewBrowserWidget", "Form", None, QtGui.QApplication.UnicodeUTF8))
+
+
+
+if __name__ == "__main__":
+ import sys
+ app = QtGui.QApplication(sys.argv)
+ ViewBrowserWidget = QtGui.QWidget()
+ ui = Ui_ViewBrowserWidget()
+ ui.setupUi(ViewBrowserWidget)
+ ViewBrowserWidget.show()
+ sys.exit(app.exec_())
Added: trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui (rev 0)
+++ trunk/fclient/src/fclient/tpls/ViewBrowserWidgetTpl.ui 2008-07-13 14:19:10 UTC (rev 621)
@@ -0,0 +1,18 @@
+<ui version="4.0" >
+ <class>ViewBrowserWidget</class>
+ <widget class="QWidget" name="ViewBrowserWidget" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>533</width>
+ <height>356</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:18:40
|
Revision: 620
http://fclient.svn.sourceforge.net/fclient/?rev=620&view=rev
Author: jUrner
Date: 2008-07-13 07:18:49 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
continued impl main window
Modified Paths:
--------------
trunk/fclient/src/fclient/Ui_MainWindow.py
Modified: trunk/fclient/src/fclient/Ui_MainWindow.py
===================================================================
--- trunk/fclient/src/fclient/Ui_MainWindow.py 2008-07-13 14:18:11 UTC (rev 619)
+++ trunk/fclient/src/fclient/Ui_MainWindow.py 2008-07-13 14:18:49 UTC (rev 620)
@@ -8,9 +8,11 @@
from PyQt4 import QtCore, QtGui
-
+from . import __init__
from . import config
+from . import Ui_Prefs
from . import Ui_View
+from .lib.qt4ex import dlgabout
from .tpls.Ui_MainWindowTpl import Ui_MainWindow
#**********************************************************************************
@@ -18,40 +20,119 @@
#**********************************************************************************
class Settings(config.SettingsBase):
- _key_ = config.IdMainWindow
- _settings_ = (
- )
+ _key_ = config.IdMainWindow
+ _settings_ = (
+ ('Geometry', 'ByteArray', QtCore.QByteArray(), config.SettingScopePrivate),
+ )
#**********************************************************************************
#
#**********************************************************************************
+class MenuBarWrap(QtCore.QObject):
+
+ def __init__(self, parent):
+ QtCore.QObject.__init__(self, parent)
+ self.setObjectName(config.IdMainWindowMenuBarWrap)
+ config.ObjectRegistry.register(self)
+
+ def menuBar(self):
+ return self.parent()
+
+ def addViewMenu(self, menu):
+ menuBar = self.parent()
+ menuHelp = menuBar.parent().menuHelp
+ menuBar.insertMenu(menuHelp.children()[0], menu)
+ return menu
+
+
class StatusBar(QtGui.QStatusBar):
def __init__(self, parent):
QtGui.QStatusBar.__init__(self, parent)
self.setObjectName(config.IdMainWindowStatusBar)
+ config.ObjectRegistry.register(self)
+ parent.setStatusBar(self)
#**********************************************************************************
#
#**********************************************************************************
class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
- def __init__(self, parent, cfg=None):
+ def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
+ self._isCreated = False
self.settings = Settings()
self.setupUi(self)
+
config.ObjectRegistry.register(self)
+ self.settings.restore()
+ self.restoreGeometry(self.settings.value('Geometry'))
- # register menuBar
- menuBar = self.menuBar()
- menuBar.setObjectName(config.IdMainWindowMenuBar)
- config.ObjectRegistry.register(menuBar)
+ self.menuBarWrap = MenuBarWrap(self.menuBar())
+ self.statusBar = StatusBar(self)
- # register statusBar
- statusBar = StatusBar(self)
- self.setStatusBar(statusBar)
- config.ObjectRegistry.register(statusBar)
+ ##################################################
+ ## events
+ ##################################################
+ def closeEvent(self, event):
+ self.settings.setValues(Geometry=self.saveGeometry())
+ def showEvent(self, event):
+ if self._isCreated:
+ return
+ self._isCreated = True
+
+ self.connect(
+ self.actPreferences,
+ QtCore.SIGNAL('triggered()'),
+ self.handleActPreferencesTriggered
+ )
+ self.connect(
+ self.actExit,
+ QtCore.SIGNAL('triggered()'),
+ self.handleActExitTriggered
+ )
+ self.connect(
+ self.actHelp,
+ QtCore.SIGNAL('triggered()'),
+ self.handleActHelpTriggered
+ )
+ self.connect(
+ self.actAbout,
+ QtCore.SIGNAL('triggered()'),
+ self.handleActAboutTriggered
+ )
+
+ ##################################################
+ ## event handlers
+ ##################################################
+ def handleActPreferencesTriggered(self):
+ dlg = Ui_Prefs.PrefsDlg(self)
+ if dlg.exec_() == dlg.Accepted:
+ pass
+
+ def handleActExitTriggered(self):
+ self.close()
+
+ def handleActHelpTriggered(self):
+ pass
+
+ def handleActAboutTriggered(self):
+ dlg = dlgabout.DlgAbout(
+ self,
+ ##state=self.guiSettings['DlgAboutState'],
+ caption=config.FclientAppName + ' - ' + self.trUtf8('About'),
+ appName=config.FclientAppName,
+ description=self.trUtf8('a freenet client written in python and Qt4'),
+ version=config.FclientVersion,
+ author=config.FclientAuthor,
+ licence=config.FclientLicence,
+ copyright=config.FclientCopyright,
+ homepage=config.FclientHomepage
+ )
+ dlg.exec_()
+ #self.guiSettings['DlgAboutState'] = dlg.saveState()
+
#**********************************************************************************
#
#**********************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:18:07
|
Revision: 619
http://fclient.svn.sourceforge.net/fclient/?rev=619&view=rev
Author: jUrner
Date: 2008-07-13 07:18:11 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
whatever
Modified Paths:
--------------
trunk/fclient/src/fclient/tpls/ViewWidgetTpl.ui
Modified: trunk/fclient/src/fclient/tpls/ViewWidgetTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/ViewWidgetTpl.ui 2008-07-13 14:17:56 UTC (rev 618)
+++ trunk/fclient/src/fclient/tpls/ViewWidgetTpl.ui 2008-07-13 14:18:11 UTC (rev 619)
@@ -32,7 +32,7 @@
<number>0</number>
</property>
<item row="0" column="0" >
- <widget class="QSplitter" name="splitter" >
+ <widget class="QSplitter" name="Splitter" >
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:17:55
|
Revision: 618
http://fclient.svn.sourceforge.net/fclient/?rev=618&view=rev
Author: jUrner
Date: 2008-07-13 07:17:56 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
whatever
Modified Paths:
--------------
trunk/fclient/src/fclient/tpls/Ui_ViewWidgetTpl.py
Modified: trunk/fclient/src/fclient/tpls/Ui_ViewWidgetTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_ViewWidgetTpl.py 2008-07-13 14:17:35 UTC (rev 617)
+++ trunk/fclient/src/fclient/tpls/Ui_ViewWidgetTpl.py 2008-07-13 14:17:56 UTC (rev 618)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/ViewWidgetTpl.ui'
#
-# Created: Tue Jul 8 17:55:38 2008
+# Created: Sun Jul 13 00:07:25 2008
# by: PyQt4 UI code generator 4.3.3
#
# WARNING! All changes made in this file will be lost!
@@ -19,11 +19,11 @@
self.gridlayout.setSpacing(0)
self.gridlayout.setObjectName("gridlayout")
- self.splitter = QtGui.QSplitter(ViewWidget)
- self.splitter.setOrientation(QtCore.Qt.Vertical)
- self.splitter.setObjectName("splitter")
+ self.Splitter = QtGui.QSplitter(ViewWidget)
+ self.Splitter.setOrientation(QtCore.Qt.Vertical)
+ self.Splitter.setObjectName("Splitter")
- self.frameTop = QtGui.QFrame(self.splitter)
+ self.frameTop = QtGui.QFrame(self.Splitter)
self.frameTop.setFrameShape(QtGui.QFrame.NoFrame)
self.frameTop.setFrameShadow(QtGui.QFrame.Plain)
self.frameTop.setLineWidth(0)
@@ -42,7 +42,7 @@
self.tabTop.addTab(self.tab_3,"")
self.gridlayout1.addWidget(self.tabTop,0,0,1,1)
- self.frameBottom = QtGui.QFrame(self.splitter)
+ self.frameBottom = QtGui.QFrame(self.Splitter)
self.frameBottom.setFrameShape(QtGui.QFrame.NoFrame)
self.frameBottom.setFrameShadow(QtGui.QFrame.Plain)
self.frameBottom.setLineWidth(0)
@@ -60,7 +60,7 @@
self.tab_5.setObjectName("tab_5")
self.tabBottom.addTab(self.tab_5,"")
self.gridlayout2.addWidget(self.tabBottom,0,0,1,1)
- self.gridlayout.addWidget(self.splitter,0,0,1,1)
+ self.gridlayout.addWidget(self.Splitter,0,0,1,1)
self.retranslateUi(ViewWidget)
self.tabTop.setCurrentIndex(0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:17:42
|
Revision: 617
http://fclient.svn.sourceforge.net/fclient/?rev=617&view=rev
Author: jUrner
Date: 2008-07-13 07:17:35 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
whatever
Modified Paths:
--------------
trunk/fclient/src/fclient/tpls/MainWindowTpl.ui
trunk/fclient/src/fclient/tpls/Ui_MainWindowTpl.py
Modified: trunk/fclient/src/fclient/tpls/MainWindowTpl.ui
===================================================================
--- trunk/fclient/src/fclient/tpls/MainWindowTpl.ui 2008-07-13 14:17:18 UTC (rev 616)
+++ trunk/fclient/src/fclient/tpls/MainWindowTpl.ui 2008-07-13 14:17:35 UTC (rev 617)
@@ -22,8 +22,55 @@
<height>26</height>
</rect>
</property>
+ <widget class="QMenu" name="menuApplication" >
+ <property name="title" >
+ <string>&Application</string>
+ </property>
+ <addaction name="actPreferences" />
+ <addaction name="actExit" />
+ </widget>
+ <widget class="QMenu" name="menuHelp" >
+ <property name="title" >
+ <string>&Help</string>
+ </property>
+ <addaction name="actHelp" />
+ <addaction name="actAbout" />
+ </widget>
+ <addaction name="menuApplication" />
+ <addaction name="menuHelp" />
</widget>
<widget class="QStatusBar" name="statusbar" />
+ <action name="action_Preferences" >
+ <property name="text" >
+ <string>_Preferences</string>
+ </property>
+ </action>
+ <action name="actPreferences" >
+ <property name="text" >
+ <string>&Preferences..</string>
+ </property>
+ </action>
+ <action name="actExit" >
+ <property name="text" >
+ <string>E&xit</string>
+ </property>
+ </action>
+ <action name="actHelp" >
+ <property name="text" >
+ <string>&Help..</string>
+ </property>
+ <property name="toolTip" >
+ <string>Help</string>
+ </property>
+ </action>
+ <action name="actAbout" >
+ <property name="text" >
+ <string>A&bout..</string>
+ </property>
+ <property name="iconText" >
+ <string>About</string>
+ </property>
+ </action>
</widget>
<resources/>
<connections/>
Modified: trunk/fclient/src/fclient/tpls/Ui_MainWindowTpl.py
===================================================================
--- trunk/fclient/src/fclient/tpls/Ui_MainWindowTpl.py 2008-07-13 14:17:18 UTC (rev 616)
+++ trunk/fclient/src/fclient/tpls/Ui_MainWindowTpl.py 2008-07-13 14:17:35 UTC (rev 617)
@@ -2,7 +2,7 @@
# Form implementation generated from reading ui file '/home/me/src/proj/fclient/trunk/fclient/src/fclient/tpls/MainWindowTpl.ui'
#
-# Created: Sat Jul 12 21:39:29 2008
+# Created: Sun Jul 13 10:08:35 2008
# by: PyQt4 UI code generator 4.3.3
#
# WARNING! All changes made in this file will be lost!
@@ -21,17 +21,53 @@
self.menubar = QtGui.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0,0,800,26))
self.menubar.setObjectName("menubar")
+
+ self.menuApplication = QtGui.QMenu(self.menubar)
+ self.menuApplication.setObjectName("menuApplication")
+
+ self.menuHelp = QtGui.QMenu(self.menubar)
+ self.menuHelp.setObjectName("menuHelp")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtGui.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
+ self.action_Preferences = QtGui.QAction(MainWindow)
+ self.action_Preferences.setObjectName("action_Preferences")
+
+ self.actPreferences = QtGui.QAction(MainWindow)
+ self.actPreferences.setObjectName("actPreferences")
+
+ self.actExit = QtGui.QAction(MainWindow)
+ self.actExit.setObjectName("actExit")
+
+ self.actHelp = QtGui.QAction(MainWindow)
+ self.actHelp.setObjectName("actHelp")
+
+ self.actAbout = QtGui.QAction(MainWindow)
+ self.actAbout.setObjectName("actAbout")
+ self.menuApplication.addAction(self.actPreferences)
+ self.menuApplication.addAction(self.actExit)
+ self.menuHelp.addAction(self.actHelp)
+ self.menuHelp.addAction(self.actAbout)
+ self.menubar.addAction(self.menuApplication.menuAction())
+ self.menubar.addAction(self.menuHelp.menuAction())
+
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(QtGui.QApplication.translate("MainWindow", "MainWindow", None, QtGui.QApplication.UnicodeUTF8))
+ self.menuApplication.setTitle(QtGui.QApplication.translate("MainWindow", "&Application", None, QtGui.QApplication.UnicodeUTF8))
+ self.menuHelp.setTitle(QtGui.QApplication.translate("MainWindow", "&Help", None, QtGui.QApplication.UnicodeUTF8))
+ self.action_Preferences.setText(QtGui.QApplication.translate("MainWindow", "_Preferences", None, QtGui.QApplication.UnicodeUTF8))
+ self.actPreferences.setText(QtGui.QApplication.translate("MainWindow", "&Preferences..", None, QtGui.QApplication.UnicodeUTF8))
+ self.actExit.setText(QtGui.QApplication.translate("MainWindow", "E&xit", None, QtGui.QApplication.UnicodeUTF8))
+ self.actHelp.setText(QtGui.QApplication.translate("MainWindow", "&Help..", None, QtGui.QApplication.UnicodeUTF8))
+ self.actHelp.setToolTip(QtGui.QApplication.translate("MainWindow", "Help", None, QtGui.QApplication.UnicodeUTF8))
+ self.actAbout.setText(QtGui.QApplication.translate("MainWindow", "A&bout..", None, QtGui.QApplication.UnicodeUTF8))
+ self.actAbout.setIconText(QtGui.QApplication.translate("MainWindow", "About", None, QtGui.QApplication.UnicodeUTF8))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:17:15
|
Revision: 616
http://fclient.svn.sourceforge.net/fclient/?rev=616&view=rev
Author: jUrner
Date: 2008-07-13 07:17:18 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
lazy. add auto update project script
Added Paths:
-----------
trunk/fclient/src/fclient/lib/qt4ex/scripts/update_project.py
Added: trunk/fclient/src/fclient/lib/qt4ex/scripts/update_project.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/scripts/update_project.py (rev 0)
+++ trunk/fclient/src/fclient/lib/qt4ex/scripts/update_project.py 2008-07-13 14:17:18 UTC (rev 616)
@@ -0,0 +1,27 @@
+"""Commandline script to update the project
+
+@note: the scrips assumes it is located in the 'scipts' subdirectory of the package
+@note: the script assumes pylupdate4 is installed
+"""
+from __future__ import absolute_import
+if __name__ == '__main__': # see --> http://bugs.python.org/issue1510172 . works only current dir and below
+ import os; __path__ = [os.path.dirname(__file__)]
+
+import os
+from . import qtpro, manifest, pylupdate
+#****************************************************************
+#
+#****************************************************************
+Locales = (
+ 'en',
+ 'de',
+ )
+
+#*****************************************************************
+#
+#*****************************************************************
+if __name__ == '__main__':
+ d = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
+ ##manifest = manifest.createManifest(d)
+ pro = qtpro.createProjectFile(d, locales=Locales, prefix='qt4ex_')
+ pylupdate.main(pro)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:16:26
|
Revision: 615
http://fclient.svn.sourceforge.net/fclient/?rev=615&view=rev
Author: jUrner
Date: 2008-07-13 07:16:36 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
typo
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/scripts/qtpro.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/scripts/qtpro.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/scripts/qtpro.py 2008-07-13 14:16:17 UTC (rev 614)
+++ trunk/fclient/src/fclient/lib/qt4ex/scripts/qtpro.py 2008-07-13 14:16:36 UTC (rev 615)
@@ -13,7 +13,7 @@
the directorys name is assumed to be the projects' name
...a subdir [lang] will be created
...some default translation files are added, pointing to [lang/ProjectName_locale.ts]
- ...subpackages containig a 'lang' directories are skipped
+ ...subpackages containig a 'lang' directory are skipped
'''
#************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:16:07
|
Revision: 614
http://fclient.svn.sourceforge.net/fclient/?rev=614&view=rev
Author: jUrner
Date: 2008-07-13 07:16:17 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
adapt to PyQt4 change
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/scripts/pylupdate.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/scripts/pylupdate.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/scripts/pylupdate.py 2008-07-13 14:15:14 UTC (rev 613)
+++ trunk/fclient/src/fclient/lib/qt4ex/scripts/pylupdate.py 2008-07-13 14:16:17 UTC (rev 614)
@@ -1,17 +1,18 @@
-"""Runs an update of language resources calling "pylupdate4"
+"""Runs an update of language resources calling "pylupdate"
"""
-import subprocess
+import subprocess, os
#*****************************************************************
#
#*****************************************************************
-def shell_exec(args):
+def shell_exec(args, cwd='.'):
p = subprocess.Popen(
args=args,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
+ cwd=cwd,
)
stdout, stderr = p.communicate()
if stdout: print stdout
@@ -23,7 +24,8 @@
"""
@param projectFile: *.pro
"""
- shell_exec('pylupdate4 "%s"' % projectFile)
+ d = os.path.dirname(projectFile)
+ shell_exec('pylupdate "%s"' % projectFile, cwd=d)
#*****************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <jU...@us...> - 2008-07-13 14:15:10
|
Revision: 613
http://fclient.svn.sourceforge.net/fclient/?rev=613&view=rev
Author: jUrner
Date: 2008-07-13 07:15:14 -0700 (Sun, 13 Jul 2008)
Log Message:
-----------
whitespace
Modified Paths:
--------------
trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
Modified: trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py
===================================================================
--- trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py 2008-07-13 14:14:48 UTC (rev 612)
+++ trunk/fclient/src/fclient/lib/qt4ex/lib/tools.py 2008-07-13 14:15:14 UTC (rev 613)
@@ -97,13 +97,6 @@
obj = mthd()
return obj, ok
castVariant =_castVariant.castVariant
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+#****************************************************************************
+#
+#****************************************************************************
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|