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

View File

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

View File

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

View File

@ -621,6 +621,7 @@ class ServiceManager(QtGui.QWidget):
self.parent.PreviewController.addServiceManagerItem( self.parent.PreviewController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count) self.serviceItems[item][u'service_item'], count)
def makeLive(self): def makeLive(self):
""" """
Send the current item to the Live slide controller Send the current item to the Live slide controller
@ -628,6 +629,13 @@ class ServiceManager(QtGui.QWidget):
item, count = self.findServiceItem() item, count = self.findServiceItem()
self.parent.LiveController.addServiceManagerItem( self.parent.LiveController.addServiceManagerItem(
self.serviceItems[item][u'service_item'], count) 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): def remoteEdit(self):
""" """

View File

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

View File

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

View File

@ -144,6 +144,7 @@ class ImageMediaItem(MediaManagerItem):
items = self.ListView.selectedIndexes() items = self.ListView.selectedIndexes()
if items: if items:
service_item.title = self.trUtf8('Image(s)') service_item.title = self.trUtf8('Image(s)')
self.service_item.autoPreviewAllowed = True
for item in items: for item in items:
bitem = self.ListView.item(item.row()) bitem = self.ListView.item(item.row())
filename = unicode((bitem.data(QtCore.Qt.UserRole)).toString()) 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] item_id = (item.data(QtCore.Qt.UserRole)).toInt()[0]
else: else:
item_id = self.remoteSong item_id = self.remoteSong
service_item.autoPreviewAllowed = True
song = self.parent.songmanager.get_song(item_id) song = self.parent.songmanager.get_song(item_id)
service_item.theme = song.theme_name service_item.theme = song.theme_name
service_item.edit_enabled = True service_item.edit_enabled = True

View File

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