From 68c1c86ac5acfcc571e93a5574e936b269447883 Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Wed, 13 Jul 2011 22:41:54 +0200 Subject: [PATCH 01/22] - fixed view adjustments for os x 10.6 - added compatibility with the file extension on os x - started to work on the "open with" file event on os x --- openlp.pyw | 23 +++++ resources/osx/Info.plist.master | 93 ++++++++++++++++++ .../osx/applescript-adjustview-10-5.master | 2 +- .../osx/applescript-adjustview-10-6.master | 14 ++- resources/osx/build.py | 12 ++- resources/osx/openlp-logo-with-text.icns | Bin resources/osx/openlp.spec.master | 2 +- 7 files changed, 135 insertions(+), 11 deletions(-) mode change 100755 => 100644 resources/osx/openlp-logo-with-text.icns diff --git a/openlp.pyw b/openlp.pyw index a39f6cf65..d1627a8a6 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -90,6 +90,7 @@ class OpenLP(QtGui.QApplication): """ Run the OpenLP application. """ + self.eventQueue = [] # On Windows, the args passed into the constructor are # ignored. Not very handy, so set the ones we want to use. self.args = args @@ -135,6 +136,9 @@ class OpenLP(QtGui.QApplication): VersionThread(self.mainWindow).start() Receiver.send_message(u'maindisplay_blank_check') self.mainWindow.appStartup() + # do a check for queued events + for e in self.eventQueue: + self.event(e) DelayStartThread(self.mainWindow).start() return self.exec_() @@ -180,6 +184,25 @@ class OpenLP(QtGui.QApplication): """ self.restoreOverrideCursor() + def event(self, event): + """ + Enables direct file opening on OS X + """ + if event.type() == QtCore.QEvent.FileOpen: + file_name = event.file() + log.debug(u'Got open file event for %s!', file_name) + log.error(file_name) + try: + self.mainWindow.serviceManagerContents.loadFile(file_name) + return True + except AttributeError, NameError: + log.debug(u'The main window is not initialized yet,\ + will queue event!') + self.eventQueue.append(event) + return False + else: + return QtGui.QApplication.event(self, event) + def main(): """ The main function which parses command line options and then runs diff --git a/resources/osx/Info.plist.master b/resources/osx/Info.plist.master index 45aab92a5..5fc3aa48f 100755 --- a/resources/osx/Info.plist.master +++ b/resources/osx/Info.plist.master @@ -2,6 +2,99 @@ + + CFBundleDocumentTypes + + + CFBundleTypeExtension + + osz + + CFBundleTypeIconFiles + + openlp-logo-with-text.icns + + CFBundleTypeName + OpenLP Service + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + org.openlp.osz + + + + CFBundleTypeExtension + + otz + + CFBundleTypeIconFiles + + openlp-logo-with-text.icns + + CFBundleTypeName + OpenLP Theme + CFBundleTypeRole + Viewer + LSHandlerRank + Owner + LSItemContentTypes + + org.openlp.otz + + + + + UTExportedTypeDeclarations + + + UTTypeIdentifier + org.openlp.osz + UTTypeDescription + OpenLP Service + UTTypeConformsTo + + public.data + public.content + + UTTypeTagSpecification + + public.filename-extension + + osz + + public.mime-type + + application/x-openlp-service + + + + + UTTypeIdentifier + org.openlp.otz + UTTypeDescription + OpenLP Theme + UTTypeConformsTo + + public.data + public.content + + UTTypeTagSpecification + + public.filename-extension + + otz + + public.mime-type + + application/x-openlp-theme + + + + + CFBundleIdentifier org.openlp CFBundleShortVersionString diff --git a/resources/osx/applescript-adjustview-10-5.master b/resources/osx/applescript-adjustview-10-5.master index abc0e5a8d..19be239d0 100755 --- a/resources/osx/applescript-adjustview-10-5.master +++ b/resources/osx/applescript-adjustview-10-5.master @@ -48,7 +48,7 @@ on run set theViewOptions to the icon view options of container window set arrangement of theViewOptions to not arranged set icon size of theViewOptions to 128 - set background picture of theViewOptions to file ".installer-background.png" + set background picture of theViewOptions to file ".background:installer-background.png" if not exists file "Applications" then make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} end if diff --git a/resources/osx/applescript-adjustview-10-6.master b/resources/osx/applescript-adjustview-10-6.master index 2b5a0c000..170842564 100755 --- a/resources/osx/applescript-adjustview-10-6.master +++ b/resources/osx/applescript-adjustview-10-6.master @@ -49,15 +49,19 @@ on run set theViewOptions to the icon view options of container window set arrangement of theViewOptions to not arranged set icon size of theViewOptions to 128 - set background picture of theViewOptions to file ".installer-background.png" - make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} - delay 5 + set background picture of theViewOptions to file ".background:installer-background.png" + if not exists file "Applications" then + make new alias file at container window to POSIX file "/Applications" with properties {name:"Applications"} + end if + delay 1 set position of item "%s" of container window to {160, 200} set position of item ".Trashes" of container window to {100, 500} - set position of item ".installer-background.png" of container window to {200, 500} + set position of item ".background" of container window to {200, 500} set position of item ".DS_Store" of container window to {400, 500} set position of item "Applications" of container window to {550, 200} - set position of item ".VolumeIcon.icns" of container window to {500, 500} + if exists file ".VolumeIcon.icns" then + set position of item ".VolumeIcon.icns" of container window to {500, 500} + end if set position of item ".fseventsd" of container window to {300, 500} if exists POSIX file ".SymAVx86QSFile" then set position of item ".SymAVx86QSFile" of container window to {600, 500} diff --git a/resources/osx/build.py b/resources/osx/build.py index ff7f6bdfd..38e56e42a 100644 --- a/resources/osx/build.py +++ b/resources/osx/build.py @@ -93,8 +93,12 @@ script_name = "build" def build_application(settings, app_name_lower, app_dir): logging.info('[%s] now building the app with pyinstaller at "%s"...', script_name, settings['pyinstaller_basedir']) - result = os.system('python %s/pyinstaller.py openlp.spec' \ - % settings['pyinstaller_basedir']) + full_python_dir = os.path.join('/opt/local/Library/Frameworks', + 'Python.framework/Versions/2.6/Resources/', + 'Python.app/Contents/MacOS/Python') + result = os.system('arch -i386 %s %s/pyinstaller.py openlp.spec' \ + % ( full_python_dir, + settings['pyinstaller_basedir']) ) if (result != 0): logging.error('[%s] The pyinstaller build reported an error, cannot \ continue!', script_name) @@ -219,10 +223,10 @@ def create_dmg(settings): sys.exit(1) logging.info('[%s] copying the background image...', script_name) - # os.mkdir(volume_basedir + '/.background') + os.mkdir(volume_basedir + '/.background') result = os.system('CpMac %s %s' % (settings['installer_backgroundimage_file'], - volume_basedir + '/.installer-background.png')) + volume_basedir + '/.background/installer-background.png')) if (result != 0): logging.error('[%s] could not copy the background image, dmg creation\ failed!', script_name) diff --git a/resources/osx/openlp-logo-with-text.icns b/resources/osx/openlp-logo-with-text.icns old mode 100755 new mode 100644 diff --git a/resources/osx/openlp.spec.master b/resources/osx/openlp.spec.master index 94aec2a60..eb743c40b 100755 --- a/resources/osx/openlp.spec.master +++ b/resources/osx/openlp.spec.master @@ -1,5 +1,5 @@ # -*- mode: python -*- -a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(HOMEPATH,'support/useUnicode.py'), '%(openlp_basedir)s/openlp.pyw'], +a = Analysis([os.path.join(HOMEPATH,'support/_mountzlib.py'), os.path.join(CONFIGDIR,'support/useUnicode.py'), '%(openlp_basedir)s/openlp.pyw'], pathex=['%(pyinstaller_basedir)s'], hookspath=['%(openlp_basedir)s/resources/pyinstaller']) pyz = PYZ(a.pure) exe = EXE(pyz, From b15fd4df49ca1154717c12d1534c8eb742ee7c1f Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Fri, 22 Jul 2011 09:39:49 -0400 Subject: [PATCH 02/22] modified mainwondow.py to allow first time wizard to be re-run --- openlp/core/ui/mainwindow.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index c88508672..4fce23164 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -244,6 +244,9 @@ class Ui_MainWindow(object): self.toolsOpenDataFolder = icon_action(mainWindow, u'toolsOpenDataFolder', u':/general/general_open.png', category=UiStrings().Tools) + self.toolsFirstTimeWizard = icon_action(mainWindow, + u'toolsFirstTimeWizard', u':/general/general_revert.png', + category=UiStrings().Tools) self.updateThemeImages = base_action(mainWindow, u'updateThemeImages', category=UiStrings().Tools) action_list.add_category(UiStrings().Settings, @@ -323,6 +326,7 @@ class Ui_MainWindow(object): self.settingsConfigureItem)) add_actions(self.toolsMenu, (self.toolsAddToolItem, None)) add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None)) + add_actions(self.toolsMenu, (self.toolsFirstTimeWizard, None)) add_actions(self.toolsMenu, [self.updateThemeImages]) if os.name == u'nt': add_actions(self.helpMenu, (self.offlineHelpItem, @@ -469,6 +473,8 @@ class Ui_MainWindow(object): 'Add an application to the list of tools.')) self.toolsOpenDataFolder.setText( translate('OpenLP.MainWindow', 'Open &Data Folder...')) + self.toolsFirstTimeWizard.setText( + translate('OpenLP.MainWindow', 'Run First Time Wizard')) self.toolsOpenDataFolder.setStatusTip(translate('OpenLP.MainWindow', 'Open the folder where songs, bibles and other data resides.')) self.updateThemeImages.setText( @@ -546,6 +552,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.SIGNAL(u'triggered()'), self.onHelpWebSiteClicked) QtCore.QObject.connect(self.toolsOpenDataFolder, QtCore.SIGNAL(u'triggered()'), self.onToolsOpenDataFolderClicked) + QtCore.QObject.connect(self.toolsFirstTimeWizard, + QtCore.SIGNAL(u'triggered()'), self.onFirstTimeWizardClicked) QtCore.QObject.connect(self.updateThemeImages, QtCore.SIGNAL(u'triggered()'), self.onUpdateThemeImages) QtCore.QObject.connect(self.displayTagItem, @@ -714,6 +722,20 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): delete_file(os.path.join(temp_dir, filename)) os.removedirs(temp_dir) + def onFirstTimeWizardClicked(self): + ret = QtGui.QMessageBox.information(self, + translate('OpenLP.MainWindow', 'Restart OpenLP'), + translate('OpenLP.MainWindow', + 'OpenLP will now restart. The First Time Wizard will run when ' + + 'OpenLP is restarted'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), + QtGui.QMessageBox.Ok) + QtCore.QSettings().setValue(u'general/has run wizard', + QtCore.QVariant(False)) + self.close() + OpenLP_exe = sys.executable + os.execl(OpenLP_exe, OpenLP_exe, * sys.argv) + def blankCheck(self): """ Check and display message if screen blank on setup. From f7a222da6c300883897db24c2b0b56adc039d49a Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Sat, 23 Jul 2011 08:52:43 -0400 Subject: [PATCH 03/22] modified mainwindow.py code to make first time wizard re-run inline code --- openlp/core/ui/firsttimeform.py | 1 + openlp/core/ui/mainwindow.py | 30 +++++++++++++++++------------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 8ffd87bcf..e5d434180 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -129,6 +129,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): os.path.join(gettempdir(), u'openlp', screenshot))) item.setCheckState(QtCore.Qt.Unchecked) item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) + Receiver.send_message(u'cursor_normal') def nextId(self): """ diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 4fce23164..2e44f26da 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -33,7 +33,7 @@ from tempfile import gettempdir from PyQt4 import QtCore, QtGui from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \ - PluginManager, Receiver, translate, ImageManager + PluginManager, Receiver, translate, ImageManager, PluginStatus from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \ icon_action, shortcut_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ @@ -42,6 +42,8 @@ from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ from openlp.core.utils import AppLocation, add_actions, LanguageManager, \ get_application_version, delete_file from openlp.core.utils.actions import ActionList, CategoryOrder +from openlp.core.ui.firsttimeform import FirstTimeForm +from openlp.core.ui import ScreenList log = logging.getLogger(__name__) @@ -723,18 +725,20 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): os.removedirs(temp_dir) def onFirstTimeWizardClicked(self): - ret = QtGui.QMessageBox.information(self, - translate('OpenLP.MainWindow', 'Restart OpenLP'), - translate('OpenLP.MainWindow', - 'OpenLP will now restart. The First Time Wizard will run when ' + - 'OpenLP is restarted'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), - QtGui.QMessageBox.Ok) - QtCore.QSettings().setValue(u'general/has run wizard', - QtCore.QVariant(False)) - self.close() - OpenLP_exe = sys.executable - os.execl(OpenLP_exe, OpenLP_exe, * sys.argv) + Receiver.send_message(u'cursor_busy') + screens = ScreenList.get_instance() + FirstTimeForm(screens).exec_() + self.firstTime() + for plugin in self.pluginManager.plugins: + self.activePlugin = plugin + oldStatus = self.activePlugin.status + self.activePlugin.setStatus() + if oldStatus != self.activePlugin.status: + if self.activePlugin.status == PluginStatus.Active: + self.activePlugin.toggleStatus(PluginStatus.Active) + self.activePlugin.appStartup() + else: + self.activePlugin.toggleStatus(PluginStatus.Inactive) def blankCheck(self): """ From 1c1cfddce41bf6436f3f91cc190c194129e60588 Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Sat, 23 Jul 2011 19:50:25 +0200 Subject: [PATCH 04/22] provide sample configuration --- resources/osx/openlp.cfg | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/osx/openlp.cfg b/resources/osx/openlp.cfg index 954bf861d..f72a8fca1 100755 --- a/resources/osx/openlp.cfg +++ b/resources/osx/openlp.cfg @@ -1,8 +1,8 @@ [openlp] openlp_appname = OpenLP -openlp_dmgname = OpenLP-1.9.6-bzr1684 -openlp_version = 1684 -openlp_basedir = /Users/openlp/repo/osx-fixes +openlp_dmgname = OpenLP-1.9.6-bzrXXXX +openlp_version = XXXX +openlp_basedir = /Users/openlp/repo/trunk openlp_icon_file = openlp-logo-with-text.icns openlp_dmg_icon_file = openlp-logo-420x420.png installer_backgroundimage_file = installation-background.png From 8800b4174919149c24e1e771db42071acc849a6f Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Sat, 23 Jul 2011 14:09:13 -0400 Subject: [PATCH 05/22] Added confirmation message prior to re-start of FTW --- openlp/core/ui/mainwindow.py | 44 ++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 2e44f26da..c2ce381f0 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -725,20 +725,36 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): os.removedirs(temp_dir) def onFirstTimeWizardClicked(self): - Receiver.send_message(u'cursor_busy') - screens = ScreenList.get_instance() - FirstTimeForm(screens).exec_() - self.firstTime() - for plugin in self.pluginManager.plugins: - self.activePlugin = plugin - oldStatus = self.activePlugin.status - self.activePlugin.setStatus() - if oldStatus != self.activePlugin.status: - if self.activePlugin.status == PluginStatus.Active: - self.activePlugin.toggleStatus(PluginStatus.Active) - self.activePlugin.appStartup() - else: - self.activePlugin.toggleStatus(PluginStatus.Inactive) + ret = QtGui.QMessageBox.warning(self, + translate('OpenLP.MainWindow', 'Re-Run First Time Wizard?'), + translate('OpenLP.MainWindow', + 'Are you sure you want to run the First Time Wizard?\n\n' + \ + 'Re-running this wizard will make changes to your current ' + \ + 'OpenLP configuration, possibly add songs to your ' + \ + 'existing Songs list and change your Default Theme'), + QtGui.QMessageBox.StandardButtons( + QtGui.QMessageBox.Yes | + QtGui.QMessageBox.No), + QtGui.QMessageBox.Yes) + if ret == QtGui.QMessageBox.Yes: + Receiver.send_message(u'cursor_busy') + screens = ScreenList.get_instance() + if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted: + self.firstTime() + for plugin in self.pluginManager.plugins: + self.activePlugin = plugin + oldStatus = self.activePlugin.status + self.activePlugin.setStatus() + if oldStatus != self.activePlugin.status: + if self.activePlugin.status == PluginStatus.Active: + self.activePlugin.toggleStatus(PluginStatus.Active) + self.activePlugin.appStartup() + else: + self.activePlugin.toggleStatus(PluginStatus.Inactive) + self.themeManagerContents.configUpdated() + self.themeManagerContents.loadThemes(True) + Receiver.send_message(u'theme_update_global', + self.themeManagerContents.global_theme) def blankCheck(self): """ From 189d98dc397e455bace406b1285856ec060be51e Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Sun, 24 Jul 2011 00:39:37 +0200 Subject: [PATCH 06/22] using self.args way of opening a file on startup even on OS X --- .bzrignore | 1 + openlp.pyw | 20 ++++++-------------- resources/osx/openlp.cfg | 10 ---------- 3 files changed, 7 insertions(+), 24 deletions(-) delete mode 100755 resources/osx/openlp.cfg diff --git a/.bzrignore b/.bzrignore index 2620fea42..1d2bb8267 100644 --- a/.bzrignore +++ b/.bzrignore @@ -20,3 +20,4 @@ _eric4project openlp/core/resources.py.old *.qm resources/windows/warnOpenLP.txt +openlp.cfg diff --git a/openlp.pyw b/openlp.pyw index d1627a8a6..c01d29b00 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -79,6 +79,8 @@ class OpenLP(QtGui.QApplication): class in order to provide the core of the application. """ + args = [] + def exec_(self): """ Override exec method to allow the shared memory to be released on exit @@ -90,10 +92,10 @@ class OpenLP(QtGui.QApplication): """ Run the OpenLP application. """ - self.eventQueue = [] + log.debug("run()") # On Windows, the args passed into the constructor are # ignored. Not very handy, so set the ones we want to use. - self.args = args + self.args.extend(args) # provide a listener for widgets to reqest a screen update. QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) @@ -136,9 +138,6 @@ class OpenLP(QtGui.QApplication): VersionThread(self.mainWindow).start() Receiver.send_message(u'maindisplay_blank_check') self.mainWindow.appStartup() - # do a check for queued events - for e in self.eventQueue: - self.event(e) DelayStartThread(self.mainWindow).start() return self.exec_() @@ -191,15 +190,8 @@ class OpenLP(QtGui.QApplication): if event.type() == QtCore.QEvent.FileOpen: file_name = event.file() log.debug(u'Got open file event for %s!', file_name) - log.error(file_name) - try: - self.mainWindow.serviceManagerContents.loadFile(file_name) - return True - except AttributeError, NameError: - log.debug(u'The main window is not initialized yet,\ - will queue event!') - self.eventQueue.append(event) - return False + self.args.insert(0, unicode(file_name)) + return True else: return QtGui.QApplication.event(self, event) diff --git a/resources/osx/openlp.cfg b/resources/osx/openlp.cfg deleted file mode 100755 index f72a8fca1..000000000 --- a/resources/osx/openlp.cfg +++ /dev/null @@ -1,10 +0,0 @@ -[openlp] -openlp_appname = OpenLP -openlp_dmgname = OpenLP-1.9.6-bzrXXXX -openlp_version = XXXX -openlp_basedir = /Users/openlp/repo/trunk -openlp_icon_file = openlp-logo-with-text.icns -openlp_dmg_icon_file = openlp-logo-420x420.png -installer_backgroundimage_file = installation-background.png -pyinstaller_basedir = /Users/openlp/pyinstaller/trunk -qt_menu_basedir = /Library/Frameworks/QtGui.framework/Versions/4/Resources/qt_menu.nib From 099b11f175793589924e685e2187300bf6b694ca Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Sun, 24 Jul 2011 00:40:40 +0200 Subject: [PATCH 07/22] added build configuration sample --- resources/osx/openlp.cfg.sample | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100755 resources/osx/openlp.cfg.sample diff --git a/resources/osx/openlp.cfg.sample b/resources/osx/openlp.cfg.sample new file mode 100755 index 000000000..f72a8fca1 --- /dev/null +++ b/resources/osx/openlp.cfg.sample @@ -0,0 +1,10 @@ +[openlp] +openlp_appname = OpenLP +openlp_dmgname = OpenLP-1.9.6-bzrXXXX +openlp_version = XXXX +openlp_basedir = /Users/openlp/repo/trunk +openlp_icon_file = openlp-logo-with-text.icns +openlp_dmg_icon_file = openlp-logo-420x420.png +installer_backgroundimage_file = installation-background.png +pyinstaller_basedir = /Users/openlp/pyinstaller/trunk +qt_menu_basedir = /Library/Frameworks/QtGui.framework/Versions/4/Resources/qt_menu.nib From 16cd20a81ad1bcfba66be84781d9cb9b1db58668 Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Sun, 24 Jul 2011 00:48:07 +0200 Subject: [PATCH 08/22] fixed indentation issue --- openlp.pyw | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp.pyw b/openlp.pyw index c01d29b00..71a13de08 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -190,7 +190,7 @@ class OpenLP(QtGui.QApplication): if event.type() == QtCore.QEvent.FileOpen: file_name = event.file() log.debug(u'Got open file event for %s!', file_name) - self.args.insert(0, unicode(file_name)) + self.args.insert(0, unicode(file_name)) return True else: return QtGui.QApplication.event(self, event) From f5f95eef9a7fb3230505770b8abc329fb009f920 Mon Sep 17 00:00:00 2001 From: Matthias Hub Date: Sun, 24 Jul 2011 00:52:34 +0200 Subject: [PATCH 09/22] removed debug logging --- openlp.pyw | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp.pyw b/openlp.pyw index 71a13de08..fe96ebd23 100755 --- a/openlp.pyw +++ b/openlp.pyw @@ -92,7 +92,6 @@ class OpenLP(QtGui.QApplication): """ Run the OpenLP application. """ - log.debug("run()") # On Windows, the args passed into the constructor are # ignored. Not very handy, so set the ones we want to use. self.args.extend(args) From c84c69645efd4171d5b6031ca11090f97be88e70 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Mon, 25 Jul 2011 15:24:35 -0400 Subject: [PATCH 10/22] added docstring to FTW section. changed menu text, changed default button to No --- openlp/core/ui/mainwindow.py | 59 ++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index c2ce381f0..9d7b0542c 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -476,7 +476,7 @@ class Ui_MainWindow(object): self.toolsOpenDataFolder.setText( translate('OpenLP.MainWindow', 'Open &Data Folder...')) self.toolsFirstTimeWizard.setText( - translate('OpenLP.MainWindow', 'Run First Time Wizard')) + translate('OpenLP.MainWindow', 'Re-run First Time Wizard')) self.toolsOpenDataFolder.setStatusTip(translate('OpenLP.MainWindow', 'Open the folder where songs, bibles and other data resides.')) self.updateThemeImages.setText( @@ -725,36 +725,43 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): os.removedirs(temp_dir) def onFirstTimeWizardClicked(self): - ret = QtGui.QMessageBox.warning(self, - translate('OpenLP.MainWindow', 'Re-Run First Time Wizard?'), + """ + Re-run the first time wizard. Prompts the user for run confirmation + If wizard is run, songs, bibles and themes are imported. The default + theme is changed (if necessary). The plugins in pluginmanager are + set active/in-active to match the selection in the wizard. + """ + answer = QtGui.QMessageBox.warning(self, + translate('OpenLP.MainWindow', 'Re-run First Time Wizard?'), translate('OpenLP.MainWindow', - 'Are you sure you want to run the First Time Wizard?\n\n' + \ - 'Re-running this wizard will make changes to your current ' + \ - 'OpenLP configuration, possibly add songs to your ' + \ + 'Are you sure you want to re-run the First Time Wizard?\n\n' \ + 'Re-running this wizard may make changes to your current ' \ + 'OpenLP configuration and possibly add Songs to your ' \ 'existing Songs list and change your Default Theme'), QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), - QtGui.QMessageBox.Yes) - if ret == QtGui.QMessageBox.Yes: - Receiver.send_message(u'cursor_busy') - screens = ScreenList.get_instance() - if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted: - self.firstTime() - for plugin in self.pluginManager.plugins: - self.activePlugin = plugin - oldStatus = self.activePlugin.status - self.activePlugin.setStatus() - if oldStatus != self.activePlugin.status: - if self.activePlugin.status == PluginStatus.Active: - self.activePlugin.toggleStatus(PluginStatus.Active) - self.activePlugin.appStartup() - else: - self.activePlugin.toggleStatus(PluginStatus.Inactive) - self.themeManagerContents.configUpdated() - self.themeManagerContents.loadThemes(True) - Receiver.send_message(u'theme_update_global', - self.themeManagerContents.global_theme) + QtGui.QMessageBox.No) + if answer == QtGui.QMessageBox.No: + return + Receiver.send_message(u'cursor_busy') + screens = ScreenList.get_instance() + if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted: + self.firstTime() + for plugin in self.pluginManager.plugins: + self.activePlugin = plugin + oldStatus = self.activePlugin.status + self.activePlugin.setStatus() + if oldStatus != self.activePlugin.status: + if self.activePlugin.status == PluginStatus.Active: + self.activePlugin.toggleStatus(PluginStatus.Active) + self.activePlugin.appStartup() + else: + self.activePlugin.toggleStatus(PluginStatus.Inactive) + self.themeManagerContents.configUpdated() + self.themeManagerContents.loadThemes(True) + Receiver.send_message(u'theme_update_global', + self.themeManagerContents.global_theme) def blankCheck(self): """ From 1ffe0e961d0348af6382d82be2bac1ce408f3b49 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 26 Jul 2011 20:30:56 -0400 Subject: [PATCH 11/22] Added status tips for FTW menu item. Removed some continuation characters --- openlp/core/ui/mainwindow.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 9d7b0542c..b24ded9c1 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -475,10 +475,12 @@ class Ui_MainWindow(object): 'Add an application to the list of tools.')) self.toolsOpenDataFolder.setText( translate('OpenLP.MainWindow', 'Open &Data Folder...')) - self.toolsFirstTimeWizard.setText( - translate('OpenLP.MainWindow', 'Re-run First Time Wizard')) self.toolsOpenDataFolder.setStatusTip(translate('OpenLP.MainWindow', 'Open the folder where songs, bibles and other data resides.')) + self.toolsFirstTimeWizard.setText( + translate('OpenLP.MainWindow', 'Re-run First Time Wizard')) + self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow', + 'Re-run the First Time Wizard importing Songs, Bibles and Themes.')) self.updateThemeImages.setText( translate('OpenLP.MainWindow', 'Update Theme Images')) self.updateThemeImages.setStatusTip( @@ -734,9 +736,9 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): answer = QtGui.QMessageBox.warning(self, translate('OpenLP.MainWindow', 'Re-run First Time Wizard?'), translate('OpenLP.MainWindow', - 'Are you sure you want to re-run the First Time Wizard?\n\n' \ - 'Re-running this wizard may make changes to your current ' \ - 'OpenLP configuration and possibly add Songs to your ' \ + 'Are you sure you want to re-run the First Time Wizard?\n\n' + 'Re-running this wizard may make changes to your current ' + 'OpenLP configuration and possibly add Songs to your ' 'existing Songs list and change your Default Theme'), QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Yes | From e40f561976721460705d857ac6c24ac1d72a8ab1 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 27 Jul 2011 13:04:31 -0400 Subject: [PATCH 12/22] minor changes to text in mainwindow.py --- openlp/core/ui/mainwindow.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index b24ded9c1..35f895e89 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -480,7 +480,7 @@ class Ui_MainWindow(object): self.toolsFirstTimeWizard.setText( translate('OpenLP.MainWindow', 'Re-run First Time Wizard')) self.toolsFirstTimeWizard.setStatusTip(translate('OpenLP.MainWindow', - 'Re-run the First Time Wizard importing Songs, Bibles and Themes.')) + 'Re-run the First Time Wizard, importing songs, Bibles and themes.')) self.updateThemeImages.setText( translate('OpenLP.MainWindow', 'Update Theme Images')) self.updateThemeImages.setStatusTip( @@ -738,8 +738,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): translate('OpenLP.MainWindow', 'Are you sure you want to re-run the First Time Wizard?\n\n' 'Re-running this wizard may make changes to your current ' - 'OpenLP configuration and possibly add Songs to your ' - 'existing Songs list and change your Default Theme'), + 'OpenLP configuration and possibly add songs to your ' + 'existing songs list and change your default theme'), QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), From 7c13fcfaad1270f931059ad781cd7a24914faeab Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 27 Jul 2011 16:38:23 -0400 Subject: [PATCH 13/22] Minor text change to FTW message in mainwindow --- openlp/core/ui/mainwindow.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 35f895e89..69626cae8 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -739,7 +739,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): 'Are you sure you want to re-run the First Time Wizard?\n\n' 'Re-running this wizard may make changes to your current ' 'OpenLP configuration and possibly add songs to your ' - 'existing songs list and change your default theme'), + 'existing songs list and change your default theme.'), QtGui.QMessageBox.StandardButtons( QtGui.QMessageBox.Yes | QtGui.QMessageBox.No), From 77f7581d22633f70421144ff4896425920643a50 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 30 Jul 2011 09:14:39 +0200 Subject: [PATCH 14/22] change 'Display Tag' strings to 'Formatting Tag' Fixes: https://launchpad.net/bugs/816382 --- openlp/core/ui/mainwindow.py | 2 +- openlp/core/ui/shortcutlistdialog.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index c88508672..f3a5e2cb9 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -404,7 +404,7 @@ class Ui_MainWindow(object): self.settingsShortcutsItem.setText( translate('OpenLP.MainWindow', 'Configure &Shortcuts...')) self.displayTagItem.setText( - translate('OpenLP.MainWindow', '&Configure Display Tags')) + translate('OpenLP.MainWindow', '&Configure Formatting Tags...')) self.settingsConfigureItem.setText( translate('OpenLP.MainWindow', '&Configure OpenLP...')) self.viewMediaManagerItem.setText( diff --git a/openlp/core/ui/shortcutlistdialog.py b/openlp/core/ui/shortcutlistdialog.py index 6d877358f..a9b9b22cf 100644 --- a/openlp/core/ui/shortcutlistdialog.py +++ b/openlp/core/ui/shortcutlistdialog.py @@ -123,7 +123,7 @@ class Ui_ShortcutListDialog(object): def retranslateUi(self, shortcutListDialog): shortcutListDialog.setWindowTitle( - translate('OpenLP.ShortcutListDialog', 'Customize Shortcuts')) + translate('OpenLP.ShortcutListDialog', 'Configure Shortcuts')) self.descriptionLabel.setText(translate('OpenLP.ShortcutListDialog', 'Select an action and click one of the buttons below to start ' 'capturing a new primary or alternate shortcut, respectively.')) From 06d32e51083b34c2d9dd1289b2c39994719d4e78 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 30 Jul 2011 09:19:16 +0200 Subject: [PATCH 15/22] change 'Display Tag' strings to 'Formatting Tag' Fixes: https://launchpad.net/bugs/816382 --- openlp/core/lib/displaytags.py | 2 +- openlp/core/lib/renderer.py | 4 ++-- openlp/core/ui/displaytagdialog.py | 2 +- openlp/core/ui/displaytagform.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/displaytags.py b/openlp/core/lib/displaytags.py index 95ce13bda..aa6f3b5a7 100644 --- a/openlp/core/lib/displaytags.py +++ b/openlp/core/lib/displaytags.py @@ -25,7 +25,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -Provide Html Tag management and Display Tag access class +Provide HTML Tag management and Formatting Tag access class """ from openlp.core.lib import translate diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index e9e28bcf6..1b94e7896 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -422,7 +422,7 @@ class Renderer(object): to the list of slides. (unicode string) ``previous_raw`` - The raw text (with display tags) which is know to fit on a slide, + The raw text (with formatting tags) which is know to fit on a slide, but is not yet added to the list of slides. (unicode string) ``html_list`` @@ -431,7 +431,7 @@ class Renderer(object): ``raw_list`` The elements which do not fit on a slide and needs to be processed - using the binary chop. The elements can contain display tags. + using the binary chop. The elements can contain formatting tags. ``separator`` The separator for the elements. For lines this is ``u'
'`` and diff --git a/openlp/core/ui/displaytagdialog.py b/openlp/core/ui/displaytagdialog.py index 328fcd137..093e0c167 100644 --- a/openlp/core/ui/displaytagdialog.py +++ b/openlp/core/ui/displaytagdialog.py @@ -122,7 +122,7 @@ class Ui_DisplayTagDialog(object): def retranslateUi(self, displayTagDialog): displayTagDialog.setWindowTitle(translate('OpenLP.displayTagDialog', - 'Configure Display Tags')) + 'Configure Formatting Tags')) self.editGroupBox.setTitle( translate('OpenLP.DisplayTagDialog', 'Edit Selection')) self.savePushButton.setText( diff --git a/openlp/core/ui/displaytagform.py b/openlp/core/ui/displaytagform.py index 22ac38f06..9456f1028 100644 --- a/openlp/core/ui/displaytagform.py +++ b/openlp/core/ui/displaytagform.py @@ -177,7 +177,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): def _saveTable(self): """ - Saves all display tags except protected ones. + Saves all formatting tags except protected ones. """ tags = [] for tag in DisplayTags.get_html_tags(): From c0976a4690f43655548c3c6dc3ece0edc0ff5e0f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 30 Jul 2011 09:34:37 +0200 Subject: [PATCH 16/22] moved files and changed code to reflect string changes Fixes: https://launchpad.net/bugs/816382 --- openlp/core/lib/__init__.py | 6 +-- .../lib/{displaytags.py => formattingtags.py} | 44 ++++++++-------- openlp/core/lib/spelltextedit.py | 6 +-- openlp/core/ui/__init__.py | 2 +- ...laytagdialog.py => formattingtagdialog.py} | 50 +++++++++---------- ...displaytagform.py => formattingtagform.py} | 48 +++++++++--------- openlp/core/ui/mainwindow.py | 21 ++++---- 7 files changed, 88 insertions(+), 89 deletions(-) rename openlp/core/lib/{displaytags.py => formattingtags.py} (78%) rename openlp/core/ui/{displaytagdialog.py => formattingtagdialog.py} (82%) rename openlp/core/ui/{displaytagform.py => formattingtagform.py} (87%) diff --git a/openlp/core/lib/__init__.py b/openlp/core/lib/__init__.py index 7fbd5243c..620d5dafd 100644 --- a/openlp/core/lib/__init__.py +++ b/openlp/core/lib/__init__.py @@ -205,7 +205,7 @@ def clean_tags(text): text = text.replace(u'
', u'\n') text = text.replace(u'{br}', u'\n') text = text.replace(u' ', u' ') - for tag in DisplayTags.get_html_tags(): + for tag in FormattingTags.get_html_tags(): text = text.replace(tag[u'start tag'], u'') text = text.replace(tag[u'end tag'], u'') return text @@ -214,7 +214,7 @@ def expand_tags(text): """ Expand tags HTML for display """ - for tag in DisplayTags.get_html_tags(): + for tag in FormattingTags.get_html_tags(): text = text.replace(tag[u'start tag'], tag[u'start html']) text = text.replace(tag[u'end tag'], tag[u'end html']) return text @@ -234,7 +234,7 @@ def check_directory_exists(dir): pass from listwidgetwithdnd import ListWidgetWithDnD -from displaytags import DisplayTags +from formattingtags import FormattingTags from eventreceiver import Receiver from spelltextedit import SpellTextEdit from settingsmanager import SettingsManager diff --git a/openlp/core/lib/displaytags.py b/openlp/core/lib/formattingtags.py similarity index 78% rename from openlp/core/lib/displaytags.py rename to openlp/core/lib/formattingtags.py index aa6f3b5a7..9fd42a605 100644 --- a/openlp/core/lib/displaytags.py +++ b/openlp/core/lib/formattingtags.py @@ -30,7 +30,7 @@ Provide HTML Tag management and Formatting Tag access class from openlp.core.lib import translate -class DisplayTags(object): +class FormattingTags(object): """ Static Class to HTML Tags to be access around the code the list is managed by the Options Tab. @@ -42,89 +42,89 @@ class DisplayTags(object): """ Provide access to the html_expands list. """ - return DisplayTags.html_expands + return FormattingTags.html_expands @staticmethod def reset_html_tags(): """ Resets the html_expands list. """ - DisplayTags.html_expands = [] + FormattingTags.html_expands = [] base_tags = [] # Append the base tags. # Hex Color tags from http://www.w3schools.com/html/html_colornames.asp - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Red'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Red'), u'start tag': u'{r}', u'start html': u'', u'end tag': u'{/r}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Black'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Black'), u'start tag': u'{b}', u'start html': u'', u'end tag': u'{/b}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Blue'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Blue'), u'start tag': u'{bl}', u'start html': u'', u'end tag': u'{/bl}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Yellow'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Yellow'), u'start tag': u'{y}', u'start html': u'', u'end tag': u'{/y}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Green'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Green'), u'start tag': u'{g}', u'start html': u'', u'end tag': u'{/g}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Pink'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Pink'), u'start tag': u'{pk}', u'start html': u'', u'end tag': u'{/pk}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Orange'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Orange'), u'start tag': u'{o}', u'start html': u'', u'end tag': u'{/o}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Purple'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Purple'), u'start tag': u'{pp}', u'start html': u'', u'end tag': u'{/pp}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'White'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'White'), u'start tag': u'{w}', u'start html': u'', u'end tag': u'{/w}', u'end html': u'', u'protected': True}) base_tags.append({ - u'desc': translate('OpenLP.DisplayTags', 'Superscript'), + u'desc': translate('OpenLP.FormattingTags', 'Superscript'), u'start tag': u'{su}', u'start html': u'', u'end tag': u'{/su}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Subscript'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Subscript'), u'start tag': u'{sb}', u'start html': u'', u'end tag': u'{/sb}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Paragraph'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Paragraph'), u'start tag': u'{p}', u'start html': u'

