From b15fd4df49ca1154717c12d1534c8eb742ee7c1f Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Fri, 22 Jul 2011 09:39:49 -0400 Subject: [PATCH 1/7] 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 2/7] 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 8800b4174919149c24e1e771db42071acc849a6f Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Sat, 23 Jul 2011 14:09:13 -0400 Subject: [PATCH 3/7] 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 c84c69645efd4171d5b6031ca11090f97be88e70 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Mon, 25 Jul 2011 15:24:35 -0400 Subject: [PATCH 4/7] 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 5/7] 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 6/7] 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 7/7] 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),