← Back to team overview

openlp-core team mailing list archive

[Merge] lp:~smpettit/openlp/ftw into lp:openlp

 

Stevan Pettit has proposed merging lp:~smpettit/openlp/ftw into lp:openlp.

Requested reviews:
  Jonathan Corwin (j-corwin)
  Andreas Preikschat (googol)
  Raoul Snyman (raoul-snyman)
  Tim Bentley (trb143)

For more details, see:
https://code.launchpad.net/~smpettit/openlp/ftw/+merge/69556

Bug #801325

Modified mainwindow.py:

Add "Run First Time Wizard" to the "Tools" menu
Added code to reset the "has run wizard" indicator
Added code to close and restart OpenLP so the FTW will run

Modified code to run first time wizard "inline".  After the wizard exits, any items downloaded are imported and the pluginmanager is set to reflect plugins selected.

Due to the delay between selecting the menu item and the display of the FTW screen, the cursor is set to "busy"

Added code for FTW re-run confirmation with warnings informing what re-running the wizard will do.
Added code to check for FTW "Cancel"
Added code to update thememanager and a new default theme

Added docstring.  Modified code as per comments.  Changed menu text to "Re-run First....."

Added status tips, removed un-needed continuation characters

Made minor changes to text .... ditto
-- 
https://code.launchpad.net/~smpettit/openlp/ftw/+merge/69556
Your team OpenLP Core is subscribed to branch lp:openlp.
=== modified file 'openlp/core/ui/firsttimeform.py'
--- openlp/core/ui/firsttimeform.py	2011-06-12 16:02:52 +0000
+++ openlp/core/ui/firsttimeform.py	2011-07-27 20:52:32 +0000
@@ -129,6 +129,7 @@
                     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):
         """

=== modified file 'openlp/core/ui/mainwindow.py'
--- openlp/core/ui/mainwindow.py	2011-07-12 19:06:37 +0000
+++ openlp/core/ui/mainwindow.py	2011-07-27 20:52:32 +0000
@@ -33,7 +33,7 @@
 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.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__)
 
@@ -244,6 +246,9 @@
         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 +328,7 @@
                 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,
@@ -471,6 +477,10 @@
             translate('OpenLP.MainWindow', 'Open &Data Folder...'))
         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(
@@ -546,6 +556,8 @@
             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 +726,45 @@
             delete_file(os.path.join(temp_dir, filename))
         os.removedirs(temp_dir)
 
+    def onFirstTimeWizardClicked(self):
+        """
+        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 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.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):
         """
         Check and display message if screen blank on setup.


Follow ups