modified mainwindow.py code to make first time wizard re-run inline code

This commit is contained in:
Stevan Pettit 2011-07-23 08:52:43 -04:00
parent b15fd4df49
commit f7a222da6c
2 changed files with 18 additions and 13 deletions

View File

@ -129,6 +129,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
os.path.join(gettempdir(), u'openlp', screenshot))) os.path.join(gettempdir(), u'openlp', screenshot)))
item.setCheckState(QtCore.Qt.Unchecked) item.setCheckState(QtCore.Qt.Unchecked)
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable) item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
Receiver.send_message(u'cursor_normal')
def nextId(self): def nextId(self):
""" """

View File

@ -33,7 +33,7 @@ from tempfile import gettempdir
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from openlp.core.lib import Renderer, build_icon, OpenLPDockWidget, \ 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, \ from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \
icon_action, shortcut_action icon_action, shortcut_action
from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ 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, \ from openlp.core.utils import AppLocation, add_actions, LanguageManager, \
get_application_version, delete_file get_application_version, delete_file
from openlp.core.utils.actions import ActionList, CategoryOrder 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__) log = logging.getLogger(__name__)
@ -723,18 +725,20 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
os.removedirs(temp_dir) os.removedirs(temp_dir)
def onFirstTimeWizardClicked(self): def onFirstTimeWizardClicked(self):
ret = QtGui.QMessageBox.information(self, Receiver.send_message(u'cursor_busy')
translate('OpenLP.MainWindow', 'Restart OpenLP'), screens = ScreenList.get_instance()
translate('OpenLP.MainWindow', FirstTimeForm(screens).exec_()
'OpenLP will now restart. The First Time Wizard will run when ' + self.firstTime()
'OpenLP is restarted'), for plugin in self.pluginManager.plugins:
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok), self.activePlugin = plugin
QtGui.QMessageBox.Ok) oldStatus = self.activePlugin.status
QtCore.QSettings().setValue(u'general/has run wizard', self.activePlugin.setStatus()
QtCore.QVariant(False)) if oldStatus != self.activePlugin.status:
self.close() if self.activePlugin.status == PluginStatus.Active:
OpenLP_exe = sys.executable self.activePlugin.toggleStatus(PluginStatus.Active)
os.execl(OpenLP_exe, OpenLP_exe, * sys.argv) self.activePlugin.appStartup()
else:
self.activePlugin.toggleStatus(PluginStatus.Inactive)
def blankCheck(self): def blankCheck(self):
""" """