Add HTTP Check to Thread to stop UI blocking at startup

Add Preview option for songs etc from service manager

bzr-revno: 716
This commit is contained in:
Tim Bentley 2010-02-26 12:45:22 +00:00
commit 4006bfcf51
9 changed files with 48 additions and 16 deletions

View File

@ -72,6 +72,7 @@ class ServiceItem(object):
self._raw_frames = []
self._display_frames = []
self._uuid = unicode(uuid.uuid1())
self.autoPreviewAllowed = False
def addIcon(self, icon):
"""
@ -200,7 +201,8 @@ class ServiceItem(object):
u'icon':self.icon,
u'footer':self.raw_footer,
u'type':self.service_item_type,
u'audit':self.audit
u'audit':self.audit,
u'preview':self.autoPreviewAllowed
}
service_data = []
if self.service_item_type == ServiceItemType.Text:
@ -234,6 +236,7 @@ class ServiceItem(object):
self.addIcon(header[u'icon'])
self.raw_footer = header[u'footer']
self.audit = header[u'audit']
self.autoPreviewAllowed = header[u'preview']
if self.service_item_type == ServiceItemType.Text:
for slide in serviceitem[u'serviceitem'][u'data']:
self._raw_frames.append(slide)

View File

@ -87,6 +87,10 @@ class GeneralTab(SettingsTab):
self.SaveCheckServiceCheckBox.setObjectName(u'SaveCheckServiceCheckBox')
self.SettingsLayout.addWidget(self.SaveCheckServiceCheckBox)
self.GeneralLeftLayout.addWidget(self.SettingsGroupBox)
self.AutoPreviewCheckBox = QtGui.QCheckBox(self.SettingsGroupBox)
self.AutoPreviewCheckBox.setObjectName(u'AutoPreviewCheckBox')
self.SettingsLayout.addWidget(self.AutoPreviewCheckBox)
self.GeneralLeftLayout.addWidget(self.SettingsGroupBox)
self.GeneralLeftSpacer = QtGui.QSpacerItem(20, 40,
QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)
self.GeneralLeftLayout.addItem(self.GeneralLeftSpacer)
@ -137,6 +141,8 @@ class GeneralTab(SettingsTab):
QtCore.SIGNAL(u'stateChanged(int)'), self.onShowSplashCheckBoxChanged)
QtCore.QObject.connect(self.SaveCheckServiceCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onSaveCheckServiceCheckBox)
QtCore.QObject.connect(self.AutoPreviewCheckBox,
QtCore.SIGNAL(u'stateChanged(int)'), self.onAutoPreviewCheckBox)
QtCore.QObject.connect(self.NumberEdit,
QtCore.SIGNAL(u'editingFinished()'), self.onNumberEditLostFocus)
QtCore.QObject.connect(self.UsernameEdit,
@ -153,6 +159,7 @@ class GeneralTab(SettingsTab):
self.ShowSplashCheckBox.setText(self.trUtf8('Show the splash screen'))
self.SettingsGroupBox.setTitle(self.trUtf8('Application Settings'))
self.SaveCheckServiceCheckBox.setText(self.trUtf8('Prompt to save Service before starting New'))
self.AutoPreviewCheckBox.setText(self.trUtf8('Preview Next Song from Service Manager'))
self.CCLIGroupBox.setTitle(self.trUtf8('CCLI Details'))
self.NumberLabel.setText(self.trUtf8('CCLI Number:'))
self.UsernameLabel.setText(self.trUtf8('SongSelect Username:'))
@ -173,6 +180,9 @@ class GeneralTab(SettingsTab):
def onSaveCheckServiceCheckBox(self, value):
self.PromptSaveService = (value == QtCore.Qt.Checked)
def onAutoPreviewCheckBox(self, value):
self.AutoPreview = (value == QtCore.Qt.Checked)
def onNumberEditLostFocus(self):
self.CCLINumber = self.NumberEdit.displayText()
@ -194,6 +204,7 @@ class GeneralTab(SettingsTab):
self.AutoOpen = str_to_bool(self.config.get_config(u'auto open', u'False'))
self.ShowSplash = str_to_bool(self.config.get_config(u'show splash', u'True'))
self.PromptSaveService = str_to_bool(self.config.get_config(u'save prompt', u'False'))
self.AutoPreview = str_to_bool(self.config.get_config(u'auto preview', u'False'))
self.CCLINumber = unicode(self.config.get_config(u'ccli number', u''))
self.Username = unicode(self.config.get_config(u'songselect username', u''))
self.Password = unicode(self.config.get_config(u'songselect password', u''))
@ -203,6 +214,7 @@ class GeneralTab(SettingsTab):
self.WarningCheckBox.setChecked(self.Warning)
self.AutoOpenCheckBox.setChecked(self.AutoOpen)
self.ShowSplashCheckBox.setChecked(self.ShowSplash)
self.AutoPreviewCheckBox.setChecked(self.AutoPreview)
self.NumberEdit.setText(self.CCLINumber)
self.UsernameEdit.setText(self.Username)
self.PasswordEdit.setText(self.Password)
@ -213,6 +225,7 @@ class GeneralTab(SettingsTab):
self.config.set_config(u'auto open', self.AutoOpen)
self.config.set_config(u'show splash', self.ShowSplash)
self.config.set_config(u'save prompt', self.PromptSaveService)
self.config.set_config(u'auto preview', self.AutoPreview)
self.config.set_config(u'ccli number', self.CCLINumber)
self.config.set_config(u'songselect username', self.Username)
self.config.set_config(u'songselect password', self.Password)

View File

@ -52,12 +52,17 @@ media_manager_style = """
}
"""
class versionThread(QtCore.QThread):
def __init__(self, parent):
def __init__(self, parent, app_version, generalConfig):
QtCore.QThread.__init__(self, parent)
self.parent = parent
self.app_version = app_version
self.generalConfig = generalConfig
def run (self):
time.sleep(2)
Receiver.send_message(u'version_check')
version = check_latest_version(self.generalConfig, self.app_version)
#new version has arrived
if version != self.app_version:
Receiver.send_message(u'version_check', u'%s' % version)
class Ui_MainWindow(object):
@ -536,20 +541,18 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
log.info(u'Load data from Settings')
self.settingsForm.postSetUp()
def versionCheck(self):
def versionCheck(self, version):
"""
Checks the version of the Application called from openlp.pyw
"""
app_version = self.applicationVersion[u'full']
version = check_latest_version(self.generalConfig, app_version)
if app_version != version:
version_text = unicode(self.trUtf8('OpenLP version %s has been updated '
'to version %s\n\nYou can obtain the latest version from http://openlp.org'))
QtGui.QMessageBox.question(self,
self.trUtf8('OpenLP Version Updated'),
version_text % (app_version, version),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
version_text = unicode(self.trUtf8('OpenLP version %s has been updated '
'to version %s\n\nYou can obtain the latest version from http://openlp.org'))
QtGui.QMessageBox.question(self,
self.trUtf8('OpenLP Version Updated'),
version_text % (app_version, version),
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok),
QtGui.QMessageBox.Ok)
def getMonitorNumber(self):
"""
@ -584,7 +587,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
QtGui.QMessageBox.Ok)
def versionThread(self):
vT = versionThread(self)
app_version = self.applicationVersion[u'full']
vT = versionThread(self, app_version, self.generalConfig)
vT.start()
def onHelpAboutItemClicked(self):