', u'end tag': u'{/p}', u'end html': u'

', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Bold'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Bold'), u'start tag': u'{st}', u'start html': u'', u'end tag': u'{/st}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Italics'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Italics'), u'start tag': u'{it}', u'start html': u'', u'end tag': u'{/it}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Underline'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Underline'), u'start tag': u'{u}', u'start html': u'', u'end tag': u'{/u}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.DisplayTags', 'Break'), + base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Break'), u'start tag': u'{br}', u'start html': u'
', u'end tag': u'', u'end html': u'', u'protected': True}) - DisplayTags.add_html_tags(base_tags) + FormattingTags.add_html_tags(base_tags) @staticmethod def add_html_tags(tags): """ Add a list of tags to the list """ - DisplayTags.html_expands.extend(tags) + FormattingTags.html_expands.extend(tags) @staticmethod def remove_html_tag(tag_id): """ Removes an individual html_expands tag. """ - DisplayTags.html_expands.pop(tag_id) + FormattingTags.html_expands.pop(tag_id) diff --git a/openlp/core/lib/spelltextedit.py b/openlp/core/lib/spelltextedit.py index 0d277b9fe..b0bb61e92 100644 --- a/openlp/core/lib/spelltextedit.py +++ b/openlp/core/lib/spelltextedit.py @@ -39,7 +39,7 @@ except ImportError: from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, DisplayTags +from openlp.core.lib import translate, FormattingTags from openlp.core.lib.ui import checkable_action log = logging.getLogger(__name__) @@ -114,7 +114,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): popupMenu.insertMenu(popupMenu.actions()[0], spell_menu) tagMenu = QtGui.QMenu(translate('OpenLP.SpellTextEdit', 'Formatting Tags')) - for html in DisplayTags.get_html_tags(): + for html in FormattingTags.get_html_tags(): action = SpellAction(html[u'desc'], tagMenu) action.correct.connect(self.htmlTag) tagMenu.addAction(action) @@ -148,7 +148,7 @@ class SpellTextEdit(QtGui.QPlainTextEdit): """ Replaces the selected text with word. """ - for html in DisplayTags.get_html_tags(): + for html in FormattingTags.get_html_tags(): if tag == html[u'desc']: cursor = self.textCursor() if self.textCursor().hasSelection(): diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 7aebcb1df..e754480e0 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -69,7 +69,7 @@ from advancedtab import AdvancedTab from aboutform import AboutForm from pluginform import PluginForm from settingsform import SettingsForm -from displaytagform import DisplayTagForm +from formattingtagform import FormattingTagForm from shortcutlistform import ShortcutListForm from mediadockmanager import MediaDockManager from servicemanager import ServiceManager diff --git a/openlp/core/ui/displaytagdialog.py b/openlp/core/ui/formattingtagdialog.py similarity index 82% rename from openlp/core/ui/displaytagdialog.py rename to openlp/core/ui/formattingtagdialog.py index 093e0c167..186f4739b 100644 --- a/openlp/core/ui/displaytagdialog.py +++ b/openlp/core/ui/formattingtagdialog.py @@ -30,15 +30,15 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import translate from openlp.core.lib.ui import UiStrings -class Ui_DisplayTagDialog(object): +class Ui_FormattingTagDialog(object): - def setupUi(self, displayTagDialog): - displayTagDialog.setObjectName(u'displayTagDialog') - displayTagDialog.resize(725, 548) - self.listdataGridLayout = QtGui.QGridLayout(displayTagDialog) + def setupUi(self, formattingTagDialog): + formattingTagDialog.setObjectName(u'formattingTagDialog') + formattingTagDialog.resize(725, 548) + self.listdataGridLayout = QtGui.QGridLayout(formattingTagDialog) self.listdataGridLayout.setMargin(8) self.listdataGridLayout.setObjectName(u'listdataGridLayout') - self.tagTableWidget = QtGui.QTableWidget(displayTagDialog) + self.tagTableWidget = QtGui.QTableWidget(formattingTagDialog) self.tagTableWidget.setHorizontalScrollBarPolicy( QtCore.Qt.ScrollBarAlwaysOff) self.tagTableWidget.setEditTriggers( @@ -67,11 +67,11 @@ class Ui_DisplayTagDialog(object): spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) - self.deletePushButton = QtGui.QPushButton(displayTagDialog) + self.deletePushButton = QtGui.QPushButton(formattingTagDialog) self.deletePushButton.setObjectName(u'deletePushButton') self.horizontalLayout.addWidget(self.deletePushButton) self.listdataGridLayout.addLayout(self.horizontalLayout, 1, 0, 1, 1) - self.editGroupBox = QtGui.QGroupBox(displayTagDialog) + self.editGroupBox = QtGui.QGroupBox(formattingTagDialog) self.editGroupBox.setObjectName(u'editGroupBox') self.dataGridLayout = QtGui.QGridLayout(self.editGroupBox) self.dataGridLayout.setObjectName(u'dataGridLayout') @@ -112,38 +112,38 @@ class Ui_DisplayTagDialog(object): self.savePushButton.setObjectName(u'savePushButton') self.dataGridLayout.addWidget(self.savePushButton, 4, 2, 1, 1) self.listdataGridLayout.addWidget(self.editGroupBox, 2, 0, 1, 1) - self.buttonBox = QtGui.QDialogButtonBox(displayTagDialog) - self.buttonBox.setObjectName('displayTagDialogButtonBox') + self.buttonBox = QtGui.QDialogButtonBox(formattingTagDialog) + self.buttonBox.setObjectName('formattingTagDialogButtonBox') self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Close) self.listdataGridLayout.addWidget(self.buttonBox, 3, 0, 1, 1) - self.retranslateUi(displayTagDialog) - QtCore.QMetaObject.connectSlotsByName(displayTagDialog) + self.retranslateUi(formattingTagDialog) + QtCore.QMetaObject.connectSlotsByName(formattingTagDialog) - def retranslateUi(self, displayTagDialog): - displayTagDialog.setWindowTitle(translate('OpenLP.displayTagDialog', - 'Configure Formatting Tags')) + def retranslateUi(self, formattingTagDialog): + formattingTagDialog.setWindowTitle(translate( + 'OpenLP.FormattingTagDialog', 'Configure Formatting Tags')) self.editGroupBox.setTitle( - translate('OpenLP.DisplayTagDialog', 'Edit Selection')) + translate('OpenLP.FormattingTagDialog', 'Edit Selection')) self.savePushButton.setText( - translate('OpenLP.DisplayTagDialog', 'Save')) + translate('OpenLP.FormattingTagDialog', 'Save')) self.descriptionLabel.setText( - translate('OpenLP.DisplayTagDialog', 'Description')) - self.tagLabel.setText(translate('OpenLP.DisplayTagDialog', 'Tag')) + translate('OpenLP.FormattingTagDialog', 'Description')) + self.tagLabel.setText(translate('OpenLP.FormattingTagDialog', 'Tag')) self.startTagLabel.setText( - translate('OpenLP.DisplayTagDialog', 'Start tag')) + translate('OpenLP.FormattingTagDialog', 'Start tag')) self.endTagLabel.setText( - translate('OpenLP.DisplayTagDialog', 'End tag')) + translate('OpenLP.FormattingTagDialog', 'End tag')) self.deletePushButton.setText(UiStrings().Delete) self.newPushButton.setText(UiStrings().New) self.tagTableWidget.horizontalHeaderItem(0).setText( - translate('OpenLP.DisplayTagDialog', 'Description')) + translate('OpenLP.FormattingTagDialog', 'Description')) self.tagTableWidget.horizontalHeaderItem(1).setText( - translate('OpenLP.DisplayTagDialog', 'Tag Id')) + translate('OpenLP.FormattingTagDialog', 'Tag Id')) self.tagTableWidget.horizontalHeaderItem(2).setText( - translate('OpenLP.DisplayTagDialog', 'Start HTML')) + translate('OpenLP.FormattingTagDialog', 'Start HTML')) self.tagTableWidget.horizontalHeaderItem(3).setText( - translate('OpenLP.DisplayTagDialog', 'End HTML')) + translate('OpenLP.FormattingTagDialog', 'End HTML')) self.tagTableWidget.setColumnWidth(0, 120) self.tagTableWidget.setColumnWidth(1, 80) self.tagTableWidget.setColumnWidth(2, 330) diff --git a/openlp/core/ui/displaytagform.py b/openlp/core/ui/formattingtagform.py similarity index 87% rename from openlp/core/ui/displaytagform.py rename to openlp/core/ui/formattingtagform.py index 9456f1028..7312ffa7b 100644 --- a/openlp/core/ui/displaytagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -25,22 +25,22 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`DisplayTagTab` provides an Tag Edit facility. The Base set are -protected and included each time loaded. Custom tags can be defined and saved. -The Custom Tag arrays are saved in a pickle so QSettings works on them. Base +The :mod:`DisplayTagTab` provides an Tag Edit facility. The Base set are +protected and included each time loaded. Custom tags can be defined and saved. +The Custom Tag arrays are saved in a pickle so QSettings works on them. Base Tags cannot be changed. """ import cPickle from PyQt4 import QtCore, QtGui -from openlp.core.lib import translate, DisplayTags +from openlp.core.lib import translate, FormattingTags from openlp.core.lib.ui import critical_error_message_box -from openlp.core.ui.displaytagdialog import Ui_DisplayTagDialog +from openlp.core.ui.formattingtagdialog import Ui_FormattingTagDialog -class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): +class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): """ - The :class:`DisplayTagTab` manages the settings tab . + The :class:`FormattingTagForm` manages the settings tab . """ def __init__(self, parent): """ @@ -48,7 +48,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): """ QtGui.QDialog.__init__(self, parent) self.setupUi(self) - self._loadDisplayTags() + self._loadFormattingTags() QtCore.QObject.connect(self.tagTableWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onRowSelected) QtCore.QObject.connect(self.newPushButton, @@ -65,19 +65,20 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): Load Display and set field state. """ # Create initial copy from master - self._loadDisplayTags() + self._loadFormattingTags() self._resetTable() self.selected = -1 return QtGui.QDialog.exec_(self) - def _loadDisplayTags(self): + def _loadFormattingTags(self): """ Load the Tags from store so can be used in the system or used to update the display. If Cancel was selected this is needed to reset the dsiplay to the correct version. """ # Initial Load of the Tags - DisplayTags.reset_html_tags() + FormattingTags.reset_html_tags() + # Formatting Tags where also known as display tags. user_expands = QtCore.QSettings().value(u'displayTags/html_tags', QtCore.QVariant(u'')).toString() # cPickle only accepts str not unicode strings @@ -85,14 +86,14 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): if user_expands_string: user_tags = cPickle.loads(user_expands_string) # If we have some user ones added them as well - DisplayTags.add_html_tags(user_tags) + FormattingTags.add_html_tags(user_tags) def onRowSelected(self): """ Table Row selected so display items and set field state. """ row = self.tagTableWidget.currentRow() - html = DisplayTags.get_html_tags()[row] + html = FormattingTags.get_html_tags()[row] self.selected = row self.descriptionLineEdit.setText(html[u'desc']) self.tagLineEdit.setText(self._strip(html[u'start tag'])) @@ -117,7 +118,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): """ Add a new tag to list only if it is not a duplicate. """ - for html in DisplayTags.get_html_tags(): + for html in FormattingTags.get_html_tags(): if self._strip(html[u'start tag']) == u'n': critical_error_message_box( translate('OpenLP.DisplayTagTab', 'Update Error'), @@ -133,7 +134,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): u'end html': translate('OpenLP.DisplayTagTab', ''), u'protected': False } - DisplayTags.add_html_tags([tag]) + FormattingTags.add_html_tags([tag]) self._resetTable() # Highlight new row self.tagTableWidget.selectRow(self.tagTableWidget.rowCount() - 1) @@ -145,7 +146,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): Delete selected custom tag. """ if self.selected != -1: - DisplayTags.remove_html_tag(self.selected) + FormattingTags.remove_html_tag(self.selected) self.selected = -1 self._resetTable() self._saveTable() @@ -154,7 +155,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): """ Update Custom Tag details if not duplicate and save the data. """ - html_expands = DisplayTags.get_html_tags() + html_expands = FormattingTags.get_html_tags() if self.selected != -1: html = html_expands[self.selected] tag = unicode(self.tagLineEdit.text()) @@ -180,15 +181,12 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): Saves all formatting tags except protected ones. """ tags = [] - for tag in DisplayTags.get_html_tags(): + for tag in FormattingTags.get_html_tags(): if not tag[u'protected']: tags.append(tag) - if tags: - QtCore.QSettings().setValue(u'displayTags/html_tags', - QtCore.QVariant(cPickle.dumps(tags))) - else: - QtCore.QSettings().setValue(u'displayTags/html_tags', - QtCore.QVariant(u'')) + # Formatting Tags where also known as display tags. + QtCore.QSettings().setValue(u'displayTags/html_tags', + QtCore.QVariant(cPickle.dumps(tags) if tags else u'')) def _resetTable(self): """ @@ -199,7 +197,7 @@ class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): self.newPushButton.setEnabled(True) self.savePushButton.setEnabled(False) self.deletePushButton.setEnabled(False) - for linenumber, html in enumerate(DisplayTags.get_html_tags()): + for linenumber, html in enumerate(FormattingTags.get_html_tags()): self.tagTableWidget.setRowCount( self.tagTableWidget.rowCount() + 1) self.tagTableWidget.setItem(linenumber, 0, diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index f3a5e2cb9..16691e5a0 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -38,7 +38,7 @@ from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \ icon_action, shortcut_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, \ - ShortcutListForm, DisplayTagForm + ShortcutListForm, FormattingTagForm from openlp.core.utils import AppLocation, add_actions, LanguageManager, \ get_application_version, delete_file from openlp.core.utils.actions import ActionList, CategoryOrder @@ -269,7 +269,8 @@ class Ui_MainWindow(object): u'settingsShortcutsItem', u':/system/system_configure_shortcuts.png', category=UiStrings().Settings) - self.displayTagItem = icon_action(mainWindow, + # Formatting Tags where also known as display tags. + self.formattingTagItem = icon_action(mainWindow, u'displayTagItem', u':/system/tag_editor.png', category=UiStrings().Settings) self.settingsConfigureItem = icon_action(mainWindow, @@ -315,11 +316,11 @@ class Ui_MainWindow(object): add_actions(self.settingsMenu, (self.settingsPluginListItem, self.settingsLanguageMenu.menuAction(), None, self.settingsConfigureItem, self.settingsShortcutsItem, - self.displayTagItem)) + self.formattingTagItem)) else: add_actions(self.settingsMenu, (self.settingsPluginListItem, self.settingsLanguageMenu.menuAction(), None, - self.displayTagItem, self.settingsShortcutsItem, + self.formattingTagItem, self.settingsShortcutsItem, self.settingsConfigureItem)) add_actions(self.toolsMenu, (self.toolsAddToolItem, None)) add_actions(self.toolsMenu, (self.toolsOpenDataFolder, None)) @@ -403,7 +404,7 @@ class Ui_MainWindow(object): translate('OpenLP.MainWindow', '&Language')) self.settingsShortcutsItem.setText( translate('OpenLP.MainWindow', 'Configure &Shortcuts...')) - self.displayTagItem.setText( + self.formattingTagItem.setText( translate('OpenLP.MainWindow', '&Configure Formatting Tags...')) self.settingsConfigureItem.setText( translate('OpenLP.MainWindow', '&Configure OpenLP...')) @@ -511,7 +512,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.serviceNotSaved = False self.aboutForm = AboutForm(self) self.settingsForm = SettingsForm(self, self) - self.displayTagForm = DisplayTagForm(self) + self.formattingTagForm = FormattingTagForm(self) self.shortcutForm = ShortcutListForm(self) self.recentFiles = QtCore.QStringList() # Set up the path with plugins @@ -548,8 +549,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.SIGNAL(u'triggered()'), self.onToolsOpenDataFolderClicked) QtCore.QObject.connect(self.updateThemeImages, QtCore.SIGNAL(u'triggered()'), self.onUpdateThemeImages) - QtCore.QObject.connect(self.displayTagItem, - QtCore.SIGNAL(u'triggered()'), self.onDisplayTagItemClicked) + QtCore.QObject.connect(self.formattingTagItem, + QtCore.SIGNAL(u'triggered()'), self.onFormattingTagItemClicked) QtCore.QObject.connect(self.settingsConfigureItem, QtCore.SIGNAL(u'triggered()'), self.onSettingsConfigureItemClicked) QtCore.QObject.connect(self.settingsShortcutsItem, @@ -788,11 +789,11 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): """ self.themeManagerContents.updatePreviewImages() - def onDisplayTagItemClicked(self): + def onFormattingTagItemClicked(self): """ Show the Settings dialog """ - self.displayTagForm.exec_() + self.formattingTagForm.exec_() def onSettingsConfigureItemClicked(self): """ From b3896d880bd7f222cd01557d9fd2af7d7bd0b49f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 30 Jul 2011 09:40:34 +0200 Subject: [PATCH 17/22] spelling --- openlp/core/ui/formattingtagform.py | 6 +++--- openlp/core/ui/mainwindow.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py index 7312ffa7b..b3fda20ba 100644 --- a/openlp/core/ui/formattingtagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -25,7 +25,7 @@ # Temple Place, Suite 330, Boston, MA 02111-1307 USA # ############################################################################### """ -The :mod:`DisplayTagTab` provides an Tag Edit facility. The Base set are +The :mod:`formattingtagform` provides an Tag Edit facility. The Base set are protected and included each time loaded. Custom tags can be defined and saved. The Custom Tag arrays are saved in a pickle so QSettings works on them. Base Tags cannot be changed. @@ -78,7 +78,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): """ # Initial Load of the Tags FormattingTags.reset_html_tags() - # Formatting Tags where also known as display tags. + # Formatting Tags were also known as display tags. user_expands = QtCore.QSettings().value(u'displayTags/html_tags', QtCore.QVariant(u'')).toString() # cPickle only accepts str not unicode strings @@ -184,7 +184,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): for tag in FormattingTags.get_html_tags(): if not tag[u'protected']: tags.append(tag) - # Formatting Tags where also known as display tags. + # Formatting Tags were also known as display tags. QtCore.QSettings().setValue(u'displayTags/html_tags', QtCore.QVariant(cPickle.dumps(tags) if tags else u'')) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 16691e5a0..8beb21eac 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -269,7 +269,7 @@ class Ui_MainWindow(object): u'settingsShortcutsItem', u':/system/system_configure_shortcuts.png', category=UiStrings().Settings) - # Formatting Tags where also known as display tags. + # Formatting Tags were also known as display tags. self.formattingTagItem = icon_action(mainWindow, u'displayTagItem', u':/system/tag_editor.png', category=UiStrings().Settings) From 4f195a4721a3253f0cea101f2a26fde0d0a03797 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 30 Jul 2011 09:43:19 +0200 Subject: [PATCH 18/22] changed translate context --- openlp/core/ui/formattingtagform.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/formattingtagform.py b/openlp/core/ui/formattingtagform.py index b3fda20ba..2a8625b1a 100644 --- a/openlp/core/ui/formattingtagform.py +++ b/openlp/core/ui/formattingtagform.py @@ -121,17 +121,17 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): for html in FormattingTags.get_html_tags(): if self._strip(html[u'start tag']) == u'n': critical_error_message_box( - translate('OpenLP.DisplayTagTab', 'Update Error'), - translate('OpenLP.DisplayTagTab', + translate('OpenLP.FormattingTagForm', 'Update Error'), + translate('OpenLP.FormattingTagForm', 'Tag "n" already defined.')) return # Add new tag to list tag = { - u'desc': translate('OpenLP.DisplayTagTab', 'New Tag'), + u'desc': translate('OpenLP.FormattingTagForm', 'New Tag'), u'start tag': u'{n}', - u'start html': translate('OpenLP.DisplayTagTab', ''), + u'start html': translate('OpenLP.FormattingTagForm', ''), u'end tag': u'{/n}', - u'end html': translate('OpenLP.DisplayTagTab', ''), + u'end html': translate('OpenLP.FormattingTagForm', ''), u'protected': False } FormattingTags.add_html_tags([tag]) @@ -163,8 +163,8 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog): if self._strip(html1[u'start tag']) == tag and \ linenumber != self.selected: critical_error_message_box( - translate('OpenLP.DisplayTagTab', 'Update Error'), - unicode(translate('OpenLP.DisplayTagTab', + translate('OpenLP.FormattingTagForm', 'Update Error'), + unicode(translate('OpenLP.FormattingTagForm', 'Tag %s already defined.')) % tag) return html[u'desc'] = unicode(self.descriptionLineEdit.text()) From 5e91aa7aee0d7bdc7006dabfa8f0273cd6385102 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 30 Jul 2011 10:07:48 +0200 Subject: [PATCH 19/22] fixed long lines --- openlp/core/lib/formattingtags.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/formattingtags.py b/openlp/core/lib/formattingtags.py index 9fd42a605..ae9d5c1cf 100644 --- a/openlp/core/lib/formattingtags.py +++ b/openlp/core/lib/formattingtags.py @@ -93,20 +93,24 @@ class FormattingTags(object): u'desc': translate('OpenLP.FormattingTags', 'Superscript'), u'start tag': u'{su}', u'start html': u'', u'end tag': u'{/su}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Subscript'), + base_tags.append({ + u'desc': translate('OpenLP.FormattingTags', 'Subscript'), u'start tag': u'{sb}', u'start html': u'', u'end tag': u'{/sb}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Paragraph'), + base_tags.append({ + u'desc': translate('OpenLP.FormattingTags', 'Paragraph'), u'start tag': u'{p}', u'start html': u'

