From 978cc3bc3687fcac81894fb9ca547210c8d3d1eb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Thu, 12 Jul 2012 18:48:28 +0200 Subject: [PATCH 1/5] - removed not needed 'QtCore.Qt.OtherFocusReason' from setFocus calls - fixed 'short' lines - changed addItem to addItems when possible - other clean ups --- openlp/core/lib/ui.py | 8 ++-- openlp/core/ui/advancedtab.py | 44 +++++++------------ openlp/core/ui/shortcutlistform.py | 4 +- openlp/core/ui/thememanager.py | 2 +- openlp/plugins/bibles/lib/biblestab.py | 3 +- openlp/plugins/custom/forms/editcustomform.py | 42 +++++++----------- openlp/plugins/songs/forms/editsongform.py | 4 +- openlp/plugins/songs/forms/editverseform.py | 2 +- 8 files changed, 41 insertions(+), 68 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index e9638a58b..3ecfa049e 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -464,9 +464,8 @@ def create_valign_selection_widgets(parent): label = QtGui.QLabel(parent) label.setText(translate('OpenLP.Ui', '&Vertical Align:')) combo_box = QtGui.QComboBox(parent) - combo_box.addItem(UiStrings().Top) - combo_box.addItem(UiStrings().Middle) - combo_box.addItem(UiStrings().Bottom) + combo_box.addItems( + [UiStrings().Top, UiStrings().Middle, UiStrings().Bottom]) label.setBuddy(combo_box) return label, combo_box @@ -481,8 +480,7 @@ def find_and_set_in_combo_box(combo_box, value_to_find): ``value_to_find`` The value to find """ - index = combo_box.findText(value_to_find, - QtCore.Qt.MatchExactly) + index = combo_box.findText(value_to_find, QtCore.Qt.MatchExactly) if index == -1: # Not Found. index = 0 diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 25c6f7a26..ef15b2c91 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -102,28 +102,22 @@ class AdvancedTab(SettingsTab): u'expandServiceItemCheckBox') self.uiLayout.addRow(self.expandServiceItemCheckBox) self.enableAutoCloseCheckBox = QtGui.QCheckBox(self.uiGroupBox) - self.enableAutoCloseCheckBox.setObjectName( - u'enableAutoCloseCheckBox') + self.enableAutoCloseCheckBox.setObjectName(u'enableAutoCloseCheckBox') self.uiLayout.addRow(self.enableAutoCloseCheckBox) self.leftLayout.addWidget(self.uiGroupBox) # Default service name self.serviceNameGroupBox = QtGui.QGroupBox(self.leftColumn) self.serviceNameGroupBox.setObjectName(u'serviceNameGroupBox') - self.serviceNameLayout = QtGui.QFormLayout( - self.serviceNameGroupBox) - self.serviceNameCheckBox = QtGui.QCheckBox( - self.serviceNameGroupBox) + self.serviceNameLayout = QtGui.QFormLayout(self.serviceNameGroupBox) + self.serviceNameCheckBox = QtGui.QCheckBox(self.serviceNameGroupBox) self.serviceNameCheckBox.setObjectName(u'serviceNameCheckBox') self.serviceNameLayout.setObjectName(u'serviceNameLayout') self.serviceNameLayout.addRow(self.serviceNameCheckBox) self.serviceNameTimeLabel = QtGui.QLabel(self.serviceNameGroupBox) self.serviceNameTimeLabel.setObjectName(u'serviceNameTimeLabel') - self.serviceNameDay = QtGui.QComboBox( - self.serviceNameGroupBox) - self.serviceNameDay.addItems( - [u'', u'', u'', u'', u'', u'', u'', u'']) - self.serviceNameDay.setObjectName( - u'serviceNameDay') + self.serviceNameDay = QtGui.QComboBox(self.serviceNameGroupBox) + self.serviceNameDay.addItems([u'', u'', u'', u'', u'', u'', u'', u'']) + self.serviceNameDay.setObjectName(u'serviceNameDay') self.serviceNameTime = QtGui.QTimeEdit(self.serviceNameGroupBox) self.serviceNameTime.setObjectName(u'serviceNameTime') self.serviceNameTimeHBox = QtGui.QHBoxLayout() @@ -150,8 +144,7 @@ class AdvancedTab(SettingsTab): self.serviceNameHBox.addWidget(self.serviceNameRevertButton) self.serviceNameLayout.addRow(self.serviceNameLabel, self.serviceNameHBox) - self.serviceNameExampleLabel = QtGui.QLabel( - self.serviceNameGroupBox) + self.serviceNameExampleLabel = QtGui.QLabel(self.serviceNameGroupBox) self.serviceNameExampleLabel.setObjectName( u'serviceNameExampleLabel') self.serviceNameExample = QtGui.QLabel(self.serviceNameGroupBox) @@ -201,8 +194,7 @@ class AdvancedTab(SettingsTab): self.newDataDirectoryLabelHBox.setObjectName( u'newDataDirectoryLabelHBox') self.newDataDirectoryLabelHBox.addWidget(self.newDataDirectoryEdit) - self.newDataDirectoryLabelHBox.addWidget( - self.dataDirectoryBrowseButton) + self.newDataDirectoryLabelHBox.addWidget(self.dataDirectoryBrowseButton) self.newDataDirectoryLabelHBox.addWidget( self.dataDirectoryDefaultButton) self.dataDirectoryCopyCheckHBox = QtGui.QHBoxLayout() @@ -339,8 +331,7 @@ class AdvancedTab(SettingsTab): Setup the interface translation strings. """ self.tabTitleVisible = UiStrings().Advanced - self.uiGroupBox.setTitle( - translate('OpenLP.AdvancedTab', 'UI Settings')) + self.uiGroupBox.setTitle(translate('OpenLP.AdvancedTab', 'UI Settings')) self.dataDirectoryGroupBox.setTitle( translate('OpenLP.AdvancedTab', 'Data Location')) self.recentLabel.setText( @@ -432,8 +423,7 @@ class AdvancedTab(SettingsTab): translate('OpenLP.AdvancedTab', 'WARNING: New data directory location contains ' 'OpenLP data files. These files WILL be replaced during a copy.')) - self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', - 'X11')) + self.x11GroupBox.setTitle(translate('OpenLP.AdvancedTab', 'X11')) self.x11BypassCheckBox.setText(translate('OpenLP.AdvancedTab', 'Bypass X11 Window Manager')) # Slide Limits @@ -498,8 +488,7 @@ class AdvancedTab(SettingsTab): self.defaultColor = settings.value(u'default color', QtCore.QVariant(u'#ffffff')).toString() self.defaultFileEdit.setText(settings.value(u'default image', - QtCore.QVariant(u':/graphics/openlp-splash-screen.png'))\ - .toString()) + QtCore.QVariant(u':/graphics/openlp-splash-screen.png')).toString()) self.slide_limits = settings.value( u'slide limits', QtCore.QVariant(SlideLimits.End)).toInt()[0] if self.slide_limits == SlideLimits.End: @@ -541,8 +530,7 @@ class AdvancedTab(SettingsTab): self.currentDataPath = AppLocation.get_data_path() log.warning(u'User requested data path set to default %s' % self.currentDataPath) - self.dataDirectoryLabel.setText(os.path.abspath( - self.currentDataPath)) + self.dataDirectoryLabel.setText(os.path.abspath(self.currentDataPath)) self.defaultColorButton.setStyleSheet( u'background-color: %s' % self.defaultColor) @@ -652,8 +640,7 @@ class AdvancedTab(SettingsTab): file_filters = u'%s;;%s (*.*) (*)' % (get_images_filter(), UiStrings().AllFiles) filename = QtGui.QFileDialog.getOpenFileName(self, - translate('OpenLP.AdvancedTab', 'Open File'), '', - file_filters) + translate('OpenLP.AdvancedTab', 'Open File'), '', file_filters) if filename: self.defaultFileEdit.setText(filename) self.defaultFileEdit.setFocus() @@ -702,7 +689,8 @@ class AdvancedTab(SettingsTab): """ new_data_path = AppLocation.get_directory(AppLocation.DataDir) if self.currentDataPath.lower() != new_data_path.lower(): - # Make sure they want to change the data location back to the default. + # Make sure they want to change the data location back to the + # default. answer = QtGui.QMessageBox.question(self, translate('OpenLP.AdvancedTab', 'Reset Data Directory'), translate('OpenLP.AdvancedTab', @@ -761,7 +749,7 @@ class AdvancedTab(SettingsTab): self.dataExists = False self.dataDirectoryCopyCheckBox.setChecked(True) self.newDataDirectoryHasFilesLabel.hide() - + def onDataDirectoryCancelButtonClicked(self): """ Cancel the data directory location change diff --git a/openlp/core/ui/shortcutlistform.py b/openlp/core/ui/shortcutlistform.py index b2ae27063..26aa9e7f7 100644 --- a/openlp/core/ui/shortcutlistform.py +++ b/openlp/core/ui/shortcutlistform.py @@ -222,10 +222,10 @@ class ShortcutListForm(QtGui.QDialog, Ui_ShortcutListDialog): self.alternatePushButton.setChecked(column not in [0, 1]) if column in [0, 1]: self.primaryPushButton.setText(u'') - self.primaryPushButton.setFocus(QtCore.Qt.OtherFocusReason) + self.primaryPushButton.setFocus() else: self.alternatePushButton.setText(u'') - self.alternatePushButton.setFocus(QtCore.Qt.OtherFocusReason) + self.alternatePushButton.setFocus() def onCurrentItemChanged(self, item=None, previousItem=None): """ diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 585ab2329..334774394 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -457,7 +457,7 @@ class ThemeManager(QtGui.QWidget): # Sort the themes by its name considering language specific characters. # lower() is needed for windows! files.sort(key=lambda file_name: unicode(file_name).lower(), - cmp=locale.strcoll) + cmp=locale.strcoll) # now process the file list of png files for name in files: # check to see file is in theme root directory diff --git a/openlp/plugins/bibles/lib/biblestab.py b/openlp/plugins/bibles/lib/biblestab.py index b093d06e4..218553236 100644 --- a/openlp/plugins/bibles/lib/biblestab.py +++ b/openlp/plugins/bibles/lib/biblestab.py @@ -537,8 +537,7 @@ class BiblesTab(SettingsTab): """ self.bibleThemeComboBox.clear() self.bibleThemeComboBox.addItem(u'') - for theme in theme_list: - self.bibleThemeComboBox.addItem(theme) + self.bibleThemeComboBox.addItems(theme_list) find_and_set_in_combo_box(self.bibleThemeComboBox, self.bible_theme) def getGreyTextPalette(self, greyed): diff --git a/openlp/plugins/custom/forms/editcustomform.py b/openlp/plugins/custom/forms/editcustomform.py index 816cd2720..13d722b18 100644 --- a/openlp/plugins/custom/forms/editcustomform.py +++ b/openlp/plugins/custom/forms/editcustomform.py @@ -75,8 +75,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): def loadThemes(self, themelist): self.themeComboBox.clear() self.themeComboBox.addItem(u'') - for themename in themelist: - self.themeComboBox.addItem(themename) + self.themeComboBox.addItems(themelist) def loadCustom(self, id, preview=False): """ @@ -105,7 +104,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.slideListView.addItem(slide[1]) theme = self.customSlide.theme_name find_and_set_in_combo_box(self.themeComboBox, theme) - self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) + self.titleEdit.setFocus() # If not preview hide the preview button. self.previewButton.setVisible(preview) @@ -127,11 +126,9 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): sxml = CustomXMLBuilder() sxml.new_document() sxml.add_lyrics_to_song() - count = 1 - for i in range(self.slideListView.count()): - sxml.add_verse_to_lyrics(u'custom', unicode(count), - unicode(self.slideListView.item(i).text())) - count += 1 + for count in range(self.slideListView.count()): + sxml.add_verse_to_lyrics(u'custom', unicode(count + 1), + unicode(self.slideListView.item(count).text())) self.customSlide.title = unicode(self.titleEdit.text()) self.customSlide.text = unicode(sxml.extract_xml(), u'utf-8') self.customSlide.credits = unicode(self.creditEdit.text()) @@ -158,8 +155,7 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): def onAddButtonClicked(self): self.editSlideForm.setText(u'') if self.editSlideForm.exec_(): - for slide in self.editSlideForm.getText(): - self.slideListView.addItem(slide) + self.slideListView.addItems(self.editSlideForm.getText()) def onEditButtonClicked(self): self.editSlideForm.setText(self.slideListView.currentItem().text()) @@ -170,13 +166,13 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ Edits all slides. """ - slide_list = u'' + slide_text = u'' for row in range(self.slideListView.count()): item = self.slideListView.item(row) - slide_list += item.text() + slide_text += item.text() if row != self.slideListView.count() - 1: - slide_list += u'\n[===]\n' - self.editSlideForm.setText(slide_list) + slide_text += u'\n[===]\n' + self.editSlideForm.setText(slide_text) if self.editSlideForm.exec_(): self.updateSlideList(self.editSlideForm.getText(), True) @@ -200,21 +196,19 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): """ if edit_all: self.slideListView.clear() - for slide in slides: - self.slideListView.addItem(slide) + self.slideListView.addItems(slides) else: old_slides = [] old_row = self.slideListView.currentRow() # Create a list with all (old/unedited) slides. - old_slides = [self.slideListView.item(row).text() for row in \ + old_slides = [self.slideListView.item(row).text() for row in range(self.slideListView.count())] self.slideListView.clear() old_slides.pop(old_row) # Insert all slides to make the old_slides list complete. for slide in slides: old_slides.insert(old_row, slide) - for slide in old_slides: - self.slideListView.addItem(slide) + self.slideListView.addItems(old_slides) self.slideListView.repaint() def onDeleteButtonClicked(self): @@ -241,14 +235,8 @@ class EditCustomForm(QtGui.QDialog, Ui_CustomEditDialog): self.deleteButton.setEnabled(True) self.editButton.setEnabled(True) # Decide if the up/down buttons should be enabled or not. - if self.slideListView.count() - 1 == row: - self.downButton.setEnabled(False) - else: - self.downButton.setEnabled(True) - if row == 0: - self.upButton.setEnabled(False) - else: - self.upButton.setEnabled(True) + self.downButton.setEnabled(self.slideListView.count() - 1 != row) + self.upButton.setEnabled(row != 0) def _validate(self): """ diff --git a/openlp/plugins/songs/forms/editsongform.py b/openlp/plugins/songs/forms/editsongform.py index 0b3dddcc9..41cfbfe19 100644 --- a/openlp/plugins/songs/forms/editsongform.py +++ b/openlp/plugins/songs/forms/editsongform.py @@ -202,7 +202,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): self.authorsListView.clear() self.topicsListView.clear() self.audioListWidget.clear() - self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) + self.titleEdit.setFocus() self.songBookNumberEdit.clear() self.loadAuthors() self.loadTopics() @@ -325,7 +325,7 @@ class EditSongForm(QtGui.QDialog, Ui_EditSongDialog): media_file.setData(QtCore.Qt.UserRole, QtCore.QVariant(media.file_name)) self.audioListWidget.addItem(media_file) - self.titleEdit.setFocus(QtCore.Qt.OtherFocusReason) + self.titleEdit.setFocus() # Hide or show the preview button. self.previewButton.setVisible(preview) diff --git a/openlp/plugins/songs/forms/editverseform.py b/openlp/plugins/songs/forms/editverseform.py index f5c8e5d48..ffa7f2331 100644 --- a/openlp/plugins/songs/forms/editverseform.py +++ b/openlp/plugins/songs/forms/editverseform.py @@ -171,7 +171,7 @@ class EditVerseForm(QtGui.QDialog, Ui_EditVerseDialog): self.verseNumberBox.setValue(1) self.insertButton.setVisible(True) self.verseTextEdit.setPlainText(text) - self.verseTextEdit.setFocus(QtCore.Qt.OtherFocusReason) + self.verseTextEdit.setFocus() self.verseTextEdit.moveCursor(QtGui.QTextCursor.End) def getVerse(self): From 88288aa6950915aea594e731a31ef5309f282fe7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 24 Sep 2012 17:14:36 +0200 Subject: [PATCH 2/5] refactored class --- openlp/core/ui/slidecontroller.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 2d108e72c..7c80a495c 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -43,14 +43,6 @@ from openlp.core.utils.actions import ActionList, CategoryOrder log = logging.getLogger(__name__) -class SlideList(QtGui.QTableWidget): - """ - Customised version of QTableWidget which can respond to keyboard - events. - """ - def __init__(self, parent=None): - QtGui.QTableWidget.__init__(self, parent.controller) - class Controller(QtGui.QWidget): """ @@ -149,7 +141,7 @@ class SlideController(Controller): self.controllerLayout.setSpacing(0) self.controllerLayout.setMargin(0) # Controller list view - self.previewListWidget = SlideList(self) + self.previewListWidget = QtGui.QTableWidget(self.controller) self.previewListWidget.setColumnCount(1) self.previewListWidget.horizontalHeader().setVisible(False) self.previewListWidget.setColumnWidth(0, self.controller.width()) @@ -286,7 +278,7 @@ class SlideController(Controller): text=translate('OpenLP.SlideController', 'Pause Audio'), tooltip=translate('OpenLP.SlideController', 'Pause audio.'), checked=False, visible=False, category=self.category, - context=QtCore.Qt.WindowShortcut, + context=QtCore.Qt.WindowShortcut, shortcuts=[], triggers=self.onAudioPauseClicked) self.audioMenu = QtGui.QMenu( translate('OpenLP.SlideController', 'Background Audio'), self.toolbar) From 5eeab86db9b9bd4349f6271c77fa28a89e387cc9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 26 Sep 2012 16:13:42 +0200 Subject: [PATCH 3/5] removed not needed parameters --- openlp/core/ui/firsttimeform.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/openlp/core/ui/firsttimeform.py b/openlp/core/ui/firsttimeform.py index 1bd746759..7ee3807e2 100644 --- a/openlp/core/ui/firsttimeform.py +++ b/openlp/core/ui/firsttimeform.py @@ -104,7 +104,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'config_screen_changed'), self.updateScreenListCombo) - def exec_(self, edit=False): + def exec_(self): """ Run the wizard. """ @@ -265,8 +265,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): self._performWizard() Receiver.send_message(u'openlp_process_events') Receiver.send_message(u'cursor_normal') - Settings().setValue(u'general/has run wizard', - QtCore.QVariant(True)) + Settings().setValue(u'general/has run wizard', QtCore.QVariant(True)) self.close() def urlGetFile(self, url, fpath): @@ -277,7 +276,6 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): block_count = 0 block_size = 4096 urlfile = urllib2.urlopen(url) - filesize = urlfile.headers["Content-Length"] filename = open(fpath, "wb") # Download until finished or canceled. while not self.downloadCancelled: @@ -286,7 +284,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): break filename.write(data) block_count += 1 - self._downloadProgress(block_count, block_size, filesize) + self._downloadProgress(block_count, block_size) filename.close() # Delete file if cancelled, it may be a partial file. if self.downloadCancelled: @@ -314,7 +312,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): meta = site.info() return int(meta.getheaders("Content-Length")[0]) - def _downloadProgress(self, count, block_size, total_size): + def _downloadProgress(self, count, block_size): increment = (count * block_size) - self.previous_size self._incrementProgressBar(None, increment) self.previous_size = count * block_size @@ -468,7 +466,7 @@ class FirstTimeForm(QtGui.QWizard, Ui_FirstTimeWizard): Settings().setValue(u'General/monitor', QtCore.QVariant(self.displayComboBox.currentIndex())) self.screens.set_current_display( - self.displayComboBox.currentIndex()) + self.displayComboBox.currentIndex()) # Set Global Theme if self.themeComboBox.currentIndex() != -1: Settings().setValue(u'themes/global theme', From f375d4b0b8a5015759e43f95da5f0818d9d37fcb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 3 Oct 2012 13:27:28 +0200 Subject: [PATCH 4/5] fixed bug 1050081 'display screen - hide mouse by default' Fixes: https://launchpad.net/bugs/1050081 --- openlp/core/ui/advancedtab.py | 4 ++-- openlp/core/ui/maindisplay.py | 2 +- openlp/core/ui/media/vlcplayer.py | 3 +-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index ab8228658..427075f02 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -477,7 +477,7 @@ class AdvancedTab(SettingsTab): settings.value(u'enable exit confirmation', QtCore.QVariant(True)).toBool()) self.hideMouseCheckBox.setChecked( - settings.value(u'hide mouse', QtCore.QVariant(False)).toBool()) + settings.value(u'hide mouse', QtCore.QVariant(True)).toBool()) self.serviceNameDay.setCurrentIndex( settings.value(u'default service day', QtCore.QVariant(self.defaultServiceDay)).toInt()[0]) @@ -766,7 +766,7 @@ class AdvancedTab(SettingsTab): self.dataExists = False self.dataDirectoryCopyCheckBox.setChecked(True) self.newDataDirectoryHasFilesLabel.hide() - + def onDataDirectoryCancelButtonClicked(self): """ Cancel the data directory location change diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 306bb7511..e38da6fbc 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -490,7 +490,7 @@ class MainDisplay(Display): Hide mouse cursor when moved over display. """ if Settings().value(u'advanced/hide mouse', - QtCore.QVariant(False)).toBool(): + QtCore.QVariant(True)).toBool(): self.setCursor(QtCore.Qt.BlankCursor) self.frame.evaluateJavaScript('document.body.style.cursor = "none"') else: diff --git a/openlp/core/ui/media/vlcplayer.py b/openlp/core/ui/media/vlcplayer.py index 6203ca696..48d46ee66 100644 --- a/openlp/core/ui/media/vlcplayer.py +++ b/openlp/core/ui/media/vlcplayer.py @@ -113,8 +113,7 @@ class VlcPlayer(MediaPlayer): if not display.hasAudio: command_line_options += u' --no-audio --no-video-title-show' if Settings().value(u'advanced/hide mouse', - QtCore.QVariant(False)).toBool() and \ - display.controller.isLive: + QtCore.QVariant(True)).toBool() and display.controller.isLive: command_line_options += u' --mouse-hide-timeout=0' display.vlcInstance = vlc.Instance(command_line_options) display.vlcInstance.set_log_verbosity(2) From 0c5430b925f75de658154625ec3ac1e270c6c6b1 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 5 Dec 2012 05:53:14 +0000 Subject: [PATCH 5/5] Test 120 column diffs --- openlp/core/__init__.py | 78 +++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 50 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index ba81ddb95..8a0861dc4 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 +# vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 ############################################################################### # OpenLP - Open Source Lyrics Projection # @@ -113,33 +113,24 @@ class OpenLP(QtGui.QApplication): args.remove('OpenLP') self.args.extend(args) # provide a listener for widgets to reqest a screen update. - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor) - QtCore.QObject.connect(Receiver.get_receiver(), - QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor) + QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'openlp_process_events'), self.processEvents) + QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_busy'), self.setBusyCursor) + QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'cursor_normal'), self.setNormalCursor) # Decide how many screens we have and their size screens = ScreenList.create(self.desktop()) # First time checks in settings - has_run_wizard = Settings().value( - u'general/has run wizard', QtCore.QVariant(False)).toBool() + has_run_wizard = Settings().value(u'general/has run wizard', QtCore.QVariant(False)).toBool() if not has_run_wizard: if FirstTimeForm(screens).exec_() == QtGui.QDialog.Accepted: - Settings().setValue(u'general/has run wizard', - QtCore.QVariant(True)) + Settings().setValue(u'general/has run wizard', QtCore.QVariant(True)) # Correct stylesheet bugs if os.name == u'nt': - base_color = self.palette().color(QtGui.QPalette.Active, - QtGui.QPalette.Base) - application_stylesheet = \ - u'* {alternate-background-color: ' + \ - base_color.name() + ';}\n' + base_color = self.palette().color(QtGui.QPalette.Active, QtGui.QPalette.Base) + application_stylesheet = u'* {alternate-background-color: ' + base_color.name() + ';}\n' application_stylesheet += nt_repair_stylesheet self.setStyleSheet(application_stylesheet) # show the splashscreen - show_splash = Settings().value( - u'general/show splash', QtCore.QVariant(True)).toBool() + show_splash = Settings().value(u'general/show splash', QtCore.QVariant(True)).toBool() if show_splash: self.splash = SplashScreen() self.splash.show() @@ -158,8 +149,7 @@ class OpenLP(QtGui.QApplication): self.processEvents() if not has_run_wizard: self.mainWindow.firstTime() - update_check = Settings().value( - u'general/update check', QtCore.QVariant(True)).toBool() + update_check = Settings().value(u'general/update check', QtCore.QVariant(True)).toBool() if update_check: VersionThread(self.mainWindow).start() Receiver.send_message(u'live_display_blank_check') @@ -175,10 +165,8 @@ class OpenLP(QtGui.QApplication): """ self.sharedMemory = QtCore.QSharedMemory('OpenLP') if self.sharedMemory.attach(): - status = QtGui.QMessageBox.critical(None, - UiStrings().Error, UiStrings().OpenLPStart, - QtGui.QMessageBox.StandardButtons( - QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) + status = QtGui.QMessageBox.critical(None, UiStrings().Error, UiStrings().OpenLPStart, + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) if status == QtGui.QMessageBox.No: return True return False @@ -192,8 +180,7 @@ class OpenLP(QtGui.QApplication): return if not hasattr(self, u'exceptionForm'): self.exceptionForm = ExceptionForm(self.mainWindow) - self.exceptionForm.exceptionTextEdit.setPlainText( - ''.join(format_exception(exctype, value, traceback))) + self.exceptionForm.exceptionTextEdit.setPlainText(''.join(format_exception(exctype, value, traceback))) self.setNormalCursor() self.exceptionForm.exec_() @@ -230,8 +217,7 @@ def set_up_logging(log_path): check_directory_exists(log_path) filename = os.path.join(log_path, u'openlp.log') logfile = logging.FileHandler(filename, u'w') - logfile.setFormatter(logging.Formatter( - u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s')) + logfile.setFormatter(logging.Formatter(u'%(asctime)s %(name)-55s %(levelname)-8s %(message)s')) log.addHandler(logfile) if log.isEnabledFor(logging.DEBUG): print 'Logging to:', filename @@ -245,28 +231,22 @@ def main(args=None): # Set up command line options. usage = 'Usage: %prog [options] [qt-options]' parser = OptionParser(usage=usage) - parser.add_option('-e', '--no-error-form', dest='no_error_form', - action='store_true', help='Disable the error notification form.') - parser.add_option('-l', '--log-level', dest='loglevel', - default='warning', metavar='LEVEL', help='Set logging to LEVEL ' - 'level. Valid values are "debug", "info", "warning".') - parser.add_option('-p', '--portable', dest='portable', - action='store_true', help='Specify if this should be run as a ' - 'portable app, off a USB flash drive (not implemented).') - parser.add_option('-d', '--dev-version', dest='dev_version', - action='store_true', help='Ignore the version file and pull the ' - 'version directly from Bazaar') - parser.add_option('-s', '--style', dest='style', - help='Set the Qt4 style (passed directly to Qt4).') - parser.add_option('--testing', dest='testing', - action='store_true', help='Run by testing framework') + parser.add_option('-e', '--no-error-form', dest='no_error_form', action='store_true', + help='Disable the error notification form.') + parser.add_option('-l', '--log-level', dest='loglevel', default='warning', metavar='LEVEL', + help='Set logging to LEVEL level. Valid values are "debug", "info", "warning".') + parser.add_option('-p', '--portable', dest='portable', action='store_true', + help='Specify if this should be run as a portable app, off a USB flash drive (not implemented).') + parser.add_option('-d', '--dev-version', dest='dev_version', action='store_true', + help='Ignore the version file and pull the version directly from Bazaar') + parser.add_option('-s', '--style', dest='style', help='Set the Qt4 style (passed directly to Qt4).') + parser.add_option('--testing', dest='testing', action='store_true', help='Run by testing framework') # Parse command line options and deal with them. # Use args supplied programatically if possible. (options, args) = parser.parse_args(args) if args else parser.parse_args() if options.portable: app_path = AppLocation.get_directory(AppLocation.AppDir) - set_up_logging(os.path.abspath(os.path.join(app_path, u'..', - u'..', u'Other'))) + set_up_logging(os.path.abspath(os.path.join(app_path, u'..', u'..', u'Other'))) log.info(u'Running portable') else: set_up_logging(AppLocation.get_directory(AppLocation.CacheDir)) @@ -294,8 +274,7 @@ def main(args=None): app.setApplicationName(u'OpenLPPortable') Settings.setDefaultFormat(Settings.IniFormat) # Get location OpenLPPortable.ini - portable_settings_file = os.path.abspath(os.path.join(app_path, u'..', - u'..', u'Data', u'OpenLP.ini')) + portable_settings_file = os.path.abspath(os.path.join(app_path, u'..', u'..', u'Data', u'OpenLP.ini')) # Make this our settings file log.info(u'INI file: %s', portable_settings_file) Settings.setFilename(portable_settings_file) @@ -324,8 +303,7 @@ def main(args=None): sys.exit() # i18n Set Language language = LanguageManager.get_language() - app_translator, default_translator = \ - LanguageManager.get_translator(language) + app_translator, default_translator = LanguageManager.get_translator(language) if not app_translator.isEmpty(): app.installTranslator(app_translator) if not default_translator.isEmpty(): @@ -337,7 +315,7 @@ def main(args=None): # Do not run method app.exec_() when running gui tests if options.testing: app.run(qt_args, testing=True) - # For gui tests we need access to window intances and their components + # For gui tests we need access to window instances and their components return app else: sys.exit(app.run(qt_args))