View File

@ -621,6 +621,7 @@ class ServiceManager(QtGui.QWidget):
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
def makeLive(self):
"""
Send the current item to the Live slide controller
@ -628,6 +629,13 @@ class ServiceManager(QtGui.QWidget):
item, count = self.findServiceItem()
self.parent.LiveController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count)
if str_to_bool(PluginConfig(u'General').
get_config(u'auto preview', u'False')):
item += 1
if len(self.serviceItems) > 0 and item < len(self.serviceItems) and \
self.serviceItems[item][u'service_item'].autoPreviewAllowed:
self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], 0)
def remoteEdit(self):
"""

View File

@ -435,6 +435,7 @@ class BibleMediaItem(MediaManagerItem):
raw_slides = []
raw_footer = []
bible_text = u''
self.service_item.autoPreviewAllowed = True
#If we want to use a 2nd translation / version
bible2 = u''
if self.SearchTabWidget.currentIndex() == 0:

View File

@ -144,6 +144,7 @@ class CustomMediaItem(MediaManagerItem):
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else:
item_id = self.remoteCustom
self.service_item.autoPreviewAllowed = True
customSlide = self.parent.custommanager.get_custom(item_id)
title = customSlide.title
credit = customSlide.credits

View File

@ -144,6 +144,7 @@ class ImageMediaItem(MediaManagerItem):
items = self.ListView.selectedIndexes()
if items:
service_item.title = self.trUtf8('Image(s)')
self.service_item.autoPreviewAllowed = True
for item in items:
bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString())

View File

@ -290,6 +290,7 @@ class SongMediaItem(MediaManagerItem):
item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else:
item_id = self.remoteSong
service_item.autoPreviewAllowed = True
song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name
service_item.edit_enabled = True

View File

@ -1 +1 @@
1.9.0-715
1.9.0-716