', u'end tag': u'{/p}', u'end html': u'

', u'protected': True}) base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Bold'), u'start tag': u'{st}', u'start html': u'', u'end tag': u'{/st}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Italics'), + base_tags.append({ + u'desc': translate('OpenLP.FormattingTags', 'Italics'), u'start tag': u'{it}', u'start html': u'', u'end tag': u'{/it}', u'end html': u'', u'protected': True}) - base_tags.append({u'desc': translate('OpenLP.FormattingTags', 'Underline'), + base_tags.append({ + u'desc': translate('OpenLP.FormattingTags', 'Underline'), u'start tag': u'{u}', u'start html': u'', u'end tag': u'{/u}', u'end html': u'', u'protected': True}) From c608a0750dad4ca1418988cd6932c8b8a752874a Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Mon, 1 Aug 2011 21:58:10 -0400 Subject: [PATCH 20/22] Modified firsttimeform to include existing themes when wizard is re-run --- openlp/core/ui/firsttimeform.py | 36 +++++++++++++++++++++++++++++---- openlp/core/ui/mainwindow.py | 2 +- 2 files changed, 33 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index e5d434180..71c18044e 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -157,10 +157,28 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): item = self.themesListWidget.item(iter) if item.checkState() == QtCore.Qt.Checked: self.themeComboBox.addItem(item.text()) + #Check if this is a re-run of the wizard. If so, add existing themes to list + self.has_run_wizard = QtCore.QSettings().value( + u'general/has run wizard', QtCore.QVariant(False)).toBool() + if self.has_run_wizard: + #If themes already exist, add them to the list + self.theme_list = self.parent().themeManagerContents.getThemes() + for theme in self.theme_list: + index = self.themeComboBox.findText(theme) + if index == -1: + self.themeComboBox.addItem(theme) + default_theme = unicode(QtCore.QSettings().value( + u'themes/global theme', + QtCore.QVariant(u'')).toString()) + #Pre-select the current default theme + index = self.themeComboBox.findText(default_theme) + self.themeComboBox.setCurrentIndex(index) elif pageId == FirstTimePage.Progress: + Receiver.send_message(u'cursor_busy') self._preWizard() self._performWizard() self._postWizard() + Receiver.send_message(u'cursor_normal') def updateScreenListCombo(self): """ @@ -249,11 +267,21 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): """ if self.max_progress: self.progressBar.setValue(self.progressBar.maximum()) - self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', - 'Download complete. Click the finish button to start OpenLP.')) + if self.has_run_wizard: + self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Download complete.' + ' Click the finish button to return to OpenLP.')) + else: + self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Download complete.' + ' Click the finish button to start OpenLP.')) else: - self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', - 'Click the finish button to start OpenLP.')) + if self.has_run_wizard: + self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Click the finish button to return to OpenLP.')) + else: + self.progressLabel.setText(translate('OpenLP.FirstTimeWizard', + 'Click the finish button to start OpenLP.')) self.finishButton.setVisible(True) self.finishButton.setEnabled(True) self.cancelButton.setVisible(False) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 69626cae8..7de14594a 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -748,7 +748,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): return Receiver.send_message(u'cursor_busy') screens = ScreenList.get_instance() - if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted: + if FirstTimeForm(screens, self).exec_() == QtGui.QDialog.Accepted: self.firstTime() for plugin in self.pluginManager.plugins: self.activePlugin = plugin From af8a89dfd4f1e2f87b1cea18c4514912211bec3e Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 2 Aug 2011 08:51:41 -0400 Subject: [PATCH 21/22] fixed come comments --- openlp/core/ui/firsttimeform.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 71c18044e..f5a2563e5 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -157,11 +157,11 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): item = self.themesListWidget.item(iter) if item.checkState() == QtCore.Qt.Checked: self.themeComboBox.addItem(item.text()) - #Check if this is a re-run of the wizard. If so, add existing themes to list + # Check if this is a re-run of the wizard. If so, add existing themes to list self.has_run_wizard = QtCore.QSettings().value( u'general/has run wizard', QtCore.QVariant(False)).toBool() if self.has_run_wizard: - #If themes already exist, add them to the list + # If themes already exist, add them to the list self.theme_list = self.parent().themeManagerContents.getThemes() for theme in self.theme_list: index = self.themeComboBox.findText(theme) @@ -170,7 +170,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): default_theme = unicode(QtCore.QSettings().value( u'themes/global theme', QtCore.QVariant(u'')).toString()) - #Pre-select the current default theme + # Pre-select the current default theme index = self.themeComboBox.findText(default_theme) self.themeComboBox.setCurrentIndex(index) elif pageId == FirstTimePage.Progress: From af7ff7c6be8e222d23b7b51abbcc272c85eb01a7 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Wed, 3 Aug 2011 09:19:43 -0400 Subject: [PATCH 22/22] changed some comments, removed a variable using functioin inline --- openlp/core/ui/firsttimeform.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index f5a2563e5..4beebfde6 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -157,20 +157,19 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): item = self.themesListWidget.item(iter) if item.checkState() == QtCore.Qt.Checked: self.themeComboBox.addItem(item.text()) - # Check if this is a re-run of the wizard. If so, add existing themes to list + # Check if this is a re-run of the wizard. self.has_run_wizard = QtCore.QSettings().value( u'general/has run wizard', QtCore.QVariant(False)).toBool() if self.has_run_wizard: - # If themes already exist, add them to the list - self.theme_list = self.parent().themeManagerContents.getThemes() - for theme in self.theme_list: + # Add any existing themes to list. + for theme in self.parent().themeManagerContents.getThemes(): index = self.themeComboBox.findText(theme) if index == -1: self.themeComboBox.addItem(theme) default_theme = unicode(QtCore.QSettings().value( u'themes/global theme', QtCore.QVariant(u'')).toString()) - # Pre-select the current default theme + # Pre-select the current default theme. index = self.themeComboBox.findText(default_theme) self.themeComboBox.setCurrentIndex(index) elif pageId == FirstTimePage.Progress: