forked from openlp/openlp
yet more clean ups
This commit is contained in:
parent
508d050b4c
commit
da08356f1c
|
@ -137,13 +137,13 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
bible_languages = bible_languages.split(',')
|
||||
for lang in bible_languages:
|
||||
language = self.config.get('bibles_%s' % lang, 'title')
|
||||
langItem = QtGui.QTreeWidgetItem(self.bibles_tree_widget, [language])
|
||||
lang_item = QtGui.QTreeWidgetItem(self.bibles_tree_widget, [language])
|
||||
bibles = self.config.get('bibles_%s' % lang, 'translations')
|
||||
bibles = bibles.split(',')
|
||||
for bible in bibles:
|
||||
title = self.config.get('bible_%s' % bible, 'title')
|
||||
filename = self.config.get('bible_%s' % bible, 'filename')
|
||||
item = QtGui.QTreeWidgetItem(langItem, [title])
|
||||
item = QtGui.QTreeWidgetItem(lang_item, [title])
|
||||
item.setData(0, QtCore.Qt.UserRole, filename)
|
||||
item.setCheckState(0, QtCore.Qt.Unchecked)
|
||||
item.setFlags(item.flags() | QtCore.Qt.ItemIsUserCheckable)
|
||||
|
@ -239,7 +239,8 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
"""
|
||||
Process the triggering of the cancel button.
|
||||
"""
|
||||
if self.last_id == FirstTimePage.NoInternet or (self.last_id <= FirstTimePage.Plugins and not self.has_run_wizard):
|
||||
if self.last_id == FirstTimePage.NoInternet or \
|
||||
(self.last_id <= FirstTimePage.Plugins and not self.has_run_wizard):
|
||||
QtCore.QCoreApplication.exit()
|
||||
sys.exit()
|
||||
self.was_download_cancelled = True
|
||||
|
@ -391,17 +392,17 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard):
|
|||
self.progress_bar.setValue(self.progress_bar.maximum())
|
||||
if self.has_run_wizard:
|
||||
self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Download complete. Click the finish button to return to OpenLP.'))
|
||||
'Download complete. Click the finish button to return to OpenLP.'))
|
||||
else:
|
||||
self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Download complete. Click the finish button to start OpenLP.'))
|
||||
'Download complete. Click the finish button to start OpenLP.'))
|
||||
else:
|
||||
if self.has_run_wizard:
|
||||
self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Click the finish button to return to OpenLP.'))
|
||||
'Click the finish button to return to OpenLP.'))
|
||||
else:
|
||||
self.progress_label.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'Click the finish button to start OpenLP.'))
|
||||
'Click the finish button to start OpenLP.'))
|
||||
self.finish_button.setVisible(True)
|
||||
self.finish_button.setEnabled(True)
|
||||
self.cancel_button.setVisible(False)
|
||||
|
|
|
@ -46,9 +46,9 @@ class FirstTimeLanguageForm(QtGui.QDialog, Ui_FirstTimeLanguageDialog):
|
|||
"""
|
||||
super(FirstTimeLanguageForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.qmList = LanguageManager.get_qm_list()
|
||||
self.qm_list = LanguageManager.get_qm_list()
|
||||
self.language_combo_box.addItem('Autodetect')
|
||||
self.language_combo_box.addItems(sorted(self.qmList.keys()))
|
||||
self.language_combo_box.addItems(sorted(self.qm_list.keys()))
|
||||
|
||||
def exec_(self):
|
||||
"""
|
||||
|
|
|
@ -64,7 +64,7 @@ class Ui_FirstTimeWizard(object):
|
|||
first_time_wizard.setModal(True)
|
||||
first_time_wizard.setWizardStyle(QtGui.QWizard.ModernStyle)
|
||||
first_time_wizard.setOptions(QtGui.QWizard.IndependentPages | QtGui.QWizard.NoBackButtonOnStartPage |
|
||||
QtGui.QWizard.NoBackButtonOnLastPage | QtGui.QWizard.HaveCustomButton1)
|
||||
QtGui.QWizard.NoBackButtonOnLastPage | QtGui.QWizard.HaveCustomButton1)
|
||||
self.finish_button = self.button(QtGui.QWizard.FinishButton)
|
||||
self.no_internet_finish_button = self.button(QtGui.QWizard.CustomButton1)
|
||||
self.cancel_button = self.button(QtGui.QWizard.CancelButton)
|
||||
|
@ -210,9 +210,10 @@ class Ui_FirstTimeWizard(object):
|
|||
"""
|
||||
first_time_wizard.setWindowTitle(translate('OpenLP.FirstTimeWizard', 'First Time Wizard'))
|
||||
self.title_label.setText('<span style="font-size:14pt; font-weight:600;">%s</span>' %
|
||||
translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard'))
|
||||
translate('OpenLP.FirstTimeWizard', 'Welcome to the First Time Wizard'))
|
||||
self.information_label.setText(translate('OpenLP.FirstTimeWizard',
|
||||
'This wizard will help you to configure OpenLP for initial use. Click the next button below to start.'))
|
||||
'This wizard will help you to configure OpenLP for initial use. '
|
||||
'Click the next button below to start.'))
|
||||
self.plugin_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Activate required Plugins'))
|
||||
self.plugin_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select the Plugins you wish to use. '))
|
||||
self.songs_check_box.setText(translate('OpenLP.FirstTimeWizard', 'Songs'))
|
||||
|
@ -231,13 +232,15 @@ class Ui_FirstTimeWizard(object):
|
|||
self.no_internet_page.setSubTitle(
|
||||
translate('OpenLP.FirstTimeWizard', 'Unable to detect an Internet connection.'))
|
||||
self.no_internet_text = translate('OpenLP.FirstTimeWizard',
|
||||
'No Internet connection was found. The First Time Wizard needs an Internet connection in order to be able '
|
||||
'to download sample songs, Bibles and themes. Click the Finish button now to start OpenLP with initial '
|
||||
'settings and no sample data.\n\nTo re-run the First Time Wizard and import this sample data at a later '
|
||||
'time, check your Internet connection and re-run this wizard by selecting "Tools/Re-run First Time Wizard" '
|
||||
'from OpenLP.')
|
||||
'No Internet connection was found. The First Time Wizard needs an Internet '
|
||||
'connection in order to be able to download sample songs, Bibles and themes.'
|
||||
' Click the Finish button now to start OpenLP with initial settings and '
|
||||
'no sample data.\n\nTo re-run the First Time Wizard and import this sample '
|
||||
'data at a later time, check your Internet connection and re-run this '
|
||||
'wizard by selecting "Tools/Re-run First Time Wizard" from OpenLP.')
|
||||
self.cancelWizardText = translate('OpenLP.FirstTimeWizard',
|
||||
'\n\nTo cancel the First Time Wizard completely (and not start OpenLP), click the Cancel button now.')
|
||||
'\n\nTo cancel the First Time Wizard completely (and not start OpenLP), '
|
||||
'click the Cancel button now.')
|
||||
self.songs_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Songs'))
|
||||
self.songs_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download public domain songs.'))
|
||||
self.bibles_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Sample Bibles'))
|
||||
|
@ -246,7 +249,7 @@ class Ui_FirstTimeWizard(object):
|
|||
self.themes_page.setSubTitle(translate('OpenLP.FirstTimeWizard', 'Select and download sample themes.'))
|
||||
self.defaults_page.setTitle(translate('OpenLP.FirstTimeWizard', 'Default Settings'))
|
||||
self.defaults_page.setSubTitle(translate('OpenLP.FirstTimeWizard',
|
||||
'Set up default settings to be used by OpenLP.'))
|
||||
'Set up default settings to be used by OpenLP.'))
|
||||
self.display_label.setText(translate('OpenLP.FirstTimeWizard', 'Default output display:'))
|
||||
self.theme_label.setText(translate('OpenLP.FirstTimeWizard', 'Select default theme:'))
|
||||
self.progress_label.setText(translate('OpenLP.FirstTimeWizard', 'Starting configuration process...'))
|
||||
|
|
|
@ -45,11 +45,12 @@ class FormattingTagController(object):
|
|||
"""
|
||||
Initiator
|
||||
"""
|
||||
self.html_tag_regex = re.compile(r'<(?:(?P<close>/(?=[^\s/>]+>))?'
|
||||
r'(?P<tag>[^\s/!\?>]+)(?:\s+[^\s=]+="[^"]*")*\s*(?P<empty>/)?'
|
||||
r'|(?P<cdata>!\[CDATA\[(?:(?!\]\]>).)*\]\])'
|
||||
r'|(?P<procinst>\?(?:(?!\?>).)*\?)'
|
||||
r'|(?P<comment>!--(?:(?!-->).)*--))>', re.UNICODE)
|
||||
self.html_tag_regex = re.compile(
|
||||
r'<(?:(?P<close>/(?=[^\s/>]+>))?'
|
||||
r'(?P<tag>[^\s/!\?>]+)(?:\s+[^\s=]+="[^"]*")*\s*(?P<empty>/)?'
|
||||
r'|(?P<cdata>!\[CDATA\[(?:(?!\]\]>).)*\]\])'
|
||||
r'|(?P<procinst>\?(?:(?!\?>).)*\?)'
|
||||
r'|(?P<comment>!--(?:(?!-->).)*--))>', re.UNICODE)
|
||||
self.html_regex = re.compile(r'^(?:[^<>]*%s)*[^<>]*$' % self.html_tag_regex.pattern)
|
||||
|
||||
def pre_save(self):
|
||||
|
@ -76,12 +77,12 @@ class FormattingTagController(object):
|
|||
The end html tag.
|
||||
|
||||
"""
|
||||
for linenumber, html1 in enumerate(self.protected_tags):
|
||||
for line_number, html1 in enumerate(self.protected_tags):
|
||||
if self._strip(html1['start tag']) == tag:
|
||||
return translate('OpenLP.FormattingTagForm', 'Tag %s already defined.') % tag
|
||||
if self._strip(html1['desc']) == desc:
|
||||
return translate('OpenLP.FormattingTagForm', 'Description %s already defined.') % tag
|
||||
for linenumber, html1 in enumerate(self.custom_tags):
|
||||
for line_number, html1 in enumerate(self.custom_tags):
|
||||
if self._strip(html1['start tag']) == tag:
|
||||
return translate('OpenLP.FormattingTagForm', 'Tag %s already defined.') % tag
|
||||
if self._strip(html1['desc']) == desc:
|
||||
|
@ -172,5 +173,5 @@ class FormattingTagController(object):
|
|||
return None, end
|
||||
if end and end != end_html:
|
||||
return translate('OpenLP.FormattingTagForm',
|
||||
'End tag %s does not match end tag for start tag %s' % (end, start_html)), None
|
||||
'End tag %s does not match end tag for start tag %s' % (end, start_html)), None
|
||||
return None, None
|
|
@ -93,10 +93,11 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
|
|||
new_row = self.tag_table_widget.rowCount()
|
||||
self.tag_table_widget.insertRow(new_row)
|
||||
self.tag_table_widget.setItem(new_row, 0,
|
||||
QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm', 'New Tag%s') % str(new_row)))
|
||||
QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm', 'New Tag%s')
|
||||
% str(new_row)))
|
||||
self.tag_table_widget.setItem(new_row, 1, QtGui.QTableWidgetItem('n%s' % str(new_row)))
|
||||
self.tag_table_widget.setItem(new_row, 2,
|
||||
QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm', '<HTML here>')))
|
||||
QtGui.QTableWidgetItem(translate('OpenLP.FormattingTagForm', '<HTML here>')))
|
||||
self.tag_table_widget.setItem(new_row, 3, QtGui.QTableWidgetItem(''))
|
||||
self.tag_table_widget.resizeRowsToContents()
|
||||
self.tag_table_widget.scrollToBottom()
|
||||
|
@ -119,11 +120,12 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
|
|||
self.services.pre_save()
|
||||
while count < self.tag_table_widget.rowCount():
|
||||
error = self.services.validate_for_save(self.tag_table_widget.item(count, 0).text(),
|
||||
self.tag_table_widget.item(count, 1).text(), self.tag_table_widget.item(count, 2).text(),
|
||||
self.tag_table_widget.item(count, 3).text())
|
||||
self.tag_table_widget.item(count, 1).text(),
|
||||
self.tag_table_widget.item(count, 2).text(),
|
||||
self.tag_table_widget.item(count, 3).text())
|
||||
if error:
|
||||
QtGui.QMessageBox.warning(self,
|
||||
translate('OpenLP.FormattingTagForm', 'Validation Error'), error, QtGui.QMessageBox.Ok)
|
||||
QtGui.QMessageBox.warning(self, translate('OpenLP.FormattingTagForm', 'Validation Error'), error,
|
||||
QtGui.QMessageBox.Ok)
|
||||
self.tag_table_widget.selectRow(count)
|
||||
return
|
||||
count += 1
|
||||
|
@ -141,7 +143,7 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
|
|||
self.tag_table_widget.setRowCount(0)
|
||||
self.new_button.setEnabled(True)
|
||||
self.delete_button.setEnabled(False)
|
||||
for linenumber, html in enumerate(FormattingTags.get_html_tags()):
|
||||
for line_number, html in enumerate(FormattingTags.get_html_tags()):
|
||||
if html['protected']:
|
||||
line = self.tag_table_widget_read.rowCount()
|
||||
self.tag_table_widget_read.setRowCount(line + 1)
|
||||
|
@ -198,8 +200,8 @@ class FormattingTagForm(QtGui.QDialog, Ui_FormattingTagDialog, FormattingTagCont
|
|||
if tag:
|
||||
self.tag_table_widget.setItem(pre_row, 3, QtGui.QTableWidgetItem(tag))
|
||||
if errors:
|
||||
QtGui.QMessageBox.warning(self,
|
||||
translate('OpenLP.FormattingTagForm', 'Validation Error'), errors, QtGui.QMessageBox.Ok)
|
||||
QtGui.QMessageBox.warning(self, translate('OpenLP.FormattingTagForm', 'Validation Error'), errors,
|
||||
QtGui.QMessageBox.Ok)
|
||||
#self.tag_table_widget.selectRow(pre_row - 1)
|
||||
self.tag_table_widget.resizeRowsToContents()
|
||||
|
||||
|
|
|
@ -221,7 +221,7 @@ class GeneralTab(SettingsTab):
|
|||
self.check_for_updates_check_box.setText(translate('OpenLP.GeneralTab', 'Check for updates to OpenLP'))
|
||||
self.settings_group_box.setTitle(translate('OpenLP.GeneralTab', 'Application Settings'))
|
||||
self.save_check_service_check_box.setText(translate('OpenLP.GeneralTab',
|
||||
'Prompt to save before starting a new service'))
|
||||
'Prompt to save before starting a new service'))
|
||||
self.auto_unblank_check_box.setText(translate('OpenLP.GeneralTab', 'Unblank display when adding new live item'))
|
||||
self.auto_preview_check_box.setText(translate('OpenLP.GeneralTab', 'Automatically preview next item in service'))
|
||||
self.timeout_label.setText(translate('OpenLP.GeneralTab', 'Timed slide interval:'))
|
||||
|
@ -248,8 +248,8 @@ class GeneralTab(SettingsTab):
|
|||
settings.beginGroup(self.settings_section)
|
||||
self.monitor_combo_box.clear()
|
||||
self.monitor_combo_box.addItems(self.screens.get_screen_list())
|
||||
monitorNumber = settings.value('monitor')
|
||||
self.monitor_combo_box.setCurrentIndex(monitorNumber)
|
||||
monitor_number = settings.value('monitor')
|
||||
self.monitor_combo_box.setCurrentIndex(monitor_number)
|
||||
self.number_edit.setText(settings.value('ccli number'))
|
||||
self.username_edit.setText(settings.value('songselect username'))
|
||||
self.password_edit.setText(settings.value('songselect password'))
|
||||
|
|
|
@ -75,9 +75,9 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||
self.resizeRowsToContents()
|
||||
else:
|
||||
# Sort out image heights.
|
||||
for framenumber in range(len(self.service_item.get_frames())):
|
||||
for frame_number in range(len(self.service_item.get_frames())):
|
||||
height = self.viewport().width() // self.screen_ratio
|
||||
self.setRowHeight(framenumber, height)
|
||||
self.setRowHeight(frame_number, height)
|
||||
|
||||
def screen_size_changed(self, screen_ratio):
|
||||
"""
|
||||
|
@ -87,7 +87,7 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||
self.screen_ratio = screen_ratio
|
||||
self.__recalculate_layout()
|
||||
|
||||
def replace_service_item(self, service_item, width, slideNumber):
|
||||
def replace_service_item(self, service_item, width, slide_number):
|
||||
"""
|
||||
Replaces the current preview items with the ones in service_item.
|
||||
Displays the given slide.
|
||||
|
@ -98,7 +98,7 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||
self.setColumnWidth(0, width)
|
||||
row = 0
|
||||
text = []
|
||||
for framenumber, frame in enumerate(self.service_item.get_frames()):
|
||||
for frame_number, frame in enumerate(self.service_item.get_frames()):
|
||||
self.setRowCount(self.slide_count() + 1)
|
||||
item = QtGui.QTableWidgetItem()
|
||||
slide_height = 0
|
||||
|
@ -124,19 +124,19 @@ class ListPreviewWidget(QtGui.QTableWidget):
|
|||
else:
|
||||
image = self.image_manager.get_image(frame['path'], ImageSource.ImagePlugin)
|
||||
label.setPixmap(QtGui.QPixmap.fromImage(image))
|
||||
self.setCellWidget(framenumber, 0, label)
|
||||
self.setCellWidget(frame_number, 0, label)
|
||||
slide_height = width // self.screen_ratio
|
||||
row += 1
|
||||
text.append(str(row))
|
||||
self.setItem(framenumber, 0, item)
|
||||
self.setItem(frame_number, 0, item)
|
||||
if slide_height:
|
||||
self.setRowHeight(framenumber, slide_height)
|
||||
self.setRowHeight(frame_number, slide_height)
|
||||
self.setVerticalHeaderLabels(text)
|
||||
if self.service_item.is_text():
|
||||
self.resizeRowsToContents()
|
||||
self.setColumnWidth(0, self.viewport().width())
|
||||
self.setFocus()
|
||||
self.change_slide(slideNumber)
|
||||
self.change_slide(slide_number)
|
||||
|
||||
def change_slide(self, slide):
|
||||
"""
|
||||
|
|
|
@ -215,7 +215,7 @@ class MainDisplay(Display):
|
|||
service_item = ServiceItem()
|
||||
service_item.bg_image_bytes = image_to_byte(self.initial_fame)
|
||||
self.web_view.setHtml(build_html(service_item, self.screen, self.is_live, None,
|
||||
plugins=self.plugin_manager.plugins))
|
||||
plugins=self.plugin_manager.plugins))
|
||||
self.__hideMouse()
|
||||
log.debug('Finished MainDisplay setup')
|
||||
|
||||
|
@ -390,7 +390,7 @@ class MainDisplay(Display):
|
|||
# replace the background
|
||||
background = self.image_manager.get_image_bytes(self.override['image'], ImageSource.ImagePlugin)
|
||||
self.set_transparency(self.service_item.themedata.background_type ==
|
||||
BackgroundType.to_string(BackgroundType.Transparent))
|
||||
BackgroundType.to_string(BackgroundType.Transparent))
|
||||
if self.service_item.themedata.background_filename:
|
||||
self.service_item.bg_image_bytes = self.image_manager.get_image_bytes(
|
||||
self.service_item.themedata.background_filename, ImageSource.Theme
|
||||
|
@ -400,7 +400,7 @@ class MainDisplay(Display):
|
|||
else:
|
||||
image_bytes = None
|
||||
html = build_html(self.service_item, self.screen, self.is_live, background, image_bytes,
|
||||
plugins=self.plugin_manager.plugins)
|
||||
plugins=self.plugin_manager.plugins)
|
||||
log.debug('buildHtml - pre setHtml')
|
||||
self.web_view.setHtml(html)
|
||||
log.debug('buildHtml - post setHtml')
|
||||
|
@ -535,7 +535,7 @@ class AudioPlayer(QtCore.QObject):
|
|||
"""
|
||||
log.debug('AudioPlayer Initialisation started')
|
||||
super(AudioPlayer, self).__init__(parent)
|
||||
self.currentIndex = -1
|
||||
self.current_index = -1
|
||||
self.playlist = []
|
||||
self.repeat = False
|
||||
self.media_object = Phonon.MediaObject()
|
||||
|
@ -558,9 +558,9 @@ class AudioPlayer(QtCore.QObject):
|
|||
Just before the audio player finishes the current track, queue the next
|
||||
item in the playlist, if there is one.
|
||||
"""
|
||||
self.currentIndex += 1
|
||||
if len(self.playlist) > self.currentIndex:
|
||||
self.media_object.enqueue(self.playlist[self.currentIndex])
|
||||
self.current_index += 1
|
||||
if len(self.playlist) > self.current_index:
|
||||
self.media_object.enqueue(self.playlist[self.current_index])
|
||||
|
||||
def on_finished(self):
|
||||
"""
|
||||
|
@ -570,7 +570,7 @@ class AudioPlayer(QtCore.QObject):
|
|||
log.debug('Repeat is enabled... here we go again!')
|
||||
self.media_object.clearQueue()
|
||||
self.media_object.clear()
|
||||
self.currentIndex = -1
|
||||
self.current_index = -1
|
||||
self.play()
|
||||
|
||||
def connectVolumeSlider(self, slider):
|
||||
|
@ -583,7 +583,7 @@ class AudioPlayer(QtCore.QObject):
|
|||
"""
|
||||
Reset the audio player, clearing the playlist and the queue.
|
||||
"""
|
||||
self.currentIndex = -1
|
||||
self.current_index = -1
|
||||
self.playlist = []
|
||||
self.stop()
|
||||
self.media_object.clear()
|
||||
|
@ -593,7 +593,7 @@ class AudioPlayer(QtCore.QObject):
|
|||
We want to play the file so start it
|
||||
"""
|
||||
log.debug('AudioPlayer.play() called')
|
||||
if self.currentIndex == -1:
|
||||
if self.current_index == -1:
|
||||
self.on_about_to_finish()
|
||||
self.media_object.play()
|
||||
|
||||
|
@ -611,43 +611,43 @@ class AudioPlayer(QtCore.QObject):
|
|||
log.debug('AudioPlayer.stop() called')
|
||||
self.media_object.stop()
|
||||
|
||||
def add_to_playlist(self, filenames):
|
||||
def add_to_playlist(self, file_names):
|
||||
"""
|
||||
Add another file to the playlist.
|
||||
|
||||
``filenames``
|
||||
``file_names``
|
||||
A list with files to be added to the playlist.
|
||||
"""
|
||||
if not isinstance(filenames, list):
|
||||
filenames = [filenames]
|
||||
self.playlist.extend(list(map(Phonon.MediaSource, filenames)))
|
||||
if not isinstance(file_names, list):
|
||||
file_names = [file_names]
|
||||
self.playlist.extend(list(map(Phonon.MediaSource, file_names)))
|
||||
|
||||
def next(self):
|
||||
"""
|
||||
Skip forward to the next track in the list
|
||||
"""
|
||||
if not self.repeat and self.currentIndex + 1 >= len(self.playlist):
|
||||
if not self.repeat and self.current_index + 1 >= len(self.playlist):
|
||||
return
|
||||
isPlaying = self.media_object.state() == Phonon.PlayingState
|
||||
self.currentIndex += 1
|
||||
if self.repeat and self.currentIndex == len(self.playlist):
|
||||
self.currentIndex = 0
|
||||
is_playing = self.media_object.state() == Phonon.PlayingState
|
||||
self.current_index += 1
|
||||
if self.repeat and self.current_index == len(self.playlist):
|
||||
self.current_index = 0
|
||||
self.media_object.clearQueue()
|
||||
self.media_object.clear()
|
||||
self.media_object.enqueue(self.playlist[self.currentIndex])
|
||||
if isPlaying:
|
||||
self.media_object.enqueue(self.playlist[self.current_index])
|
||||
if is_playing:
|
||||
self.media_object.play()
|
||||
|
||||
def go_to(self, index):
|
||||
"""
|
||||
Go to a particular track in the list
|
||||
"""
|
||||
isPlaying = self.media_object.state() == Phonon.PlayingState
|
||||
is_playing = self.media_object.state() == Phonon.PlayingState
|
||||
self.media_object.clearQueue()
|
||||
self.media_object.clear()
|
||||
self.currentIndex = index
|
||||
self.media_object.enqueue(self.playlist[self.currentIndex])
|
||||
if isPlaying:
|
||||
self.current_index = index
|
||||
self.media_object.enqueue(self.playlist[self.current_index])
|
||||
if is_playing:
|
||||
self.media_object.play()
|
||||
|
||||
def connectSlot(self, signal, slot):
|
||||
|
|
|
@ -45,38 +45,38 @@ class Ui_PluginViewDialog(object):
|
|||
"""
|
||||
pluginViewDialog.setObjectName('pluginViewDialog')
|
||||
pluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal)
|
||||
self.pluginLayout = QtGui.QVBoxLayout(pluginViewDialog)
|
||||
self.pluginLayout.setObjectName('pluginLayout')
|
||||
self.listLayout = QtGui.QHBoxLayout()
|
||||
self.listLayout.setObjectName('listLayout')
|
||||
self.pluginListWidget = QtGui.QListWidget(pluginViewDialog)
|
||||
self.pluginListWidget.setObjectName('pluginListWidget')
|
||||
self.listLayout.addWidget(self.pluginListWidget)
|
||||
self.pluginInfoGroupBox = QtGui.QGroupBox(pluginViewDialog)
|
||||
self.pluginInfoGroupBox.setObjectName('pluginInfoGroupBox')
|
||||
self.pluginInfoLayout = QtGui.QFormLayout(self.pluginInfoGroupBox)
|
||||
self.pluginInfoLayout.setObjectName('pluginInfoLayout')
|
||||
self.statusLabel = QtGui.QLabel(self.pluginInfoGroupBox)
|
||||
self.statusLabel.setObjectName('statusLabel')
|
||||
self.statusComboBox = QtGui.QComboBox(self.pluginInfoGroupBox)
|
||||
self.statusComboBox.addItems(('', ''))
|
||||
self.statusComboBox.setObjectName('statusComboBox')
|
||||
self.pluginInfoLayout.addRow(self.statusLabel, self.statusComboBox)
|
||||
self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox)
|
||||
self.versionLabel.setObjectName('versionLabel')
|
||||
self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox)
|
||||
self.versionNumberLabel.setObjectName('versionNumberLabel')
|
||||
self.pluginInfoLayout.addRow(self.versionLabel, self.versionNumberLabel)
|
||||
self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox)
|
||||
self.aboutLabel.setObjectName('aboutLabel')
|
||||
self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox)
|
||||
self.aboutTextBrowser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse)
|
||||
self.aboutTextBrowser.setObjectName('aboutTextBrowser')
|
||||
self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser)
|
||||
self.listLayout.addWidget(self.pluginInfoGroupBox)
|
||||
self.pluginLayout.addLayout(self.listLayout)
|
||||
self.plugin_layout = QtGui.QVBoxLayout(pluginViewDialog)
|
||||
self.plugin_layout.setObjectName('plugin_layout')
|
||||
self.list_layout = QtGui.QHBoxLayout()
|
||||
self.list_layout.setObjectName('list_layout')
|
||||
self.plugin_list_widget = QtGui.QListWidget(pluginViewDialog)
|
||||
self.plugin_list_widget.setObjectName('plugin_list_widget')
|
||||
self.list_layout.addWidget(self.plugin_list_widget)
|
||||
self.plugin_info_group_box = QtGui.QGroupBox(pluginViewDialog)
|
||||
self.plugin_info_group_box.setObjectName('plugin_info_group_box')
|
||||
self.plugin_info_layout = QtGui.QFormLayout(self.plugin_info_group_box)
|
||||
self.plugin_info_layout.setObjectName('plugin_info_layout')
|
||||
self.status_label = QtGui.QLabel(self.plugin_info_group_box)
|
||||
self.status_label.setObjectName('status_label')
|
||||
self.status_combo_box = QtGui.QComboBox(self.plugin_info_group_box)
|
||||
self.status_combo_box.addItems(('', ''))
|
||||
self.status_combo_box.setObjectName('status_combo_box')
|
||||
self.plugin_info_layout.addRow(self.status_label, self.status_combo_box)
|
||||
self.version_label = QtGui.QLabel(self.plugin_info_group_box)
|
||||
self.version_label.setObjectName('version_label')
|
||||
self.version_number_label = QtGui.QLabel(self.plugin_info_group_box)
|
||||
self.version_number_label.setObjectName('version_number_label')
|
||||
self.plugin_info_layout.addRow(self.version_label, self.version_number_label)
|
||||
self.about_label = QtGui.QLabel(self.plugin_info_group_box)
|
||||
self.about_label.setObjectName('about_label')
|
||||
self.about_text_browser = QtGui.QTextBrowser(self.plugin_info_group_box)
|
||||
self.about_text_browser.setTextInteractionFlags(QtCore.Qt.LinksAccessibleByMouse)
|
||||
self.about_text_browser.setObjectName('aboutTextBrowser')
|
||||
self.plugin_info_layout.addRow(self.about_label, self.about_text_browser)
|
||||
self.list_layout.addWidget(self.plugin_info_group_box)
|
||||
self.plugin_layout.addLayout(self.list_layout)
|
||||
self.button_box = create_button_box(pluginViewDialog, 'button_box', ['ok'])
|
||||
self.pluginLayout.addWidget(self.button_box)
|
||||
self.plugin_layout.addWidget(self.button_box)
|
||||
self.retranslateUi(pluginViewDialog)
|
||||
|
||||
def retranslateUi(self, pluginViewDialog):
|
||||
|
@ -84,9 +84,9 @@ class Ui_PluginViewDialog(object):
|
|||
Translate the UI on the fly
|
||||
"""
|
||||
pluginViewDialog.setWindowTitle(translate('OpenLP.PluginForm', 'Plugin List'))
|
||||
self.pluginInfoGroupBox.setTitle(translate('OpenLP.PluginForm', 'Plugin Details'))
|
||||
self.versionLabel.setText('%s:' % UiStrings().Version)
|
||||
self.aboutLabel.setText('%s:' % UiStrings().About)
|
||||
self.statusLabel.setText(translate('OpenLP.PluginForm', 'Status:'))
|
||||
self.statusComboBox.setItemText(0, translate('OpenLP.PluginForm', 'Active'))
|
||||
self.statusComboBox.setItemText(1, translate('OpenLP.PluginForm', 'Inactive'))
|
||||
self.plugin_info_group_box.setTitle(translate('OpenLP.PluginForm', 'Plugin Details'))
|
||||
self.version_label.setText('%s:' % UiStrings().Version)
|
||||
self.about_label.setText('%s:' % UiStrings().About)
|
||||
self.status_label.setText(translate('OpenLP.PluginForm', 'Status:'))
|
||||
self.status_combo_box.setItemText(0, translate('OpenLP.PluginForm', 'Active'))
|
||||
self.status_combo_box.setItemText(1, translate('OpenLP.PluginForm', 'Inactive'))
|
||||
|
|
|
@ -50,24 +50,24 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||
Constructor
|
||||
"""
|
||||
super(PluginForm, self).__init__(parent)
|
||||
self.activePlugin = None
|
||||
self.programaticChange = False
|
||||
self.active_plugin = None
|
||||
self.programatic_change = False
|
||||
self.setupUi(self)
|
||||
self.load()
|
||||
self._clearDetails()
|
||||
self._clear_details()
|
||||
# Right, now let's put some signals and slots together!
|
||||
self.pluginListWidget.itemSelectionChanged.connect(self.onPluginListWidgetSelectionChanged)
|
||||
self.statusComboBox.currentIndexChanged.connect(self.onStatusComboBoxChanged)
|
||||
self.pluginListWidget.itemSelectionChanged.connect(self.on_plugin_list_widget_selection_changed)
|
||||
self.statusComboBox.currentIndexChanged.connect(self.on_status_combo_box_changed)
|
||||
|
||||
def load(self):
|
||||
"""
|
||||
Load the plugin details into the screen
|
||||
"""
|
||||
self.pluginListWidget.clear()
|
||||
self.programaticChange = True
|
||||
self._clearDetails()
|
||||
self.programaticChange = True
|
||||
pluginListWidth = 0
|
||||
self.programatic_change = True
|
||||
self._clear_details()
|
||||
self.programatic_change = True
|
||||
plugin_list_width = 0
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
item = QtGui.QListWidgetItem(self.pluginListWidget)
|
||||
# We do this just to make 100% sure the status is an integer as
|
||||
|
@ -86,11 +86,11 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||
if plugin.icon:
|
||||
item.setIcon(plugin.icon)
|
||||
self.pluginListWidget.addItem(item)
|
||||
pluginListWidth = max(pluginListWidth, self.fontMetrics().width(
|
||||
plugin_list_width = max(plugin_list_width, self.fontMetrics().width(
|
||||
translate('OpenLP.PluginForm', '%s (Inactive)') % plugin.name_strings['singular']))
|
||||
self.pluginListWidget.setFixedWidth(pluginListWidth + self.pluginListWidget.iconSize().width() + 48)
|
||||
self.pluginListWidget.setFixedWidth(plugin_list_width + self.pluginListWidget.iconSize().width() + 48)
|
||||
|
||||
def _clearDetails(self):
|
||||
def _clear_details(self):
|
||||
"""
|
||||
Clear the plugin details widgets
|
||||
"""
|
||||
|
@ -99,62 +99,62 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog):
|
|||
self.aboutTextBrowser.setHtml('')
|
||||
self.statusComboBox.setEnabled(False)
|
||||
|
||||
def _setDetails(self):
|
||||
def _set_details(self):
|
||||
"""
|
||||
Set the details of the currently selected plugin
|
||||
"""
|
||||
log.debug('PluginStatus: %s', str(self.activePlugin.status))
|
||||
self.versionNumberLabel.setText(self.activePlugin.version)
|
||||
self.aboutTextBrowser.setHtml(self.activePlugin.about())
|
||||
self.programaticChange = True
|
||||
log.debug('PluginStatus: %s', str(self.active_plugin.status))
|
||||
self.versionNumberLabel.setText(self.active_plugin.version)
|
||||
self.aboutTextBrowser.setHtml(self.active_plugin.about())
|
||||
self.programatic_change = True
|
||||
status = PluginStatus.Active
|
||||
if self.activePlugin.status == PluginStatus.Active:
|
||||
if self.active_plugin.status == PluginStatus.Active:
|
||||
status = PluginStatus.Inactive
|
||||
self.statusComboBox.setCurrentIndex(status)
|
||||
self.statusComboBox.setEnabled(True)
|
||||
self.programaticChange = False
|
||||
self.programatic_change = False
|
||||
|
||||
def onPluginListWidgetSelectionChanged(self):
|
||||
def on_plugin_list_widget_selection_changed(self):
|
||||
"""
|
||||
If the selected plugin changes, update the form
|
||||
"""
|
||||
if self.pluginListWidget.currentItem() is None:
|
||||
self._clearDetails()
|
||||
self._clear_details()
|
||||
return
|
||||
plugin_name_singular = self.pluginListWidget.currentItem().text().split('(')[0][:-1]
|
||||
self.activePlugin = None
|
||||
self.active_plugin = None
|
||||
for plugin in self.plugin_manager.plugins:
|
||||
if plugin.status != PluginStatus.Disabled:
|
||||
if plugin.name_strings['singular'] == plugin_name_singular:
|
||||
self.activePlugin = plugin
|
||||
self.active_plugin = plugin
|
||||
break
|
||||
if self.activePlugin:
|
||||
self._setDetails()
|
||||
if self.active_plugin:
|
||||
self._set_details()
|
||||
else:
|
||||
self._clearDetails()
|
||||
self._clear_details()
|
||||
|
||||
def onStatusComboBoxChanged(self, status):
|
||||
def on_status_combo_box_changed(self, status):
|
||||
"""
|
||||
If the status of a plugin is altered, apply the change
|
||||
"""
|
||||
if self.programaticChange or status == PluginStatus.Disabled:
|
||||
if self.programatic_change or status == PluginStatus.Disabled:
|
||||
return
|
||||
if status == PluginStatus.Inactive:
|
||||
self.application.set_busy_cursor()
|
||||
self.activePlugin.toggle_status(PluginStatus.Active)
|
||||
self.active_plugin.toggle_status(PluginStatus.Active)
|
||||
self.application.set_normal_cursor()
|
||||
self.activePlugin.app_startup()
|
||||
self.active_plugin.app_startup()
|
||||
else:
|
||||
self.activePlugin.toggle_status(PluginStatus.Inactive)
|
||||
self.active_plugin.toggle_status(PluginStatus.Inactive)
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
|
||||
if self.activePlugin.status == PluginStatus.Active:
|
||||
if self.active_plugin.status == PluginStatus.Active:
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Active)')
|
||||
elif self.activePlugin.status == PluginStatus.Inactive:
|
||||
elif self.active_plugin.status == PluginStatus.Inactive:
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Inactive)')
|
||||
elif self.activePlugin.status == PluginStatus.Disabled:
|
||||
elif self.active_plugin.status == PluginStatus.Disabled:
|
||||
status_text = translate('OpenLP.PluginForm', '%s (Disabled)')
|
||||
self.pluginListWidget.currentItem().setText(
|
||||
status_text % self.activePlugin.name_strings['singular'])
|
||||
status_text % self.active_plugin.name_strings['singular'])
|
||||
|
||||
def _get_plugin_manager(self):
|
||||
"""
|
||||
|
|
|
@ -65,7 +65,7 @@ class Ui_PrintServiceDialog(object):
|
|||
self.toolbar.setIconSize(QtCore.QSize(22, 22))
|
||||
self.toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||
self.print_button = self.toolbar.addAction(build_icon(':/general/general_print.png'),
|
||||
translate('OpenLP.PrintServiceForm', 'Print'))
|
||||
translate('OpenLP.PrintServiceForm', 'Print'))
|
||||
self.options_button = QtGui.QToolButton(self.toolbar)
|
||||
self.options_button.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon)
|
||||
self.options_button.setIcon(build_icon(':/system/system_configure.png'))
|
||||
|
@ -73,9 +73,9 @@ class Ui_PrintServiceDialog(object):
|
|||
self.toolbar.addWidget(self.options_button)
|
||||
self.toolbar.addSeparator()
|
||||
self.plain_copy = self.toolbar.addAction(build_icon(':/system/system_edit_copy.png'),
|
||||
translate('OpenLP.PrintServiceForm', 'Copy'))
|
||||
translate('OpenLP.PrintServiceForm', 'Copy'))
|
||||
self.html_copy = self.toolbar.addAction(build_icon(':/system/system_edit_copy.png'),
|
||||
translate('OpenLP.PrintServiceForm', 'Copy as HTML'))
|
||||
translate('OpenLP.PrintServiceForm', 'Copy as HTML'))
|
||||
self.toolbar.addSeparator()
|
||||
self.zoom_in_button = QtGui.QToolButton(self.toolbar)
|
||||
self.zoom_in_button.setIcon(build_icon(':/general/general_zoom_in.png'))
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
"""
|
||||
The actual print service dialog
|
||||
"""
|
||||
import cgi
|
||||
import datetime
|
||||
import os
|
||||
|
||||
|
@ -175,7 +174,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
custom_css = DEFAULT_CSS
|
||||
self._add_element('style', custom_css, html_data.head, attribute=('type', 'text/css'))
|
||||
self._add_element('body', parent=html_data)
|
||||
self._add_element('h1', cgi.escape(self.title_line_edit.text()), html_data.body, classId='serviceTitle')
|
||||
self._add_element('h1', html.escape(self.title_line_edit.text()), html_data.body, classId='serviceTitle')
|
||||
for index, item in enumerate(self.service_manager.service_items):
|
||||
self._add_preview_item(html_data.body, item['service_item'], index)
|
||||
# Add the custom service notes:
|
||||
|
@ -183,7 +182,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
div = self._add_element('div', parent=html_data.body, classId='customNotes')
|
||||
self._add_element(
|
||||
'span', translate('OpenLP.ServiceManager', 'Custom Service Notes: '), div, classId='customNotesTitle')
|
||||
self._add_element('span', cgi.escape(self.footer_text_edit.toPlainText()), div, classId='customNotesText')
|
||||
self._add_element('span', html.escape(self.footer_text_edit.toPlainText()), div, classId='customNotesText')
|
||||
self.document.setHtml(html.tostring(html_data).decode())
|
||||
self.preview_widget.updatePreview()
|
||||
|
||||
|
@ -195,7 +194,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
# Add the title of the service item.
|
||||
item_title = self._add_element('h2', parent=div, classId='itemTitle')
|
||||
self._add_element('img', parent=item_title, attribute=('src', item.icon))
|
||||
self._add_element('span', ' ' + cgi.escape(item.get_display_title()), item_title)
|
||||
self._add_element('span', ' ' + html.escape(item.get_display_title()), item_title)
|
||||
if self.slide_text_check_box.isChecked():
|
||||
# Add the text of the service item.
|
||||
if item.is_text():
|
||||
|
@ -219,14 +218,14 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
foot_text = item.foot_text
|
||||
foot_text = foot_text.partition('<br>')[2]
|
||||
if foot_text:
|
||||
foot_text = cgi.escape(foot_text.replace('<br>', '\n'))
|
||||
foot_text = html.escape(foot_text.replace('<br>', '\n'))
|
||||
self._add_element('div', foot_text.replace('\n', '<br>'), parent=div, classId='itemFooter')
|
||||
# Add service items' notes.
|
||||
if self.notes_check_box.isChecked():
|
||||
if item.notes:
|
||||
p = self._add_element('div', classId='itemNotes', parent=div)
|
||||
self._add_element('span', translate('OpenLP.ServiceManager', 'Notes: '), p, classId='itemNotesTitle')
|
||||
self._add_element('span', cgi.escape(item.notes).replace('\n', '<br>'), p, classId='itemNotesText')
|
||||
self._add_element('span', html.escape(item.notes).replace('\n', '<br>'), p, classId='itemNotesText')
|
||||
# Add play length of media files.
|
||||
if item.is_media() and self.meta_data_check_box.isChecked():
|
||||
tme = item.media_length
|
||||
|
@ -320,7 +319,7 @@ class PrintServiceForm(QtGui.QDialog, Ui_PrintServiceDialog):
|
|||
clipboard_text = clipboard_text.replace('\u201c', '"')
|
||||
clipboard_text = clipboard_text.replace('\u201d', '"')
|
||||
clipboard_text = clipboard_text.replace('\u2026', '...')
|
||||
clipboard_text = clipboard_text.replace('\u2014', '-')
|
||||
clipboard_text = clipboard_text.replace('\u2013', '-')
|
||||
clipboard_text = clipboard_text.replace('\u2014', '-')
|
||||
# remove the icon from the text
|
||||
clipboard_text = clipboard_text.replace('\ufffc\xa0', '')
|
||||
|
|
|
@ -55,13 +55,13 @@ class Ui_ServiceItemEditDialog(object):
|
|||
self.button_layout = QtGui.QVBoxLayout()
|
||||
self.button_layout.setObjectName('button_layout')
|
||||
self.delete_button = create_button(serviceItemEditDialog, 'deleteButton', role='delete',
|
||||
click=serviceItemEditDialog.on_delete_button_clicked)
|
||||
click=serviceItemEditDialog.on_delete_button_clicked)
|
||||
self.button_layout.addWidget(self.delete_button)
|
||||
self.button_layout.addStretch()
|
||||
self.up_button = create_button(serviceItemEditDialog, 'up_button', role='up',
|
||||
click=serviceItemEditDialog.on_up_button_clicked)
|
||||
click=serviceItemEditDialog.on_up_button_clicked)
|
||||
self.down_button = create_button(serviceItemEditDialog, 'down_button', role='down',
|
||||
click=serviceItemEditDialog.on_down_button_clicked)
|
||||
click=serviceItemEditDialog.on_down_button_clicked)
|
||||
self.button_layout.addWidget(self.up_button)
|
||||
self.button_layout.addWidget(self.down_button)
|
||||
self.dialog_layout.addLayout(self.button_layout, 0, 1)
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
"""
|
||||
The service manager sets up, loads, saves and manages services.
|
||||
"""
|
||||
import cgi
|
||||
import html
|
||||
import logging
|
||||
import os
|
||||
import shutil
|
||||
|
@ -75,7 +75,7 @@ class ServiceManagerList(QtGui.QTreeWidget):
|
|||
self.serviceManager.on_move_selection_down()
|
||||
event.accept()
|
||||
elif event.key() == QtCore.Qt.Key_Delete:
|
||||
self.serviceManager.onDeleteFromService()
|
||||
self.serviceManager.on_delete_from_service()
|
||||
event.accept()
|
||||
event.ignore()
|
||||
else:
|
||||
|
@ -110,14 +110,15 @@ class ServiceManagerDialog(object):
|
|||
# Create the top toolbar
|
||||
self.toolbar = OpenLPToolbar(self)
|
||||
self.toolbar.add_toolbar_action('newService', text=UiStrings().NewService, icon=':/general/general_new.png',
|
||||
tooltip=UiStrings().CreateService, triggers=self.on_new_service_clicked)
|
||||
tooltip=UiStrings().CreateService, triggers=self.on_new_service_clicked)
|
||||
self.toolbar.add_toolbar_action('openService', text=UiStrings().OpenService,
|
||||
icon=':/general/general_open.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'),
|
||||
triggers=self.on_load_service_clicked)
|
||||
icon=':/general/general_open.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Load an existing service.'),
|
||||
triggers=self.on_load_service_clicked)
|
||||
self.toolbar.add_toolbar_action('saveService', text=UiStrings().SaveService,
|
||||
icon=':/general/general_save.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'), triggers=self.decide_save_method)
|
||||
icon=':/general/general_save.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Save this service.'),
|
||||
triggers=self.decide_save_method)
|
||||
self.toolbar.addSeparator()
|
||||
self.theme_label = QtGui.QLabel('%s:' % UiStrings().Theme, self)
|
||||
self.theme_label.setMargin(3)
|
||||
|
@ -153,22 +154,22 @@ class ServiceManagerDialog(object):
|
|||
self.order_toolbar = OpenLPToolbar(self)
|
||||
action_list = ActionList.get_instance()
|
||||
action_list.add_category(UiStrings().Service, CategoryOrder.standard_toolbar)
|
||||
self.service_manager_list.moveTop = self.order_toolbar.add_toolbar_action('moveTop',
|
||||
self.service_manager_list.move_top = self.order_toolbar.add_toolbar_action('move_top',
|
||||
text=translate('OpenLP.ServiceManager', 'Move to &top'), icon=':/services/service_top.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Move item to the top of the service.'),
|
||||
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceTop)
|
||||
self.service_manager_list.moveUp = self.order_toolbar.add_toolbar_action('moveUp',
|
||||
can_shortcuts=True, category=UiStrings().Service, triggers=self.on_service_top)
|
||||
self.service_manager_list.move_up = self.order_toolbar.add_toolbar_action('move_up',
|
||||
text=translate('OpenLP.ServiceManager', 'Move &up'), icon=':/services/service_up.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Move item up one position in the service.'),
|
||||
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceUp)
|
||||
self.service_manager_list.moveDown = self.order_toolbar.add_toolbar_action('moveDown',
|
||||
can_shortcuts=True, category=UiStrings().Service, triggers=self.on_service_up)
|
||||
self.service_manager_list.move_down = self.order_toolbar.add_toolbar_action('move_down',
|
||||
text=translate('OpenLP.ServiceManager', 'Move &down'), icon=':/services/service_down.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Move item down one position in the service.'),
|
||||
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceDown)
|
||||
self.service_manager_list.moveBottom = self.order_toolbar.add_toolbar_action('moveBottom',
|
||||
can_shortcuts=True, category=UiStrings().Service, triggers=self.on_service_down)
|
||||
self.service_manager_list.move_bottom = self.order_toolbar.add_toolbar_action('move_bottom',
|
||||
text=translate('OpenLP.ServiceManager', 'Move to &bottom'), icon=':/services/service_bottom.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Move item to the end of the service.'),
|
||||
can_shortcuts=True, category=UiStrings().Service, triggers=self.onServiceEnd)
|
||||
can_shortcuts=True, category=UiStrings().Service, triggers=self.on_service_end)
|
||||
self.service_manager_list.down = self.order_toolbar.add_toolbar_action('down',
|
||||
text=translate('OpenLP.ServiceManager', 'Move &down'), can_shortcuts=True,
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Moves the selection down the window.'), visible=False,
|
||||
|
@ -183,16 +184,16 @@ class ServiceManagerDialog(object):
|
|||
self.service_manager_list.delete = self.order_toolbar.add_toolbar_action('delete', can_shortcuts=True,
|
||||
text=translate('OpenLP.ServiceManager', '&Delete From Service'), icon=':/general/general_delete.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Delete the selected item from the service.'),
|
||||
triggers=self.onDeleteFromService)
|
||||
triggers=self.on_delete_from_service)
|
||||
self.order_toolbar.addSeparator()
|
||||
self.service_manager_list.expand = self.order_toolbar.add_toolbar_action('expand', can_shortcuts=True,
|
||||
text=translate('OpenLP.ServiceManager', '&Expand all'), icon=':/services/service_expand_all.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Expand all the service items.'),
|
||||
category=UiStrings().Service, triggers=self.onExpandAll)
|
||||
category=UiStrings().Service, triggers=self.on_expand_all)
|
||||
self.service_manager_list.collapse = self.order_toolbar.add_toolbar_action('collapse', can_shortcuts=True,
|
||||
text=translate('OpenLP.ServiceManager', '&Collapse all'), icon=':/services/service_collapse_all.png',
|
||||
tooltip=translate('OpenLP.ServiceManager', 'Collapse all the service items.'),
|
||||
category=UiStrings().Service, triggers=self.onCollapseAll)
|
||||
category=UiStrings().Service, triggers=self.on_collapse_all)
|
||||
self.order_toolbar.addSeparator()
|
||||
self.service_manager_list.make_live = self.order_toolbar.add_toolbar_action('make_live', can_shortcuts=True,
|
||||
text=translate('OpenLP.ServiceManager', 'Go Live'), icon=':/general/general_live.png',
|
||||
|
@ -258,11 +259,11 @@ class ServiceManagerDialog(object):
|
|||
self.theme_menu = QtGui.QMenu(translate('OpenLP.ServiceManager', '&Change Item Theme'))
|
||||
self.menu.addMenu(self.theme_menu)
|
||||
self.service_manager_list.addActions(
|
||||
[self.service_manager_list.moveDown,
|
||||
self.service_manager_list.moveUp,
|
||||
[self.service_manager_list.move_down,
|
||||
self.service_manager_list.move_up,
|
||||
self.service_manager_list.make_live,
|
||||
self.service_manager_list.moveTop,
|
||||
self.service_manager_list.moveBottom,
|
||||
self.service_manager_list.move_top,
|
||||
self.service_manager_list.move_bottom,
|
||||
self.service_manager_list.up,
|
||||
self.service_manager_list.down,
|
||||
self.service_manager_list.expand,
|
||||
|
@ -408,18 +409,19 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
else:
|
||||
file_name = load_file
|
||||
Settings().setValue(self.main_window.service_manager_settings_section + '/last directory',
|
||||
split_filename(file_name)[0])
|
||||
split_filename(file_name)[0])
|
||||
self.load_file(file_name)
|
||||
|
||||
def save_modified_service(self):
|
||||
"""
|
||||
Check to see if a service needs to be saved.
|
||||
"""
|
||||
return QtGui.QMessageBox.question(self.main_window,
|
||||
translate('OpenLP.ServiceManager', 'Modified Service'),
|
||||
translate('OpenLP.ServiceManager',
|
||||
'The current service has been modified. Would you like to save this service?'),
|
||||
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard | QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
|
||||
return QtGui.QMessageBox.question(self.main_window, translate('OpenLP.ServiceManager', 'Modified Service'),
|
||||
translate('OpenLP.ServiceManager',
|
||||
'The current service has been modified. Would you like to save this '
|
||||
'service?'),
|
||||
QtGui.QMessageBox.Save | QtGui.QMessageBox.Discard |
|
||||
QtGui.QMessageBox.Cancel, QtGui.QMessageBox.Save)
|
||||
|
||||
def on_recent_service_clicked(self):
|
||||
"""
|
||||
|
@ -484,10 +486,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.application.set_normal_cursor()
|
||||
title = translate('OpenLP.ServiceManager', 'Service File(s) Missing')
|
||||
message = translate('OpenLP.ServiceManager',
|
||||
'The following file(s) in the service are missing:\n\t%s\n\n'
|
||||
'These files will be removed if you continue to save.') % "\n\t".join(missing_list)
|
||||
'The following file(s) in the service are missing:\n\t%s\n\n'
|
||||
'These files will be removed if you continue to save.') % "\n\t".join(missing_list)
|
||||
answer = QtGui.QMessageBox.critical(self, title, message,
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Ok |
|
||||
QtGui.QMessageBox.Cancel))
|
||||
if answer == QtGui.QMessageBox.Cancel:
|
||||
self.main_window.finished_progress_bar()
|
||||
return False
|
||||
|
@ -539,7 +542,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
except IOError:
|
||||
log.exception('Failed to save service to disk: %s', temp_file_name)
|
||||
self.main_window.error_message(translate('OpenLP.ServiceManager', 'Error Saving File'),
|
||||
translate('OpenLP.ServiceManager', 'There was an error saving your file.')
|
||||
translate('OpenLP.ServiceManager', 'There was an error saving your file.')
|
||||
)
|
||||
success = False
|
||||
finally:
|
||||
|
@ -596,7 +599,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
except IOError:
|
||||
log.exception('Failed to save service to disk: %s', temp_file_name)
|
||||
self.main_window.error_message(translate('OpenLP.ServiceManager', 'Error Saving File'),
|
||||
translate('OpenLP.ServiceManager', 'There was an error saving your file.')
|
||||
translate('OpenLP.ServiceManager', 'There was an error saving your file.')
|
||||
)
|
||||
success = False
|
||||
finally:
|
||||
|
@ -642,11 +645,13 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
# the long term.
|
||||
if self._file_name.endswith('oszl') or self.service_has_all_original_files:
|
||||
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
|
||||
translate('OpenLP.ServiceManager',
|
||||
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite (*.oszl)'))
|
||||
translate('OpenLP.ServiceManager',
|
||||
'OpenLP Service Files (*.osz);; OpenLP Service Files - lite '
|
||||
'(*.oszl)'))
|
||||
else:
|
||||
file_name = QtGui.QFileDialog.getSaveFileName(self.main_window, UiStrings().SaveService, path,
|
||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*.osz);;'))
|
||||
translate('OpenLP.ServiceManager', 'OpenLP Service Files (*'
|
||||
'.osz);;'))
|
||||
if not file_name:
|
||||
return False
|
||||
if os.path.splitext(file_name)[1] == '':
|
||||
|
@ -688,7 +693,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
except UnicodeDecodeError:
|
||||
log.exception('file_name "%s" is not valid UTF-8' % zip_info.file_name)
|
||||
critical_error_message_box(message=translate('OpenLP.ServiceManager',
|
||||
'File is not a valid service.\n The content encoding is not UTF-8.'))
|
||||
'File is not a valid service.\n The content encoding is not UTF-8.'))
|
||||
continue
|
||||
osfile = ucs_file.replace('/', os.path.sep)
|
||||
if not osfile.startswith('audio'):
|
||||
|
@ -704,8 +709,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
items = json.load(file_to)
|
||||
else:
|
||||
critical_error_message_box(message=translate('OpenLP.ServiceManager',
|
||||
'The service file you are trying to open is in an old format.\n '
|
||||
'Please save it using OpenLP 2.0.2 or greater.'))
|
||||
'The service file you are trying to open is in an old format.\n '
|
||||
'Please save it using OpenLP 2.0.2 or greater.'))
|
||||
return
|
||||
file_to.close()
|
||||
self.new_file()
|
||||
|
@ -734,18 +739,19 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
except (IOError, NameError, zipfile.BadZipfile):
|
||||
log.exception('Problem loading service file %s' % file_name)
|
||||
critical_error_message_box(message=translate('OpenLP.ServiceManager',
|
||||
'File could not be opened because it is corrupt.'))
|
||||
'File could not be opened because it is corrupt.'))
|
||||
except zipfile.BadZipfile:
|
||||
if os.path.getsize(file_name) == 0:
|
||||
log.exception('Service file is zero sized: %s' % file_name)
|
||||
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Empty File'),
|
||||
translate('OpenLP.ServiceManager', 'This service file does not contain any data.'))
|
||||
translate('OpenLP.ServiceManager', 'This service file does not contain '
|
||||
'any data.'))
|
||||
else:
|
||||
log.exception('Service file is cannot be extracted as zip: '
|
||||
'%s' % file_name)
|
||||
log.exception('Service file is cannot be extracted as zip: %s' % file_name)
|
||||
QtGui.QMessageBox.information(self, translate('OpenLP.ServiceManager', 'Corrupt File'),
|
||||
translate('OpenLP.ServiceManager',
|
||||
'This file is either corrupt or it is not an OpenLP 2 service file.'))
|
||||
translate('OpenLP.ServiceManager',
|
||||
'This file is either corrupt or it is not an OpenLP 2 service '
|
||||
'file.'))
|
||||
self.application.set_normal_cursor()
|
||||
return
|
||||
finally:
|
||||
|
@ -757,7 +763,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.application.set_normal_cursor()
|
||||
self.repaint_service_list(-1, -1)
|
||||
|
||||
def load_Last_file(self):
|
||||
def load_last_file(self):
|
||||
"""
|
||||
Load the last service item from the service manager when the service was last closed. Can be blank if there was
|
||||
no service present.
|
||||
|
@ -892,9 +898,11 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
timed_slide_interval = Settings().value(self.main_window.general_settings_section + '/loop delay')
|
||||
else:
|
||||
timed_slide_interval = service_item.timed_slide_interval
|
||||
timed_slide_interval, ok = QtGui.QInputDialog.getInteger(self, translate('OpenLP.ServiceManager',
|
||||
'Input delay'), translate('OpenLP.ServiceManager', 'Delay between slides in seconds.'),
|
||||
timed_slide_interval, 0, 180, 1)
|
||||
timed_slide_interval, ok = QtGui.QInputDialog.getInteger(self, translate('OpenLP.ServiceManager',
|
||||
'Input delay'),
|
||||
translate('OpenLP.ServiceManager',
|
||||
'Delay between slides in seconds.'),
|
||||
timed_slide_interval, 0, 180, 1)
|
||||
if ok:
|
||||
service_item.timed_slide_interval = timed_slide_interval
|
||||
if service_item.timed_slide_interval != 0 and not service_item.auto_play_slides_loop \
|
||||
|
@ -921,7 +929,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.service_item_edit_form.set_service_item(self.service_items[item]['service_item'])
|
||||
if self.service_item_edit_form.exec_():
|
||||
self.add_service_item(self.service_item_edit_form.get_service_item(),
|
||||
replace=True, expand=self.service_items[item]['expanded'])
|
||||
replace=True, expand=self.service_items[item]['expanded'])
|
||||
|
||||
def preview_live(self, unique_identifier, row):
|
||||
"""
|
||||
|
@ -948,16 +956,16 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
if not self.service_manager_list.selectedItems():
|
||||
return
|
||||
selected = self.service_manager_list.selectedItems()[0]
|
||||
lookFor = 0
|
||||
serviceIterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
|
||||
while serviceIterator.value():
|
||||
if lookFor == 1 and serviceIterator.value().parent() is None:
|
||||
self.service_manager_list.setCurrentItem(serviceIterator.value())
|
||||
look_for = 0
|
||||
service_iterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
|
||||
while service_iterator.value():
|
||||
if look_for == 1 and service_iterator.value().parent() is None:
|
||||
self.service_manager_list.setCurrentItem(service_iterator.value())
|
||||
self.make_live()
|
||||
return
|
||||
if serviceIterator.value() == selected:
|
||||
lookFor = 1
|
||||
serviceIterator += 1
|
||||
if service_iterator.value() == selected:
|
||||
look_for = 1
|
||||
service_iterator += 1
|
||||
|
||||
def previous_item(self, last_slide=False):
|
||||
"""
|
||||
|
@ -970,28 +978,28 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
if not self.service_manager_list.selectedItems():
|
||||
return
|
||||
selected = self.service_manager_list.selectedItems()[0]
|
||||
prevItem = None
|
||||
prevItemLastSlide = None
|
||||
serviceIterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
|
||||
while serviceIterator.value():
|
||||
if serviceIterator.value() == selected:
|
||||
if last_slide and prevItemLastSlide:
|
||||
pos = prevItem.data(0, QtCore.Qt.UserRole)
|
||||
prev_item = None
|
||||
prev_item_last_slide = None
|
||||
service_iterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
|
||||
while service_iterator.value():
|
||||
if service_iterator.value() == selected:
|
||||
if last_slide and prev_item_last_slide:
|
||||
pos = prev_item.data(0, QtCore.Qt.UserRole)
|
||||
check_expanded = self.service_items[pos - 1]['expanded']
|
||||
self.service_manager_list.setCurrentItem(prevItemLastSlide)
|
||||
self.service_manager_list.setCurrentItem(prev_item_last_slide)
|
||||
if not check_expanded:
|
||||
self.service_manager_list.collapseItem(prevItem)
|
||||
self.service_manager_list.collapseItem(prev_item)
|
||||
self.make_live()
|
||||
self.service_manager_list.setCurrentItem(prevItem)
|
||||
elif prevItem:
|
||||
self.service_manager_list.setCurrentItem(prevItem)
|
||||
self.service_manager_list.setCurrentItem(prev_item)
|
||||
elif prev_item:
|
||||
self.service_manager_list.setCurrentItem(prev_item)
|
||||
self.make_live()
|
||||
return
|
||||
if serviceIterator.value().parent() is None:
|
||||
prevItem = serviceIterator.value()
|
||||
if serviceIterator.value().parent() is prevItem:
|
||||
prevItemLastSlide = serviceIterator.value()
|
||||
serviceIterator += 1
|
||||
if service_iterator.value().parent() is None:
|
||||
prev_item = service_iterator.value()
|
||||
if service_iterator.value().parent() is prev_item:
|
||||
prev_item_last_slide = service_iterator.value()
|
||||
service_iterator += 1
|
||||
|
||||
def on_set_item(self, message):
|
||||
"""
|
||||
|
@ -1013,22 +1021,22 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
Moves the cursor selection up the window. Called by the up arrow.
|
||||
"""
|
||||
item = self.service_manager_list.currentItem()
|
||||
itemBefore = self.service_manager_list.itemAbove(item)
|
||||
if itemBefore is None:
|
||||
item_before = self.service_manager_list.itemAbove(item)
|
||||
if item_before is None:
|
||||
return
|
||||
self.service_manager_list.setCurrentItem(itemBefore)
|
||||
self.service_manager_list.setCurrentItem(item_before)
|
||||
|
||||
def on_move_selection_down(self):
|
||||
"""
|
||||
Moves the cursor selection down the window. Called by the down arrow.
|
||||
"""
|
||||
item = self.service_manager_list.currentItem()
|
||||
itemAfter = self.service_manager_list.itemBelow(item)
|
||||
if itemAfter is None:
|
||||
item_after = self.service_manager_list.itemBelow(item)
|
||||
if item_after is None:
|
||||
return
|
||||
self.service_manager_list.setCurrentItem(itemAfter)
|
||||
self.service_manager_list.setCurrentItem(item_after)
|
||||
|
||||
def onCollapseAll(self):
|
||||
def on_collapse_all(self):
|
||||
"""
|
||||
Collapse all the service items.
|
||||
"""
|
||||
|
@ -1043,7 +1051,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
pos = item.data(0, QtCore.Qt.UserRole)
|
||||
self.service_items[pos - 1]['expanded'] = False
|
||||
|
||||
def onExpandAll(self):
|
||||
def on_expand_all(self):
|
||||
"""
|
||||
Collapse all the service items.
|
||||
"""
|
||||
|
@ -1058,7 +1066,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
pos = item.data(0, QtCore.Qt.UserRole)
|
||||
self.service_items[pos - 1]['expanded'] = True
|
||||
|
||||
def onServiceTop(self):
|
||||
def on_service_top(self):
|
||||
"""
|
||||
Move the current ServiceItem to the top of the list.
|
||||
"""
|
||||
|
@ -1070,7 +1078,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.repaint_service_list(0, child)
|
||||
self.set_modified()
|
||||
|
||||
def onServiceUp(self):
|
||||
def on_service_up(self):
|
||||
"""
|
||||
Move the current ServiceItem one position up in the list.
|
||||
"""
|
||||
|
@ -1082,7 +1090,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.repaint_service_list(item - 1, child)
|
||||
self.set_modified()
|
||||
|
||||
def onServiceDown(self):
|
||||
def on_service_down(self):
|
||||
"""
|
||||
Move the current ServiceItem one position down in the list.
|
||||
"""
|
||||
|
@ -1094,7 +1102,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.repaint_service_list(item + 1, child)
|
||||
self.set_modified()
|
||||
|
||||
def onServiceEnd(self):
|
||||
def on_service_end(self):
|
||||
"""
|
||||
Move the current ServiceItem to the bottom of the list.
|
||||
"""
|
||||
|
@ -1106,7 +1114,7 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.repaint_service_list(len(self.service_items) - 1, child)
|
||||
self.set_modified()
|
||||
|
||||
def onDeleteFromService(self):
|
||||
def on_delete_from_service(self):
|
||||
"""
|
||||
Remove the current ServiceItem from the list.
|
||||
"""
|
||||
|
@ -1139,51 +1147,51 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.service_manager_list.clear()
|
||||
self.service_manager_list.clearSelection()
|
||||
for item_count, item in enumerate(self.service_items):
|
||||
serviceitem = item['service_item']
|
||||
treewidgetitem = QtGui.QTreeWidgetItem(self.service_manager_list)
|
||||
if serviceitem.is_valid:
|
||||
if serviceitem.notes:
|
||||
icon = QtGui.QImage(serviceitem.icon)
|
||||
service_item = item['service_item']
|
||||
treewidget_item = QtGui.QTreeWidgetItem(self.service_manager_list)
|
||||
if service_item.is_valid:
|
||||
if service_item.notes:
|
||||
icon = QtGui.QImage(service_item.icon)
|
||||
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
overlay = QtGui.QImage(':/services/service_item_notes.png')
|
||||
overlay = overlay.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
painter = QtGui.QPainter(icon)
|
||||
painter.drawImage(0, 0, overlay)
|
||||
painter.end()
|
||||
treewidgetitem.setIcon(0, build_icon(icon))
|
||||
elif serviceitem.temporary_edit:
|
||||
icon = QtGui.QImage(serviceitem.icon)
|
||||
treewidget_item.setIcon(0, build_icon(icon))
|
||||
elif service_item.temporary_edit:
|
||||
icon = QtGui.QImage(service_item.icon)
|
||||
icon = icon.scaled(80, 80, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
overlay = QtGui.QImage(':/general/general_export.png')
|
||||
overlay = overlay.scaled(40, 40, QtCore.Qt.KeepAspectRatio, QtCore.Qt.SmoothTransformation)
|
||||
painter = QtGui.QPainter(icon)
|
||||
painter.drawImage(40, 0, overlay)
|
||||
painter.end()
|
||||
treewidgetitem.setIcon(0, build_icon(icon))
|
||||
treewidget_item.setIcon(0, build_icon(icon))
|
||||
else:
|
||||
treewidgetitem.setIcon(0, serviceitem.iconic_representation)
|
||||
treewidget_item.setIcon(0, service_item.iconic_representation)
|
||||
else:
|
||||
treewidgetitem.setIcon(0, build_icon(':/general/general_delete.png'))
|
||||
treewidgetitem.setText(0, serviceitem.get_display_title())
|
||||
treewidget_item.setIcon(0, build_icon(':/general/general_delete.png'))
|
||||
treewidget_item.setText(0, service_item.get_display_title())
|
||||
tips = []
|
||||
if serviceitem.temporary_edit:
|
||||
if service_item.temporary_edit:
|
||||
tips.append('<strong>%s:</strong> <em>%s</em>' %
|
||||
(translate('OpenLP.ServiceManager', 'Edit'),
|
||||
(translate('OpenLP.ServiceManager', 'Service copy only'))))
|
||||
if serviceitem.theme and serviceitem.theme != -1:
|
||||
if service_item.theme and service_item.theme != -1:
|
||||
tips.append('<strong>%s:</strong> <em>%s</em>' %
|
||||
(translate('OpenLP.ServiceManager', 'Slide theme'), serviceitem.theme))
|
||||
if serviceitem.notes:
|
||||
(translate('OpenLP.ServiceManager', 'Slide theme'), service_item.theme))
|
||||
if service_item.notes:
|
||||
tips.append('<strong>%s: </strong> %s' %
|
||||
(translate('OpenLP.ServiceManager', 'Notes'), cgi.escape(serviceitem.notes)))
|
||||
(translate('OpenLP.ServiceManager', 'Notes'), html.escape(service_item.notes)))
|
||||
if item['service_item'].is_capable(ItemCapabilities.HasVariableStartTime):
|
||||
tips.append(item['service_item'].get_media_time())
|
||||
treewidgetitem.setToolTip(0, '<br>'.join(tips))
|
||||
treewidgetitem.setData(0, QtCore.Qt.UserRole, item['order'])
|
||||
treewidgetitem.setSelected(item['selected'])
|
||||
treewidget_item.setToolTip(0, '<br>'.join(tips))
|
||||
treewidget_item.setData(0, QtCore.Qt.UserRole, item['order'])
|
||||
treewidget_item.setSelected(item['selected'])
|
||||
# Add the children to their parent treewidgetitem.
|
||||
for count, frame in enumerate(serviceitem.get_frames()):
|
||||
child = QtGui.QTreeWidgetItem(treewidgetitem)
|
||||
for count, frame in enumerate(service_item.get_frames()):
|
||||
child = QtGui.QTreeWidgetItem(treewidget_item)
|
||||
text = frame['title'].replace('\n', ' ')
|
||||
child.setText(0, text[:40])
|
||||
child.setData(0, QtCore.Qt.UserRole, count)
|
||||
|
@ -1191,8 +1199,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
if item['expanded'] and service_item_child == count:
|
||||
self.service_manager_list.setCurrentItem(child)
|
||||
elif service_item_child == -1:
|
||||
self.service_manager_list.setCurrentItem(treewidgetitem)
|
||||
treewidgetitem.setExpanded(item['expanded'])
|
||||
self.service_manager_list.setCurrentItem(treewidget_item)
|
||||
treewidget_item.setExpanded(item['expanded'])
|
||||
|
||||
def clean_up(self):
|
||||
"""
|
||||
|
@ -1235,25 +1243,25 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
if self.service_items:
|
||||
for item in self.service_items:
|
||||
item['selected'] = False
|
||||
serviceIterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
|
||||
selectedItem = None
|
||||
while serviceIterator.value():
|
||||
if serviceIterator.value().isSelected():
|
||||
selectedItem = serviceIterator.value()
|
||||
serviceIterator += 1
|
||||
if selectedItem is not None:
|
||||
if selectedItem.parent() is None:
|
||||
pos = selectedItem.data(0, QtCore.Qt.UserRole)
|
||||
service_iterator = QtGui.QTreeWidgetItemIterator(self.service_manager_list)
|
||||
selected_item = None
|
||||
while service_iterator.value():
|
||||
if service_iterator.value().isSelected():
|
||||
selected_item = service_iterator.value()
|
||||
service_iterator += 1
|
||||
if selected_item is not None:
|
||||
if selected_item.parent() is None:
|
||||
pos = selected_item.data(0, QtCore.Qt.UserRole)
|
||||
else:
|
||||
pos = selectedItem.parent().data(0, QtCore.Qt.UserRole)
|
||||
pos = selected_item.parent().data(0, QtCore.Qt.UserRole)
|
||||
self.service_items[pos - 1]['selected'] = True
|
||||
tempServiceItems = self.service_items
|
||||
temp_service_items = self.service_items
|
||||
self.service_manager_list.clear()
|
||||
self.service_items = []
|
||||
self.isNew = True
|
||||
for item in tempServiceItems:
|
||||
self.is_new = True
|
||||
for item in temp_service_items:
|
||||
self.add_service_item(item['service_item'], False, expand=item['expanded'], repaint=False,
|
||||
selected=item['selected'])
|
||||
selected=item['selected'])
|
||||
# Set to False as items may have changed rendering does not impact the saved song so True may also be valid
|
||||
if changed:
|
||||
self.set_modified()
|
||||
|
@ -1330,8 +1338,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.preview_controller.add_service_manager_item(self.service_items[item]['service_item'], child)
|
||||
else:
|
||||
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
||||
translate('OpenLP.ServiceManager',
|
||||
'Your item cannot be displayed as there is no handler to display it'))
|
||||
translate('OpenLP.ServiceManager', 'Your item cannot be displayed as there is '
|
||||
'no handler to display it'))
|
||||
self.application.set_normal_cursor()
|
||||
|
||||
def get_service_item(self):
|
||||
|
@ -1376,8 +1384,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
self.live_controller.preview_widget.setFocus()
|
||||
else:
|
||||
critical_error_message_box(translate('OpenLP.ServiceManager', 'Missing Display Handler'),
|
||||
translate('OpenLP.ServiceManager',
|
||||
'Your item cannot be displayed as the plugin required to display it is missing or inactive'))
|
||||
translate('OpenLP.ServiceManager',
|
||||
'Your item cannot be displayed as the plugin required to display it '
|
||||
'is missing or inactive'))
|
||||
self.application.set_normal_cursor()
|
||||
|
||||
def remote_edit(self):
|
||||
|
@ -1446,18 +1455,18 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
item = self.service_manager_list.itemAt(event.pos())
|
||||
# ServiceManager started the drag and drop
|
||||
if plugin == 'ServiceManager':
|
||||
startpos, child = self.find_service_item()
|
||||
start_pos, child = self.find_service_item()
|
||||
# If no items selected
|
||||
if startpos == -1:
|
||||
if start_pos == -1:
|
||||
return
|
||||
if item is None:
|
||||
endpos = len(self.service_items)
|
||||
end_pos = len(self.service_items)
|
||||
else:
|
||||
endpos = self._get_parent_item_data(item) - 1
|
||||
serviceItem = self.service_items[startpos]
|
||||
self.service_items.remove(serviceItem)
|
||||
self.service_items.insert(endpos, serviceItem)
|
||||
self.repaint_service_list(endpos, child)
|
||||
end_pos = self._get_parent_item_data(item) - 1
|
||||
service_item = self.service_items[start_pos]
|
||||
self.service_items.remove(service_item)
|
||||
self.service_items.insert(end_pos, service_item)
|
||||
self.repaint_service_list(end_pos, child)
|
||||
self.set_modified()
|
||||
else:
|
||||
# we are not over anything so drop
|
||||
|
@ -1467,9 +1476,9 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
else:
|
||||
# we are over something so lets investigate
|
||||
pos = self._get_parent_item_data(item) - 1
|
||||
serviceItem = self.service_items[pos]
|
||||
if (plugin == serviceItem['service_item'].name and
|
||||
serviceItem['service_item'].is_capable(ItemCapabilities.CanAppend)):
|
||||
service_item = self.service_items[pos]
|
||||
if (plugin == service_item['service_item'].name and
|
||||
service_item['service_item'].is_capable(ItemCapabilities.CanAppend)):
|
||||
action = self.dndMenu.exec_(QtGui.QCursor.pos())
|
||||
# New action required
|
||||
if action == self.newAction:
|
||||
|
@ -1498,15 +1507,15 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
theme_group.setObjectName('theme_group')
|
||||
# Create a "Default" theme, which allows the user to reset the item's theme to the service theme or global
|
||||
# theme.
|
||||
defaultTheme = create_widget_action(self.theme_menu, text=UiStrings().Default, checked=False,
|
||||
triggers=self.on_theme_change_action)
|
||||
self.theme_menu.setDefaultAction(defaultTheme)
|
||||
theme_group.addAction(defaultTheme)
|
||||
default_theme = create_widget_action(self.theme_menu, text=UiStrings().Default, checked=False,
|
||||
triggers=self.on_theme_change_action)
|
||||
self.theme_menu.setDefaultAction(default_theme)
|
||||
theme_group.addAction(default_theme)
|
||||
self.theme_menu.addSeparator()
|
||||
for theme in theme_list:
|
||||
self.theme_combo_box.addItem(theme)
|
||||
theme_group.addAction(create_widget_action(self.theme_menu, theme, text=theme, checked=False,
|
||||
triggers=self.on_theme_change_action))
|
||||
triggers=self.on_theme_change_action))
|
||||
find_and_set_in_combo_box(self.theme_combo_box, self.service_theme)
|
||||
self.renderer.set_service_theme(self.service_theme)
|
||||
self.regenerate_service_Items()
|
||||
|
@ -1537,8 +1546,8 @@ class ServiceManager(QtGui.QWidget, ServiceManagerDialog):
|
|||
"""
|
||||
Print a Service Order Sheet.
|
||||
"""
|
||||
settingDialog = PrintServiceForm()
|
||||
settingDialog.exec_()
|
||||
setting_dialog = PrintServiceForm()
|
||||
setting_dialog.exec_()
|
||||
|
||||
def _get_renderer(self):
|
||||
"""
|
||||
|
|
|
@ -136,11 +136,11 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||
if plugin.settings_tab:
|
||||
plugin.settings_tab.post_set_up()
|
||||
|
||||
def tab_changed(self, tabIndex):
|
||||
def tab_changed(self, tab_index):
|
||||
"""
|
||||
A different settings tab is selected
|
||||
"""
|
||||
self.stacked_layout.setCurrentIndex(tabIndex)
|
||||
self.stacked_layout.setCurrentIndex(tab_index)
|
||||
self.stacked_layout.currentWidget().tab_visible()
|
||||
|
||||
def register_post_process(self, function):
|
||||
|
|
|
@ -67,62 +67,62 @@ class Ui_ShortcutListDialog(object):
|
|||
"""
|
||||
shortcutListDialog.setObjectName('shortcutListDialog')
|
||||
shortcutListDialog.resize(500, 438)
|
||||
self.shortcutListLayout = QtGui.QVBoxLayout(shortcutListDialog)
|
||||
self.shortcutListLayout.setObjectName('shortcutListLayout')
|
||||
self.shortcut_list_layout = QtGui.QVBoxLayout(shortcutListDialog)
|
||||
self.shortcut_list_layout.setObjectName('shortcut_list_layout')
|
||||
self.description_label = QtGui.QLabel(shortcutListDialog)
|
||||
self.description_label.setObjectName('description_label')
|
||||
self.description_label.setWordWrap(True)
|
||||
self.shortcutListLayout.addWidget(self.description_label)
|
||||
self.treeWidget = QtGui.QTreeWidget(shortcutListDialog)
|
||||
self.treeWidget.setObjectName('treeWidget')
|
||||
self.treeWidget.setAlternatingRowColors(True)
|
||||
self.treeWidget.setColumnCount(3)
|
||||
self.treeWidget.setColumnWidth(0, 250)
|
||||
self.shortcutListLayout.addWidget(self.treeWidget)
|
||||
self.detailsLayout = QtGui.QGridLayout()
|
||||
self.detailsLayout.setObjectName('detailsLayout')
|
||||
self.detailsLayout.setContentsMargins(-1, 0, -1, -1)
|
||||
self.defaultRadioButton = QtGui.QRadioButton(shortcutListDialog)
|
||||
self.defaultRadioButton.setObjectName('defaultRadioButton')
|
||||
self.defaultRadioButton.setChecked(True)
|
||||
self.detailsLayout.addWidget(self.defaultRadioButton, 0, 0, 1, 1)
|
||||
self.customRadioButton = QtGui.QRadioButton(shortcutListDialog)
|
||||
self.customRadioButton.setObjectName('customRadioButton')
|
||||
self.detailsLayout.addWidget(self.customRadioButton, 1, 0, 1, 1)
|
||||
self.primaryLayout = QtGui.QHBoxLayout()
|
||||
self.primaryLayout.setObjectName('primaryLayout')
|
||||
self.primaryPushButton = CaptureShortcutButton(shortcutListDialog)
|
||||
self.primaryPushButton.setObjectName('primaryPushButton')
|
||||
self.primaryPushButton.setMinimumSize(QtCore.QSize(84, 0))
|
||||
self.primaryPushButton.setIcon(build_icon(':/system/system_configure_shortcuts.png'))
|
||||
self.primaryLayout.addWidget(self.primaryPushButton)
|
||||
self.clearPrimaryButton = QtGui.QToolButton(shortcutListDialog)
|
||||
self.clearPrimaryButton.setObjectName('clearPrimaryButton')
|
||||
self.clearPrimaryButton.setMinimumSize(QtCore.QSize(0, 16))
|
||||
self.clearPrimaryButton.setIcon(build_icon(':/system/clear_shortcut.png'))
|
||||
self.primaryLayout.addWidget(self.clearPrimaryButton)
|
||||
self.detailsLayout.addLayout(self.primaryLayout, 1, 1, 1, 1)
|
||||
self.alternateLayout = QtGui.QHBoxLayout()
|
||||
self.alternateLayout.setObjectName('alternateLayout')
|
||||
self.alternatePushButton = CaptureShortcutButton(shortcutListDialog)
|
||||
self.alternatePushButton.setObjectName('alternatePushButton')
|
||||
self.alternatePushButton.setIcon(build_icon(':/system/system_configure_shortcuts.png'))
|
||||
self.alternateLayout.addWidget(self.alternatePushButton)
|
||||
self.clearAlternateButton = QtGui.QToolButton(shortcutListDialog)
|
||||
self.clearAlternateButton.setObjectName('clearAlternateButton')
|
||||
self.clearAlternateButton.setIcon(build_icon(':/system/clear_shortcut.png'))
|
||||
self.alternateLayout.addWidget(self.clearAlternateButton)
|
||||
self.detailsLayout.addLayout(self.alternateLayout, 1, 2, 1, 1)
|
||||
self.primaryLabel = QtGui.QLabel(shortcutListDialog)
|
||||
self.primaryLabel.setObjectName('primaryLabel')
|
||||
self.detailsLayout.addWidget(self.primaryLabel, 0, 1, 1, 1)
|
||||
self.alternateLabel = QtGui.QLabel(shortcutListDialog)
|
||||
self.alternateLabel.setObjectName('alternateLabel')
|
||||
self.detailsLayout.addWidget(self.alternateLabel, 0, 2, 1, 1)
|
||||
self.shortcutListLayout.addLayout(self.detailsLayout)
|
||||
self.shortcut_list_layout.addWidget(self.description_label)
|
||||
self.tree_widget = QtGui.QTreeWidget(shortcutListDialog)
|
||||
self.tree_widget.setObjectName('tree_widget')
|
||||
self.tree_widget.setAlternatingRowColors(True)
|
||||
self.tree_widget.setColumnCount(3)
|
||||
self.tree_widget.setColumnWidth(0, 250)
|
||||
self.shortcut_list_layout.addWidget(self.tree_widget)
|
||||
self.details_layout = QtGui.QGridLayout()
|
||||
self.details_layout.setObjectName('details_layout')
|
||||
self.details_layout.setContentsMargins(-1, 0, -1, -1)
|
||||
self.default_radio_button = QtGui.QRadioButton(shortcutListDialog)
|
||||
self.default_radio_button.setObjectName('default_radio_button')
|
||||
self.default_radio_button.setChecked(True)
|
||||
self.details_layout.addWidget(self.default_radio_button, 0, 0, 1, 1)
|
||||
self.custom_radio_button = QtGui.QRadioButton(shortcutListDialog)
|
||||
self.custom_radio_button.setObjectName('custom_radio_button')
|
||||
self.details_layout.addWidget(self.custom_radio_button, 1, 0, 1, 1)
|
||||
self.primary_layout = QtGui.QHBoxLayout()
|
||||
self.primary_layout.setObjectName('primary_layout')
|
||||
self.primary_push_button = CaptureShortcutButton(shortcutListDialog)
|
||||
self.primary_push_button.setObjectName('primary_push_button')
|
||||
self.primary_push_button.setMinimumSize(QtCore.QSize(84, 0))
|
||||
self.primary_push_button.setIcon(build_icon(':/system/system_configure_shortcuts.png'))
|
||||
self.primary_layout.addWidget(self.primary_push_button)
|
||||
self.clear_primary_button = QtGui.QToolButton(shortcutListDialog)
|
||||
self.clear_primary_button.setObjectName('clear_primary_button')
|
||||
self.clear_primary_button.setMinimumSize(QtCore.QSize(0, 16))
|
||||
self.clear_primary_button.setIcon(build_icon(':/system/clear_shortcut.png'))
|
||||
self.primary_layout.addWidget(self.clear_primary_button)
|
||||
self.details_layout.add_layout(self.primary_layout, 1, 1, 1, 1)
|
||||
self.alternate_layout = QtGui.QHBoxLayout()
|
||||
self.alternate_layout.setObjectName('alternate_layout')
|
||||
self.alternate_push_button = CaptureShortcutButton(shortcutListDialog)
|
||||
self.alternate_push_button.setObjectName('alternate_push_button')
|
||||
self.alternate_push_button.setIcon(build_icon(':/system/system_configure_shortcuts.png'))
|
||||
self.alternate_layout.addWidget(self.alternate_push_button)
|
||||
self.clear_alternate_button = QtGui.QToolButton(shortcutListDialog)
|
||||
self.clear_alternate_button.setObjectName('clear_alternate_button')
|
||||
self.clear_alternate_button.setIcon(build_icon(':/system/clear_shortcut.png'))
|
||||
self.alternate_layout.addWidget(self.clear_alternate_button)
|
||||
self.details_layout.add_layout(self.alternate_layout, 1, 2, 1, 1)
|
||||
self.primary_label = QtGui.QLabel(shortcutListDialog)
|
||||
self.primary_label.setObjectName('primary_label')
|
||||
self.details_layout.addWidget(self.primary_label, 0, 1, 1, 1)
|
||||
self.alternate_label = QtGui.QLabel(shortcutListDialog)
|
||||
self.alternate_label.setObjectName('alternate_label')
|
||||
self.details_layout.addWidget(self.alternate_label, 0, 2, 1, 1)
|
||||
self.shortcut_list_layout.add_layout(self.details_layout)
|
||||
self.button_box = create_button_box(shortcutListDialog, 'button_box', ['cancel', 'ok', 'defaults'])
|
||||
self.button_box.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.shortcutListLayout.addWidget(self.button_box)
|
||||
self.shortcut_list_layout.addWidget(self.button_box)
|
||||
self.retranslateUi(shortcutListDialog)
|
||||
|
||||
def retranslateUi(self, shortcutListDialog):
|
||||
|
@ -132,15 +132,15 @@ class Ui_ShortcutListDialog(object):
|
|||
shortcutListDialog.setWindowTitle(translate('OpenLP.ShortcutListDialog', 'Configure Shortcuts'))
|
||||
self.description_label.setText(
|
||||
translate('OpenLP.ShortcutListDialog', 'Select an action and click one of the buttons below to start '
|
||||
'capturing a new primary or alternate shortcut, respectively.'))
|
||||
self.treeWidget.setHeaderLabels([translate('OpenLP.ShortcutListDialog', 'Action'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Shortcut'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Alternate')])
|
||||
self.defaultRadioButton.setText(translate('OpenLP.ShortcutListDialog', 'Default'))
|
||||
self.customRadioButton.setText(translate('OpenLP.ShortcutListDialog', 'Custom'))
|
||||
self.primaryPushButton.setToolTip(translate('OpenLP.ShortcutListDialog', 'Capture shortcut.'))
|
||||
self.alternatePushButton.setToolTip(translate('OpenLP.ShortcutListDialog', 'Capture shortcut.'))
|
||||
self.clearPrimaryButton.setToolTip(translate('OpenLP.ShortcutListDialog',
|
||||
'Restore the default shortcut of this action.'))
|
||||
self.clearAlternateButton.setToolTip(translate('OpenLP.ShortcutListDialog',
|
||||
'Restore the default shortcut of this action.'))
|
||||
'capturing a new primary or alternate shortcut, respectively.'))
|
||||
self.tree_widget.setHeaderLabels([translate('OpenLP.ShortcutListDialog', 'Action'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Shortcut'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Alternate')])
|
||||
self.default_radio_button.setText(translate('OpenLP.ShortcutListDialog', 'Default'))
|
||||
self.custom_radio_button.setText(translate('OpenLP.ShortcutListDialog', 'Custom'))
|
||||
self.primary_push_button.setToolTip(translate('OpenLP.ShortcutListDialog', 'Capture shortcut.'))
|
||||
self.alternate_push_button.setToolTip(translate('OpenLP.ShortcutListDialog', 'Capture shortcut.'))
|
||||
self.clear_primary_button.setToolTip(translate('OpenLP.ShortcutListDialog',
|
||||
'Restore the default shortcut of this action.'))
|
||||
self.clear_alternate_button.setToolTip(translate('OpenLP.ShortcutListDialog',
|
||||
'Restore the default shortcut of this action.'))
|
||||
|
|
|
@ -54,18 +54,18 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
"""
|
||||
super(ShortcutListForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.changedActions = {}
|
||||
self.changed_actions = {}
|
||||
self.action_list = ActionList.get_instance()
|
||||
self.dialog_was_shown = False
|
||||
self.primaryPushButton.toggled.connect(self.onPrimaryPushButtonClicked)
|
||||
self.alternatePushButton.toggled.connect(self.onAlternatePushButtonClicked)
|
||||
self.treeWidget.currentItemChanged.connect(self.onCurrentItemChanged)
|
||||
self.treeWidget.itemDoubleClicked.connect(self.onItemDoubleClicked)
|
||||
self.clearPrimaryButton.clicked.connect(self.onClearPrimaryButtonClicked)
|
||||
self.clearAlternateButton.clicked.connect(self.onClearAlternateButtonClicked)
|
||||
self.button_box.clicked.connect(self.onRestoreDefaultsClicked)
|
||||
self.defaultRadioButton.clicked.connect(self.onDefaultRadioButtonClicked)
|
||||
self.customRadioButton.clicked.connect(self.onCustomRadioButtonClicked)
|
||||
self.primaryPushButton.toggled.connect(self.on_primary_push_button_clicked)
|
||||
self.alternatePushButton.toggled.connect(self.on_alternate_push_button_clicked)
|
||||
self.treeWidget.currentItemChanged.connect(self.on_current_item_changed)
|
||||
self.treeWidget.itemDoubleClicked.connect(self.on_item_double_clicked)
|
||||
self.clearPrimaryButton.clicked.connect(self.on_clear_primary_button_clicked)
|
||||
self.clearAlternateButton.clicked.connect(self.on_clear_alternate_button_clicked)
|
||||
self.button_box.clicked.connect(self.on_restore_defaults_clicked)
|
||||
self.defaultRadioButton.clicked.connect(self.on_default_radio_button_clicked)
|
||||
self.customRadioButton.clicked.connect(self.on_custom_radio_button_clicked)
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
"""
|
||||
|
@ -102,23 +102,23 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
if event.modifiers() & QtCore.Qt.MetaModifier == QtCore.Qt.MetaModifier:
|
||||
key_string = 'Meta+' + key_string
|
||||
key_sequence = QtGui.QKeySequence(key_string)
|
||||
if self._validiate_shortcut(self._currentItemAction(), key_sequence):
|
||||
if self._validiate_shortcut(self._current_item_action(), key_sequence):
|
||||
if self.primaryPushButton.isChecked():
|
||||
self._adjustButton(self.primaryPushButton, False, text=key_sequence.toString())
|
||||
self._adjust_button(self.primaryPushButton, False, text=key_sequence.toString())
|
||||
elif self.alternatePushButton.isChecked():
|
||||
self._adjustButton(self.alternatePushButton, False, text=key_sequence.toString())
|
||||
self._adjust_button(self.alternatePushButton, False, text=key_sequence.toString())
|
||||
|
||||
def exec_(self):
|
||||
"""
|
||||
Execute the dialog
|
||||
"""
|
||||
self.changedActions = {}
|
||||
self.reloadShortcutList()
|
||||
self._adjustButton(self.primaryPushButton, False, False, '')
|
||||
self._adjustButton(self.alternatePushButton, False, False, '')
|
||||
self.changed_actions = {}
|
||||
self.reload_shortcut_list()
|
||||
self._adjust_button(self.primaryPushButton, False, False, '')
|
||||
self._adjust_button(self.alternatePushButton, False, False, '')
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def reloadShortcutList(self):
|
||||
def reload_shortcut_list(self):
|
||||
"""
|
||||
Reload the ``treeWidget`` list to add new and remove old actions.
|
||||
"""
|
||||
|
@ -143,9 +143,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
item.addChild(action_item)
|
||||
self.treeWidget.addTopLevelItem(item)
|
||||
item.setExpanded(True)
|
||||
self.refreshShortcutList()
|
||||
self.refresh_shortcut_list()
|
||||
|
||||
def refreshShortcutList(self):
|
||||
def refresh_shortcut_list(self):
|
||||
"""
|
||||
This refreshes the item's shortcuts shown in the list. Note, this neither adds new actions nor removes old
|
||||
actions.
|
||||
|
@ -154,10 +154,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
while iterator.value():
|
||||
item = iterator.value()
|
||||
iterator += 1
|
||||
action = self._currentItemAction(item)
|
||||
action = self._current_item_action(item)
|
||||
if action is None:
|
||||
continue
|
||||
shortcuts = self._actionShortcuts(action)
|
||||
shortcuts = self._action_shortcuts(action)
|
||||
if not shortcuts:
|
||||
item.setText(1, '')
|
||||
item.setText(2, '')
|
||||
|
@ -167,9 +167,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
else:
|
||||
item.setText(1, shortcuts[0].toString())
|
||||
item.setText(2, shortcuts[1].toString())
|
||||
self.onCurrentItemChanged()
|
||||
self.on_current_item_changed()
|
||||
|
||||
def onPrimaryPushButtonClicked(self, toggled):
|
||||
def on_primary_push_button_clicked(self, toggled):
|
||||
"""
|
||||
Save the new primary shortcut.
|
||||
"""
|
||||
|
@ -178,17 +178,17 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
self.alternatePushButton.setChecked(False)
|
||||
self.primaryPushButton.setText('')
|
||||
return
|
||||
action = self._currentItemAction()
|
||||
action = self._current_item_action()
|
||||
if action is None:
|
||||
return
|
||||
shortcuts = self._actionShortcuts(action)
|
||||
shortcuts = self._action_shortcuts(action)
|
||||
new_shortcuts = [QtGui.QKeySequence(self.primaryPushButton.text())]
|
||||
if len(shortcuts) == 2:
|
||||
new_shortcuts.append(shortcuts[1])
|
||||
self.changedActions[action] = new_shortcuts
|
||||
self.refreshShortcutList()
|
||||
self.changed_actions[action] = new_shortcuts
|
||||
self.refresh_shortcut_list()
|
||||
|
||||
def onAlternatePushButtonClicked(self, toggled):
|
||||
def on_alternate_push_button_clicked(self, toggled):
|
||||
"""
|
||||
Save the new alternate shortcut.
|
||||
"""
|
||||
|
@ -197,28 +197,28 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
self.primaryPushButton.setChecked(False)
|
||||
self.alternatePushButton.setText('')
|
||||
return
|
||||
action = self._currentItemAction()
|
||||
action = self._current_item_action()
|
||||
if action is None:
|
||||
return
|
||||
shortcuts = self._actionShortcuts(action)
|
||||
shortcuts = self._action_shortcuts(action)
|
||||
new_shortcuts = []
|
||||
if shortcuts:
|
||||
new_shortcuts.append(shortcuts[0])
|
||||
new_shortcuts.append(QtGui.QKeySequence(self.alternatePushButton.text()))
|
||||
self.changedActions[action] = new_shortcuts
|
||||
self.changed_actions[action] = new_shortcuts
|
||||
if not self.primaryPushButton.text():
|
||||
# When we do not have a primary shortcut, the just entered alternate shortcut will automatically become the
|
||||
# primary shortcut. That is why we have to adjust the primary button's text.
|
||||
self.primaryPushButton.setText(self.alternatePushButton.text())
|
||||
self.alternatePushButton.setText('')
|
||||
self.refreshShortcutList()
|
||||
self.refresh_shortcut_list()
|
||||
|
||||
def onItemDoubleClicked(self, item, column):
|
||||
def on_item_double_clicked(self, item, column):
|
||||
"""
|
||||
A item has been double clicked. The ``primaryPushButton`` will be checked and the item's shortcut will be
|
||||
displayed.
|
||||
"""
|
||||
action = self._currentItemAction(item)
|
||||
action = self._current_item_action(item)
|
||||
if action is None:
|
||||
return
|
||||
self.primaryPushButton.setChecked(column in [0, 1])
|
||||
|
@ -230,11 +230,11 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
self.alternatePushButton.setText('')
|
||||
self.alternatePushButton.setFocus()
|
||||
|
||||
def onCurrentItemChanged(self, item=None, previousItem=None):
|
||||
def on_current_item_changed(self, item=None, previousItem=None):
|
||||
"""
|
||||
A item has been pressed. We adjust the button's text to the action's shortcut which is encapsulate in the item.
|
||||
"""
|
||||
action = self._currentItemAction(item)
|
||||
action = self._current_item_action(item)
|
||||
self.primaryPushButton.setEnabled(action is not None)
|
||||
self.alternatePushButton.setEnabled(action is not None)
|
||||
primary_text = ''
|
||||
|
@ -249,7 +249,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
primary_label_text = action.defaultShortcuts[0].toString()
|
||||
if len(action.defaultShortcuts) == 2:
|
||||
alternate_label_text = action.defaultShortcuts[1].toString()
|
||||
shortcuts = self._actionShortcuts(action)
|
||||
shortcuts = self._action_shortcuts(action)
|
||||
# We do not want to loose pending changes, that is why we have to keep the text when, this function has not
|
||||
# been triggered by a signal.
|
||||
if item is None:
|
||||
|
@ -277,37 +277,38 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
else:
|
||||
self.customRadioButton.toggle()
|
||||
|
||||
def onRestoreDefaultsClicked(self, button):
|
||||
def on_restore_defaults_clicked(self, button):
|
||||
"""
|
||||
Restores all default shortcuts.
|
||||
"""
|
||||
if self.button_box.buttonRole(button) != QtGui.QDialogButtonBox.ResetRole:
|
||||
return
|
||||
if QtGui.QMessageBox.question(self, translate('OpenLP.ShortcutListDialog', 'Restore Default Shortcuts'),
|
||||
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
|
||||
'shortcuts to their defaults?'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
|
||||
translate('OpenLP.ShortcutListDialog', 'Do you want to restore all '
|
||||
'shortcuts to their defaults?'),
|
||||
QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes |
|
||||
QtGui.QMessageBox.No)) == QtGui.QMessageBox.No:
|
||||
return
|
||||
self._adjustButton(self.primaryPushButton, False, text='')
|
||||
self._adjustButton(self.alternatePushButton, False, text='')
|
||||
self._adjust_button(self.primaryPushButton, False, text='')
|
||||
self._adjust_button(self.alternatePushButton, False, text='')
|
||||
for category in self.action_list.categories:
|
||||
for action in category.actions:
|
||||
self.changedActions[action] = action.defaultShortcuts
|
||||
self.refreshShortcutList()
|
||||
self.changed_actions[action] = action.defaultShortcuts
|
||||
self.refresh_shortcut_list()
|
||||
|
||||
def onDefaultRadioButtonClicked(self, toggled):
|
||||
def on_default_radio_button_clicked(self, toggled):
|
||||
"""
|
||||
The default radio button has been clicked, which means we have to make sure, that we use the default shortcuts
|
||||
for the action.
|
||||
"""
|
||||
if not toggled:
|
||||
return
|
||||
action = self._currentItemAction()
|
||||
action = self._current_item_action()
|
||||
if action is None:
|
||||
return
|
||||
temp_shortcuts = self._actionShortcuts(action)
|
||||
self.changedActions[action] = action.defaultShortcuts
|
||||
self.refreshShortcutList()
|
||||
temp_shortcuts = self._action_shortcuts(action)
|
||||
self.changed_actions[action] = action.defaultShortcuts
|
||||
self.refresh_shortcut_list()
|
||||
primary_button_text = ''
|
||||
alternate_button_text = ''
|
||||
if temp_shortcuts:
|
||||
|
@ -317,16 +318,16 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
self.primaryPushButton.setText(primary_button_text)
|
||||
self.alternatePushButton.setText(alternate_button_text)
|
||||
|
||||
def onCustomRadioButtonClicked(self, toggled):
|
||||
def on_custom_radio_button_clicked(self, toggled):
|
||||
"""
|
||||
The custom shortcut radio button was clicked, thus we have to restore the custom shortcuts by calling those
|
||||
functions triggered by button clicks.
|
||||
"""
|
||||
if not toggled:
|
||||
return
|
||||
self.onPrimaryPushButtonClicked(False)
|
||||
self.onAlternatePushButtonClicked(False)
|
||||
self.refreshShortcutList()
|
||||
self.on_primary_push_button_clicked(False)
|
||||
self.on_alternate_push_button_clicked(False)
|
||||
self.refresh_shortcut_list()
|
||||
|
||||
def save(self):
|
||||
"""
|
||||
|
@ -340,22 +341,22 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
if category.name is None:
|
||||
continue
|
||||
for action in category.actions:
|
||||
if action in self.changedActions:
|
||||
if action in self.changed_actions:
|
||||
old_shortcuts = list(map(QtGui.QKeySequence.toString, action.shortcuts()))
|
||||
action.setShortcuts(self.changedActions[action])
|
||||
action.setShortcuts(self.changed_actions[action])
|
||||
self.action_list.update_shortcut_map(action, old_shortcuts)
|
||||
settings.setValue(action.objectName(), action.shortcuts())
|
||||
settings.endGroup()
|
||||
|
||||
def onClearPrimaryButtonClicked(self, toggled):
|
||||
def on_clear_primary_button_clicked(self, toggled):
|
||||
"""
|
||||
Restore the defaults of this action.
|
||||
"""
|
||||
self.primaryPushButton.setChecked(False)
|
||||
action = self._currentItemAction()
|
||||
action = self._current_item_action()
|
||||
if action is None:
|
||||
return
|
||||
shortcuts = self._actionShortcuts(action)
|
||||
shortcuts = self._action_shortcuts(action)
|
||||
new_shortcuts = []
|
||||
if action.defaultShortcuts:
|
||||
new_shortcuts.append(action.defaultShortcuts[0])
|
||||
|
@ -367,19 +368,19 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
return
|
||||
if len(shortcuts) == 2:
|
||||
new_shortcuts.append(shortcuts[1])
|
||||
self.changedActions[action] = new_shortcuts
|
||||
self.refreshShortcutList()
|
||||
self.onCurrentItemChanged(self.treeWidget.currentItem())
|
||||
self.changed_actions[action] = new_shortcuts
|
||||
self.refresh_shortcut_list()
|
||||
self.on_current_item_changed(self.treeWidget.currentItem())
|
||||
|
||||
def onClearAlternateButtonClicked(self, toggled):
|
||||
def on_clear_alternate_button_clicked(self, toggled):
|
||||
"""
|
||||
Restore the defaults of this action.
|
||||
"""
|
||||
self.alternatePushButton.setChecked(False)
|
||||
action = self._currentItemAction()
|
||||
action = self._current_item_action()
|
||||
if action is None:
|
||||
return
|
||||
shortcuts = self._actionShortcuts(action)
|
||||
shortcuts = self._action_shortcuts(action)
|
||||
new_shortcuts = []
|
||||
if shortcuts:
|
||||
new_shortcuts.append(shortcuts[0])
|
||||
|
@ -388,9 +389,9 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
if len(new_shortcuts) == 2:
|
||||
if not self._validiate_shortcut(action, new_shortcuts[1]):
|
||||
return
|
||||
self.changedActions[action] = new_shortcuts
|
||||
self.refreshShortcutList()
|
||||
self.onCurrentItemChanged(self.treeWidget.currentItem())
|
||||
self.changed_actions[action] = new_shortcuts
|
||||
self.refresh_shortcut_list()
|
||||
self.on_current_item_changed(self.treeWidget.currentItem())
|
||||
|
||||
def _validiate_shortcut(self, changing_action, key_sequence):
|
||||
"""
|
||||
|
@ -406,7 +407,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
is_valid = True
|
||||
for category in self.action_list.categories:
|
||||
for action in category.actions:
|
||||
shortcuts = self._actionShortcuts(action)
|
||||
shortcuts = self._action_shortcuts(action)
|
||||
if key_sequence not in shortcuts:
|
||||
continue
|
||||
if action is changing_action:
|
||||
|
@ -418,30 +419,29 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
if action.parent() is changing_action.parent():
|
||||
is_valid = False
|
||||
# The new shortcut is already assigned, but if both shortcuts are only valid in a different widget the
|
||||
# new shortcut is vaild, because they will not interfere.
|
||||
# new shortcut is valid, because they will not interfere.
|
||||
if action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
|
||||
is_valid = False
|
||||
if changing_action.shortcutContext() in [QtCore.Qt.WindowShortcut, QtCore.Qt.ApplicationShortcut]:
|
||||
is_valid = False
|
||||
if not is_valid:
|
||||
self.main_window.warning_message(translate('OpenLP.ShortcutListDialog', 'Duplicate Shortcut'),
|
||||
translate('OpenLP.ShortcutListDialog',
|
||||
'The shortcut "%s" is already assigned to another action, please use a different shortcut.') %
|
||||
key_sequence.toString()
|
||||
)
|
||||
translate('OpenLP.ShortcutListDialog',
|
||||
'The shortcut "%s" is already assigned to another action, please'
|
||||
' use a different shortcut.') % key_sequence.toString())
|
||||
self.dialog_was_shown = True
|
||||
return is_valid
|
||||
|
||||
def _actionShortcuts(self, action):
|
||||
def _action_shortcuts(self, action):
|
||||
"""
|
||||
This returns the shortcuts for the given ``action``, which also includes those shortcuts which are not saved
|
||||
yet but already assigned (as changes yre applied when closing the dialog).
|
||||
"""
|
||||
if action in self.changedActions:
|
||||
return self.changedActions[action]
|
||||
if action in self.changed_actions:
|
||||
return self.changed_actions[action]
|
||||
return action.shortcuts()
|
||||
|
||||
def _currentItemAction(self, item=None):
|
||||
def _current_item_action(self, item=None):
|
||||
"""
|
||||
Returns the action of the given ``item``. If no item is given, we return the action of the current item of
|
||||
the ``treeWidget``.
|
||||
|
@ -452,7 +452,7 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog):
|
|||
return
|
||||
return item.data(0, QtCore.Qt.UserRole)
|
||||
|
||||
def _adjustButton(self, button, checked=None, enabled=None, text=None):
|
||||
def _adjust_button(self, button, checked=None, enabled=None, text=None):
|
||||
"""
|
||||
Can be called to adjust more properties of the given ``button`` at once.
|
||||
"""
|
||||
|
|
|
@ -45,73 +45,73 @@ class Ui_StartTimeDialog(object):
|
|||
"""
|
||||
StartTimeDialog.setObjectName('StartTimeDialog')
|
||||
StartTimeDialog.resize(350, 10)
|
||||
self.dialogLayout = QtGui.QGridLayout(StartTimeDialog)
|
||||
self.dialogLayout.setObjectName('dialog_layout')
|
||||
self.startLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.startLabel.setObjectName('startLabel')
|
||||
self.startLabel.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialogLayout.addWidget(self.startLabel, 0, 1, 1, 1)
|
||||
self.finishLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.finishLabel.setObjectName('finishLabel')
|
||||
self.finishLabel.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialogLayout.addWidget(self.finishLabel, 0, 2, 1, 1)
|
||||
self.lengthLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.lengthLabel.setObjectName('startLabel')
|
||||
self.lengthLabel.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialogLayout.addWidget(self.lengthLabel, 0, 3, 1, 1)
|
||||
self.hourLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.hourLabel.setObjectName('hourLabel')
|
||||
self.dialogLayout.addWidget(self.hourLabel, 1, 0, 1, 1)
|
||||
self.hourSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.hourSpinBox.setObjectName('hourSpinBox')
|
||||
self.hourSpinBox.setMinimum(0)
|
||||
self.hourSpinBox.setMaximum(4)
|
||||
self.dialogLayout.addWidget(self.hourSpinBox, 1, 1, 1, 1)
|
||||
self.hourFinishSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.hourFinishSpinBox.setObjectName('hourFinishSpinBox')
|
||||
self.hourFinishSpinBox.setMinimum(0)
|
||||
self.hourFinishSpinBox.setMaximum(4)
|
||||
self.dialogLayout.addWidget(self.hourFinishSpinBox, 1, 2, 1, 1)
|
||||
self.hourFinishLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.hourFinishLabel.setObjectName('hourLabel')
|
||||
self.hourFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialogLayout.addWidget(self.hourFinishLabel, 1, 3, 1, 1)
|
||||
self.minuteLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.minuteLabel.setObjectName('minuteLabel')
|
||||
self.dialogLayout.addWidget(self.minuteLabel, 2, 0, 1, 1)
|
||||
self.minuteSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.minuteSpinBox.setObjectName('minuteSpinBox')
|
||||
self.minuteSpinBox.setMinimum(0)
|
||||
self.minuteSpinBox.setMaximum(59)
|
||||
self.dialogLayout.addWidget(self.minuteSpinBox, 2, 1, 1, 1)
|
||||
self.minuteFinishSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.minuteFinishSpinBox.setObjectName('minuteFinishSpinBox')
|
||||
self.minuteFinishSpinBox.setMinimum(0)
|
||||
self.minuteFinishSpinBox.setMaximum(59)
|
||||
self.dialogLayout.addWidget(self.minuteFinishSpinBox, 2, 2, 1, 1)
|
||||
self.minuteFinishLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.minuteFinishLabel.setObjectName('minuteLabel')
|
||||
self.minuteFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialogLayout.addWidget(self.minuteFinishLabel, 2, 3, 1, 1)
|
||||
self.secondLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.secondLabel.setObjectName('secondLabel')
|
||||
self.dialogLayout.addWidget(self.secondLabel, 3, 0, 1, 1)
|
||||
self.secondSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.secondSpinBox.setObjectName('secondSpinBox')
|
||||
self.secondSpinBox.setMinimum(0)
|
||||
self.secondSpinBox.setMaximum(59)
|
||||
self.secondFinishSpinBox = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.secondFinishSpinBox.setObjectName('secondFinishSpinBox')
|
||||
self.secondFinishSpinBox.setMinimum(0)
|
||||
self.secondFinishSpinBox.setMaximum(59)
|
||||
self.dialogLayout.addWidget(self.secondFinishSpinBox, 3, 2, 1, 1)
|
||||
self.secondFinishLabel = QtGui.QLabel(StartTimeDialog)
|
||||
self.secondFinishLabel.setObjectName('secondLabel')
|
||||
self.secondFinishLabel.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialogLayout.addWidget(self.secondFinishLabel, 3, 3, 1, 1)
|
||||
self.dialogLayout.addWidget(self.secondSpinBox, 3, 1, 1, 1)
|
||||
self.dialog_layout = QtGui.QGridLayout(StartTimeDialog)
|
||||
self.dialog_layout.setObjectName('dialog_layout')
|
||||
self.start_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.start_label.setObjectName('start_label')
|
||||
self.start_label.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialog_layout.addWidget(self.start_label, 0, 1, 1, 1)
|
||||
self.finish_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.finish_label.setObjectName('finish_label')
|
||||
self.finish_label.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialog_layout.addWidget(self.finish_label, 0, 2, 1, 1)
|
||||
self.length_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.length_label.setObjectName('start_label')
|
||||
self.length_label.setAlignment(QtCore.Qt.AlignHCenter)
|
||||
self.dialog_layout.addWidget(self.length_label, 0, 3, 1, 1)
|
||||
self.hour_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.hour_label.setObjectName('hour_label')
|
||||
self.dialog_layout.addWidget(self.hour_label, 1, 0, 1, 1)
|
||||
self.hour_spin_box = QtGui.R(StartTimeDialog)
|
||||
self.hour_spin_box.setObjectName('hour_spin_box')
|
||||
self.hour_spin_box.setMinimum(0)
|
||||
self.hour_spin_box.setMaximum(4)
|
||||
self.dialog_layout.addWidget(self.hour_spin_box, 1, 1, 1, 1)
|
||||
self.hour_finish_spin_box = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.hour_finish_spin_box.setObjectName('hour_finish_spin_box')
|
||||
self.hour_finish_spin_box.setMinimum(0)
|
||||
self.hour_finish_spin_box.setMaximum(4)
|
||||
self.dialog_layout.addWidget(self.hour_finish_spin_box, 1, 2, 1, 1)
|
||||
self.hour_finish_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.hour_finish_label.setObjectName('hour_label')
|
||||
self.hour_finish_label.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialog_layout.addWidget(self.hour_finish_label, 1, 3, 1, 1)
|
||||
self.minute_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.minute_label.setObjectName('minute_label')
|
||||
self.dialog_layout.addWidget(self.minute_label, 2, 0, 1, 1)
|
||||
self.minute_spin_box = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.minute_spin_box.setObjectName('minute_spin_box')
|
||||
self.minute_spin_box.setMinimum(0)
|
||||
self.minute_spin_box.setMaximum(59)
|
||||
self.dialog_layout.addWidget(self.minute_spin_box, 2, 1, 1, 1)
|
||||
self.minute_finish_spin_box = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.minute_finish_spin_box.setObjectName('minute_finish_spin_box')
|
||||
self.minute_finish_spin_box.setMinimum(0)
|
||||
self.minute_finish_spin_box.setMaximum(59)
|
||||
self.dialog_layout.addWidget(self.minute_finish_spin_box, 2, 2, 1, 1)
|
||||
self.minute_finish_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.minute_finish_label.setObjectName('minute_label')
|
||||
self.minute_finish_label.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialog_layout.addWidget(self.minute_finish_label, 2, 3, 1, 1)
|
||||
self.second_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.second_label.setObjectName('second_label')
|
||||
self.dialog_layout.addWidget(self.second_label, 3, 0, 1, 1)
|
||||
self.second_spin_box = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.second_spin_box.setObjectName('second_spin_box')
|
||||
self.second_spin_box.setMinimum(0)
|
||||
self.second_spin_box.setMaximum(59)
|
||||
self.second_finish_spin_box = QtGui.QSpinBox(StartTimeDialog)
|
||||
self.second_finish_spin_box.setObjectName('second_finish_spin_box')
|
||||
self.second_finish_spin_box.setMinimum(0)
|
||||
self.second_finish_spin_box.setMaximum(59)
|
||||
self.dialog_layout.addWidget(self.second_finish_spin_box, 3, 2, 1, 1)
|
||||
self.second_finish_label = QtGui.QLabel(StartTimeDialog)
|
||||
self.second_finish_label.setObjectName('second_label')
|
||||
self.second_finish_label.setAlignment(QtCore.Qt.AlignRight)
|
||||
self.dialog_layout.addWidget(self.second_finish_label, 3, 3, 1, 1)
|
||||
self.dialog_layout.addWidget(self.second_spin_box, 3, 1, 1, 1)
|
||||
self.button_box = create_button_box(StartTimeDialog, 'button_box', ['cancel', 'ok'])
|
||||
self.dialogLayout.addWidget(self.button_box, 5, 2, 1, 2)
|
||||
self.dialog_layout.addWidget(self.button_box, 5, 2, 1, 2)
|
||||
self.retranslateUi(StartTimeDialog)
|
||||
self.setMaximumHeight(self.sizeHint().height())
|
||||
|
||||
|
@ -119,16 +119,16 @@ class Ui_StartTimeDialog(object):
|
|||
"""
|
||||
Update the translations on the fly
|
||||
"""
|
||||
self.setWindowTitle(translate('OpenLP.StartTimeForm', 'Item Start and Finish Time'))
|
||||
self.hourSpinBox.setSuffix(UiStrings().Hours)
|
||||
self.minuteSpinBox.setSuffix(UiStrings().Minutes)
|
||||
self.secondSpinBox.setSuffix(UiStrings().Seconds)
|
||||
self.hourFinishSpinBox.setSuffix(UiStrings().Hours)
|
||||
self.minuteFinishSpinBox.setSuffix(UiStrings().Minutes)
|
||||
self.secondFinishSpinBox.setSuffix(UiStrings().Seconds)
|
||||
self.hourLabel.setText(translate('OpenLP.StartTimeForm', 'Hours:'))
|
||||
self.minuteLabel.setText(translate('OpenLP.StartTimeForm', 'Minutes:'))
|
||||
self.secondLabel.setText(translate('OpenLP.StartTimeForm', 'Seconds:'))
|
||||
self.startLabel.setText(translate('OpenLP.StartTimeForm', 'Start'))
|
||||
self.finishLabel.setText(translate('OpenLP.StartTimeForm', 'Finish'))
|
||||
self.lengthLabel.setText(translate('OpenLP.StartTimeForm', 'Length'))
|
||||
self.setWindowTitle(translate('OpenLP.StartTime_form', 'Item Start and Finish Time'))
|
||||
self.hour_spin_box.setSuffix(UiStrings().Hours)
|
||||
self.minute_spin_box.setSuffix(UiStrings().Minutes)
|
||||
self.second_spin_box.setSuffix(UiStrings().Seconds)
|
||||
self.hour_finish_spin_box.setSuffix(UiStrings().Hours)
|
||||
self.minute_finish_spin_box.setSuffix(UiStrings().Minutes)
|
||||
self.second_finish_spin_box.setSuffix(UiStrings().Seconds)
|
||||
self.hour_label.setText(translate('OpenLP.StartTime_form', 'Hours:'))
|
||||
self.minute_label.setText(translate('OpenLP.StartTime_form', 'Minutes:'))
|
||||
self.second_label.setText(translate('OpenLP.StartTime_form', 'Seconds:'))
|
||||
self.start_label.setText(translate('OpenLP.StartTime_form', 'Start'))
|
||||
self.finish_label.setText(translate('OpenLP.StartTime_form', 'Finish'))
|
||||
self.length_label.setText(translate('OpenLP.StartTime_form', 'Length'))
|
||||
|
|
|
@ -54,32 +54,34 @@ class StartTimeForm(QtGui.QDialog, Ui_StartTimeDialog):
|
|||
Run the Dialog with correct heading.
|
||||
"""
|
||||
hour, minutes, seconds = self._time_split(self.item['service_item'].start_time)
|
||||
self.hourSpinBox.setValue(hour)
|
||||
self.minuteSpinBox.setValue(minutes)
|
||||
self.secondSpinBox.setValue(seconds)
|
||||
self.hour_spin_box.setValue(hour)
|
||||
self.minute_spin_box.setValue(minutes)
|
||||
self.second_spin_box.setValue(seconds)
|
||||
hours, minutes, seconds = self._time_split(self.item['service_item'].media_length)
|
||||
self.hourFinishSpinBox.setValue(hours)
|
||||
self.minuteFinishSpinBox.setValue(minutes)
|
||||
self.secondFinishSpinBox.setValue(seconds)
|
||||
self.hourFinishLabel.setText('%s%s' % (str(hour), UiStrings().Hours))
|
||||
self.minuteFinishLabel.setText('%s%s' % (str(minutes), UiStrings().Minutes))
|
||||
self.secondFinishLabel.setText('%s%s' % (str(seconds), UiStrings().Seconds))
|
||||
self.hour_finish_spin_box.setValue(hours)
|
||||
self.minute_finish_spin_box.setValue(minutes)
|
||||
self.second_finish_spin_box.setValue(seconds)
|
||||
self.hour_finish_label.setText('%s%s' % (str(hour), UiStrings().Hours))
|
||||
self.minute_finish_label.setText('%s%s' % (str(minutes), UiStrings().Minutes))
|
||||
self.second_finish_label.setText('%s%s' % (str(seconds), UiStrings().Seconds))
|
||||
return QtGui.QDialog.exec_(self)
|
||||
|
||||
def accept(self):
|
||||
"""
|
||||
When the dialog succeeds, this is run
|
||||
"""
|
||||
start = self.hourSpinBox.value() * 3600 + self.minuteSpinBox.value() * 60 + self.secondSpinBox.value()
|
||||
end = self.hourFinishSpinBox.value() * 3600 + \
|
||||
self.minuteFinishSpinBox.value() * 60 + self.secondFinishSpinBox.value()
|
||||
start = self.hour_spin_box.value() * 3600 + self.minute_spin_box.value() * 60 + self.second_spin_box.value()
|
||||
end = self.hour_finish_spin_box.value() * 3600 + \
|
||||
self.minute_finish_spin_box.value() * 60 + self.second_finish_spin_box.value()
|
||||
if end > self.item['service_item'].media_length:
|
||||
critical_error_message_box(title=translate('OpenLP.StartTimeForm', 'Time Validation Error'),
|
||||
message=translate('OpenLP.StartTimeForm', 'Finish time is set after the end of the media item'))
|
||||
critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'),
|
||||
message=translate('OpenLP.StartTime_form',
|
||||
'Finish time is set after the end of the media item'))
|
||||
return
|
||||
elif start > end:
|
||||
critical_error_message_box(title=translate('OpenLP.StartTimeForm', 'Time Validation Error'),
|
||||
message=translate('OpenLP.StartTimeForm', 'Start time is after the finish time of the media item'))
|
||||
critical_error_message_box(title=translate('OpenLP.StartTime_form', 'Time Validation Error'),
|
||||
message=translate('OpenLP.StartTime_form',
|
||||
'Start time is after the finish time of the media item'))
|
||||
return
|
||||
self.item['service_item'].start_time = start
|
||||
self.item['service_item'].end_time = end
|
||||
|
|
|
@ -62,7 +62,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
super(ThemeForm, self).__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.registerFields()
|
||||
self.updateThemeAllowed = True
|
||||
self.update_theme_allowed = True
|
||||
self.temp_background_filename = ''
|
||||
self.themeLayoutForm = ThemeLayoutForm(self)
|
||||
self.backgroundComboBox.currentIndexChanged.connect(self.onBackgroundComboBoxCurrentIndexChanged)
|
||||
|
@ -222,7 +222,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
"""
|
||||
Change state as Outline check box changed
|
||||
"""
|
||||
if self.updateThemeAllowed:
|
||||
if self.update_theme_allowed:
|
||||
self.theme.font_main_outline = state == QtCore.Qt.Checked
|
||||
self.outlineColorButton.setEnabled(self.theme.font_main_outline)
|
||||
self.outlineSizeSpinBox.setEnabled(self.theme.font_main_outline)
|
||||
|
@ -232,7 +232,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
"""
|
||||
Change state as Shadow check box changed
|
||||
"""
|
||||
if self.updateThemeAllowed:
|
||||
if self.update_theme_allowed:
|
||||
if state == QtCore.Qt.Checked:
|
||||
self.theme.font_main_shadow = True
|
||||
else:
|
||||
|
@ -246,7 +246,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
Change state as Main Area Position check box changed
|
||||
NOTE the font_main_override is the inverse of the check box value
|
||||
"""
|
||||
if self.updateThemeAllowed:
|
||||
if self.update_theme_allowed:
|
||||
self.theme.font_main_override = not (value == QtCore.Qt.Checked)
|
||||
|
||||
def onFooterPositionCheckBoxStateChanged(self, value):
|
||||
|
@ -254,7 +254,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
Change state as Footer Area Position check box changed
|
||||
NOTE the font_footer_override is the inverse of the check box value
|
||||
"""
|
||||
if self.updateThemeAllowed:
|
||||
if self.update_theme_allowed:
|
||||
self.theme.font_footer_override = not (value == QtCore.Qt.Checked)
|
||||
|
||||
def exec_(self, edit=False):
|
||||
|
@ -263,9 +263,9 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
"""
|
||||
log.debug('Editing theme %s' % self.theme.theme_name)
|
||||
self.temp_background_filename = ''
|
||||
self.updateThemeAllowed = False
|
||||
self.update_theme_allowed = False
|
||||
self.setDefaults()
|
||||
self.updateThemeAllowed = True
|
||||
self.update_theme_allowed = True
|
||||
self.themeNameLabel.setVisible(not edit)
|
||||
self.themeNameEdit.setVisible(not edit)
|
||||
self.edit_mode = edit
|
||||
|
@ -383,7 +383,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
Background style Combo box has changed.
|
||||
"""
|
||||
# do not allow updates when screen is building for the first time.
|
||||
if self.updateThemeAllowed:
|
||||
if self.update_theme_allowed:
|
||||
self.theme.background_type = BackgroundType.to_string(index)
|
||||
if self.theme.background_type != BackgroundType.to_string(BackgroundType.Image) and \
|
||||
self.temp_background_filename == '':
|
||||
|
@ -399,7 +399,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
"""
|
||||
Background gradient Combo box has changed.
|
||||
"""
|
||||
if self.updateThemeAllowed:
|
||||
if self.update_theme_allowed:
|
||||
self.theme.background_direction = BackgroundGradientType.to_string(index)
|
||||
self.setBackgroundPageValues()
|
||||
|
||||
|
@ -482,7 +482,7 @@ class ThemeForm(QtGui.QWizard, Ui_ThemeWizard):
|
|||
Update the theme object from the UI for fields not already updated
|
||||
when the are changed.
|
||||
"""
|
||||
if not self.updateThemeAllowed:
|
||||
if not self.update_theme_allowed:
|
||||
return
|
||||
log.debug('updateTheme')
|
||||
# main page
|
||||
|
|
Loading…
Reference in New Issue