frogpie-commit Mailing List for frogpie (Page 3)
Status: Pre-Alpha
Brought to you by:
jurner
You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(49) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(178) |
Feb
(190) |
Mar
(195) |
Apr
(2) |
May
|
Jun
(79) |
Jul
(296) |
Aug
(297) |
Sep
(61) |
Oct
(1) |
Nov
(2) |
Dec
|
From: <jU...@us...> - 2007-09-03 16:00:39
|
Revision: 1323 http://frogpie.svn.sourceforge.net/frogpie/?rev=1323&view=rev Author: jUrner Date: 2007-09-03 02:47:48 -0700 (Mon, 03 Sep 2007) Log Message: ----------- update Modified Paths: -------------- trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/__init__.py Modified: trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui =================================================================== --- trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui 2007-09-03 07:50:58 UTC (rev 1322) +++ trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui 2007-09-03 09:47:48 UTC (rev 1323) @@ -53,6 +53,9 @@ <property name="text" > <string>About text here...</string> </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> <property name="textInteractionFlags" > <set>Qt::LinksAccessibleByMouse|Qt::NoTextInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> </property> Modified: trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py =================================================================== --- trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py 2007-09-03 07:50:58 UTC (rev 1322) +++ trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py 2007-09-03 09:47:48 UTC (rev 1323) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/me/src/proj/frogpie/trunk/sandbox/qt4ex/qt4ex/dlgs/about/about.ui' +# Form implementation generated from reading ui file '/home/me/src/proj/frogpie/trunk/sandbox/qt4ex/qt4ex/dlgs/dlgabout/DlgAbout.ui' # -# Created: Fri Aug 24 21:05:08 2007 +# Created: Mon Sep 3 11:37:45 2007 # by: PyQt4 UI code generator 4.3 # # WARNING! All changes made in this file will be lost! @@ -32,6 +32,7 @@ self.gridlayout.addWidget(self.line,1,0,1,1) self.label_about = QtGui.QLabel(DlgAbout) + self.label_about.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_about.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.NoTextInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) self.label_about.setObjectName("label_about") self.gridlayout.addWidget(self.label_about,0,0,1,1) Modified: trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/__init__.py =================================================================== --- trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/__init__.py 2007-09-03 07:50:58 UTC (rev 1322) +++ trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/dlgs/dlgabout/__init__.py 2007-09-03 09:47:48 UTC (rev 1323) @@ -1,4 +1,5 @@ import sys, os +import cPickle from PyQt4 import QtCore, QtGui from Ui_DlgAbout import Ui_DlgAbout @@ -6,9 +7,8 @@ d = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0, d) -import settingsbase, qtools +import qtools - sys.path.pop(0) del d #<-- rel import hack @@ -16,26 +16,15 @@ #********************************************************************* # #********************************************************************* -ID_LABEL_ABOUT = 'label_about' - -#***************************************************************** -# settings -#***************************************************************** -class DlgSettings(settingsbase.SettingsBase): - - KEY_SETTINGS = 'Qt4Ex/Dlgs/DlgAbout' - SETTINGS = [ - ('Geometry', ['UGeometry', None]), - ] - -#********************************************************************* -# -#********************************************************************* class DlgAbout(QtGui.QDialog, Ui_DlgAbout): + # control ids + IdLabelAbout = 'label_about' + + def __init__(self, parent, - settings=None, + state=None, caption=None, appName=None, description=None, @@ -46,24 +35,20 @@ copyright=None, ): """ - @param settings: qt4ex.settingsbase.Settings() object or None - - + @param state: formerly saved state of the dialog or None + @param caption: ttle of the dialog or None + @note: all other keyword params should be pretty self explanatory and + should be (str, QString). + """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self._settings = settings - if settings is not None: - self.dlgSettings = DlgSettings() - settings.readSettings(self, self.dlgSettings) - - if caption is not None: self.setWindowTitle(caption) - label = self.controlById(ID_LABEL_ABOUT) + label = self.controlById(self.IdLabelAbout) text = '' if appName is not None: @@ -89,24 +74,38 @@ text += '</ul>\n' label.setText(text) + # restore state + if state is not None: + self.restoreState(state) - def closeEvent(self, event): - self.close() - - - def hideEvent(self, event): - self.close() - - - def close(self): - if self._settings is not None: - self._settings.dumpSettings(self, self.dlgSettings) - - + def controlById(self, id_control): + """Returns a widget of the dialog given its id""" return getattr(self, id_control) - + + def saveState(self): + """Saves the state of the dialog + @return: (str) state + """ + return cPickle.dumps(self.saveGeometry(), 0) + + + def restoreState(self, state): + """Restores the state of the dialog + @param state: formerly saved state + @return True if successful, False otherwise + """ + result = False + try: + state = cPickle.loads(state) + except: pass + else: + try: + result = self.restoreGeometry(state) + except: pass + return result + #*********************************************************************** # #*********************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 15:52:21
|
Revision: 1332 http://frogpie.svn.sourceforge.net/frogpie/?rev=1332&view=rev Author: jUrner Date: 2007-09-03 05:20:40 -0700 (Mon, 03 Sep 2007) Log Message: ----------- bit of this and that Modified Paths: -------------- trunk/sandbox/qt4ex/qt4ex/qtools.py Modified: trunk/sandbox/qt4ex/qt4ex/qtools.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/qtools.py 2007-09-03 12:20:34 UTC (rev 1331) +++ trunk/sandbox/qt4ex/qt4ex/qtools.py 2007-09-03 12:20:40 UTC (rev 1332) @@ -54,6 +54,6 @@ return key in [int(i) for i in QtGui.QKeySequence.keyBindings(standardKey)] + - \ 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...> - 2007-09-03 15:22:41
|
Revision: 1338 http://frogpie.svn.sourceforge.net/frogpie/?rev=1338&view=rev Author: jUrner Date: 2007-09-03 05:22:49 -0700 (Mon, 03 Sep 2007) Log Message: ----------- updates Modified Paths: -------------- trunk/sandbox/colordip/MANIFEST trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/manifest.py trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/qtpro.py trunk/sandbox/colordip/updateProject.py Added Paths: ----------- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/pylupdate.py Modified: trunk/sandbox/colordip/MANIFEST =================================================================== --- trunk/sandbox/colordip/MANIFEST 2007-09-03 12:22:17 UTC (rev 1337) +++ trunk/sandbox/colordip/MANIFEST 2007-09-03 12:22:49 UTC (rev 1338) @@ -35,6 +35,7 @@ colordip/colordip_lib/qt4ex/res/language/LangCodes-ISO 639-1.txt colordip/colordip_lib/qt4ex/scripts/__init__.py colordip/colordip_lib/qt4ex/scripts/manifest.py +colordip/colordip_lib/qt4ex/scripts/pylupdate.py colordip/colordip_lib/qt4ex/scripts/qtpro.py colordip/colordip_dlgs/Ui_preferences.py colordip/colordip_dlgs/__init__.py Modified: trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/manifest.py =================================================================== --- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/manifest.py 2007-09-03 12:22:17 UTC (rev 1337) +++ trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/manifest.py 2007-09-03 12:22:49 UTC (rev 1338) @@ -1,7 +1,7 @@ """ommandline script to create a distutils MANIFEST file from all files in a folder (recursively) -The folders 'dist', 'sdist' and a directory 'data' are skipped by default +The folders 'dist', 'sdist' and a directory 'data' and 'sandbox' are skipped by default """ @@ -20,7 +20,10 @@ #****************************************************************** # #****************************************************************** -def create_manifest(directory): +def createManifest(directory): + """Creates a MANIFEST file for the specified directory + @return: filepath of the MANIFEST file + """ def include_file(file_name): @@ -36,7 +39,7 @@ def include_dir(dir_name): if not dir_name.startswith('.'): - if dir_name not in ('build', 'dist', 'data'): ################### + if dir_name not in ('build', 'dist', 'data', 'sandbox'): ################### return True return False @@ -55,9 +58,9 @@ else: for root, dirs, files in os.walk(directory): - exclude_dirs = [i for i in dirs if not include_dir(i)] for d in exclude_dirs: + print 'skipping directory: ' + to_relpath(directory, root, d) dirs.remove(d) include_files = [to_relpath(directory, root, i) for i in files if include_file(i)] @@ -67,17 +70,19 @@ yield relpath # - fp = open(os.path.join(directory, 'MANIFEST'), 'w') + fpath_manifest = os.path.join(directory, 'MANIFEST') + fp = open(fpath_manifest, 'w') try: for relpath in walk_directory(directory): fp.write(relpath + '\n') finally: fp.close() print '<done>' + return fpath_manifest def main(directory): - create_manifest(directory) + createManifest(directory) #****************************************************************** # Added: trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/pylupdate.py =================================================================== --- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/pylupdate.py (rev 0) +++ trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/pylupdate.py 2007-09-03 12:22:49 UTC (rev 1338) @@ -0,0 +1,35 @@ +"""Runs an update of language resources calling "pylupdate4" +""" + +import subprocess +#***************************************************************** +# +#***************************************************************** +def shell_exec(args): + + p = subprocess.Popen( + args=args, + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + stdout, stderr = p.communicate() + if stdout: print stdout + if stderr: print stderr + + + +def main(projectFile): + """ + @param projectFile: *.pro + """ + shell_exec('pylupdate4 "%s"' % projectFile) + + +#***************************************************************** +# +#***************************************************************** +if __name__ == '__main__': + import sys + if len(sys.argv) > 1: + sys.exit(main(sys.argv[1])) \ No newline at end of file Modified: trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/qtpro.py =================================================================== --- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/qtpro.py 2007-09-03 12:22:17 UTC (rev 1337) +++ trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/scripts/qtpro.py 2007-09-03 12:22:49 UTC (rev 1338) @@ -31,6 +31,7 @@ DefaultLocales = ('en', ) +DefaultPrefix = 'qt4ex_' #********************************************************************** # #********************************************************************** @@ -40,11 +41,12 @@ return 'lang' in dirs -def main(directory, locales=DefaultLocales): +def createProjectFile(directory, locales=DefaultLocales, prefix=DefaultPrefix): """Creates a Qt *.pro project file @param directory: diretory tree to create a project file for @param locales: (list) of locale names to add translations for - + @param prefix: prefix to add to the traslation files + @return: filepath of the project file created """ directory = removeSlashes(directory) @@ -104,16 +106,16 @@ print 'ok' for locale in locales: - tr_file = os.path.join(tr_dir_name, locale + '.ts') + tr_file = os.path.join(tr_dir_name, prefix + locale + '.ts') print 'adding translation: ' + tr_file project_files['tr'].append(tr_file) print 'ok' - proj_fpath = os.path.join(directory, proj_name + '.pro') - print 'writing project: ' + proj_fpath - with open(proj_fpath, 'w') as fp: + fpath_project = os.path.join(directory, proj_name + '.pro') + print 'writing project: ' + fpath_project + with open(fpath_project, 'w') as fp: fp.write('SOURCES = ') fp.write(' \\\n\t\t\t\t'.join(project_files['py']) ) @@ -126,7 +128,11 @@ print 'ok' print 'done' + return fpath_project +def main(directory, locales=DefaultLocales, prefix=DefaultPrefix): + cretaeProjectFile(directory, locales=DefaultLocales, prefix=DefaultPrefix) + #***************************************************************** # #***************************************************************** Modified: trunk/sandbox/colordip/updateProject.py =================================================================== --- trunk/sandbox/colordip/updateProject.py 2007-09-03 12:22:17 UTC (rev 1337) +++ trunk/sandbox/colordip/updateProject.py 2007-09-03 12:22:49 UTC (rev 1338) @@ -13,9 +13,9 @@ #**************************************************************** if __name__ == '__main__': d = os.path.dirname(__file__) - manifest.main(d) + manifest = manifest.createManifest(d) d = os.path.join(d, 'colordip') - qtpro.main(d, locales=Locales) + pro = qtpro.createProjectFile(d, locales=Locales, prefix='colordip_') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 15:03:13
|
Revision: 1330 http://frogpie.svn.sourceforge.net/frogpie/?rev=1330&view=rev Author: jUrner Date: 2007-09-03 05:20:29 -0700 (Mon, 03 Sep 2007) Log Message: ----------- bit of this and that Modified Paths: -------------- trunk/sandbox/qt4ex/qt4ex/scripts/qtpro.py Modified: trunk/sandbox/qt4ex/qt4ex/scripts/qtpro.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/scripts/qtpro.py 2007-09-03 12:19:57 UTC (rev 1329) +++ trunk/sandbox/qt4ex/qt4ex/scripts/qtpro.py 2007-09-03 12:20:29 UTC (rev 1330) @@ -31,6 +31,7 @@ DefaultLocales = ('en', ) +DefaultPrefix = 'qt4ex_' #********************************************************************** # #********************************************************************** @@ -40,11 +41,12 @@ return 'lang' in dirs -def main(directory, locales=DefaultLocales): +def createProjectFile(directory, locales=DefaultLocales, prefix=DefaultPrefix): """Creates a Qt *.pro project file @param directory: diretory tree to create a project file for @param locales: (list) of locale names to add translations for - + @param prefix: prefix to add to the traslation files + @return: filepath of the project file created """ directory = removeSlashes(directory) @@ -104,16 +106,16 @@ print 'ok' for locale in locales: - tr_file = os.path.join(tr_dir_name, locale + '.ts') + tr_file = os.path.join(tr_dir_name, prefix + locale + '.ts') print 'adding translation: ' + tr_file project_files['tr'].append(tr_file) print 'ok' - proj_fpath = os.path.join(directory, proj_name + '.pro') - print 'writing project: ' + proj_fpath - with open(proj_fpath, 'w') as fp: + fpath_project = os.path.join(directory, proj_name + '.pro') + print 'writing project: ' + fpath_project + with open(fpath_project, 'w') as fp: fp.write('SOURCES = ') fp.write(' \\\n\t\t\t\t'.join(project_files['py']) ) @@ -126,7 +128,11 @@ print 'ok' print 'done' + return fpath_project +def main(directory, locales=DefaultLocales, prefix=DefaultPrefix): + cretaeProjectFile(directory, locales=DefaultLocales, prefix=DefaultPrefix) + #***************************************************************** # #***************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 14:13:54
|
Revision: 1333 http://frogpie.svn.sourceforge.net/frogpie/?rev=1333&view=rev Author: jUrner Date: 2007-09-03 05:21:00 -0700 (Mon, 03 Sep 2007) Log Message: ----------- added translations Added Paths: ----------- trunk/sandbox/qt4ex/qt4ex/lang/qt4ex_de.ts trunk/sandbox/qt4ex/qt4ex/lang/qt4ex_en.ts Added: trunk/sandbox/qt4ex/qt4ex/lang/qt4ex_de.ts =================================================================== --- trunk/sandbox/qt4ex/qt4ex/lang/qt4ex_de.ts (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/lang/qt4ex_de.ts 2007-09-03 12:21:00 UTC (rev 1333) @@ -0,0 +1,928 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name>Assistant</name> + <message> + <location filename="assistant.py" line="70"/> + <source>Qt assistant error</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="assistant.py" line="110"/> + <source>Can not display help. Assistant is not installed</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="assistant.py" line="114"/> + <source>Can not display help. No such page: </source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="assistant.py" line="116"/> + <source>Can not display help. Page not found: </source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>DlgAbout</name> + <message> + <location filename="dlgs/dlgabout/Ui_DlgAbout.py" line="46"/> + <source>About</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgabout/Ui_DlgAbout.py" line="47"/> + <source>About text here...</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>DlgActionReplace</name> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="240"/> + <source>Replace...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="242"/> + <source>Find...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="284"/> + <source>Ready</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="300"/> + <source>Replaced:</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="302"/> + <source>Found:</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>DlgFindReplace</name> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="147"/> + <source>FindReplace...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="148"/> + <source>Find:</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="149"/> + <source>Replace:</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="150"/> + <source>&Find Next</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="151"/> + <source>Ctrl+F</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="152"/> + <source>&Upwards</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="153"/> + <source>Ctrl+U</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="154"/> + <source>&Replace</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="155"/> + <source>Ctrl+R</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="156"/> + <source>Replace &All</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="157"/> + <source>Ctrl+A</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="158"/> + <source>O&k</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="159"/> + <source>Ctrl+K</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="160"/> + <source>Whole &Word</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="161"/> + <source>Custom &1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="162"/> + <source>Match &Case</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="163"/> + <source>Custom &2</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="164"/> + <source>Regular E&xpression</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="165"/> + <source>Custom &3</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="166"/> + <source>Status</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>DlgPreferencesTree</name> + <message> + <location filename="dlgs/dlgpreferences/Ui_DlgPreferencesTree.py" line="45"/> + <source>Preferences</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgpreferences/Ui_DlgPreferencesTree.py" line="46"/> + <source>1</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>LanguageNames</name> + <message> + <location filename="language.py" line="71"/> + <source>Oromo</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="72"/> + <source>Abkhazian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="73"/> + <source>Afar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="74"/> + <source>Afrikaans</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="75"/> + <source>Albanian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="76"/> + <source>Amharic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="77"/> + <source>Arabic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="78"/> + <source>Armenian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="79"/> + <source>Assamese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="80"/> + <source>Aymara</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="81"/> + <source>Azerbaijani</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="82"/> + <source>Bashkir</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="83"/> + <source>Basque</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="84"/> + <source>Bengali</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="85"/> + <source>Bhutani</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="86"/> + <source>Bihari</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="87"/> + <source>Bislama</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="88"/> + <source>Breton</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="89"/> + <source>Bulgarian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="90"/> + <source>Burmese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="91"/> + <source>Byelorussian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="92"/> + <source>Cambodian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="93"/> + <source>Catalan</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="94"/> + <source>Chinese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="95"/> + <source>Corsican</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="96"/> + <source>Croatian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="97"/> + <source>Czech</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="98"/> + <source>Danish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="99"/> + <source>Dutch</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="100"/> + <source>English</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="101"/> + <source>Esperanto</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="102"/> + <source>Estonian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="103"/> + <source>Faeroese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="104"/> + <source>Fiji</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="105"/> + <source>Finnish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="106"/> + <source>French</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="107"/> + <source>Frisian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="108"/> + <source>Galician</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="109"/> + <source>Georgian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="110"/> + <source>German</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="111"/> + <source>Greek</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="112"/> + <source>Greenlandic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="113"/> + <source>Guarani</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="114"/> + <source>Gujarati</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="115"/> + <source>Hausa</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="116"/> + <source>Hebrew</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="117"/> + <source>Hindi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="118"/> + <source>Hungarian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="119"/> + <source>Icelandic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="120"/> + <source>Indonesian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="121"/> + <source>Interlingua</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="122"/> + <source>Interlingue</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="123"/> + <source>Inupiak</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="124"/> + <source>Inuktitut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="125"/> + <source>Irish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="126"/> + <source>Italian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="127"/> + <source>Japanese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="128"/> + <source>Javanese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="129"/> + <source>Kannada</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="130"/> + <source>Kashmiri</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="131"/> + <source>Kazakh</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="132"/> + <source>Kinyarwanda</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="133"/> + <source>Kirghiz</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="134"/> + <source>Kirundi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="135"/> + <source>Korean</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="136"/> + <source>Kurdish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="137"/> + <source>Laothian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="138"/> + <source>Latin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="139"/> + <source>Latvian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="140"/> + <source>Lingala</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="141"/> + <source>Lithuanian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="142"/> + <source>Macedonian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="143"/> + <source>Malagasy</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="144"/> + <source>Malay</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="145"/> + <source>Malayalam</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="146"/> + <source>Maltese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="147"/> + <source>Maori</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="148"/> + <source>Marathi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="149"/> + <source>Moldavian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="150"/> + <source>Mongolian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="151"/> + <source>Nauru</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="152"/> + <source>Nepali</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="153"/> + <source>Norwegian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="154"/> + <source>Occitan</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="155"/> + <source>Oriya</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="156"/> + <source>Pashto</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="157"/> + <source>Persian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="158"/> + <source>Polish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="159"/> + <source>Portuguese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="160"/> + <source>Punjabi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="161"/> + <source>Quechua</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="162"/> + <source>Rhaeto-Romance</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="163"/> + <source>Romanian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="164"/> + <source>Russian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="165"/> + <source>Samoan</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="166"/> + <source>Sangro</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="167"/> + <source>Sanskrit</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="168"/> + <source>Scots Gaelic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="169"/> + <source>Serbian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="170"/> + <source>Serbo-Croatian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="171"/> + <source>Sesotho</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="172"/> + <source>Setswana</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="173"/> + <source>Shona</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="174"/> + <source>Sindhi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="175"/> + <source>Singhalese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="176"/> + <source>Siswati</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="177"/> + <source>Slovak</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="178"/> + <source>Slovenian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="179"/> + <source>Somali</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="180"/> + <source>Spanish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="181"/> + <source>Sudanese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="182"/> + <source>Swahili</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="183"/> + <source>Swedish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="184"/> + <source>Tagalog</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="185"/> + <source>Tajik</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="186"/> + <source>Tamil</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="187"/> + <source>Tatar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="188"/> + <source>Tegulu</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="189"/> + <source>Thai</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="190"/> + <source>Tibetan</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="191"/> + <source>Tigrinya</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="192"/> + <source>Tonga</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="193"/> + <source>Tsonga</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="194"/> + <source>Turkish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="195"/> + <source>Turkmen</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="196"/> + <source>Twi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="197"/> + <source>Uigur</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="198"/> + <source>Ukrainian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="199"/> + <source>Urdu</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="200"/> + <source>Uzbek</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="201"/> + <source>Vietnamese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="202"/> + <source>Volapuk</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="203"/> + <source>Welch</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="204"/> + <source>Wolof</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="205"/> + <source>Xhosa</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="206"/> + <source>Yiddish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="207"/> + <source>Yoruba</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="208"/> + <source>Zhuang</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="209"/> + <source>Zulu</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Page</name> + <message> + <location filename="dlgs/dlgpreferences/__init__.py.py" line="63"/> + <source>Page</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Page1</name> + <message> + <location filename="dlgs/dlgpreferences/__init__.py.py" line="636"/> + <source>MyPage-1</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>Page2</name> + <message> + <location filename="dlgs/dlgpreferences/__init__.py.py" line="659"/> + <source>MyPage-2</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>ToolBarMenuWrap</name> + <message> + <location filename="ctrls/toolbarwrap.py" line="113"/> + <source>Icons only</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="ctrls/toolbarwrap.py" line="114"/> + <source>Text only</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="ctrls/toolbarwrap.py" line="115"/> + <source>Text next to icons</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="ctrls/toolbarwrap.py" line="116"/> + <source>Text under icons</source> + <translation type="unfinished"></translation> + </message> +</context> +</TS> Added: trunk/sandbox/qt4ex/qt4ex/lang/qt4ex_en.ts =================================================================== --- trunk/sandbox/qt4ex/qt4ex/lang/qt4ex_en.ts (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/lang/qt4ex_en.ts 2007-09-03 12:21:00 UTC (rev 1333) @@ -0,0 +1,928 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS><TS version="1.1"> +<context> + <name>Assistant</name> + <message> + <location filename="assistant.py" line="70"/> + <source>Qt assistant error</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="assistant.py" line="110"/> + <source>Can not display help. Assistant is not installed</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="assistant.py" line="114"/> + <source>Can not display help. No such page: </source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="assistant.py" line="116"/> + <source>Can not display help. Page not found: </source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>DlgAbout</name> + <message> + <location filename="dlgs/dlgabout/Ui_DlgAbout.py" line="46"/> + <source>About</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgabout/Ui_DlgAbout.py" line="47"/> + <source>About text here...</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>DlgActionReplace</name> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="240"/> + <source>Replace...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="242"/> + <source>Find...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="284"/> + <source>Ready</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="300"/> + <source>Replaced:</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/__init__.py" line="302"/> + <source>Found:</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>DlgFindReplace</name> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="147"/> + <source>FindReplace...</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="148"/> + <source>Find:</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="149"/> + <source>Replace:</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="150"/> + <source>&Find Next</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="151"/> + <source>Ctrl+F</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="152"/> + <source>&Upwards</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="153"/> + <source>Ctrl+U</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="154"/> + <source>&Replace</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="155"/> + <source>Ctrl+R</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="156"/> + <source>Replace &All</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="157"/> + <source>Ctrl+A</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="158"/> + <source>O&k</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="159"/> + <source>Ctrl+K</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="160"/> + <source>Whole &Word</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="161"/> + <source>Custom &1</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="162"/> + <source>Match &Case</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="163"/> + <source>Custom &2</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="164"/> + <source>Regular E&xpression</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="165"/> + <source>Custom &3</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgfindreplace/Ui_DlgFindReplace.py" line="166"/> + <source>Status</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>DlgPreferencesTree</name> + <message> + <location filename="dlgs/dlgpreferences/Ui_DlgPreferencesTree.py" line="45"/> + <source>Preferences</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="dlgs/dlgpreferences/Ui_DlgPreferencesTree.py" line="46"/> + <source>1</source> + <translation type="unfinished"></translation> + </message> +</context> +<context> + <name>LanguageNames</name> + <message> + <location filename="language.py" line="71"/> + <source>Oromo</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="72"/> + <source>Abkhazian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="73"/> + <source>Afar</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="74"/> + <source>Afrikaans</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="75"/> + <source>Albanian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="76"/> + <source>Amharic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="77"/> + <source>Arabic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="78"/> + <source>Armenian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="79"/> + <source>Assamese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="80"/> + <source>Aymara</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="81"/> + <source>Azerbaijani</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="82"/> + <source>Bashkir</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="83"/> + <source>Basque</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="84"/> + <source>Bengali</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="85"/> + <source>Bhutani</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="86"/> + <source>Bihari</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="87"/> + <source>Bislama</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="88"/> + <source>Breton</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="89"/> + <source>Bulgarian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="90"/> + <source>Burmese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="91"/> + <source>Byelorussian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="92"/> + <source>Cambodian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="93"/> + <source>Catalan</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="94"/> + <source>Chinese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="95"/> + <source>Corsican</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="96"/> + <source>Croatian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="97"/> + <source>Czech</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="98"/> + <source>Danish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="99"/> + <source>Dutch</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="100"/> + <source>English</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="101"/> + <source>Esperanto</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="102"/> + <source>Estonian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="103"/> + <source>Faeroese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="104"/> + <source>Fiji</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="105"/> + <source>Finnish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="106"/> + <source>French</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="107"/> + <source>Frisian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="108"/> + <source>Galician</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="109"/> + <source>Georgian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="110"/> + <source>German</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="111"/> + <source>Greek</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="112"/> + <source>Greenlandic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="113"/> + <source>Guarani</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="114"/> + <source>Gujarati</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="115"/> + <source>Hausa</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="116"/> + <source>Hebrew</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="117"/> + <source>Hindi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="118"/> + <source>Hungarian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="119"/> + <source>Icelandic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="120"/> + <source>Indonesian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="121"/> + <source>Interlingua</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="122"/> + <source>Interlingue</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="123"/> + <source>Inupiak</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="124"/> + <source>Inuktitut</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="125"/> + <source>Irish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="126"/> + <source>Italian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="127"/> + <source>Japanese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="128"/> + <source>Javanese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="129"/> + <source>Kannada</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="130"/> + <source>Kashmiri</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="131"/> + <source>Kazakh</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="132"/> + <source>Kinyarwanda</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="133"/> + <source>Kirghiz</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="134"/> + <source>Kirundi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="135"/> + <source>Korean</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="136"/> + <source>Kurdish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="137"/> + <source>Laothian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="138"/> + <source>Latin</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="139"/> + <source>Latvian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="140"/> + <source>Lingala</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="141"/> + <source>Lithuanian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="142"/> + <source>Macedonian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="143"/> + <source>Malagasy</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="144"/> + <source>Malay</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="145"/> + <source>Malayalam</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="146"/> + <source>Maltese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="147"/> + <source>Maori</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="148"/> + <source>Marathi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="149"/> + <source>Moldavian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="150"/> + <source>Mongolian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="151"/> + <source>Nauru</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="152"/> + <source>Nepali</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="153"/> + <source>Norwegian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="154"/> + <source>Occitan</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="155"/> + <source>Oriya</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="156"/> + <source>Pashto</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="157"/> + <source>Persian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="158"/> + <source>Polish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="159"/> + <source>Portuguese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="160"/> + <source>Punjabi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="161"/> + <source>Quechua</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="162"/> + <source>Rhaeto-Romance</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="163"/> + <source>Romanian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="164"/> + <source>Russian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="165"/> + <source>Samoan</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="166"/> + <source>Sangro</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="167"/> + <source>Sanskrit</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="168"/> + <source>Scots Gaelic</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="169"/> + <source>Serbian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="170"/> + <source>Serbo-Croatian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="171"/> + <source>Sesotho</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="172"/> + <source>Setswana</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="173"/> + <source>Shona</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="174"/> + <source>Sindhi</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="175"/> + <source>Singhalese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="176"/> + <source>Siswati</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="177"/> + <source>Slovak</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="178"/> + <source>Slovenian</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="179"/> + <source>Somali</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="180"/> + <source>Spanish</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="181"/> + <source>Sudanese</source> + <translation type="unfinished"></translation> + </message> + <message> + <location filename="language.py" line="182"/> + <source>Swahili</source> + <translation type="unfinished"></translation> + </message> + ... [truncated message content] |
From: <jU...@us...> - 2007-09-03 13:57:34
|
Revision: 1328 http://frogpie.svn.sourceforge.net/frogpie/?rev=1328&view=rev Author: jUrner Date: 2007-09-03 03:29:57 -0700 (Mon, 03 Sep 2007) Log Message: ----------- new prefernces dialog Added Paths: ----------- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/DlgPreferencesTree.ui trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/Ui_DlgPreferencesTree.py trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/__init__.py.py Property changes on: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences ___________________________________________________________________ Name: svn:ignore + *.pyc *.pyo Added: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/DlgPreferencesTree.ui =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/DlgPreferencesTree.ui (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/DlgPreferencesTree.ui 2007-09-03 10:29:57 UTC (rev 1328) @@ -0,0 +1,85 @@ +<ui version="4.0" > + <class>DlgPreferencesTree</class> + <widget class="QDialog" name="DlgPreferencesTree" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>526</width> + <height>493</height> + </rect> + </property> + <property name="windowTitle" > + <string>Preferences</string> + </property> + <layout class="QGridLayout" > + <item row="0" column="0" > + <widget class="QSplitter" name="splitter" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <widget class="QTreeWidget" name="treePages" > + <column> + <property name="text" > + <string>1</string> + </property> + </column> + </widget> + <widget class="QFrame" name="framePages" > + <property name="frameShape" > + <enum>QFrame::StyledPanel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Raised</enum> + </property> + </widget> + </widget> + </item> + <item row="1" column="0" > + <widget class="QDialogButtonBox" name="buttonBox" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + <property name="standardButtons" > + <set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::NoButton|QDialogButtonBox::Ok|QDialogButtonBox::RestoreDefaults</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>buttonBox</sender> + <signal>accepted()</signal> + <receiver>DlgPreferencesTree</receiver> + <slot>accept()</slot> + <hints> + <hint type="sourcelabel" > + <x>248</x> + <y>254</y> + </hint> + <hint type="destinationlabel" > + <x>157</x> + <y>274</y> + </hint> + </hints> + </connection> + <connection> + <sender>buttonBox</sender> + <signal>rejected()</signal> + <receiver>DlgPreferencesTree</receiver> + <slot>reject()</slot> + <hints> + <hint type="sourcelabel" > + <x>316</x> + <y>260</y> + </hint> + <hint type="destinationlabel" > + <x>286</x> + <y>274</y> + </hint> + </hints> + </connection> + </connections> +</ui> Added: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/Ui_DlgPreferencesTree.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/Ui_DlgPreferencesTree.py (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/Ui_DlgPreferencesTree.py 2007-09-03 10:29:57 UTC (rev 1328) @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/proj/frogpie/trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/DlgPreferencesTree.ui' +# +# Created: Mon Sep 3 12:28:26 2007 +# by: PyQt4 UI code generator 4.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_DlgPreferencesTree(object): + def setupUi(self, DlgPreferencesTree): + DlgPreferencesTree.setObjectName("DlgPreferencesTree") + DlgPreferencesTree.resize(QtCore.QSize(QtCore.QRect(0,0,526,493).size()).expandedTo(DlgPreferencesTree.minimumSizeHint())) + + self.gridlayout = QtGui.QGridLayout(DlgPreferencesTree) + self.gridlayout.setObjectName("gridlayout") + + self.splitter = QtGui.QSplitter(DlgPreferencesTree) + self.splitter.setOrientation(QtCore.Qt.Horizontal) + self.splitter.setObjectName("splitter") + + self.treePages = QtGui.QTreeWidget(self.splitter) + self.treePages.setObjectName("treePages") + + self.framePages = QtGui.QFrame(self.splitter) + self.framePages.setFrameShape(QtGui.QFrame.StyledPanel) + self.framePages.setFrameShadow(QtGui.QFrame.Raised) + self.framePages.setObjectName("framePages") + self.gridlayout.addWidget(self.splitter,0,0,1,1) + + self.buttonBox = QtGui.QDialogButtonBox(DlgPreferencesTree) + self.buttonBox.setOrientation(QtCore.Qt.Horizontal) + self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Apply|QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Help|QtGui.QDialogButtonBox.NoButton|QtGui.QDialogButtonBox.Ok|QtGui.QDialogButtonBox.RestoreDefaults) + self.buttonBox.setObjectName("buttonBox") + self.gridlayout.addWidget(self.buttonBox,1,0,1,1) + + self.retranslateUi(DlgPreferencesTree) + QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),DlgPreferencesTree.accept) + QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),DlgPreferencesTree.reject) + QtCore.QMetaObject.connectSlotsByName(DlgPreferencesTree) + + def retranslateUi(self, DlgPreferencesTree): + DlgPreferencesTree.setWindowTitle(QtGui.QApplication.translate("DlgPreferencesTree", "Preferences", None, QtGui.QApplication.UnicodeUTF8)) + self.treePages.headerItem().setText(0,QtGui.QApplication.translate("DlgPreferencesTree", "1", None, QtGui.QApplication.UnicodeUTF8)) + + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + DlgPreferencesTree = QtGui.QDialog() + ui = Ui_DlgPreferencesTree() + ui.setupUi(DlgPreferencesTree) + DlgPreferencesTree.show() + sys.exit(app.exec_()) Added: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/__init__.py.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/__init__.py.py (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgpreferences/__init__.py.py 2007-09-03 10:29:57 UTC (rev 1328) @@ -0,0 +1,719 @@ +import sys, os +import cPickle + +from PyQt4 import QtCore, QtGui +from Ui_DlgPreferencesTree import Ui_DlgPreferencesTree + +#********************************************************************* +# +#********************************************************************* +class Page(QtCore.QObject): + + _page_version_ = 1 # unique version number + + + def __init__(self, uuid): + """ + @param uuid: unique id of the page. + + @note: currrently no check is done to eshure the uuid is unique throughout the tree of pages. + """ + QtCore.QObject.__init__(self) + self._page_data = { # internal state data + 'children': [], + 'isDirty': False, + 'parent': None, + 'userData': None, + 'uuid': uuid, + } + + + def __call__(self, *others): + """Adds one or more pages as child pages to a page""" + children = self._page_data['children'] + for i in others: + children.append(i) + i._page_data['parent'] = self + return self + + + def canApply(self): + """Should return a flag indicating if changes can be emidiatey applied by the page""" + return False + + def canHelp(self): + """Should return a flag indicating if a help page is available for the page""" + return False + + def canRestoreDefaults(self): + """Should return a flag indicating if the page can rstore default value""" + return False + + def children(self): + """Returns a list containing all emidiate child pages of the page""" + return self._page_data['children'] + + + def displayName(self): + """Should return the name of the page as it is to be displayed by the preferences dialog + @return: QString + """ + return self.trUtf8('Page') + + def doApply(self): + """Should apply changes made + @return: True on success, False otherisde + """ + return True + + def doCancel(self): + """Should cancel all changes made + @return: True on success, False otherisde + """ + return True + + def doOk(self): + """Should apply changes + @return: True on success, False otherisde + """ + return True + + def doRestoreDefaults(self): + """Should restore defaults + @return: True on success, False otherisde + """ + return True + + def doHelp(self): + """Should pop up a help page for the page""" + + def icon(self): + """Should return the icon associated to a page or None""" + + def isDirty(self): + """Should return a flag indicating if the page has unsaved changes""" + return self._page_data['isDirty'] + + + def pageFromUuid(self, uuid): + """Traverses the page and all its children to return a page given its uuid + @return: page or None if no page was found""" + for flag, page in self.walk(): + if page.uuid() == uuid: + return page + + + def parent(self): + """Returns the parent page of the page""" + return self._page_data['parent'] + + + def setDirty(self, flag): + """Sets or clears the dirty flag""" + self._page_data['isDirty'] = bool(flag) + self.emit(QtCore.SIGNAL('setDirty(bool)'), self._page_data['isDirty']) + + + def setUserData(self, data): + """Assignes any user data to the page + @param data: any data + @note: user data is reserved to Ui implementations displaying pages. + Do not use. + """ + self._page_data['userData'] = data + + + def setVisible(self, parent, flag): + """Should show or hide the page or create it if not already done + + @param parent: parent widget + @param flag: True if the page is to be shown, False if it is to be hidden + @return: tuple(bool createdNew, QWidget widget) + + sample code: + + class MyPage(Page): + + def __init__(self, *args): + Page.__init__(self, *args) + self._widget = None + + def setVisible(self, parent, flag): + createdNew = False + if flag and self._widget is None: + self._widget = self.CreateMyWidget(parent) + createdNew = True + self._widget.setVisible(flag) + return (createdNew, self._widget) + """ + return (False, None) + + def userData(self): + """Returns internal user data""" + return self._page_data['userData'] + + + def uuid(self): + """Returns the uuid of the page""" + return self._page_data['uuid'] + + def walk(self): + """Walks over a page and all its children + @return: tupple(flag, page) for the next page in turn + where flag is 1 if a page is a container for child pages, 0 if a page has no child pages + and -1 if traversal of a pages child pages is completed + """ + def walker(item): + children = item.children() + if children: + yield 1, item + for i in children: + for x in walker(i): + yield x + yield -1, item + else: + yield 0, item + return iter(walker(self)) + +#********************************************************************* +# +#********************************************************************* +class PageControler(QtCore.QObject): + """Controler for pages""" + + PageQueryParent = 1 + PageAdd = 2 + + PrefixCapability = 'can' + PrefixCapabilityApply = 'do' + MethodNameIsDirty = 'isDirty' + + + def __init__(self, ui, cb, pageContainer, buttonBox, maxPageDepth=None, pages=None): + """ + @param ui: (QDialog) parent + @param cb: callback + @param pageContainer: (QWidget) displaying pages + @param maxPageDepth: (int) maximum nesting depth of pages. If None pages + may be nested up to sys.maxint + @param opages: tree of ppages to control + + @note: the callback will be called with three arguments: + + 1. one of the Page* consts to indicate the action + 2. message dependend param + 3. message dependend param + + messages: + + 1. PageQueryParent = the parent for all pages is requested + param1 = param2 = always none + return = (QWidget) parent + note = the parent returned will be passed + as param1 to all toplevel calls to PageAdd + + 2. PageAdd = a page should be added. + param1 = return value of the last call to PageAdd the parent page or None + param2 = the page to be added + return = will be passed in the next call of PageAdd to all emidiate child pages + + """ + QtCore.QObject.__init__(self, ui) + + self.buttonBox = buttonBox + self.cb = cb + self.grid = QtGui.QGridLayout(pageContainer) + self.lastPage = None + self.pageContainer = pageContainer + self.pages = pages + self.ui = ui + + # buttons handld by the controler + self.buttonBoxButtons = { + QtGui.QDialogButtonBox.Apply: 'Apply', + QtGui.QDialogButtonBox.Cancel: 'Cancel', + QtGui.QDialogButtonBox.Help: 'Help', + QtGui.QDialogButtonBox.Ok: 'Ok', + QtGui.QDialogButtonBox.RestoreDefaults: 'RestoreDefaults', + } + # page depandend buttons of the button box + self.buttonBoxOptionalButtons = ( + QtGui.QDialogButtonBox.Apply, + QtGui.QDialogButtonBox.Help, + QtGui.QDialogButtonBox.RestoreDefaults, + ) + + + # dump sections and pages to tree + if pages is not None: + + # drop root item + enum = iter(pages.walk()) + flag, root = enum.next() + + # dump items + parent = self.cb(self.PageQueryParent, None, None) + pageStack = [parent, ] + for flag, page in enum: + if flag == -1: + pageStack.pop() + continue + page.setParent(parent) + result = self.cb(self.PageAdd, pageStack[-1], page) + + if flag == 1: + if maxPageDepth is not None: + if len(pageStack) > maxPageDepth: + raise ValueError('Pages nested to deeply (%s level allowed)' % maxPageDepth) + pageStack.append(result) + + # setup button box + self.connect( + buttonBox, + QtCore.SIGNAL('clicked(QAbstractButton*)'), + self.onStandardButtonClicked + ) + self.adjustStandardButtons(None) + + + + ################################################ + ## slots + ################################################ + def onPageDirtyChanged(self, flag): + bt = self.buttonBox.button(QtGui.QDialogButtonBox.Apply) + if bt.isVisible(): + bt.setEnabled(flag) + + + def onStandardButtonClicked(self, button): + if self.lastPage is None: + return + + page = self.lastPage[0] + standardButton = self.buttonBox.standardButton(button) + standardButtonName = self.buttonBoxButtons.get(standardButton, None) + if standardButtonName is not None: + methodName = self.PrefixCapabilityApply + standardButtonName + method = getattr(page, methodName, None) + if method is None: + raise valueError('Pages must prvide a "%s" method' % methodName) + if method(): + if standardButton == QtGui.QDialogButtonBox.Apply: + page.setDirty(False) + + + ################################################## + ## methods + ################################################## + def adjustStandardButtons(self, page): + + for standardButton in self.buttonBoxOptionalButtons: + bt = self.buttonBox.button(standardButton) + if bt is None: + standardButtonName = self.buttonBoxButtons[standardButton] + raise ValueError('Button not found: ' + standardButtonName) + + # show / hide standard buttons + flag = False + if page is not None: + standardButtonName = self.buttonBoxButtons[standardButton] + methodName = self.PrefixCapability + standardButtonName + method = getattr(page, methodName, None) + if method is None: + raise valueError('Pages must prvide a "%s" method' % methodName) + flag = method() + bt.setEnabled(flag) + bt.setVisible(flag) + + # enable Apply button if necessary + if flag and standardButton == QtGui.QDialogButtonBox.Apply: + method = getattr(page, self.MethodNameIsDirty, None) + if method is None: + raise valueError('Pages must prvide a "%s" method' % self.MethodNameIsDirty) + bt.setEnabled(method()) + + + def currentPage(self): + """Returns the currently displayed page or None""" + if self.lastPage is not None: + return self.lastPage[0] + + + def currentPageUuid(self): + """Returns the uuid of the current page or None""" + page = self.currentPage() + if page is not None: + return page.uuid() + + + def setCurrentPage(self, page): + """Displays a page""" + + # hide last page + if self.lastPage is not None: + oldPage, oldWidget = self.lastPage + if oldPage == page: + return + oldPage.setVisible(self.pageContainer, False) + self.grid.removeWidget(oldWidget) + self.disconnect( + page, + QtCore.SIGNAL('setDirty(bool)'), + self.onPageDirtyChanged + ) + self.lastPage = None + + # show next page + createdNew, widget = page.setVisible(self.pageContainer, True) + self.lastPage = (page, widget) + if widget is not None: + self.adjustStandardButtons(page) + self.connect( + page, + QtCore.SIGNAL('setDirty(bool)'), + self.onPageDirtyChanged + ) + + # enshure enough space is available for the widget + if createdNew: + cx, cy, cw, ch = self.grid.getContentsMargins() + w = widget.width() + cx + cw + h = widget.height() + cy + ch + pageContainerSize = self.pageContainer.minimumSize() + pageContainerW = pageContainerSize.width() + pageContainerH = pageContainerSize.height() + if pageContainerW < w or pageContainerH < h: + if pageContainerW > w: + w = pageContainerW + if pageContainerH > h: + h = pageContainerH + self.pageContainer.setMinimumSize(w, h) + + self.grid.addWidget(widget) + self.grid.activate() + + ############################ + ##widget.setAutoFillBackground(True) + ##pal = QtGui.QPalette() + ##pal.setColor(pal.Window, QtGui.QColor('white')) + ##widget.setPalette(pal) + ############################# + + + def setCurrentPageFromUuid(self, uuid): + """Sets the current page from the pages uuid + @param uuid: unique id of the page + @return: the page selected or none + """ + if self.pages is not None: + page = self.pages.pageFromUuid(uuid) + if page is not None: + self.setCurrentPage(page) + return page + + +#********************************************************************* +# +#********************************************************************* +class DlgPreferencesTree(QtGui.QDialog, Ui_DlgPreferencesTree): + """Preferences dialog that lets the user navigate a page hirarchy via a tree + """ + + IdButtonBox = 'buttonBox' + IdFramePages = 'framePages' + IdTreePages = 'treePages' + IdSplitter = 'splitter' + + + def __init__(self, + parent, + caption=None, + pages=None, + startPage=None, + state=None, + ): + """ + @param parent: parent window or None + @param caption: title of the dialog or None + @param pages: tree of Page() objects to display + @param startPage: uuid of te page to display if no state is passed or None + @param state: formerly stored state of the dialog to restore or Npne + """ + + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + + self._pageControler = None + + if caption is not None: + self.setWindowTitle(caption) + + # setup tree + tree = self.controlById(self.IdTreePages) + tree.setColumnCount(1) + tree.header().hide() + self.connect( + tree, + QtCore.SIGNAL('itemPressed(QTreeWidgetItem*, int)'), + self.onTreeItemPressed + ) + self.connect( + tree, + QtCore.SIGNAL('itemActivated(QTreeWidgetItem*, int)'), + self.onTreeItemPressed + ) + self.setupTree(tree) + + # setup page controler + self._pageControler = PageControler( + self, + self.onPageControler, + self.controlById(self.IdFramePages), + self.controlById(self.IdButtonBox), + maxPageDepth=None, + pages=pages + ) + + # set / restore state of the dialog + if state is not None: + self.restoreState(state) + elif startPage is not None: + self.selectPage(startPage) + + + ####################################### + ## slots + ####################################### + def onPageControler(self, msg, param1, param2): + """Calback handler for the page controler""" + if msg == PageControler.PageQueryParent: + return self.controlById(self.IdTreePages) + + elif msg == PageControler.PageAdd: + parent, page = param1, param2 + item = QtGui.QTreeWidgetItem(parent, [page.displayName(), ]) + item.setData(0, QtCore.Qt.UserRole, QtCore.QVariant(page.uuid())) + self.setupTreeItem(page, item) + page.setUserData(item) + return item + + def onTreeItemPressed(self, item, index): + """Slot called when an item in the tree is pressed""" + uuid = item.data(0, QtCore.Qt.UserRole).toString() + self.selectPage(uuid) + + ####################################### + ## mehods + ####################################### + def controlById(self, id_control): + """Returns a widget of the dialog given its id""" + return getattr(self, id_control) + + + def setupTree(self, tree): + """Adjusts the QTreeWidget used to display the page hirarchy + @param tree: (QTreeWidget) tree to adjust + @note: overwrite to customize + """ + pass + + + def setupTreeItem(self, page, item): + """Adjusts a QTreeWidgetItem for a page + @param page: Page() instance + @param item: (QTreeWidgetItem) to adjust + @note: overwrite to customize + """ + pass + + + def saveState(self): + """Saves the state of the dialog + @return: (str) state + """ + state = { + 'currentPage': self._pageControler.currentPageUuid(), + 'geometry': self.saveGeometry(), + 'splitter': self.controlById(self.IdSplitter).saveState(), + } + return cPickle.dumps(state, 0) + + + def selectPage(self, uuid): + """Selects a page given its uuid""" + page = self._pageControler.setCurrentPageFromUuid(uuid) + if page is not None: + # enshure item is selected / expanded / visible + item = page.userData() + tree = self.controlById(self.IdTreePages) + index = tree.setCurrentItem(item) + index = tree.currentIndex() + if index.isValid(): + tree.scrollTo(index) + + + def restoreState(self, state): + """Restors the state of the dialog + @param state: (str) state to restore + """ + try: + state = cPickle.loads(state) + assert isinstance(state, dict) + except Exception, d: + pass + else: + try: + self.restoreGeometry(state.get('geometry', None)) + except Exception, d: + pass + try: + self.controlById(self.IdSplitter).restoreState(state.get('splitter', None)) + except Exception, d: + pass + try: + self.selectPage(state.get('currentPage', None)) + except Exception, d: + pass + + + +class DlgPreferencesFlatTree(DlgPreferencesTree): + """Preferences dialog that lets the user navigate a page hirarchy via a tree + + In contrast to DlgPreferencesTree(), child pages of a page have a fixed indent + and no decorations are shown to save space. Best use with page hirarchys nested + at most 1 level deep. + + """ + + def setupTree(self, tree): + """Adjusts the QTreeWidget used to display the page hirarchy + @param tree: (QTreeWidget) tree to adjust + @note: overwrite to customize + """ + tree.setIndentation(0) + tree.setRootIsDecorated(False) + + + def setupTreeItem(self, page, item): + """Adjusts a QTreeWidgetItem for a page + @param page: Page() instance + @param item: (QTreeWidgetItem) to adjust + @note: overwrite to customize + """ + if page.children(): + font = item.font(0) + pointSize = font.pointSize() + if pointSize > -1: + font.setPointSize(font.pointSize() + 1) + font.setBold(True) + item.setFont(0, font) + #item.setForeground(0, QtGui.QBrush(QtGui.QColor('black'))) + #item.setBackground(0, QtGui.QBrush(QtGui.QColor('lightGray'))) + else: + item.setText(0, ' ' + item.text(0)) + + #item.setForeground(0, QtGui.QBrush(QtGui.QColor('black'))) + #item.setBackground(0, QtGui.QBrush(QtGui.QColor('white'))) +#*********************************************************************** +# +#*********************************************************************** +if __name__ == '__main__': + import sys + + + class Page1(Page): + + def __init__(self, *args): + Page.__init__(self, *args) + + self._widget = None + + def displayName(self): + return self.trUtf8('MyPage-1') + + + def canHelp(self): return True + + def setVisible(self, parent, flag): + createdNew = False + if flag and self._widget is None: + widget = QtGui.QFrame(parent) + ck1 = QtGui.QCheckBox('foo check', widget) + self._widget = widget + createdNew = True + self._widget.setVisible(flag) + return (createdNew, self._widget) + + + class Page2(Page): + + def __init__(self, *args): + Page.__init__(self, *args) + + self._widget = None + + def displayName(self): + return self.trUtf8('MyPage-2') + + + def canApply(self): return True + + def setVisible(self, parent, flag): + createdNew = False + if flag and self._widget is None: + widget = QtGui.QFrame(parent) + ck1 = QtGui.QPushButton('foo button', widget) + self._widget = widget + createdNew = True + self._widget.setVisible(flag) + return (createdNew, self._widget) + + + + + + + app = QtGui.QApplication(sys.argv) + + pages = Page('0')( + Page1('1')( + Page('10'), + Page('11'), + Page('2')( + Page('20'), + Page('21'), + ), + ), + Page2('3')( + Page('30'), + Page('32'), + ), + + ) + s="(dp1\nS'geometry'\np2\ncsip\n_unpickle_type\np3\n(S'PyQt4.QtCore'\np4\nS'QByteArray'\n(S'\\x01\\xd9\\xd0\\xcb\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\xdd\\x00\\x00\\x00\\xfd\\x00\\x00\\x03\\xa5\\x00\\x00\\x02\\x1f\\x00\\x00\\x00\\xdd\\x00\\x00\\x00\\xfd\\x00\\x00\\x03\\xa5\\x00\\x00\\x02\\x1f\\x00\\x00\\x00\\x00\\x00\\x00'\nttRp5\nsS'currentPage'\np6\nS'30'\np7\nsS'splitter'\np8\ng3\n(g4\nS'QByteArray'\n(S'\\x00\\x00\\x00\\xff\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x02\\x00\\x00\\x00\\x87\\x00\\x00\\x02&\\x01\\x00\\x00\\x00\\x06\\x01\\x00\\x00\\x00\\x01'\nttRp9\ns." + + + w = DlgPreferencesFlatTree(None, pages=pages, startPage='20', state=s) + + + + + #w.addSection('foo', 'foo') + #w.addSection('foo2', 'foo2') + + #for i in range(10): + # p = Page() + # p.name = lambda *args: 'page-%s' % i + # + # w.addPage('foo', p) + + + w.show() + res = app.exec_() + print repr(w.saveState()) + + sys.exit(res) + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 13:41:21
|
Revision: 1336 http://frogpie.svn.sourceforge.net/frogpie/?rev=1336&view=rev Author: jUrner Date: 2007-09-03 05:21:50 -0700 (Mon, 03 Sep 2007) Log Message: ----------- combed over dialog Modified Paths: -------------- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/__init__.py Modified: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui 2007-09-03 12:21:30 UTC (rev 1335) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui 2007-09-03 12:21:50 UTC (rev 1336) @@ -113,36 +113,51 @@ <item> <widget class="QPushButton" name="btFindDownwards" > <property name="text" > - <string>Find Next</string> + <string>&Find Next</string> </property> + <property name="shortcut" > + <string>Ctrl+F</string> + </property> </widget> </item> <item> <widget class="QPushButton" name="btFindUpwards" > <property name="text" > - <string>Upwards</string> + <string>&Upwards</string> </property> + <property name="shortcut" > + <string>Ctrl+U</string> + </property> </widget> </item> <item> <widget class="QPushButton" name="btReplace" > <property name="text" > - <string>Replace</string> + <string>&Replace</string> </property> + <property name="shortcut" > + <string>Ctrl+R</string> + </property> </widget> </item> <item> <widget class="QPushButton" name="btReplaceAll" > <property name="text" > - <string>Replace All</string> + <string>Replace &All</string> </property> + <property name="shortcut" > + <string>Ctrl+A</string> + </property> </widget> </item> <item> <widget class="QPushButton" name="btOk" > <property name="text" > - <string>Ok</string> + <string>O&k</string> </property> + <property name="shortcut" > + <string>Ctrl+K</string> + </property> </widget> </item> </layout> @@ -165,42 +180,42 @@ <item row="1" column="0" > <widget class="QCheckBox" name="ckWholeWord" > <property name="text" > - <string>Whole Word</string> + <string>Whole &Word</string> </property> </widget> </item> <item row="1" column="1" > <widget class="QCheckBox" name="ckCustom1" > <property name="text" > - <string>Custom 1</string> + <string>Custom &1</string> </property> </widget> </item> <item row="2" column="0" > <widget class="QCheckBox" name="ckMatchCase" > <property name="text" > - <string>Match Case</string> + <string>Match &Case</string> </property> </widget> </item> <item row="2" column="1" > <widget class="QCheckBox" name="ckCustom2" > <property name="text" > - <string>Custom 2</string> + <string>Custom &2</string> </property> </widget> </item> <item row="3" column="0" > <widget class="QCheckBox" name="ckRegularExpression" > <property name="text" > - <string>Regular Expression</string> + <string>Regular E&xpression</string> </property> </widget> </item> <item row="3" column="1" > <widget class="QCheckBox" name="ckCustom3" > <property name="text" > - <string>Custom 3</string> + <string>Custom &3</string> </property> </widget> </item> Modified: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py 2007-09-03 12:21:30 UTC (rev 1335) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py 2007-09-03 12:21:50 UTC (rev 1336) @@ -2,7 +2,7 @@ # Form implementation generated from reading ui file '/home/me/src/proj/frogpie/trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui' # -# Created: Sat Aug 25 04:47:50 2007 +# Created: Mon Sep 3 13:35:51 2007 # by: PyQt4 UI code generator 4.3 # # WARNING! All changes made in this file will be lost! @@ -147,17 +147,22 @@ DlgFindReplace.setWindowTitle(QtGui.QApplication.translate("DlgFindReplace", "FindReplace...", None, QtGui.QApplication.UnicodeUTF8)) self.labelFind.setText(QtGui.QApplication.translate("DlgFindReplace", "Find:", None, QtGui.QApplication.UnicodeUTF8)) self.labelReplace.setText(QtGui.QApplication.translate("DlgFindReplace", "Replace:", None, QtGui.QApplication.UnicodeUTF8)) - self.btFindDownwards.setText(QtGui.QApplication.translate("DlgFindReplace", "Find Next", None, QtGui.QApplication.UnicodeUTF8)) - self.btFindUpwards.setText(QtGui.QApplication.translate("DlgFindReplace", "Upwards", None, QtGui.QApplication.UnicodeUTF8)) - self.btReplace.setText(QtGui.QApplication.translate("DlgFindReplace", "Replace", None, QtGui.QApplication.UnicodeUTF8)) - self.btReplaceAll.setText(QtGui.QApplication.translate("DlgFindReplace", "Replace All", None, QtGui.QApplication.UnicodeUTF8)) - self.btOk.setText(QtGui.QApplication.translate("DlgFindReplace", "Ok", None, QtGui.QApplication.UnicodeUTF8)) - self.ckWholeWord.setText(QtGui.QApplication.translate("DlgFindReplace", "Whole Word", None, QtGui.QApplication.UnicodeUTF8)) - self.ckCustom1.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom 1", None, QtGui.QApplication.UnicodeUTF8)) - self.ckMatchCase.setText(QtGui.QApplication.translate("DlgFindReplace", "Match Case", None, QtGui.QApplication.UnicodeUTF8)) - self.ckCustom2.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom 2", None, QtGui.QApplication.UnicodeUTF8)) - self.ckRegularExpression.setText(QtGui.QApplication.translate("DlgFindReplace", "Regular Expression", None, QtGui.QApplication.UnicodeUTF8)) - self.ckCustom3.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom 3", None, QtGui.QApplication.UnicodeUTF8)) + self.btFindDownwards.setText(QtGui.QApplication.translate("DlgFindReplace", "&Find Next", None, QtGui.QApplication.UnicodeUTF8)) + self.btFindDownwards.setShortcut(QtGui.QApplication.translate("DlgFindReplace", "Ctrl+F", None, QtGui.QApplication.UnicodeUTF8)) + self.btFindUpwards.setText(QtGui.QApplication.translate("DlgFindReplace", "&Upwards", None, QtGui.QApplication.UnicodeUTF8)) + self.btFindUpwards.setShortcut(QtGui.QApplication.translate("DlgFindReplace", "Ctrl+U", None, QtGui.QApplication.UnicodeUTF8)) + self.btReplace.setText(QtGui.QApplication.translate("DlgFindReplace", "&Replace", None, QtGui.QApplication.UnicodeUTF8)) + self.btReplace.setShortcut(QtGui.QApplication.translate("DlgFindReplace", "Ctrl+R", None, QtGui.QApplication.UnicodeUTF8)) + self.btReplaceAll.setText(QtGui.QApplication.translate("DlgFindReplace", "Replace &All", None, QtGui.QApplication.UnicodeUTF8)) + self.btReplaceAll.setShortcut(QtGui.QApplication.translate("DlgFindReplace", "Ctrl+A", None, QtGui.QApplication.UnicodeUTF8)) + self.btOk.setText(QtGui.QApplication.translate("DlgFindReplace", "O&k", None, QtGui.QApplication.UnicodeUTF8)) + self.btOk.setShortcut(QtGui.QApplication.translate("DlgFindReplace", "Ctrl+K", None, QtGui.QApplication.UnicodeUTF8)) + self.ckWholeWord.setText(QtGui.QApplication.translate("DlgFindReplace", "Whole &Word", None, QtGui.QApplication.UnicodeUTF8)) + self.ckCustom1.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom &1", None, QtGui.QApplication.UnicodeUTF8)) + self.ckMatchCase.setText(QtGui.QApplication.translate("DlgFindReplace", "Match &Case", None, QtGui.QApplication.UnicodeUTF8)) + self.ckCustom2.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom &2", None, QtGui.QApplication.UnicodeUTF8)) + self.ckRegularExpression.setText(QtGui.QApplication.translate("DlgFindReplace", "Regular E&xpression", None, QtGui.QApplication.UnicodeUTF8)) + self.ckCustom3.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom &3", None, QtGui.QApplication.UnicodeUTF8)) self.labelStatus.setText(QtGui.QApplication.translate("DlgFindReplace", "Status", None, QtGui.QApplication.UnicodeUTF8)) Modified: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/__init__.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/__init__.py 2007-09-03 12:21:30 UTC (rev 1335) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/__init__.py 2007-09-03 12:21:50 UTC (rev 1336) @@ -3,12 +3,12 @@ import os, sys +import cPickle #--> rel import hack d = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0, d) -import settingsbase from ctrls import checkarraywrap sys.path.pop(0) @@ -18,41 +18,6 @@ from PyQt4 import QtCore, QtGui from Ui_DlgFindReplace import Ui_DlgFindReplace #***************************************************************** -# settings -#***************************************************************** -IdLabelFind = 'labelFind' -IdLabelReplace = 'labelReplace' -IdCmbFind = 'cmbFind' -IdCmbReplace = 'cmbReplace' - -IdBtActionDownwards = 'btFindDownwards' -IdBtActionUpwnwards = 'btFindUpwards' -IdBtReplace = 'btReplace' -IdBtReplaceAll = 'btReplaceAll' -IdBtOk = 'btOk' - -IdCkWholeWord = 'ckWholeWord' -IdCkMatchCase = 'ckMatchCase' -IdCkRegularExpression = 'ckRegularExpression' -IdCkCustom1 = 'ckCustom1' -IdCkCustom2 = 'ckCustom2' -IdCkCustom3 = 'ckCustom3' - -IdLabelStatus = 'labelStatus' - -CustomChecks = (IdCkCustom1, IdCkCustom2, IdCkCustom3) - -#***************************************************************** -# settings -#***************************************************************** -class DlgSettings(settingsbase.SettingsBase): - - KEY_SETTINGS = 'Qt4Ex/Dlgs/DlgAbout' - SETTINGS = [ - ('Geometry', ['UGeometry', None]), - ] - -#***************************************************************** # find parameters #***************************************************************** class FindParams(QtCore.QObject): @@ -142,15 +107,6 @@ print "Match Custom3:", bool(self.flags & self.MatchCustom3) print '-------------------------------------------' - -Checks = { - FindParams.MatchWholeWord: IdCkWholeWord, - FindParams.MatchCase: IdCkMatchCase, - FindParams.MatchRegularExpression: IdCkRegularExpression, - FindParams.MatchCustom1: IdCkCustom1, - FindParams.MatchCustom2: IdCkCustom2, - FindParams.MatchCustom3: IdCkCustom3, - } #******************************************************************** # #******************************************************************** @@ -180,6 +136,7 @@ # create dialog dlg = DlgFindReplace(parent + #state=self.getDialogFindReplaceLastSate(), findParams=findParams, showChecks=showChecks, customChecks=('My Custom Checkbox', ), @@ -187,19 +144,14 @@ #findHistory=MySavedFindHistory, #replaceHistory=MySavedReplaceHistory, ) - + # connect and run dialog self.connect(dlg, QtCore.SIGNAL('find(QObject*)'), self.onReplaceDialog) dlg.exec_() - # save state if desired...sorry for inconvenience, but PyQt - # does not support QMap - geometry = dlg.savedGeometry() - findHistory = dlg.saveFindHistory() - replaceHistory = dlg.saveReplaceHistory() - checkState = dlg.saveCheckState() - - + # save state if desired + state = dlg.saveState() + def onReplaceDialog(self, findParams): if findParams.flags & FindParams.ReplaceAll: @@ -214,42 +166,68 @@ findParams.notifyChanges(nReplacements) """ + # consts + IdLabelFind = 'labelFind' + IdLabelReplace = 'labelReplace' + IdCmbFind = 'cmbFind' + IdCmbReplace = 'cmbReplace' + + IdBtActionDownwards = 'btFindDownwards' + IdBtActionUpwnwards = 'btFindUpwards' + IdBtReplace = 'btReplace' + IdBtReplaceAll = 'btReplaceAll' + IdBtOk = 'btOk' + + IdLabelStatus = 'labelStatus' + + IdCkWholeWord = 'ckWholeWord' + IdCkMatchCase = 'ckMatchCase' + IdCkRegularExpression = 'ckRegularExpression' + IdCkCustom1 = 'ckCustom1' + IdCkCustom2 = 'ckCustom2' + IdCkCustom3 = 'ckCustom3' + + Checks = { + FindParams.MatchWholeWord: IdCkWholeWord, + FindParams.MatchCase: IdCkMatchCase, + FindParams.MatchRegularExpression: IdCkRegularExpression, + FindParams.MatchCustom1: IdCkCustom1, + FindParams.MatchCustom2: IdCkCustom2, + FindParams.MatchCustom3: IdCkCustom3, + } + CustomChecks = (IdCkCustom1, IdCkCustom2, IdCkCustom3) + + def __init__(self, parent, + state=None, findParams=None, showChecks=None, customChecks=None, - findHistory=None, - replaceHistory=None, - geometry=None ): """ @param findParams: FindParams instance. The state of the checkboxes is initialized according to FindParams.flags (Match* flags) in the FindParams instance passed. If the DlgReplace flag is set, a Replace dialog is displayed. + @param state: (str) state of the dialog to restore or None (overwrites initial findParams) @param showChecks: FindParams.Match* flags with checks to show. Default shows all checks @param customChecks: (list QStrings) text for custom checkboxes or None - @param findHistory: QStringList containing find history or None - @param replaceHistory: QStringList containing replace history or None - @param geometry: (QByteArray) geometry of the dialog as returned from QWidget.saveGeometry() or None - + @signal SIGNAL('find(QObject* findParams)'): emitted when the user hits one of the find or replace buttons. """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - - + self._checkArray = None self._findParams = findParams - self._savedGeometry = '' - + # init buttons buttons = ( - (IdBtActionDownwards, self.onBtActionDownwards), - (IdBtActionUpwnwards, self.onBtActionUpwnwards), - (IdBtReplace, self.onBtReplace), - (IdBtReplaceAll, self.onBtReplaceAll), - (IdBtOk, self.close), + (self.IdBtActionDownwards, self.onBtActionDownwards), + (self.IdBtActionUpwnwards, self.onBtActionUpwnwards), + (self.IdBtReplace, self.onBtReplace), + (self.IdBtReplaceAll, self.onBtReplaceAll), + (self.IdBtOk, self.close), ) for idControl, cb in buttons: self.connect(self.controlById(idControl), QtCore.SIGNAL('clicked()'), cb) @@ -263,14 +241,14 @@ self.setWindowTitle(self.trUtf8("Replace...")) else: self.setWindowTitle(self.trUtf8("Find...")) - for idControl in (IdLabelReplace, IdCmbReplace, IdBtReplace, IdBtReplaceAll): + for idControl in (self.IdLabelReplace, self.IdCmbReplace, self.IdBtReplace, self.IdBtReplaceAll): ctrl = self.controlById(idControl) ctrl.setEnabled(False) ctrl.setVisible(False) # init checks - checks = Checks.copy() + checks = self.Checks.copy() for const, idControl in checks.items(): checks[const] = self.controlById(idControl) self._checkArray = checkarraywrap.CheckArrayWrap( @@ -285,7 +263,7 @@ self._checkArray.showChecks(showChecks) if customChecks is not None: customChecks = list(customChecks) - for n, idControl in enumerate(CustomChecks): + for n, idControl in enumerate(self.CustomChecks): ck = self.controlById(idControl) if customChecks: ck.setText(customChecks.pop(0)) @@ -295,33 +273,19 @@ if customChecks: raise ValueError('Only %s custom checks supported' % len(CustomChecks)) - # init combos - if findHistory: - cmb = self.controlById(IdCmbFind).addItems(findHistory) - if replaceHistory: - cmb = self.controlById(IdCmbReplace).addItems(replaceHistory) - - if geometry is not None: - self.restoreGeometry(geometry) - - + # TODO: check if overwrite is ok + if state is not None: + self.restoreState(state) + ############################################ ## events ############################################ - def closeEvent(self, event): - self.close() - - def showEvent(self, event): - label = self.controlById(IdLabelStatus) + label = self.controlById(self.IdLabelStatus) label.setText(self.trUtf8('Ready')) self.resize(self.width(), 0) self.setFixedHeight(self.height()) - - - def hideEvent(self, event): - self.close() - + ################################################ ## slots ################################################ @@ -331,7 +295,8 @@ def onBtReplaceAll(self): self._emitSignalFind(FindParams.ActionReplaceAll) def onGiveFeedback(self, n): - label = self.controlById(IdLabelStatus) + """Slot called when the client gives feedback via FindParams()""" + label = self.controlById(self.IdLabelStatus) if self._findParams.flags & FindParams.MaskActionsReplace: label.setText(self.trUtf8('Replaced:') + ' ' + str(n)) else: @@ -341,6 +306,7 @@ ## private methods ############################################## def _emitSignalFind(self, flagFind): + """Emits the find signal""" if self._findParams is None: return @@ -348,9 +314,9 @@ flags &= ~self._findParams.MaskActions flags |= flagFind self._findParams.flags = flags - self._findParams.find = self.controlById(IdCmbFind).lineEdit().text() + self._findParams.find = self.controlById(self.IdCmbFind).lineEdit().text() if flags & self._findParams.DlgReplace: - self._findParams.replace = self.controlById(IdCmbReplace).lineEdit().text() + self._findParams.replace = self.controlById(self.IdCmbReplace).lineEdit().text() else: self._findParams.replace = "" self.emit(QtCore.SIGNAL('find(QObject*)'), (self._findParams)) @@ -358,50 +324,63 @@ ############################################ ## methods ############################################ - def close(self): - """Closes the dialog""" - self._savedGeometry = QtGui.QDialog.saveGeometry(self) - QtGui.QDialog.close(self) - - def controlById(self, id_control): """Returns a control fiven its id (one of the Id* consts as defined by the module)""" return getattr(self, id_control) - def saveCheckState(self): - """Returns an integer containing the current state of the checkboxes""" - if self._findParams is None: - return 0 - return self._findParams.flags & FindParams.MaskMatch - - - def saveGeometry(self): - """Returns a QByreArray containing the saved geometry of the dialog pr '' + def saveComboHistory(self, idCmb): + """Saves the find or replace history + @param idCmb: id of the combobox to save the history for + @return (QStringList) history """ - if self.isVisible(): - return QtGui.QDialog.saveGeometry(self) - return self._savedGeomtry() - - - def saveFindHistory(self): - """Returns a QStringList containing the current find history""" - cmb = self.controlById(IdCmbFind) + cmb = self.controlById(IdCmb) L = QtCore.QStringList() for i in range(cmb.count()): L << cmb.itemText(i) return L - - def saveReplaceHistory(self): - """Returns a QStringList containing the current replace history""" - cmb = self.controlById(IdCmbReplace) - L = QtCore.QStringList() - for i in range(cmb.count()): - L << cmb.itemText(i) - return L - + def saveState(self): + """Saves the state of the dialog + @return: (str) state + """ + state = { + 'checks': self._findParams.flags & FindParams.MaskMatch, + 'geometry': self.saveGeometry(), + 'historyFind': self.saveComboHistory(self.IdCmbFind), + 'historyReplace': self.saveComboHistory(self.IdCmbReplace), + } + return cPickle.dumps(state, 0) + + + def restoreState(self, state): + """Restors the state of the dialog + @param state: (str) state to restore + """ + # TODO: not tested + result = False + try: + state = cPickle.loads(state) + except Exception, d: pass + else: + # + try: + self.restoreGeometry(tate.get('geometry', None)) + except Exception, d: pass + # restore combos + try: + self.controlById(self.IdCmbFind).addItems(state.get('historyFind', None)) + except Exception, d: pass + try: + self.controlById(self.IdCmbReplace).addItems(state.get('historyReplace', None)) + except Exception, d: pass + # restore checks + try: + self._checkArray.setChecks(state.get('checks', 0)) + except Exception, d: pass + + #*********************************************************************** # #*********************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 13:34:02
|
Revision: 1337 http://frogpie.svn.sourceforge.net/frogpie/?rev=1337&view=rev Author: jUrner Date: 2007-09-03 05:22:17 -0700 (Mon, 03 Sep 2007) Log Message: ----------- updates Modified Paths: -------------- trunk/sandbox/chartables/MANIFEST trunk/sandbox/chartables/chartables/chartables.pro trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/manifest.py trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/qtpro.py trunk/sandbox/chartables/updateProject.py Added Paths: ----------- trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/pylupdate.py Modified: trunk/sandbox/chartables/MANIFEST =================================================================== --- trunk/sandbox/chartables/MANIFEST 2007-09-03 12:21:50 UTC (rev 1336) +++ trunk/sandbox/chartables/MANIFEST 2007-09-03 12:22:17 UTC (rev 1337) @@ -38,14 +38,10 @@ chartables/chartables_lib/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py chartables/chartables_lib/qt4ex/dlgs/dlgfindreplace/__init__.py chartables/chartables_lib/qt4ex/res/language/LangCodes-ISO 639-1.txt -chartables/chartables_lib/qt4ex/sandbox/zoomview.py -chartables/chartables_lib/qt4ex/sandbox/dlgpreferences/DlgPreferences.ui -chartables/chartables_lib/qt4ex/sandbox/dlgpreferences/Ui_DlgPreferences.py -chartables/chartables_lib/qt4ex/sandbox/dlgpreferences/__init__.py chartables/chartables_lib/qt4ex/scripts/__init__.py chartables/chartables_lib/qt4ex/scripts/manifest.py +chartables/chartables_lib/qt4ex/scripts/pylupdate.py chartables/chartables_lib/qt4ex/scripts/qtpro.py -chartables/res/__init__.py chartables/res/icons/48x48/chartables.png chartables/res/icons/16x16/chartables.png chartables/doc/assistant.adp @@ -58,13 +54,10 @@ chartables/doc/dialogs/screen_bookmark.png chartables/doc/dialogs/screen_bookmarks.png chartables/doc/dialogs/screen_preferences.png -chartables/chartables_dlgs/Ui_about.py chartables/chartables_dlgs/Ui_bookmark.py chartables/chartables_dlgs/Ui_bookmarks.py chartables/chartables_dlgs/Ui_preferences.py chartables/chartables_dlgs/__init__.py -chartables/chartables_dlgs/about.py -chartables/chartables_dlgs/about.ui chartables/chartables_dlgs/bookmark.py chartables/chartables_dlgs/bookmark.ui chartables/chartables_dlgs/bookmarks.py @@ -79,9 +72,7 @@ chartables/chartables_tables/tables_charsets.py chartables/chartables_tables/tables_colors.py chartables/chartables_tables/tables_entities.py -chartables/lang/__init__.py chartables/lang/chartables_de.qm chartables/lang/chartables_de.ts chartables/lang/chartables_en.qm chartables/lang/chartables_en.ts -chartables/lang/qtpro.py Modified: trunk/sandbox/chartables/chartables/chartables.pro =================================================================== --- trunk/sandbox/chartables/chartables/chartables.pro 2007-09-03 12:21:50 UTC (rev 1336) +++ trunk/sandbox/chartables/chartables/chartables.pro 2007-09-03 12:22:17 UTC (rev 1337) @@ -30,14 +30,12 @@ chartables_lib/qt4ex/scripts/__init__.py \ chartables_lib/qt4ex/scripts/manifest.py \ chartables_lib/qt4ex/scripts/qtpro.py \ - res/__init__.py \ + chartables_lib/qt4ex/scripts/pylupdate.py \ chartables_dlgs/Ui_bookmarks.py \ chartables_dlgs/__init__.py \ chartables_dlgs/bookmarks.py \ chartables_dlgs/Ui_bookmark.py \ - chartables_dlgs/Ui_about.py \ chartables_dlgs/bookmark.py \ - chartables_dlgs/about.py \ chartables_dlgs/Ui_preferences.py \ chartables_dlgs/preferences.py \ chartables_tables/__init__.py \ @@ -46,9 +44,7 @@ chartables_tables/tables_charsets.py \ chartables_tables/table_base.py \ chartables_tables/tables_entities.py \ - chartables_tables/tables_colors.py \ - lang/qtpro.py \ - lang/__init__.py + chartables_tables/tables_colors.py FORMS = chartables.ui \ chartables_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui \ @@ -56,9 +52,8 @@ chartables_lib/qt4ex/sandbox/dlgpreferences/DlgPreferences.ui \ chartables_dlgs/bookmark.ui \ chartables_dlgs/preferences.ui \ - chartables_dlgs/about.ui \ chartables_dlgs/bookmarks.ui \ chartables_tables/chartables_widget.ui -TRANSLATIONS = lang/en.ts \ - lang/de.ts \ No newline at end of file +TRANSLATIONS = lang/chartables_en.ts \ + lang/chartables_de.ts \ No newline at end of file Modified: trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/manifest.py =================================================================== --- trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/manifest.py 2007-09-03 12:21:50 UTC (rev 1336) +++ trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/manifest.py 2007-09-03 12:22:17 UTC (rev 1337) @@ -1,7 +1,7 @@ """ommandline script to create a distutils MANIFEST file from all files in a folder (recursively) -The folders 'dist', 'sdist' and a directory 'data' are skipped by default +The folders 'dist', 'sdist' and a directory 'data' and 'sandbox' are skipped by default """ @@ -20,7 +20,10 @@ #****************************************************************** # #****************************************************************** -def create_manifest(directory): +def createManifest(directory): + """Creates a MANIFEST file for the specified directory + @return: filepath of the MANIFEST file + """ def include_file(file_name): @@ -36,7 +39,7 @@ def include_dir(dir_name): if not dir_name.startswith('.'): - if dir_name not in ('build', 'dist', 'data'): ################### + if dir_name not in ('build', 'dist', 'data', 'sandbox'): ################### return True return False @@ -55,9 +58,9 @@ else: for root, dirs, files in os.walk(directory): - exclude_dirs = [i for i in dirs if not include_dir(i)] for d in exclude_dirs: + print 'skipping directory: ' + to_relpath(directory, root, d) dirs.remove(d) include_files = [to_relpath(directory, root, i) for i in files if include_file(i)] @@ -67,17 +70,19 @@ yield relpath # - fp = open(os.path.join(directory, 'MANIFEST'), 'w') + fpath_manifest = os.path.join(directory, 'MANIFEST') + fp = open(fpath_manifest, 'w') try: for relpath in walk_directory(directory): fp.write(relpath + '\n') finally: fp.close() print '<done>' + return fpath_manifest def main(directory): - create_manifest(directory) + createManifest(directory) #****************************************************************** # Added: trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/pylupdate.py =================================================================== --- trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/pylupdate.py (rev 0) +++ trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/pylupdate.py 2007-09-03 12:22:17 UTC (rev 1337) @@ -0,0 +1,35 @@ +"""Runs an update of language resources calling "pylupdate4" +""" + +import subprocess +#***************************************************************** +# +#***************************************************************** +def shell_exec(args): + + p = subprocess.Popen( + args=args, + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ) + stdout, stderr = p.communicate() + if stdout: print stdout + if stderr: print stderr + + + +def main(projectFile): + """ + @param projectFile: *.pro + """ + shell_exec('pylupdate4 "%s"' % projectFile) + + +#***************************************************************** +# +#***************************************************************** +if __name__ == '__main__': + import sys + if len(sys.argv) > 1: + sys.exit(main(sys.argv[1])) \ No newline at end of file Modified: trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/qtpro.py =================================================================== --- trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/qtpro.py 2007-09-03 12:21:50 UTC (rev 1336) +++ trunk/sandbox/chartables/chartables/chartables_lib/qt4ex/scripts/qtpro.py 2007-09-03 12:22:17 UTC (rev 1337) @@ -31,6 +31,7 @@ DefaultLocales = ('en', ) +DefaultPrefix = 'qt4ex_' #********************************************************************** # #********************************************************************** @@ -40,11 +41,12 @@ return 'lang' in dirs -def main(directory, locales=DefaultLocales): +def createProjectFile(directory, locales=DefaultLocales, prefix=DefaultPrefix): """Creates a Qt *.pro project file @param directory: diretory tree to create a project file for @param locales: (list) of locale names to add translations for - + @param prefix: prefix to add to the traslation files + @return: filepath of the project file created """ directory = removeSlashes(directory) @@ -104,16 +106,16 @@ print 'ok' for locale in locales: - tr_file = os.path.join(tr_dir_name, locale + '.ts') + tr_file = os.path.join(tr_dir_name, prefix + locale + '.ts') print 'adding translation: ' + tr_file project_files['tr'].append(tr_file) print 'ok' - proj_fpath = os.path.join(directory, proj_name + '.pro') - print 'writing project: ' + proj_fpath - with open(proj_fpath, 'w') as fp: + fpath_project = os.path.join(directory, proj_name + '.pro') + print 'writing project: ' + fpath_project + with open(fpath_project, 'w') as fp: fp.write('SOURCES = ') fp.write(' \\\n\t\t\t\t'.join(project_files['py']) ) @@ -126,7 +128,11 @@ print 'ok' print 'done' + return fpath_project +def main(directory, locales=DefaultLocales, prefix=DefaultPrefix): + cretaeProjectFile(directory, locales=DefaultLocales, prefix=DefaultPrefix) + #***************************************************************** # #***************************************************************** Modified: trunk/sandbox/chartables/updateProject.py =================================================================== --- trunk/sandbox/chartables/updateProject.py 2007-09-03 12:21:50 UTC (rev 1336) +++ trunk/sandbox/chartables/updateProject.py 2007-09-03 12:22:17 UTC (rev 1337) @@ -2,7 +2,9 @@ import os from chartables.chartables_lib.qt4ex.scripts import qtpro, manifest - +#****************************************************************** +# +#****************************************************************** Locales = ( 'en', 'de' @@ -12,9 +14,9 @@ #**************************************************************** if __name__ == '__main__': d = os.path.dirname(__file__) - manifest.main(d) + manifest = manifest.createManifest(d) d = os.path.join(d, 'chartables') - qtpro.main(d, locales=Locales) + pro = qtpro.createProjectFile(d, locales=Locales, prefix='chartables_') This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 13:19:00
|
Revision: 1326 http://frogpie.svn.sourceforge.net/frogpie/?rev=1326&view=rev Author: jUrner Date: 2007-09-03 02:48:37 -0700 (Mon, 03 Sep 2007) Log Message: ----------- update Modified Paths: -------------- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/__init__.py Modified: trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui =================================================================== --- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui 2007-09-03 09:48:16 UTC (rev 1325) +++ trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui 2007-09-03 09:48:37 UTC (rev 1326) @@ -53,6 +53,9 @@ <property name="text" > <string>About text here...</string> </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> <property name="textInteractionFlags" > <set>Qt::LinksAccessibleByMouse|Qt::NoTextInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> </property> Modified: trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py =================================================================== --- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py 2007-09-03 09:48:16 UTC (rev 1325) +++ trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py 2007-09-03 09:48:37 UTC (rev 1326) @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -# Form implementation generated from reading ui file '/home/me/src/proj/frogpie/trunk/sandbox/qt4ex/qt4ex/dlgs/about/about.ui' +# Form implementation generated from reading ui file '/home/me/src/proj/frogpie/trunk/sandbox/qt4ex/qt4ex/dlgs/dlgabout/DlgAbout.ui' # -# Created: Fri Aug 24 21:05:08 2007 +# Created: Mon Sep 3 11:37:45 2007 # by: PyQt4 UI code generator 4.3 # # WARNING! All changes made in this file will be lost! @@ -32,6 +32,7 @@ self.gridlayout.addWidget(self.line,1,0,1,1) self.label_about = QtGui.QLabel(DlgAbout) + self.label_about.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label_about.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.NoTextInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) self.label_about.setObjectName("label_about") self.gridlayout.addWidget(self.label_about,0,0,1,1) Modified: trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/__init__.py =================================================================== --- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/__init__.py 2007-09-03 09:48:16 UTC (rev 1325) +++ trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/dlgs/dlgabout/__init__.py 2007-09-03 09:48:37 UTC (rev 1326) @@ -1,4 +1,5 @@ import sys, os +import cPickle from PyQt4 import QtCore, QtGui from Ui_DlgAbout import Ui_DlgAbout @@ -6,28 +7,17 @@ d = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) sys.path.insert(0, d) -import settingsbase, qtools +import qtools - sys.path.pop(0) del d #<-- rel import hack #********************************************************************* -# +# consts #********************************************************************* -ID_LABEL_ABOUT = 'label_about' +IdLabelAbout = 'label_about' -#***************************************************************** -# settings -#***************************************************************** -class DlgSettings(settingsbase.SettingsBase): - - KEY_SETTINGS = 'Qt4Ex/Dlgs/DlgAbout' - SETTINGS = [ - ('Geometry', ['UGeometry', None]), - ] - #********************************************************************* # #********************************************************************* @@ -35,7 +25,7 @@ def __init__(self, parent, - settings=None, + state=None, caption=None, appName=None, description=None, @@ -47,23 +37,16 @@ ): """ @param settings: qt4ex.settingsbase.Settings() object or None - - + """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self._settings = settings - if settings is not None: - self.dlgSettings = DlgSettings() - settings.readSettings(self, self.dlgSettings) - - if caption is not None: self.setWindowTitle(caption) - label = self.controlById(ID_LABEL_ABOUT) + label = self.controlById(IdLabelAbout) text = '' if appName is not None: @@ -89,23 +72,31 @@ text += '</ul>\n' label.setText(text) + # restore state + if state is not None: + self.restoreState(state) - def closeEvent(self, event): - self.close() - - - def hideEvent(self, event): - self.close() - - - def close(self): - if self._settings is not None: - self._settings.dumpSettings(self, self.dlgSettings) - - + def controlById(self, id_control): return getattr(self, id_control) + + def saveState(self): + return cPickle.dumps(self.saveGeometry(), 0) + + + def restoreState(self, state): + result = False + try: + state = cPickle.loads(state) + except: pass + else: + try: + result = self.restoreGeometry(state) + except: pass + return result + + #*********************************************************************** # This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 12:56:01
|
Revision: 1334 http://frogpie.svn.sourceforge.net/frogpie/?rev=1334&view=rev Author: jUrner Date: 2007-09-03 05:21:12 -0700 (Mon, 03 Sep 2007) Log Message: ----------- ... Modified Paths: -------------- trunk/sandbox/qt4ex/qt4ex/qt4ex.pro Modified: trunk/sandbox/qt4ex/qt4ex/qt4ex.pro =================================================================== --- trunk/sandbox/qt4ex/qt4ex/qt4ex.pro 2007-09-03 12:21:00 UTC (rev 1333) +++ trunk/sandbox/qt4ex/qt4ex/qt4ex.pro 2007-09-03 12:21:12 UTC (rev 1334) @@ -19,12 +19,16 @@ dlgs/dlgabout/Ui_DlgAbout.py \ dlgs/dlgfindreplace/__init__.py \ dlgs/dlgfindreplace/Ui_DlgFindReplace.py \ - sandbox/zoomview.py \ + dlgs/dlgpreferences/__init__.py.py \ + dlgs/dlgpreferences/Ui_DlgPreferencesTree.py \ scripts/__init__.py \ scripts/qtpro.py \ - scripts/manifest.py + scripts/manifest.py \ + scripts/pylupdate.py FORMS = dlgs/dlgabout/DlgAbout.ui \ - dlgs/dlgfindreplace/DlgFindReplace.ui + dlgs/dlgfindreplace/DlgFindReplace.ui \ + dlgs/dlgpreferences/DlgPreferencesTree.ui -TRANSLATIONS = lang/en.ts \ No newline at end of file +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...> - 2007-09-03 12:17:56
|
Revision: 1324 http://frogpie.svn.sourceforge.net/frogpie/?rev=1324&view=rev Author: jUrner Date: 2007-09-03 02:48:04 -0700 (Mon, 03 Sep 2007) Log Message: ----------- update to qt4ex changes Modified Paths: -------------- trunk/sandbox/chartables/chartables/chartables.py Modified: trunk/sandbox/chartables/chartables/chartables.py =================================================================== --- trunk/sandbox/chartables/chartables/chartables.py 2007-09-03 09:47:48 UTC (rev 1323) +++ trunk/sandbox/chartables/chartables/chartables.py 2007-09-03 09:48:04 UTC (rev 1324) @@ -37,6 +37,7 @@ SETTINGS = ( ('Geometry', ['UGeometry', None]), ('Bookmarks', ['toStringList', None]), + ('DlgAboutState', ['UPyString', None]), ('Version', ['UPyString', __init__.__version__]) ) @@ -234,7 +235,7 @@ """Slot called to popup the "About"dialog """ dlg = dlgabout.DlgAbout( self, - settings=self.config.settings, + state=self.guiSettings['DlgAboutState'], caption='CharTables - ' + self.trUtf8('About'), appName='CharTables', description=self.trUtf8('Python and Qt4 good to have at hand tables'), @@ -245,6 +246,7 @@ copyright=__init__.__copyright__, ) dlg.exec_() + self.guiSettings['DlgAboutState'] = dlg.saveState() def onBookmarkTable(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 10:44:38
|
Revision: 1325 http://frogpie.svn.sourceforge.net/frogpie/?rev=1325&view=rev Author: jUrner Date: 2007-09-03 02:48:16 -0700 (Mon, 03 Sep 2007) Log Message: ----------- update to qt4ex changes Modified Paths: -------------- trunk/sandbox/colordip/colordip/colordip.py Modified: trunk/sandbox/colordip/colordip/colordip.py =================================================================== --- trunk/sandbox/colordip/colordip/colordip.py 2007-09-03 09:48:04 UTC (rev 1324) +++ trunk/sandbox/colordip/colordip/colordip.py 2007-09-03 09:48:16 UTC (rev 1325) @@ -144,6 +144,7 @@ ('ColorType', ['UColorType', 'Rgb']), ('ColorFormat', ['UColorFormat', 'Html']), ('Color', ['UColor', None]), + ('DlgAboutState', ['UPyString', None]), ('Geometry', ['UGeometry', None]), ('MagnifierImage', ['UPng', None]), ('Version', ['UPyString', __init__.__version__]), @@ -578,10 +579,9 @@ ############################ def onAbout(self): """slot called to bring up the About dialog""" - dlg = dlgabout.DlgAbout( self, - settings=self.config.settings, + state=self._globalSettings['DlgAboutState'], caption='ColorDip - ' + self.trUtf8('About'), appName='ColorDip', description=self.trUtf8('A Qt4 / PyQt4 based color picker with magnifier'), @@ -592,6 +592,7 @@ copyright=__init__.__copyright__, ) dlg.exec_() + self._globalSettings['DlgAboutState'] = dlg.saveState() def onBtCustom(self): """slot called when the 'Custom...' button is hit""" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 08:49:35
|
Revision: 1322 http://frogpie.svn.sourceforge.net/frogpie/?rev=1322&view=rev Author: jUrner Date: 2007-09-03 00:50:58 -0700 (Mon, 03 Sep 2007) Log Message: ----------- typos Modified Paths: -------------- trunk/sandbox/chartables/chartables/doc/dialogs/bookmarks.html Modified: trunk/sandbox/chartables/chartables/doc/dialogs/bookmarks.html =================================================================== --- trunk/sandbox/chartables/chartables/doc/dialogs/bookmarks.html 2007-09-03 07:39:42 UTC (rev 1321) +++ trunk/sandbox/chartables/chartables/doc/dialogs/bookmarks.html 2007-09-03 07:50:58 UTC (rev 1322) @@ -30,15 +30,15 @@ </tr> <tr> <td>Ctrl+Down</td> - <td>Moves the selected shortcut one row down</td> + <td>Moves the selected bookmark one row down</td> </tr> <tr> <td>Ctrl+Up</td> - <td>Moves the selected shortcut one row up</td> + <td>Moves the selected bookmark one row up</td> </tr> <tr> <td>Del</td> - <td>Removes the selected shortcut</td> + <td>Removes the selected bookmark</td> </tr> </table> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-09-03 08:01:03
|
Revision: 1321 http://frogpie.svn.sourceforge.net/frogpie/?rev=1321&view=rev Author: jUrner Date: 2007-09-03 00:39:42 -0700 (Mon, 03 Sep 2007) Log Message: ----------- no longer needed Removed Paths: ------------- trunk/sandbox/chartables/chartables/chartables_dlgs/Ui_about.py trunk/sandbox/chartables/chartables/chartables_dlgs/about.py trunk/sandbox/chartables/chartables/chartables_dlgs/about.ui Deleted: trunk/sandbox/chartables/chartables/chartables_dlgs/Ui_about.py =================================================================== --- trunk/sandbox/chartables/chartables/chartables_dlgs/Ui_about.py 2007-08-27 08:30:59 UTC (rev 1320) +++ trunk/sandbox/chartables/chartables/chartables_dlgs/Ui_about.py 2007-09-03 07:39:42 UTC (rev 1321) @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- - -# Form implementation generated from reading ui file '/home/me/src/proj/frogpie/trunk/sandbox/chartables/chartables/chartables_dlgs/about.ui' -# -# Created: Wed Aug 15 20:09:31 2007 -# by: PyQt4 UI code generator 4.3 -# -# WARNING! All changes made in this file will be lost! - -from PyQt4 import QtCore, QtGui - -class Ui_DlgAbout(object): - def setupUi(self, DlgAbout): - DlgAbout.setObjectName("DlgAbout") - DlgAbout.resize(QtCore.QSize(QtCore.QRect(0,0,247,89).size()).expandedTo(DlgAbout.minimumSizeHint())) - - self.gridlayout = QtGui.QGridLayout(DlgAbout) - self.gridlayout.setMargin(9) - self.gridlayout.setSpacing(6) - self.gridlayout.setObjectName("gridlayout") - - self.label_about = QtGui.QLabel(DlgAbout) - self.label_about.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse|QtCore.Qt.NoTextInteraction|QtCore.Qt.TextSelectableByKeyboard|QtCore.Qt.TextSelectableByMouse) - self.label_about.setObjectName("label_about") - self.gridlayout.addWidget(self.label_about,0,0,1,1) - - spacerItem = QtGui.QSpacerItem(142,20,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) - self.gridlayout.addItem(spacerItem,1,0,1,1) - - self.buttonBox = QtGui.QDialogButtonBox(DlgAbout) - self.buttonBox.setOrientation(QtCore.Qt.Horizontal) - self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) - self.buttonBox.setObjectName("buttonBox") - self.gridlayout.addWidget(self.buttonBox,3,0,1,1) - - self.line = QtGui.QFrame(DlgAbout) - self.line.setFrameShape(QtGui.QFrame.HLine) - self.line.setFrameShadow(QtGui.QFrame.Sunken) - self.line.setObjectName("line") - self.gridlayout.addWidget(self.line,2,0,1,1) - - self.retranslateUi(DlgAbout) - QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("accepted()"),DlgAbout.accept) - QtCore.QObject.connect(self.buttonBox,QtCore.SIGNAL("rejected()"),DlgAbout.reject) - QtCore.QMetaObject.connectSlotsByName(DlgAbout) - - def retranslateUi(self, DlgAbout): - DlgAbout.setWindowTitle(QtGui.QApplication.translate("DlgAbout", "CharTables - About", None, QtGui.QApplication.UnicodeUTF8)) - self.label_about.setText(QtGui.QApplication.translate("DlgAbout", "About text here...", None, QtGui.QApplication.UnicodeUTF8)) - - - -if __name__ == "__main__": - import sys - app = QtGui.QApplication(sys.argv) - DlgAbout = QtGui.QDialog() - ui = Ui_DlgAbout() - ui.setupUi(DlgAbout) - DlgAbout.show() - sys.exit(app.exec_()) Deleted: trunk/sandbox/chartables/chartables/chartables_dlgs/about.py =================================================================== --- trunk/sandbox/chartables/chartables/chartables_dlgs/about.py 2007-08-27 08:30:59 UTC (rev 1320) +++ trunk/sandbox/chartables/chartables/chartables_dlgs/about.py 2007-09-03 07:39:42 UTC (rev 1321) @@ -1,121 +0,0 @@ - -import os, sys - -#--> rel import hack -d = os.path.dirname(os.path.dirname(__file__)) -sys.path.insert(0, d) - -import __init__ -import config -from chartables_lib import settingsbase - -sys.path.pop(0) -del d -#<-- rel import hack - -from PyQt4 import QtCore, QtGui -from Ui_about import Ui_DlgAbout -#********************************************************************* -# -#********************************************************************* -ID_LABEL_ABOUT = 'label_about' - -#***************************************************************** -# settings -#***************************************************************** -class DlgSettings(settingsbase.SettingsBase): - - KEY_SETTINGS = 'DlgAbout' - SETTINGS = [ - ('Geometry', ['UGeometry', None]), - ] -#********************************************************************* -# -#********************************************************************* -def formatAbout(__init__): - """""" - from PyQt4.QtCore import qVersion, PYQT_VERSION_STR - - return '''<h3>CharTables</h3> -<hr> -Python and Qt4 good to have at hand tables -<hr> - -<p> - -<ul> - <li>Version: %s - <li>Author: %s - <li>E-mail: %s - <li>Licence: %s - <li>Copyright: %s<br> - - <li>Platform: %s - <li>Python: %s - <li>Qt: %s - <li>PyQt: %s - -</ul> -''' % ( - __init__.__version__, - __init__.__author__, - __init__.__email__, - __init__.__licence__, - __init__.__copyright__, - - sys.platform, - sys.version.split()[0], - qVersion(), - PYQT_VERSION_STR, - - ) - -#********************************************************************* -# -#********************************************************************* -class DlgAbout(QtGui.QDialog, Ui_DlgAbout): - - def __init__(self, parent, __init__, cfg=None): - QtGui.QDialog.__init__(self, parent) - self.setupUi(self) - - if cfg is None: - self.config = config.Config(self) - else: - self.config = cfg - - # restore settings - self.dlgSettings = DlgSettings() - self.config.settings.readSettings(self, self.dlgSettings) - - label = self.controlById(ID_LABEL_ABOUT) - label.setText(formatAbout(__init__)) - - - def closeEvent(self, event): - self.close() - - - def hideEvent(self, event): - self.close() - - - def close(self): - self.config.settings.dumpSettings(self, self.dlgSettings) - - - def controlById(self, id_control): - return getattr(self, id_control) - -#*********************************************************************** -# -#*********************************************************************** -if __name__ == '__main__': - import sys - - app = QtGui.QApplication(sys.argv) - w = DlgAbout(None) - w.show() - res = app.exec_() - sys.exit(res) - Deleted: trunk/sandbox/chartables/chartables/chartables_dlgs/about.ui =================================================================== --- trunk/sandbox/chartables/chartables/chartables_dlgs/about.ui 2007-08-27 08:30:59 UTC (rev 1320) +++ trunk/sandbox/chartables/chartables/chartables_dlgs/about.ui 2007-09-03 07:39:42 UTC (rev 1321) @@ -1,111 +0,0 @@ -<ui version="4.0" > - <class>DlgAbout</class> - <widget class="QDialog" name="DlgAbout" > - <property name="geometry" > - <rect> - <x>0</x> - <y>0</y> - <width>247</width> - <height>89</height> - </rect> - </property> - <property name="windowTitle" > - <string>CharTables - About</string> - </property> - <layout class="QGridLayout" > - <property name="leftMargin" > - <number>9</number> - </property> - <property name="topMargin" > - <number>9</number> - </property> - <property name="rightMargin" > - <number>9</number> - </property> - <property name="bottomMargin" > - <number>9</number> - </property> - <property name="horizontalSpacing" > - <number>6</number> - </property> - <property name="verticalSpacing" > - <number>6</number> - </property> - <item row="0" column="0" > - <widget class="QLabel" name="label_about" > - <property name="text" > - <string>About text here...</string> - </property> - <property name="textInteractionFlags" > - <set>Qt::LinksAccessibleByMouse|Qt::NoTextInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set> - </property> - </widget> - </item> - <item row="1" column="0" > - <spacer> - <property name="orientation" > - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" > - <size> - <width>142</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item row="3" column="0" > - <widget class="QDialogButtonBox" name="buttonBox" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - <property name="standardButtons" > - <set>QDialogButtonBox::Ok</set> - </property> - </widget> - </item> - <item row="2" column="0" > - <widget class="Line" name="line" > - <property name="orientation" > - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - </layout> - </widget> - <resources/> - <connections> - <connection> - <sender>buttonBox</sender> - <signal>accepted()</signal> - <receiver>DlgAbout</receiver> - <slot>accept()</slot> - <hints> - <hint type="sourcelabel" > - <x>248</x> - <y>254</y> - </hint> - <hint type="destinationlabel" > - <x>157</x> - <y>274</y> - </hint> - </hints> - </connection> - <connection> - <sender>buttonBox</sender> - <signal>rejected()</signal> - <receiver>DlgAbout</receiver> - <slot>reject()</slot> - <hints> - <hint type="sourcelabel" > - <x>316</x> - <y>260</y> - </hint> - <hint type="destinationlabel" > - <x>286</x> - <y>274</y> - </hint> - </hints> - </connection> - </connections> -</ui> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 18:35:45
|
Revision: 1291 http://frogpie.svn.sourceforge.net/frogpie/?rev=1291&view=rev Author: jUrner Date: 2007-08-26 15:40:53 -0700 (Sun, 26 Aug 2007) Log Message: ----------- ... Added Paths: ----------- trunk/sandbox/qt4ex/qt4ex/ctrls/compactpatwrap.py Added: trunk/sandbox/qt4ex/qt4ex/ctrls/compactpatwrap.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/ctrls/compactpatwrap.py (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/ctrls/compactpatwrap.py 2007-08-26 22:40:53 UTC (rev 1291) @@ -0,0 +1,576 @@ + +"""module to handles compacting of filepaths and urls + + @author Juergen Urner + """ + +import operator +import os +import re + +import ntpath +import posixpath +import macpath + +from PyQt4 import QtCore, QtGui + +# TODO: +# +# x. builtin type() is shaddowed in some methods +# x. rename DEFAULT to DEFAULT_TYPE + +#******************************************************************************* +# compacts a filepath to fit into a desired width +# As measuring function any function may be passed that returns True if a path +# is short enough, False otherwise. Default is len() +# +# +# IDEA: +# +# weight path components by priority, 0 is lowest. +# +# 2 0 1 3 +# mypath = "aaa/bb/ccc/ddd" +# +# genearte a sort matrix [[nPriority0, indexComponent0, component0], [...]] +# so we only have to flip the matrix to either get the priority order of the +# components and eat components from martx[0] to matrix[N] or the restore +# the original component order +# +# matrix = [[2, 0, "aaa"], [0, 1, "bbb"], [1, 2, "ccc"], [3, 3, "ddd"]] +# matrix.sort() +# matrix = [[0, 1, "bbb"], [1, 2, "ccc"], [2, 0, "aaa"], [3, 3, "ddd"]] +# +# I am shure that so. with better algo skills than me can come up with a nicer +# solution to the problem. I would like to see that. +# +#********************************************************************************** + +#************************************************************************************** +# helpers +#************************************************************************************** +_drive_pat = re.compile(r'([a-zA-Z]\:)(?=/|\\|\Z)') +def is_drive(fpath): + return bool(_drive_pat.match(fpath)) + +_host_pat = re.compile(r'([^:/?#]+:[^/]*///?)') +def is_host(fpath): + return bool(_host_pat.match(fpath)) + +def is_root(fpath): + return fpath.startswith("/") + +def is_mac_root(fpath): + if fpath: + return ':' in fpath and fpath[0] != ':' + return False + +if os.path.__name__.startswith("nt"): + DEFAULT = "nt" +elif os.path.__name__.startswith("mac"): + DEFAULT = "mac" +elif os.path.__name__.startswith("posix"): + DEFAULT = "posix" +else: + DEFAULT = os.path.__name__ + +PATH_MODULES = { # modules to handle path actions for path types + 'nt': ntpath, + 'posix': posixpath, + 'mac': macpath, + 'url': posixpath, + DEFAULT: os.path, + } + +#************************************************************************************** +# +#************************************************************************************** +class PathCompacter(object): + """ + implementation of the compact path algorithm. + + The class is available as compactPath() function in the module. + For a description of parameters see PathCompacter.__call__() + + @note: you do not have to use this class directly. On the module level + its functionality is available as function compactPath() + """ + + ELLIPSIS = "..." + PARDIR = ".." + DOT = "." + + def __init__(self): + """ + constructor + """ + self.root = "" + self.path_module = None + + + def chewComponent(self, cpn, fromLeft=True): + """ + shorten a single path component by one char + + @param cpn the component to to be shortened + @keyparam fromLeft if True the component is shortened on the left side, + if False on the right + """ + if fromLeft: + while True: + cpn = cpn[3: ] + if not cpn: + yield self.PARDIR + break + + cpn = self.PARDIR + cpn + yield cpn + + else: + while True: + cpn = cpn[ :-3] + if not cpn: + yield self.PARDIR + break + cpn = cpn + self.PARDIR + yield cpn + + + def getMatrix(self, n): + """ + generates a sort matrix of lenght (n) + """ + if n == 0: + return [] + + # ...enshure last item in range is last item in the matrix + if n % 2: + rng = range(n) + else: + rng = range(n -1) + + start = len(rng) / 2 + out = [] + for i in rng: + if i == start: + out.append([0, ]) + elif i < start: + out.append([ (start - i) *2 - 1, ]) + else: + out.append([ (i - start) *2, ]) + + if not n % 2: + out.append([len(out)]) + return out + + + def matrixToPath(self, matrix): + """ + private method to generate a filepath from a sort matrix + """ + getter = operator.itemgetter + out = [] + + matrix.sort(key=getter(1)) + for i in matrix: + out.append(i[2]) + + matrix.sort() + + if self.type == "url": + return self.root + "/".join(out) + elif self.type == "nt": + return self.path_module.join(self.root, *out) + elif self.type == "posix": + return self.path_module.join(self.root, *out) + elif self.type == "mac": + return self.path_module.join(self.root, *out) + return self.path_module.join(*out) + + + def matrixFromPath(self, fpath): + """ + private method to convert a filepath into a sort matrix + """ + arrPath = self._path_to_list(fpath) + if not arrPath: + return [] + + self.root = "" + if self.type == "nt": + if is_drive(arrPath[0]): + self.root = arrPath[0] + arrPath.pop(0) + elif self.type == "posix": + if is_root(arrPath[0]): + self.root = arrPath[0] + arrPath.pop(0) + elif self.type == "mac": + if is_mac_root(arrPath[0]): + self.root = arrPath[0] + arrPath.pop(0) + elif self.type == "url": + host = arrPath[0] + "//" + if is_host(host): + self.root = host + arrPath.pop(0) + + matrix = self.getMatrix(len(arrPath)) + i = 0 + for item in matrix: + item.append(i) + item.append(arrPath[i]) + i += 1 + + return matrix + + + def _path_to_list(self, fpath): + head = fpath + out = [] + # taken from: http://www.jorendorff.com/articles/python/path/ + while head != self.path_module.curdir and head != self.path_module.pardir: + prev = head + head, tail = self.path_module.split(head) + if head == prev: break + out.append(tail) + if head: + out.append(head) + out.reverse() + return out + + + def __call__(self, fpath, w, measure=len, max_pardirs=2, type=DEFAULT): + """ + compacts a filepath or url to fit into the desired width + + @param fpath the filepath to be compacted + @param w the desired width the filepath should fit into + @keyparam measure function to measure the length of the filepath. + Default is len() but may be any other function that takes a filepath as + argument and returns its length as undigned int. + @keyparam max_pardirs maximum number of compacted parent dirs ("../") allowed + in the compacted path. Must be > 0. + @keyparam type use this explicitely specify the type of path passed. + Can be "posix", "nt", "mac" or "url" or DEFAULT. DEFAULT processes the + path with whatever os.path currently is. + + """ + if max_pardirs < 1: + raise PathError("max_pardirs < 1 is not allowed") + + if not fpath: + return "" + if measure(fpath) < w: + return fpath + + self.type, self.path_module = type, PATH_MODULES[type] + matrix = self.matrixFromPath(fpath) + if not matrix: + return "" # error here, the pattern does not match anything + matrix.sort() + + # process our sort matrix + i = 0 + while True: + + if len(matrix) > 2: + # ...chew next component till it's exhausted + item = matrix[i] + for cpn in self.chewComponent(item[2], fromLeft=False): + item[2] = cpn + path = self.matrixToPath(matrix) + if measure(path) < w: + return path + + if cpn == self.PARDIR: + i += 1 + break + + # ...pop 1 pardir if necessary + if i > max_pardirs or i >= len(matrix) -1: + matrix.pop(0) + matrix[0][2] = self.ELLIPSIS + i -= 1 + path = self.matrixToPath(matrix) + if measure(path) < w: + return path + + else: + # finalize + # 1. chew root away + if self.root: + for cpn in self.chewComponent(self.root, fromLeft=True): + self.root = cpn + if self.root == self.PARDIR: + if not matrix: + if measure(self.PARDIR) < w: + return self.PARDIR + if measure(self.DOT) < w: + return self.DOT + return "" + self.root = "" + break + path = self.matrixToPath(matrix) + if measure(path) < w: + return path + + path = self.matrixToPath(matrix) + if measure(path) < w: + return path + + # 2. chew filename away + if len(matrix) == 2: + component = matrix[0][2] + matrix[1][2] + if measure(component) < w: + return component + else: + component = matrix[0][2] + + for cpn in self.chewComponent(component, fromLeft=True): + if measure(cpn) < w: + return cpn + + if cpn == self.PARDIR: + if measure(self.DOT) < w: + return self.DOT + break + + # done it + break + + return "" + + +#******************************************** +# init PathCompacter() as function +#******************************************** +compactPath = PathCompacter() +#******************************************************************************** +# lightweight wrapper class for QLabels to display a compactable filepath or url +# the class is designed as a wrapper not a derrived class so it does not get in the +# way with QtDesigner +# +# problem to tackle is that every setText() triggers a resize of the whole layout +# so the filepath can't be adjusted in resizeEvent() (recursive). We handle +# paintEvent() instead and draw the label from scratch. +# +# similar wrappers can be easily implemented for QMenuItem() and QListView() +# header controls (...). +# +# Usage hint: +# if used on statusbars you should adjust the stretch factor, otherwise +# the label might appear invisible, 'cos it may not get resized. +# +# The label has a minimum size of 0 by default. To force a minimum +# size set any initial text to the label wrapped. Effect is 1. the text will not be +# displayed ++ the label will not get resized any smaller than this text. +# +#******************************************************************************* +class PathLabelWrap(object): + """ + class wrapping a QLabel to display a filepath or url that is compacted on + resizing of the label + """ + + def __init__(self, label, fpath="", prefix="", max_pardirs=1, type=DEFAULT): + """ + constructor + + @param label an initialized QLabel to wrap compactPath functionality around + @param fpath the filepath or url the label should display + @keyparam prefix: chars to be used as fixed prefix of the path like: "file: my/path/here" + @keyparam max_pardirs maximum number of compacted parent dirs ("../") allowed + in the compacted path. Must be > 0. + @keyparam type: use this to explicitely specify the type of path specified. + Can be "nt", "posix", "mac", "url" or DEFAULT to use whatever type of path + os.path currently handles. + + Note: currently the wrapper does not know how to display text for disabled state. + So disabling the underlaying QLabel will not result in the desired effect. + """ + self.label = label + self.fpath = fpath + self.prefix = prefix + self.max_pardirs= max_pardirs + self.type = type + + self.label.paintEvent = self.onPaint # overwrite + # for testing: + #self.label.setPaletteBackgroundColor(qt.QColor(10, 255, 22)) + + + def onPaint(self, event): + """ + overwritten method to handle painting of the filepath + """ + + # draw the label from scratch + # TODO: check if there is an easier processing via QStyle.drawControl() + fm = self.label.fontMetrics() + rc = self.label.rect() + frameW = self.label.frameWidth() + indent = self.label.indent() + if indent < 0: # see Qt docs: label.indent() + if frameW > 0: + indent = fm.width("x") /2 + else: + indent = 0 + rc.adjust(frameW + indent, frameW , -(frameW + indent), -frameW) + + w = rc.width() + if self.prefix: + w -= fm.width(self.prefix) + + fpath = compactPath( + self.fpath, + w, + measure=fm.width, + max_pardirs=self.max_pardirs, + type=self.type + ) + + painter = QtGui.QPainter(self.label) + painter.eraseRect(self.label.rect()) + self.label.drawFrame(painter) + # TODO: draw enabled/disabled text + # textColor is already ok but I haven't found a way to draw disabled text + # embossed + # if self.label.isEnabled(): + # else: + if self.prefix: + painter.drawText(rc, self.label.alignment(), '%s%s' % (self.prefix, fpath)) + else: + painter.drawText(rc, self.label.alignment(), fpath) + + + def setPath(self, fpath, prefix=None, max_pardirs=None, type=None): + """ + sets the filepath or url to be displayed + + If any of the keyword params is not None, the according property is adjusted to the specified value + """ + if prefix is not None: + self.prefix = prefix + if max_pardirs is not None: + self.max_pardirs = max_pardirs + if type is not None: + self.type = type + self.fpath = fpath + self.label.update() + + def getPath(self): + """ + retrieves the (uncompacted) filepath or url + """ + return self.fpath + +#****************************************************************************** +# tests +#****************************************************************************** +if __name__ == "__main__": + + def testGui(): + + CAPTION = "compactPath - [%s]" + PATHS = ( + ('posix', "/my/very/long/path/containing/many/compoponents/here.txt"), + ('nt', "c:\\my\\very\\long\\path\\containing\\many\\compoponents\\here.txt"), + ('mac', "my:very:long:path:containing:many:compoponents:here.txt"), + ('url', "http://my/very/long/path/containing/many/compoponents/here.txt"), + ) + BLINDTEXT = "xxxxxxxxxx" # this is set as text to the labels to force a minimum size. Adjust to your needs + + class TestGui(QtGui.QMainWindow): + """test gui""" + + def __init__(self): + QtGui.QMainWindow.__init__(self) + + self.mainWidget = QtGui.QWidget(self) + self.setCentralWidget(self.mainWidget) + + # NOTE: all the sep="" params are only thrown in for test purposes. + # + # Too bad, the label in the caption bar seems not to be available in Qt. So there is no way + # to adjust it dynamically. So init to some fixed width. Note that the width of the caption + # bar label has no effect on the GUIs width. + # + pathType, fpath = PATHS[0] + fpath = compactPath(fpath, 50 - len(CAPTION), type=pathType) + self.setWindowTitle(CAPTION % fpath) + + # throw labels into the Gui + layout = QtGui.QVBoxLayout(self.centralWidget()) + frameStyle = QtGui.QLabel.Sunken | QtGui.QLabel.Box + self.pathLabels = [] + for pathType, fpath in PATHS: + label = QtGui.QLabel(BLINDTEXT, self.mainWidget) + w = PathLabelWrap(label, fpath=fpath, prefix=pathType + ': ', type=pathType) + label.setFrameStyle(frameStyle) + layout.addWidget(label) + + # just a test label to see if our owner drawn labels are ok + self.labelTest = QtGui.QLabel("just a test", self.mainWidget) + self.labelTest.setFrameStyle(frameStyle) + layout.addWidget(self.labelTest) + + layout.addItem(QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding)) + + # add another one on the statusbar + self.status = self.statusBar() + self.statusLabelPosix = PathLabelWrap(QtGui.QLabel(BLINDTEXT, self.status), fpath=fpath) + self.status.addWidget(QtGui.QLabel('status::', self.status)) + self.status.addWidget(self.statusLabelPosix.label, 10) + self.status.addWidget(QtGui.QLabel('foo-bar', self.status)) + + def styleChange(self, oldStyle): + """styleChange handler""" + self.update() + + import sys + a = QtGui.QApplication(sys.argv) + QtCore.QObject.connect(a,QtCore.SIGNAL("lastWindowClosed()"),a,QtCore.SLOT("quit()")) + w = TestGui() + w.show() + a.exec_() + + ## + testGui() + + + + def test(): + """ + test compactPath() + """ + + def compact(path, start, stop, type=DEFAULT): + for i in range(start +1, stop, -1): + p = compactPath(path, i, max_pardirs=1, type=type) + print i, len(p), repr(p) + + def test1(): + path = "a:\\eeeeee\\fff\\foobarbaz\\ddd" + compact(path, len(path), 0, type="nt") + test1() + + def test2(): + path = "/home/eeeeee/fff/foobarbaz/ddd" + compact(path, len(path), 0, type="posix") + test2() + + def test3(): + path = "home:eeeeee:fff:foobarbaz:ddd" + compact(path, len(path), 0, type="mac") + test3() + + def test4(): + path = "home://eeeeee/fff/foobarbaz/ddd" + compact(path, len(path), 0, type="url") + test4() + + ## + #test() + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 18:35:41
|
Revision: 1282 http://frogpie.svn.sourceforge.net/frogpie/?rev=1282&view=rev Author: jUrner Date: 2007-08-25 03:18:32 -0700 (Sat, 25 Aug 2007) Log Message: ----------- ... Added Paths: ----------- trunk/sandbox/colordip/updateProject.py Added: trunk/sandbox/colordip/updateProject.py =================================================================== --- trunk/sandbox/colordip/updateProject.py (rev 0) +++ trunk/sandbox/colordip/updateProject.py 2007-08-25 10:18:32 UTC (rev 1282) @@ -0,0 +1,21 @@ +"""Commandline script to update the project""" + +import os +from colordip.colordip_lib.qt4ex.scripts import qtpro, manifest +#**************************************************************** +# +#**************************************************************** +if __name__ == '__main__': + d = os.path.dirname(__file__) + manifest.main(d) + d = os.path.join(d, 'colordip') + qtpro.main(d) + + + + + + + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 17:37:02
|
Revision: 1286 http://frogpie.svn.sourceforge.net/frogpie/?rev=1286&view=rev Author: jUrner Date: 2007-08-26 15:38:13 -0700 (Sun, 26 Aug 2007) Log Message: ----------- adapt to recent changes Modified Paths: -------------- trunk/sandbox/colordip/PluginColorDip.py Modified: trunk/sandbox/colordip/PluginColorDip.py =================================================================== --- trunk/sandbox/colordip/PluginColorDip.py 2007-08-26 22:31:24 UTC (rev 1285) +++ trunk/sandbox/colordip/PluginColorDip.py 2007-08-26 22:38:13 UTC (rev 1286) @@ -22,13 +22,13 @@ settings.remove('') settings.endGroup() -from colordip.colordip_res import resources from colordip import config from colordip.colordip import GuiColorDip +from colordip.colordip_lib.qt4ex import settingsbase, resources #*********************************************************************** # customized settings object #*********************************************************************** -class Settings(config.Settings): +class Settings(settingsbase.Settings): def getObject(self, parent): settings = Preferences.Prefs.settings @@ -38,21 +38,6 @@ def close(self, settings): settings.endGroup() -#********************************************************************** -# -#********************************************************************** -class E4GuiColorDip(GuiColorDip): - - def getSettingsObject(self): - settings = Preferences.Prefs.settings - settings.beginGroup('Plugins/ColorDip') - return settings - - def closeSettingsObject(self, settings): - settings.endGroup() - - -config.settings = Settings() #*********************************************************************** # #*********************************************************************** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 17:36:22
|
Revision: 1290 http://frogpie.svn.sourceforge.net/frogpie/?rev=1290&view=rev Author: jUrner Date: 2007-08-26 15:40:26 -0700 (Sun, 26 Aug 2007) Log Message: ----------- ... Added Paths: ----------- trunk/sandbox/qt4ex/qt4ex/qt4ex.pro Added: trunk/sandbox/qt4ex/qt4ex/qt4ex.pro =================================================================== --- trunk/sandbox/qt4ex/qt4ex/qt4ex.pro (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/qt4ex.pro 2007-08-26 22:40:26 UTC (rev 1290) @@ -0,0 +1,30 @@ +SOURCES = assistant.py \ + resources.py \ + settingsbase.py \ + __init__.py \ + qtools.py \ + language.py \ + ctrls/areatips.py \ + ctrls/mrumenu.py \ + ctrls/labelwrap.py \ + ctrls/colorbutton.py \ + ctrls/dragtool.py \ + ctrls/tablewidget.py \ + ctrls/toolbarwrap.py \ + ctrls/__init__.py \ + ctrls/checkarraywrap.py \ + ctrls/compactpatwrap.py \ + dlgs/__init__.py \ + dlgs/dlgabout/__init__.py \ + dlgs/dlgabout/Ui_DlgAbout.py \ + dlgs/dlgfindreplace/__init__.py \ + dlgs/dlgfindreplace/Ui_DlgFindReplace.py \ + sandbox/zoomview.py \ + scripts/__init__.py \ + scripts/qtpro.py \ + scripts/manifest.py + +FORMS = dlgs/dlgabout/DlgAbout.ui \ + dlgs/dlgfindreplace/DlgFindReplace.ui + +TRANSLATIONS = lang/en.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...> - 2007-08-27 17:36:15
|
Revision: 1292 http://frogpie.svn.sourceforge.net/frogpie/?rev=1292&view=rev Author: jUrner Date: 2007-08-26 15:41:07 -0700 (Sun, 26 Aug 2007) Log Message: ----------- ... Added Paths: ----------- trunk/sandbox/qt4ex/qt4ex/ctrls/checkarraywrap.py Added: trunk/sandbox/qt4ex/qt4ex/ctrls/checkarraywrap.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/ctrls/checkarraywrap.py (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/ctrls/checkarraywrap.py 2007-08-26 22:41:07 UTC (rev 1292) @@ -0,0 +1,93 @@ +"""wrapper class for handling checkboxes (...) as bit array + + +CONST_1 = 1 +CONST_2 = 2 +CONST_3 = 4 + +checks = { + CONST_1: ckeckbox1, + CONST_2: checkbox2, + CONST_3: cjeckbox3, + + } + + +flags = CheckArray(checks, initvalue=CONST_1 | CONST_2) + +flags |= CONST_3 # check 3rd checkbox +flags.showChecks(CONST_1 | CONST_2) # hide 3rd checkbox + +""" + +from PyQt4 import QtCore +#******************************************************* +# +#******************************************************* +class CheckArrayWrap(QtCore.QObject): + + def __init__(self, parent, checks, value=None): + QtCore.QObject.__init__(self, parent) + self._checks = checks + + if value is not None: + self.setChecks(value) + + ###################################### + ## public methods + ###################################### + def getValue(self): + value = 0 + for const, ck in self._checks.items(): + if ck.isChecked(): + value |= const + return value + + + def setChecks(self, flags): + for const, ck in self._checks.items(): + if flags & const: + ck.setCheckState(QtCore.Qt.Checked) + else: + ck.setCheckState(QtCore.Qt.Unchecked) + flags &= ~const + if not flags: + break + + + def showChecks(self, flags): + for const, ck in self._checks.items(): + if flags & const: + check.control.setEnabled(True) + check.control.show() + else: + check.control.setEnabled(False) + check.control.hide() + flags &= ~const + if not flags: + break + + + def __or__(self, n): + value = self.getValue() | n + self.setChecks(value) + return self + def __ior__(self, n): return self.__or__(n) + def __ror__(self, n): return self.__or__(n) + + def __and__(self, n): + value = self.getValue() & n + self.setChecks(value) + return self + def __iand__(self, n): return self.__and__(n) + def __rand__(self, n): return self.__and__(n) + + def __xor__(self, n): + value = self.getValue() ^ n + self.setChecks(value) + return self + def __ixor__(self, n): return self.__xor__(n) + def __rxor__(self, n): return self.__xor__(n) + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 17:36:07
|
Revision: 1288 http://frogpie.svn.sourceforge.net/frogpie/?rev=1288&view=rev Author: jUrner Date: 2007-08-26 15:39:52 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Qt translations present on system are now used Modified Paths: -------------- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/language.py Modified: trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/language.py =================================================================== --- trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/language.py 2007-08-26 22:38:19 UTC (rev 1287) +++ trunk/sandbox/colordip/colordip/colordip_lib/qt4ex/language.py 2007-08-26 22:39:52 UTC (rev 1288) @@ -5,10 +5,10 @@ The Language() class scans all files in its directory for *.qm translation files and manages QTranslators and language names for an application. -note: Only translations for wich a qt_*.qm file exists are handled. -All translation files have to follow the convention "prefix + localeName.qm". -with localeName being a localeName as defined in class LanguageNames(). +@note: Available translations are taken from the first directory in languageDirs. +All translation files should follow the convention "Prefix_LocaleName.qm" +@note: the pprefixes 'qt_' and 'qt4ex_' are reserved """ @@ -26,9 +26,8 @@ #*************************************************************** # #*************************************************************** -LanguageDir = os.path.join(os.path.dirname(__file__), 'lang') +Qt4ExLanguageDir = os.path.join(os.path.dirname(__file__), 'lang') - #*************************************************************** # #*************************************************************** @@ -248,31 +247,34 @@ self._translationPrefixes = None self._translators = {'qt_': None} # prefix --> translator - if LanguageDir not in self._languageDirs: - self._languageDirs.append(LanguageDir) + if Qt4ExLanguageDir not in self._languageDirs: + self._languageDirs.append(Qt4ExLanguageDir) if translationPrefixes is None: self._translationPrefixes = ['qt_', ] else: self._translationPrefixes = list(translationPrefixes) - if 'qt_' not in self._translationPrefixes: + if 'qt_' in self._translationPrefixes: + raise valueError('"qt_" is a reserved prefix') + else: self._translationPrefixes.append('qt_') if 'qt4ex_' in self._translationPrefixes: raise valueError('"qt4ex_" is a reserved prefix') self._translationPrefixes.append('qt4ex_') - - + # gather available locale names - for languageDir in self._languageDirs: - root, dirs, files = os.walk(languageDir).next() - for f in files: - name, ext = os.path.splitext(f) - if f.startswith('qt_') and ext.lower() == '.qm': - localeName = name.split('qt_', 1)[1] - if localeName not in self._localeNames: - self._localeNames.append(localeName) + languageDir = self._languageDirs[0] + root, dirs, files = os.walk(languageDir).next() + for f in files: + name, ext = os.path.splitext(f) + if ext.lower() == '.qm': + prefix, sep, localeName = name.partition('_') + if localeName: + self._localeNames.append(localeName) + else: + raise ValueError('Invalid translation file: ' + os.path.join(root, f) ) self._localeNames.sort() - + def getDefaultLocaleName(self): """returns the default locale name @@ -292,7 +294,8 @@ def getLanguageFile(self, localeName, prefix=None): """returns the full path to a language file (*.qm) for the specified locale @param localeName: name of the locale to get the language fle for - @param prefix: prefix of the language file + @param prefix: prefix of the language file. If prefix is "qt_", one of Qts + language files is returned @return: (absolute) filepath of the translation file or None if no file was found @note: If a language file for the specified locale name is not available a path @@ -304,10 +307,18 @@ if prefix is None: prefix = '' - for languageDir in self._languageDirs: - fpath = os.path.join(languageDir, prefix + localeName + '.qm') - if os.path.isfile(fpath): - return fpath + elif prefix == 'qt_': + directory = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath) + directory = unicode(directory) + if directory: + fpath = os.path.join(directory, prefix + localeName + '.qm') + if os.path.isfile(fpath): + return fpath + else: + for languageDir in self._languageDirs: + fpath = os.path.join(languageDir, prefix + localeName + '.qm') + if os.path.isfile(fpath): + return fpath def getTranslationPrefixes(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 17:35:36
|
Revision: 1294 http://frogpie.svn.sourceforge.net/frogpie/?rev=1294&view=rev Author: jUrner Date: 2007-08-26 15:41:51 -0700 (Sun, 26 Aug 2007) Log Message: ----------- ... Property Changed: ---------------- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/ Property changes on: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace ___________________________________________________________________ Name: svn:ignore + *.pyc *.pyo This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 17:35:34
|
Revision: 1293 http://frogpie.svn.sourceforge.net/frogpie/?rev=1293&view=rev Author: jUrner Date: 2007-08-26 15:41:26 -0700 (Sun, 26 Aug 2007) Log Message: ----------- ... Added Paths: ----------- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/__init__.py Added: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui 2007-08-26 22:41:26 UTC (rev 1293) @@ -0,0 +1,246 @@ +<ui version="4.0" > + <class>DlgFindReplace</class> + <widget class="QDialog" name="DlgFindReplace" > + <property name="geometry" > + <rect> + <x>0</x> + <y>0</y> + <width>441</width> + <height>178</height> + </rect> + </property> + <property name="windowTitle" > + <string>FindReplace...</string> + </property> + <layout class="QGridLayout" > + <property name="leftMargin" > + <number>4</number> + </property> + <property name="topMargin" > + <number>4</number> + </property> + <property name="rightMargin" > + <number>4</number> + </property> + <property name="bottomMargin" > + <number>2</number> + </property> + <property name="horizontalSpacing" > + <number>2</number> + </property> + <property name="verticalSpacing" > + <number>2</number> + </property> + <item row="0" column="0" > + <layout class="QHBoxLayout" > + <property name="spacing" > + <number>2</number> + </property> + <item> + <layout class="QVBoxLayout" > + <property name="spacing" > + <number>2</number> + </property> + <item> + <widget class="QLabel" name="labelFind" > + <property name="text" > + <string>Find:</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="labelReplace" > + <property name="text" > + <string>Replace:</string> + </property> + </widget> + </item> + </layout> + </item> + <item> + <layout class="QVBoxLayout" > + <property name="spacing" > + <number>2</number> + </property> + <item> + <widget class="QComboBox" name="cmbFind" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable" > + <bool>true</bool> + </property> + <property name="insertPolicy" > + <enum>QComboBox::InsertAtTop</enum> + </property> + </widget> + </item> + <item> + <widget class="QComboBox" name="cmbReplace" > + <property name="sizePolicy" > + <sizepolicy vsizetype="Fixed" hsizetype="Expanding" > + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="editable" > + <bool>true</bool> + </property> + <property name="insertPolicy" > + <enum>QComboBox::InsertAtTop</enum> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </item> + <item rowspan="2" row="0" column="1" > + <widget class="Line" name="line_2" > + <property name="orientation" > + <enum>Qt::Vertical</enum> + </property> + </widget> + </item> + <item rowspan="2" row="0" column="2" > + <layout class="QVBoxLayout" > + <property name="spacing" > + <number>2</number> + </property> + <item> + <widget class="QPushButton" name="btFindDownwards" > + <property name="text" > + <string>Find Next</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btFindUpwards" > + <property name="text" > + <string>Upwards</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btReplace" > + <property name="text" > + <string>Replace</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btReplaceAll" > + <property name="text" > + <string>Replace All</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="btOk" > + <property name="text" > + <string>Ok</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="1" column="0" > + <layout class="QGridLayout" > + <property name="horizontalSpacing" > + <number>2</number> + </property> + <property name="verticalSpacing" > + <number>2</number> + </property> + <item row="0" column="0" colspan="2" > + <widget class="Line" name="line" > + <property name="orientation" > + <enum>Qt::Horizontal</enum> + </property> + </widget> + </item> + <item row="1" column="0" > + <widget class="QCheckBox" name="ckWholeWord" > + <property name="text" > + <string>Whole Word</string> + </property> + </widget> + </item> + <item row="1" column="1" > + <widget class="QCheckBox" name="ckCustom1" > + <property name="text" > + <string>Custom 1</string> + </property> + </widget> + </item> + <item row="2" column="0" > + <widget class="QCheckBox" name="ckMatchCase" > + <property name="text" > + <string>Match Case</string> + </property> + </widget> + </item> + <item row="2" column="1" > + <widget class="QCheckBox" name="ckCustom2" > + <property name="text" > + <string>Custom 2</string> + </property> + </widget> + </item> + <item row="3" column="0" > + <widget class="QCheckBox" name="ckRegularExpression" > + <property name="text" > + <string>Regular Expression</string> + </property> + </widget> + </item> + <item row="3" column="1" > + <widget class="QCheckBox" name="ckCustom3" > + <property name="text" > + <string>Custom 3</string> + </property> + </widget> + </item> + </layout> + </item> + <item row="2" column="0" colspan="3" > + <widget class="QLabel" name="labelStatus" > + <property name="frameShape" > + <enum>QFrame::Panel</enum> + </property> + <property name="frameShadow" > + <enum>QFrame::Sunken</enum> + </property> + <property name="text" > + <string>Status</string> + </property> + <property name="alignment" > + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + </layout> + </widget> + <resources/> + <connections> + <connection> + <sender>btOk</sender> + <signal>clicked()</signal> + <receiver>DlgFindReplace</receiver> + <slot>close()</slot> + <hints> + <hint type="sourcelabel" > + <x>395</x> + <y>134</y> + </hint> + <hint type="destinationlabel" > + <x>220</x> + <y>88</y> + </hint> + </hints> + </connection> + </connections> +</ui> Added: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/Ui_DlgFindReplace.py 2007-08-26 22:41:26 UTC (rev 1293) @@ -0,0 +1,172 @@ +# -*- coding: utf-8 -*- + +# Form implementation generated from reading ui file '/home/me/src/proj/frogpie/trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/DlgFindReplace.ui' +# +# Created: Sat Aug 25 04:47:50 2007 +# by: PyQt4 UI code generator 4.3 +# +# WARNING! All changes made in this file will be lost! + +from PyQt4 import QtCore, QtGui + +class Ui_DlgFindReplace(object): + def setupUi(self, DlgFindReplace): + DlgFindReplace.setObjectName("DlgFindReplace") + DlgFindReplace.resize(QtCore.QSize(QtCore.QRect(0,0,441,178).size()).expandedTo(DlgFindReplace.minimumSizeHint())) + + self.gridlayout = QtGui.QGridLayout(DlgFindReplace) + self.gridlayout.setContentsMargins(4,4,4,2) + self.gridlayout.setSpacing(2) + self.gridlayout.setObjectName("gridlayout") + + self.hboxlayout = QtGui.QHBoxLayout() + self.hboxlayout.setSpacing(2) + self.hboxlayout.setObjectName("hboxlayout") + + self.vboxlayout = QtGui.QVBoxLayout() + self.vboxlayout.setSpacing(2) + self.vboxlayout.setObjectName("vboxlayout") + + self.labelFind = QtGui.QLabel(DlgFindReplace) + self.labelFind.setObjectName("labelFind") + self.vboxlayout.addWidget(self.labelFind) + + self.labelReplace = QtGui.QLabel(DlgFindReplace) + self.labelReplace.setObjectName("labelReplace") + self.vboxlayout.addWidget(self.labelReplace) + self.hboxlayout.addLayout(self.vboxlayout) + + self.vboxlayout1 = QtGui.QVBoxLayout() + self.vboxlayout1.setSpacing(2) + self.vboxlayout1.setObjectName("vboxlayout1") + + self.cmbFind = QtGui.QComboBox(DlgFindReplace) + + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cmbFind.sizePolicy().hasHeightForWidth()) + self.cmbFind.setSizePolicy(sizePolicy) + self.cmbFind.setEditable(True) + self.cmbFind.setInsertPolicy(QtGui.QComboBox.InsertAtTop) + self.cmbFind.setObjectName("cmbFind") + self.vboxlayout1.addWidget(self.cmbFind) + + self.cmbReplace = QtGui.QComboBox(DlgFindReplace) + + sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,QtGui.QSizePolicy.Fixed) + sizePolicy.setHorizontalStretch(0) + sizePolicy.setVerticalStretch(0) + sizePolicy.setHeightForWidth(self.cmbReplace.sizePolicy().hasHeightForWidth()) + self.cmbReplace.setSizePolicy(sizePolicy) + self.cmbReplace.setEditable(True) + self.cmbReplace.setInsertPolicy(QtGui.QComboBox.InsertAtTop) + self.cmbReplace.setObjectName("cmbReplace") + self.vboxlayout1.addWidget(self.cmbReplace) + self.hboxlayout.addLayout(self.vboxlayout1) + self.gridlayout.addLayout(self.hboxlayout,0,0,1,1) + + self.line_2 = QtGui.QFrame(DlgFindReplace) + self.line_2.setFrameShape(QtGui.QFrame.VLine) + self.line_2.setFrameShadow(QtGui.QFrame.Sunken) + self.line_2.setObjectName("line_2") + self.gridlayout.addWidget(self.line_2,0,1,2,1) + + self.vboxlayout2 = QtGui.QVBoxLayout() + self.vboxlayout2.setSpacing(2) + self.vboxlayout2.setObjectName("vboxlayout2") + + self.btFindDownwards = QtGui.QPushButton(DlgFindReplace) + self.btFindDownwards.setObjectName("btFindDownwards") + self.vboxlayout2.addWidget(self.btFindDownwards) + + self.btFindUpwards = QtGui.QPushButton(DlgFindReplace) + self.btFindUpwards.setObjectName("btFindUpwards") + self.vboxlayout2.addWidget(self.btFindUpwards) + + self.btReplace = QtGui.QPushButton(DlgFindReplace) + self.btReplace.setObjectName("btReplace") + self.vboxlayout2.addWidget(self.btReplace) + + self.btReplaceAll = QtGui.QPushButton(DlgFindReplace) + self.btReplaceAll.setObjectName("btReplaceAll") + self.vboxlayout2.addWidget(self.btReplaceAll) + + self.btOk = QtGui.QPushButton(DlgFindReplace) + self.btOk.setObjectName("btOk") + self.vboxlayout2.addWidget(self.btOk) + self.gridlayout.addLayout(self.vboxlayout2,0,2,2,1) + + self.gridlayout1 = QtGui.QGridLayout() + self.gridlayout1.setSpacing(2) + self.gridlayout1.setObjectName("gridlayout1") + + self.line = QtGui.QFrame(DlgFindReplace) + self.line.setFrameShape(QtGui.QFrame.HLine) + self.line.setFrameShadow(QtGui.QFrame.Sunken) + self.line.setObjectName("line") + self.gridlayout1.addWidget(self.line,0,0,1,2) + + self.ckWholeWord = QtGui.QCheckBox(DlgFindReplace) + self.ckWholeWord.setObjectName("ckWholeWord") + self.gridlayout1.addWidget(self.ckWholeWord,1,0,1,1) + + self.ckCustom1 = QtGui.QCheckBox(DlgFindReplace) + self.ckCustom1.setObjectName("ckCustom1") + self.gridlayout1.addWidget(self.ckCustom1,1,1,1,1) + + self.ckMatchCase = QtGui.QCheckBox(DlgFindReplace) + self.ckMatchCase.setObjectName("ckMatchCase") + self.gridlayout1.addWidget(self.ckMatchCase,2,0,1,1) + + self.ckCustom2 = QtGui.QCheckBox(DlgFindReplace) + self.ckCustom2.setObjectName("ckCustom2") + self.gridlayout1.addWidget(self.ckCustom2,2,1,1,1) + + self.ckRegularExpression = QtGui.QCheckBox(DlgFindReplace) + self.ckRegularExpression.setObjectName("ckRegularExpression") + self.gridlayout1.addWidget(self.ckRegularExpression,3,0,1,1) + + self.ckCustom3 = QtGui.QCheckBox(DlgFindReplace) + self.ckCustom3.setObjectName("ckCustom3") + self.gridlayout1.addWidget(self.ckCustom3,3,1,1,1) + self.gridlayout.addLayout(self.gridlayout1,1,0,1,1) + + self.labelStatus = QtGui.QLabel(DlgFindReplace) + self.labelStatus.setFrameShape(QtGui.QFrame.Panel) + self.labelStatus.setFrameShadow(QtGui.QFrame.Sunken) + self.labelStatus.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) + self.labelStatus.setObjectName("labelStatus") + self.gridlayout.addWidget(self.labelStatus,2,0,1,3) + + self.retranslateUi(DlgFindReplace) + QtCore.QObject.connect(self.btOk,QtCore.SIGNAL("clicked()"),DlgFindReplace.close) + QtCore.QMetaObject.connectSlotsByName(DlgFindReplace) + + def retranslateUi(self, DlgFindReplace): + DlgFindReplace.setWindowTitle(QtGui.QApplication.translate("DlgFindReplace", "FindReplace...", None, QtGui.QApplication.UnicodeUTF8)) + self.labelFind.setText(QtGui.QApplication.translate("DlgFindReplace", "Find:", None, QtGui.QApplication.UnicodeUTF8)) + self.labelReplace.setText(QtGui.QApplication.translate("DlgFindReplace", "Replace:", None, QtGui.QApplication.UnicodeUTF8)) + self.btFindDownwards.setText(QtGui.QApplication.translate("DlgFindReplace", "Find Next", None, QtGui.QApplication.UnicodeUTF8)) + self.btFindUpwards.setText(QtGui.QApplication.translate("DlgFindReplace", "Upwards", None, QtGui.QApplication.UnicodeUTF8)) + self.btReplace.setText(QtGui.QApplication.translate("DlgFindReplace", "Replace", None, QtGui.QApplication.UnicodeUTF8)) + self.btReplaceAll.setText(QtGui.QApplication.translate("DlgFindReplace", "Replace All", None, QtGui.QApplication.UnicodeUTF8)) + self.btOk.setText(QtGui.QApplication.translate("DlgFindReplace", "Ok", None, QtGui.QApplication.UnicodeUTF8)) + self.ckWholeWord.setText(QtGui.QApplication.translate("DlgFindReplace", "Whole Word", None, QtGui.QApplication.UnicodeUTF8)) + self.ckCustom1.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom 1", None, QtGui.QApplication.UnicodeUTF8)) + self.ckMatchCase.setText(QtGui.QApplication.translate("DlgFindReplace", "Match Case", None, QtGui.QApplication.UnicodeUTF8)) + self.ckCustom2.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom 2", None, QtGui.QApplication.UnicodeUTF8)) + self.ckRegularExpression.setText(QtGui.QApplication.translate("DlgFindReplace", "Regular Expression", None, QtGui.QApplication.UnicodeUTF8)) + self.ckCustom3.setText(QtGui.QApplication.translate("DlgFindReplace", "Custom 3", None, QtGui.QApplication.UnicodeUTF8)) + self.labelStatus.setText(QtGui.QApplication.translate("DlgFindReplace", "Status", None, QtGui.QApplication.UnicodeUTF8)) + + + +if __name__ == "__main__": + import sys + app = QtGui.QApplication(sys.argv) + DlgFindReplace = QtGui.QDialog() + ui = Ui_DlgFindReplace() + ui.setupUi(DlgFindReplace) + DlgFindReplace.show() + sys.exit(app.exec_()) Added: trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/__init__.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/__init__.py (rev 0) +++ trunk/sandbox/qt4ex/qt4ex/dlgs/dlgfindreplace/__init__.py 2007-08-26 22:41:26 UTC (rev 1293) @@ -0,0 +1,427 @@ + +# TODO: feedback on how many occurences have been replaced + + +import os, sys + +#--> rel import hack +d = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) +sys.path.insert(0, d) + +import settingsbase +from ctrls import checkarraywrap + +sys.path.pop(0) +del d +#<-- rel import hack + +from PyQt4 import QtCore, QtGui +from Ui_DlgFindReplace import Ui_DlgFindReplace +#***************************************************************** +# settings +#***************************************************************** +IdLabelFind = 'labelFind' +IdLabelReplace = 'labelReplace' +IdCmbFind = 'cmbFind' +IdCmbReplace = 'cmbReplace' + +IdBtActionDownwards = 'btFindDownwards' +IdBtActionUpwnwards = 'btFindUpwards' +IdBtReplace = 'btReplace' +IdBtReplaceAll = 'btReplaceAll' +IdBtOk = 'btOk' + +IdCkWholeWord = 'ckWholeWord' +IdCkMatchCase = 'ckMatchCase' +IdCkRegularExpression = 'ckRegularExpression' +IdCkCustom1 = 'ckCustom1' +IdCkCustom2 = 'ckCustom2' +IdCkCustom3 = 'ckCustom3' + +IdLabelStatus = 'labelStatus' + +CustomChecks = (IdCkCustom1, IdCkCustom2, IdCkCustom3) + +#***************************************************************** +# settings +#***************************************************************** +class DlgSettings(settingsbase.SettingsBase): + + KEY_SETTINGS = 'Qt4Ex/Dlgs/DlgAbout' + SETTINGS = [ + ('Geometry', ['UGeometry', None]), + ] + +#***************************************************************** +# find parameters +#***************************************************************** +class FindParams(QtCore.QObject): + """data class that holds parameters of the current search""" + + DlgReplace = 0x1 # displays a replace dialog + + ActionDownwards = 0x100 # search direction is downwards + ActionUpwnwards = 0x200 # search direction is upwards + ActionReplace = 0x400 # replace + ActionReplaceAll = 0x800 # replace all + MaskActionsFind = ActionDownwards | ActionUpwnwards + MaskActionsReplace = ActionReplace | ActionReplaceAll + MaskActions = MaskActionsFind | MaskActionsReplace + + MatchNone = 0 + MatchWholeWord = 0x10000 # searches whole word + MatchCase = 0x20000 # searches case sensitive + MatchRegularExpression = 0x40000 # regular expression + MatchCustom1 = 0x80000 + MatchCustom2 = 0x100000 + MatchCustom3 = 0x200000 + MaskMatches = MatchWholeWord | MatchCase | MatchRegularExpression | \ + MatchCustom1 | MatchCustom1 | MatchCustom1 + + + __slots__ = ("flags", "find", "replace") + def __init__(self, parent): + """constructor + + @param parent: parent + @attr flags: one or more Action*, Dlg* and Match* flags + @attr find: (QString) string to find + @attr replace: (QString) string to replace + + @cvar DlgReplace: displays a Replace dialog + + @cvar ActionDownwards: the user hit the "Find Next" button + @cvar ActionUpwards: the user hit the "Upwards" button + @cvar ActionReplace: the user hit the "Replace" button + @cvar ActionReplaceAll: the user hit the "Replace All" button + @cvar MaskActionsFind: mask for find actions + @cvar MaskActionsReplace: mask for replace actions + @cvar MaskActions: mask for actions + + @cvar MatchNone: default match flag + @cvar MatchWholeWord: the user checked the "Match Word" checkbox + @cvar MatchCase: the user checked the "Match Case" checkbox + @cvar MatchRegualrExpressioin: the user checked the "Regualr Expression" checkbox + @cvar MatchCustom1: the user checked the custom-1 checkbox + @cvar MatchCustom2: the user checked the custom-2 checkbox + @cvar MatchCustom3: the user checked the custom-3 checkbox + @cvar MaskMatches: mask for match checkboxes + + """ + QtCore.QObject.__init__(self, parent) + + self.flags = self.MatchNone + self.find = QtCore.QString() + self.replace = QtCore.QString() + + + def giveFeedback(self, n): + """Notifies listenrers about the result of a find or rplace action + @param n: (uint) number of occurences found or replaced + """ + self.emit(QtCore.SIGNAL('giveFeedback(int)'), n) + + + def printFindParams(self): + """helper for debugging, prints out all info gatherd in the class""" + print '-------------------------------------------' + print self.flags & self.DlgReplace and "<Replace Dialog>" or "<Find Dialog>" + print "Action:", { + self.ActionDownwards: "Find Downwards", + self.ActionUpwnwards: "Find Upwards", + self.ActionReplace: "Replace", + self.ActionReplaceAll: "Replace All", + }[self.flags & self.MaskActions] + print 'Find:', repr(str(self.find)) + print 'Replace:', repr(str(self.replace)) + print "Match Case:", bool(self.flags & self.MatchCase) + print "Match Word:", bool(self.flags & self.MatchWholeWord) + print "Match Regex:", bool(self.flags & self.MatchRegularExpression) + print "Match custom1:", bool(self.flags & self.MatchCustom1) + print "Match Custom2:", bool(self.flags & self.MatchCustom2) + print "Match Custom3:", bool(self.flags & self.MatchCustom3) + print '-------------------------------------------' + + +Checks = { + FindParams.MatchWholeWord: IdCkWholeWord, + FindParams.MatchCase: IdCkMatchCase, + FindParams.MatchRegularExpression: IdCkRegularExpression, + FindParams.MatchCustom1: IdCkCustom1, + FindParams.MatchCustom2: IdCkCustom2, + FindParams.MatchCustom3: IdCkCustom3, + } +#******************************************************************** +# +#******************************************************************** +class DlgActionReplace(QtGui.QDialog, Ui_DlgFindReplace): + """Displays a find or replace dialog + + In addition to the default checks for MatchWord, MatchCase, MatchRegularExperession + the dialog supports up to three custom checkboxes. + + + sample code: + + + def onReplaceWhatever(self): + + # setup find params + findParams = FindParams(self) + + # display a replace dialog + findParams.flags = FindParams.DlgReplace + + # checks to set initially + findParams.flags |= FindParams.WholeWord | FindParams.MatchCase + + # adjust checks to be shown + showChecks = FindParams.WholeWord | FindParams.MatchCase | FindParams.Custom1 + + # create dialog + dlg = DlgFindReplace(parent + findParams=findParams, + showChecks=showChecks, + customChecks=('My Custom Checkbox', ), + # if find or replace history was saved last time the dialog was run, pass them + #findHistory=MySavedFindHistory, + #replaceHistory=MySavedReplaceHistory, + ) + + # connect and run dialog + self.connect(dlg, QtCore.SIGNAL('find(QObject*)'), self.onReplaceDialog) + dlg.exec_() + + # save state if desired...sorry for inconvenience, but PyQt + # does not support QMap + geometry = dlg.savedGeometry() + findHistory = dlg.saveFindHistory() + replaceHistory = dlg.saveReplaceHistory() + checkState = dlg.saveCheckState() + + + def onReplaceDialog(self, findParams): + + if findParams.flags & FindParams.ReplaceAll: + + # user checked 'My Custom Checkbox' + myFlag = bool(findParams.flags & FindParams.MatchCustom1) + + # do replacement + nReplacements = self.replaceWhatever(myFlag) + + # notify dialog about the changes + findParams.notifyChanges(nReplacements) + """ + + def __init__(self, parent, + findParams=None, + showChecks=None, + customChecks=None, + findHistory=None, + replaceHistory=None, + geometry=None + ): + """ + @param findParams: FindParams instance. The state of the checkboxes is initialized according + to FindParams.flags (Match* flags) in the FindParams instance passed. If the DlgReplace flag is + set, a Replace dialog is displayed. + @param showChecks: FindParams.Match* flags with checks to show. Default shows all checks + @param customChecks: (list QStrings) text for custom checkboxes or None + @param findHistory: QStringList containing find history or None + @param replaceHistory: QStringList containing replace history or None + @param geometry: (QByteArray) geometry of the dialog as returned from QWidget.saveGeometry() or None + + @signal SIGNAL('find(QObject* findParams)'): emitted when the user hits one of the find or replace buttons. + """ + + QtGui.QDialog.__init__(self, parent) + self.setupUi(self) + + + self._checkArray = None + self._findParams = findParams + self._savedGeometry = '' + + # init buttons + buttons = ( + (IdBtActionDownwards, self.onBtActionDownwards), + (IdBtActionUpwnwards, self.onBtActionUpwnwards), + (IdBtReplace, self.onBtReplace), + (IdBtReplaceAll, self.onBtReplaceAll), + (IdBtOk, self.close), + ) + for idControl, cb in buttons: + self.connect(self.controlById(idControl), QtCore.SIGNAL('clicked()'), cb) + + if findParams is not None: + + self.connect(findParams, QtCore.SIGNAL('giveFeedback(int)'), self.onGiveFeedback) + + # init find or replace + if findParams.flags & findParams.DlgReplace: + self.setWindowTitle(self.trUtf8("Replace...")) + else: + self.setWindowTitle(self.trUtf8("Find...")) + for idControl in (IdLabelReplace, IdCmbReplace, IdBtReplace, IdBtReplaceAll): + ctrl = self.controlById(idControl) + ctrl.setEnabled(False) + ctrl.setVisible(False) + + + # init checks + checks = Checks.copy() + for const, idControl in checks.items(): + checks[const] = self.controlById(idControl) + self._checkArray = checkarraywrap.CheckArrayWrap( + self, + checks, + value=findParams.flags + ) + if findParams is not None: + self._checkArray.setChecks(findParams.flags & findParams.MaskMatches) + + if showChecks is not None: + self._checkArray.showChecks(showChecks) + if customChecks is not None: + customChecks = list(customChecks) + for n, idControl in enumerate(CustomChecks): + ck = self.controlById(idControl) + if customChecks: + ck.setText(customChecks.pop(0)) + else: + ck.setEnabled(False) + ck.setVisible(False) + if customChecks: + raise ValueError('Only %s custom checks supported' % len(CustomChecks)) + + # init combos + if findHistory: + cmb = self.controlById(IdCmbFind).addItems(findHistory) + if replaceHistory: + cmb = self.controlById(IdCmbReplace).addItems(replaceHistory) + + if geometry is not None: + self.restoreGeometry(geometry) + + + ############################################ + ## events + ############################################ + def closeEvent(self, event): + self.close() + + + def showEvent(self, event): + label = self.controlById(IdLabelStatus) + label.setText(self.trUtf8('Ready')) + self.resize(self.width(), 0) + self.setFixedHeight(self.height()) + + + def hideEvent(self, event): + self.close() + + ################################################ + ## slots + ################################################ + def onBtActionDownwards(self): self._emitSignalFind(FindParams.ActionDownwards) + def onBtActionUpwnwards(self): self._emitSignalFind(FindParams.ActionUpwnwards) + def onBtReplace(self): self._emitSignalFind(FindParams.ActionReplace) + def onBtReplaceAll(self): self._emitSignalFind(FindParams.ActionReplaceAll) + + def onGiveFeedback(self, n): + label = self.controlById(IdLabelStatus) + if self._findParams.flags & FindParams.MaskActionsReplace: + label.setText(self.trUtf8('Replaced:') + ' ' + str(n)) + else: + label.setText(self.trUtf8('Found:') + ' ' + str(n)) + + ############################################## + ## private methods + ############################################## + def _emitSignalFind(self, flagFind): + if self._findParams is None: + return + + flags = self._checkArray.getValue() + flags &= ~self._findParams.MaskActions + flags |= flagFind + self._findParams.flags = flags + self._findParams.find = self.controlById(IdCmbFind).lineEdit().text() + if flags & self._findParams.DlgReplace: + self._findParams.replace = self.controlById(IdCmbReplace).lineEdit().text() + else: + self._findParams.replace = "" + self.emit(QtCore.SIGNAL('find(QObject*)'), (self._findParams)) + + ############################################ + ## methods + ############################################ + def close(self): + """Closes the dialog""" + self._savedGeometry = QtGui.QDialog.saveGeometry(self) + QtGui.QDialog.close(self) + + + def controlById(self, id_control): + """Returns a control fiven its id (one of the Id* consts as defined by the module)""" + return getattr(self, id_control) + + + def saveCheckState(self): + """Returns an integer containing the current state of the checkboxes""" + if self._findParams is None: + return 0 + return self._findParams.flags & FindParams.MaskMatch + + + def saveGeometry(self): + """Returns a QByreArray containing the saved geometry of the dialog pr '' + """ + if self.isVisible(): + return QtGui.QDialog.saveGeometry(self) + return self._savedGeomtry() + + + def saveFindHistory(self): + """Returns a QStringList containing the current find history""" + cmb = self.controlById(IdCmbFind) + L = QtCore.QStringList() + for i in range(cmb.count()): + L << cmb.itemText(i) + return L + + + def saveReplaceHistory(self): + """Returns a QStringList containing the current replace history""" + cmb = self.controlById(IdCmbReplace) + L = QtCore.QStringList() + for i in range(cmb.count()): + L << cmb.itemText(i) + return L + + +#*********************************************************************** +# +#*********************************************************************** +if __name__ == '__main__': + import sys + + app = QtGui.QApplication(sys.argv) + + findParams = FindParams(None) + findParams.flags |= findParams.DlgReplace + w =DlgActionReplace(None, + findParams=findParams, + customChecks=('A Custom Checkbox', ), + ) + + def cb(findParams): + findParams.printFindParams() + findParams.giveFeedback(10) + w.connect(w, QtCore.SIGNAL('find(QObject*)'), cb) + + 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...> - 2007-08-27 17:35:29
|
Revision: 1287 http://frogpie.svn.sourceforge.net/frogpie/?rev=1287&view=rev Author: jUrner Date: 2007-08-26 15:38:19 -0700 (Sun, 26 Aug 2007) Log Message: ----------- adapt to recent changes Modified Paths: -------------- trunk/sandbox/colordip/MANIFEST Modified: trunk/sandbox/colordip/MANIFEST =================================================================== --- trunk/sandbox/colordip/MANIFEST 2007-08-26 22:38:13 UTC (rev 1286) +++ trunk/sandbox/colordip/MANIFEST 2007-08-26 22:38:19 UTC (rev 1287) @@ -1,7 +1,9 @@ MANIFEST +PluginColorDip-0.2.0.zip PluginColorDip.py sdist.py setup.py +updateProject.py colordip/LICENSE.MIT colordip/README colordip/Ui_colordip.py @@ -10,26 +12,66 @@ colordip/colordip.py colordip/colordip.ui colordip/colordip_colors.py +colordip/config.py colordip/colordip_lib/__init__.py -colordip/colordip_lib/colorbutton.py -colordip/colordip_lib/draggtool.py -colordip/colordip_lib/settingsbase.py -colordip/colordip_dlgs/Ui_colordip_about.py -colordip/colordip_dlgs/Ui_colordip_settings.py +colordip/colordip_lib/qt4ex/__init__.py +colordip/colordip_lib/qt4ex/assistant.py +colordip/colordip_lib/qt4ex/language.py +colordip/colordip_lib/qt4ex/qtools.py +colordip/colordip_lib/qt4ex/resources.py +colordip/colordip_lib/qt4ex/settingsbase.py +colordip/colordip_lib/qt4ex/ctrls/__init__.py +colordip/colordip_lib/qt4ex/ctrls/areatips.py +colordip/colordip_lib/qt4ex/ctrls/colorbutton.py +colordip/colordip_lib/qt4ex/ctrls/dragtool.py +colordip/colordip_lib/qt4ex/ctrls/labelwrap.py +colordip/colordip_lib/qt4ex/ctrls/mrumenu.py +colordip/colordip_lib/qt4ex/ctrls/tablewidget.py +colordip/colordip_lib/qt4ex/ctrls/toolbarwrap.py +colordip/colordip_lib/qt4ex/dlgs/__init__.py +colordip/colordip_lib/qt4ex/dlgs/dlgabout/DlgAbout.ui +colordip/colordip_lib/qt4ex/dlgs/dlgabout/Ui_DlgAbout.py +colordip/colordip_lib/qt4ex/dlgs/dlgabout/__init__.py +colordip/colordip_lib/qt4ex/res/language/LangCodes-ISO 639-1.txt +colordip/colordip_lib/qt4ex/scripts/__init__.py +colordip/colordip_lib/qt4ex/scripts/manifest.py +colordip/colordip_lib/qt4ex/scripts/qtpro.py +colordip/colordip_dlgs/Ui_preferences.py colordip/colordip_dlgs/__init__.py -colordip/colordip_dlgs/colordip_about.py -colordip/colordip_dlgs/colordip_about.ui -colordip/colordip_dlgs/colordip_settings.py -colordip/colordip_dlgs/colordip_settings.ui +colordip/colordip_dlgs/preferences.py +colordip/colordip_dlgs/preferences.ui colordip/doc/about.html colordip/doc/assistant.adp colordip/doc/colordip_schema.png colordip/doc/index.html -colordip/doc/screen_colordip_expandet.png -colordip/doc/screen_colordip_normal.png -colordip/doc/screen_colordip_preferences.png -colordip/res/eyedropper.xpm -colordip/res/eyedropper_bw.xpm -colordip/res/magnifier.xpm -colordip/res/minus.xpm -colordip/res/plus.xpm +colordip/doc/screen_colordip.png +colordip/doc/dialogs/index.html +colordip/doc/dialogs/preferences.html +colordip/doc/dialogs/screen_preferences.png +colordip/lang/colordip_de.qm +colordip/lang/colordip_de.ts +colordip/lang/colordip_en.qm +colordip/lang/colordip_en.ts +colordip/lang/qt_de.qm +colordip/lang/qt_en.qm +colordip/res/icons/bw/32x32/about.png +colordip/res/icons/bw/32x32/arrow-left.png +colordip/res/icons/bw/32x32/arrow-right.png +colordip/res/icons/bw/32x32/custom.png +colordip/res/icons/bw/32x32/eyedropper.png +colordip/res/icons/bw/32x32/gui.png +colordip/res/icons/bw/32x32/help.png +colordip/res/icons/bw/32x32/magnifier+.png +colordip/res/icons/bw/32x32/magnifier-.png +colordip/res/icons/bw/32x32/magnifier.png +colordip/res/icons/bw/32x32/preferences.png +colordip/res/icons/crystal/32x32/about.png +colordip/res/icons/crystal/32x32/arrow-left.png +colordip/res/icons/crystal/32x32/arrow-right.png +colordip/res/icons/crystal/32x32/custom.png +colordip/res/icons/crystal/32x32/eyedropper.png +colordip/res/icons/crystal/32x32/help.png +colordip/res/icons/crystal/32x32/magnifier+.png +colordip/res/icons/crystal/32x32/magnifier-.png +colordip/res/icons/crystal/32x32/magnifier.png +colordip/res/icons/crystal/32x32/preferences.png This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 17:35:28
|
Revision: 1289 http://frogpie.svn.sourceforge.net/frogpie/?rev=1289&view=rev Author: jUrner Date: 2007-08-26 15:39:59 -0700 (Sun, 26 Aug 2007) Log Message: ----------- Qt translations present on system are now used Modified Paths: -------------- trunk/sandbox/qt4ex/qt4ex/language.py Modified: trunk/sandbox/qt4ex/qt4ex/language.py =================================================================== --- trunk/sandbox/qt4ex/qt4ex/language.py 2007-08-26 22:39:52 UTC (rev 1288) +++ trunk/sandbox/qt4ex/qt4ex/language.py 2007-08-26 22:39:59 UTC (rev 1289) @@ -5,10 +5,10 @@ The Language() class scans all files in its directory for *.qm translation files and manages QTranslators and language names for an application. -note: Only translations for wich a qt_*.qm file exists are handled. -All translation files have to follow the convention "prefix + localeName.qm". -with localeName being a localeName as defined in class LanguageNames(). +@note: Available translations are taken from the first directory in languageDirs. +All translation files should follow the convention "Prefix_LocaleName.qm" +@note: the pprefixes 'qt_' and 'qt4ex_' are reserved """ @@ -26,9 +26,8 @@ #*************************************************************** # #*************************************************************** -LanguageDir = os.path.join(os.path.dirname(__file__), 'lang') +Qt4ExLanguageDir = os.path.join(os.path.dirname(__file__), 'lang') - #*************************************************************** # #*************************************************************** @@ -248,31 +247,34 @@ self._translationPrefixes = None self._translators = {'qt_': None} # prefix --> translator - if LanguageDir not in self._languageDirs: - self._languageDirs.append(LanguageDir) + if Qt4ExLanguageDir not in self._languageDirs: + self._languageDirs.append(Qt4ExLanguageDir) if translationPrefixes is None: self._translationPrefixes = ['qt_', ] else: self._translationPrefixes = list(translationPrefixes) - if 'qt_' not in self._translationPrefixes: + if 'qt_' in self._translationPrefixes: + raise valueError('"qt_" is a reserved prefix') + else: self._translationPrefixes.append('qt_') if 'qt4ex_' in self._translationPrefixes: raise valueError('"qt4ex_" is a reserved prefix') self._translationPrefixes.append('qt4ex_') - - + # gather available locale names - for languageDir in self._languageDirs: - root, dirs, files = os.walk(languageDir).next() - for f in files: - name, ext = os.path.splitext(f) - if f.startswith('qt_') and ext.lower() == '.qm': - localeName = name.split('qt_', 1)[1] - if localeName not in self._localeNames: - self._localeNames.append(localeName) + languageDir = self._languageDirs[0] + root, dirs, files = os.walk(languageDir).next() + for f in files: + name, ext = os.path.splitext(f) + if ext.lower() == '.qm': + prefix, sep, localeName = name.partition('_') + if localeName: + self._localeNames.append(localeName) + else: + raise ValueError('Invalid translation file: ' + os.path.join(root, f) ) self._localeNames.sort() - + def getDefaultLocaleName(self): """returns the default locale name @@ -292,7 +294,8 @@ def getLanguageFile(self, localeName, prefix=None): """returns the full path to a language file (*.qm) for the specified locale @param localeName: name of the locale to get the language fle for - @param prefix: prefix of the language file + @param prefix: prefix of the language file. If prefix is "qt_", one of Qts + language files is returned @return: (absolute) filepath of the translation file or None if no file was found @note: If a language file for the specified locale name is not available a path @@ -304,10 +307,18 @@ if prefix is None: prefix = '' - for languageDir in self._languageDirs: - fpath = os.path.join(languageDir, prefix + localeName + '.qm') - if os.path.isfile(fpath): - return fpath + elif prefix == 'qt_': + directory = QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath) + directory = unicode(directory) + if directory: + fpath = os.path.join(directory, prefix + localeName + '.qm') + if os.path.isfile(fpath): + return fpath + else: + for languageDir in self._languageDirs: + fpath = os.path.join(languageDir, prefix + localeName + '.qm') + if os.path.isfile(fpath): + return fpath def getTranslationPrefixes(self): This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jU...@us...> - 2007-08-27 17:35:25
|
Revision: 1285 http://frogpie.svn.sourceforge.net/frogpie/?rev=1285&view=rev Author: jUrner Date: 2007-08-26 15:31:24 -0700 (Sun, 26 Aug 2007) Log Message: ----------- ... Removed Paths: ------------- trunk/sandbox/colordip/colordip/lang/qt_de.qm trunk/sandbox/colordip/colordip/lang/qt_en.qm Deleted: trunk/sandbox/colordip/colordip/lang/qt_de.qm =================================================================== (Binary files differ) Deleted: trunk/sandbox/colordip/colordip/lang/qt_en.qm =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |