From d1c41fae7abb32e00012730e1ddceef337e51235 Mon Sep 17 00:00:00 2001 From: Billy Lange Date: Thu, 15 Jul 2010 18:36:09 +0200 Subject: [PATCH 1/8] Confirm deletion of theme --- openlp/core/ui/thememanager.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index dd8c917af..01acf5549 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -211,6 +211,14 @@ class ThemeManager(QtGui.QWidget): 'You must select a theme to delete.')): item = self.ThemeListWidget.currentItem() theme = unicode(item.text()) + # confirm deletion + answer = QtGui.QMessageBox.question(self, + translate('ThemeManager', 'Delete Confirmation'), + translate('ThemeManager', 'Delete theme?'), + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes| + QtGui.QMessageBox.No),QtGui.QMessageBox.No) + if answer == QtGui.QMessageBox.No: + return # should be the same unless default if theme != unicode(item.data(QtCore.Qt.UserRole).toString()): QtGui.QMessageBox.critical(self, From 65d5f89302f1fdd65b71f6654075fb01fbf6df87 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 16 Jul 2010 19:53:49 +0100 Subject: [PATCH 2/8] Fix English and alignment --- .../songs/forms/songmaintenanceform.py | 32 ++++++++----------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/openlp/plugins/songs/forms/songmaintenanceform.py b/openlp/plugins/songs/forms/songmaintenanceform.py index d50bf747f..2a848ad98 100644 --- a/openlp/plugins/songs/forms/songmaintenanceform.py +++ b/openlp/plugins/songs/forms/songmaintenanceform.py @@ -137,7 +137,7 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def checkAuthor(self, new_author, edit=False): """ - Returns False when the given Author is already in the list elsewise + Returns False if the given Author is already in the list otherwise True. """ authors = self.songmanager.get_all_objects_filtered(Author, @@ -163,11 +163,10 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def checkTopic(self, new_topic, edit=False): """ - Returns False when the given Topic is already in the list elsewise True. + Returns False if the given Topic is already in the list otherwise True. """ topics = self.songmanager.get_all_objects_filtered(Topic, - Topic.name == new_topic.name - ) + Topic.name == new_topic.name) if len(topics) > 0: # If we edit an existing Topic, we need to make sure that we do # not return False when nothing has changed (because this would @@ -184,25 +183,22 @@ class SongMaintenanceForm(QtGui.QDialog, Ui_SongMaintenanceDialog): def checkBook(self, new_book, edit=False): """ - Returns False when the given Book is already in the list elsewise True. + Returns False if the given Book is already in the list otherwise True. """ books = self.songmanager.get_all_objects_filtered(Book, - and_( - Book.name == new_book.name, - Book.publisher == new_book.publisher - ) - ) + and_(Book.name == new_book.name, + Book.publisher == new_book.publisher)) if len(books) > 0: - # If we edit an existing Book, we need to make sure that we do - # not return False when nothing has changed (because this would - # cause an error message later on). - if edit: - if books[0].id == new_book.id: - return True - else: - return False + # If we edit an existing Book, we need to make sure that we do + # not return False when nothing has changed (because this would + # cause an error message later on). + if edit: + if books[0].id == new_book.id: + return True else: return False + else: + return False else: return True From 5097cbaf9ccc57c858440dc9cc7863cf68cd10bc Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 16 Jul 2010 22:06:10 +0100 Subject: [PATCH 3/8] Start cleaning getters and setters --- openlp/plugins/songs/lib/sofimport.py | 8 ++++---- openlp/plugins/songs/lib/songimport.py | 16 ++-------------- openlp/plugins/songs/lib/songxml.py | 6 +----- 3 files changed, 7 insertions(+), 23 deletions(-) diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/sofimport.py index da56580aa..8e78caceb 100644 --- a/openlp/plugins/songs/lib/sofimport.py +++ b/openlp/plugins/songs/lib/sofimport.py @@ -142,7 +142,7 @@ class SofImport(OooImport): self.blanklines += 1 if self.blanklines > 1: return - if self.song.get_title() != u'': + if self.song.title != u'': self.finish_verse() return self.blanklines = 0 @@ -166,7 +166,7 @@ class SofImport(OooImport): self.finish_verse() self.song.repeat_verse() return - if self.song.get_title() == u'': + if self.song.title == u'': if self.song.get_copyright() == u'': self.add_author(text) else: @@ -190,7 +190,7 @@ class SofImport(OooImport): if boldtext.isdigit() and self.song.get_song_number() == '': self.add_songnumber(boldtext) return u'' - if self.song.get_title() == u'': + if self.song.title == u'': text = self.uncap_text(text) self.add_title(text) return text @@ -245,7 +245,7 @@ class SofImport(OooImport): title = title[1:] if title.endswith(u','): title = title[:-1] - self.song.set_title(title) + self.song.title = title def add_author(self, text): """ diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index bf3b404cd..1db73baa3 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -123,16 +123,10 @@ class SongImport(object): if len(lines) == 1: self.parse_author(lines[0]) return - if not self.get_title(): - self.set_title(lines[0]) + if not self.title: + self.title = lines[0] self.add_verse(text) - def get_title(self): - """ - Return the title - """ - return self.title - def get_copyright(self): """ Return the copyright @@ -145,12 +139,6 @@ class SongImport(object): """ return self.song_number - def set_title(self, title): - """ - Set the title - """ - self.title = title - def set_alternate_title(self, title): """ Set the alternate title diff --git a/openlp/plugins/songs/lib/songxml.py b/openlp/plugins/songs/lib/songxml.py index 2965c579b..8124af14b 100644 --- a/openlp/plugins/songs/lib/songxml.py +++ b/openlp/plugins/songs/lib/songxml.py @@ -366,10 +366,6 @@ class Song(object): if len(self.search_title) < 1: raise SongTitleError(u'The searchable title is empty') - def get_title(self): - """Return title value""" - return self.title - def from_ccli_text_buffer(self, textList): """ Create song from a list of texts (strings) - CCLI text format expected @@ -688,7 +684,7 @@ class Song(object): raise SongSlideError(u'Slide number too high') res = [] if self.show_title: - title = self.get_title() + title = self.title else: title = "" if self.show_author_list: From c7a8bbee8b520cd16660f72da11ca5f3c4f9aab4 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 16 Jul 2010 22:26:57 +0100 Subject: [PATCH 4/8] More getters and setters --- openlp/plugins/songs/lib/sofimport.py | 23 +++++++++---------- openlp/plugins/songs/lib/songimport.py | 31 -------------------------- 2 files changed, 10 insertions(+), 44 deletions(-) diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/sofimport.py index 8e78caceb..d6f9ea08e 100644 --- a/openlp/plugins/songs/lib/sofimport.py +++ b/openlp/plugins/songs/lib/sofimport.py @@ -167,7 +167,7 @@ class SofImport(OooImport): self.song.repeat_verse() return if self.song.title == u'': - if self.song.get_copyright() == u'': + if self.song.copyright == u'': self.add_author(text) else: self.song.add_copyright(text) @@ -187,7 +187,7 @@ class SofImport(OooImport): return text if textportion.CharWeight == BOLD: boldtext = text.strip() - if boldtext.isdigit() and self.song.get_song_number() == '': + if boldtext.isdigit() and self.song.song_number == '': self.add_songnumber(boldtext) return u'' if self.song.title == u'': @@ -220,20 +220,17 @@ class SofImport(OooImport): Add a song number, store as alternate title. Also use the song number to work out which songbook we're in """ - self.song.set_song_number(song_no) - self.song.set_alternate_title(song_no + u'.') + self.song.song_number = song_no + self.song.alternate_title = song_no + u'.' + self.song.song_book_pub = u'Kingsway Publications' if int(song_no) <= 640: - self.song.set_song_book(u'Songs of Fellowship 1', - u'Kingsway Publications') + self.song.song_book = u'Songs of Fellowship 1' elif int(song_no) <= 1150: - self.song.set_song_book(u'Songs of Fellowship 2', - u'Kingsway Publications') + self.song.song_book = u'Songs of Fellowship 2' elif int(song_no) <= 1690: - self.song.set_song_book(u'Songs of Fellowship 3', - u'Kingsway Publications') + self.song.song_book = u'Songs of Fellowship 3' else: - self.song.set_song_book(u'Songs of Fellowship 4', - u'Kingsway Publications') + self.song.song_book = u'Songs of Fellowship 4' def add_title(self, text): """ @@ -283,7 +280,7 @@ class SofImport(OooImport): splitat = None else: versetag = u'V' - splitat = self.verse_splits(self.song.get_song_number()) + splitat = self.verse_splits(self.song.song_number) if splitat: ln = 0 verse = u'' diff --git a/openlp/plugins/songs/lib/songimport.py b/openlp/plugins/songs/lib/songimport.py index 1db73baa3..904ace424 100644 --- a/openlp/plugins/songs/lib/songimport.py +++ b/openlp/plugins/songs/lib/songimport.py @@ -127,37 +127,6 @@ class SongImport(object): self.title = lines[0] self.add_verse(text) - def get_copyright(self): - """ - Return the copyright - """ - return self.copyright - - def get_song_number(self): - """ - Return the song number - """ - return self.song_number - - def set_alternate_title(self, title): - """ - Set the alternate title - """ - self.alternate_title = title - - def set_song_number(self, song_number): - """ - Set the song number - """ - self.song_number = song_number - - def set_song_book(self, song_book, publisher): - """ - Set the song book name and publisher - """ - self.song_book_name = song_book - self.song_book_pub = publisher - def add_copyright(self, copyright): """ Build the copyright field From c7904f613ead160905f8377b6d6fa5765f8bfe77 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 16 Jul 2010 22:32:36 +0100 Subject: [PATCH 5/8] Fix set_last_dir call --- openlp/plugins/songs/forms/songimportform.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index 09db3dcb8..bfc1606f7 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -178,7 +178,8 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): SettingsManager.get_last_dir(self.songsplugin.settingsSection, 1)) if filename: editbox.setText(filename) - self.config.set_last_dir(filename, 1) + SettingsManager.set_last_dir(self.songsplugin.settingsSection, + filename, 1) def incrementProgressBar(self, status_text): log.debug(u'IncrementBar %s', status_text) From 096e0e8b6136a8063adc077953daa7855758b0b8 Mon Sep 17 00:00:00 2001 From: Jon Tibble Date: Fri, 16 Jul 2010 23:36:53 +0100 Subject: [PATCH 6/8] Fixes and cleanups --- openlp/plugins/songs/forms/songimportform.py | 2 +- .../plugins/songs/forms/songimportwizard.py | 26 ++++++++----------- openlp/plugins/songs/lib/sofimport.py | 1 - 3 files changed, 12 insertions(+), 17 deletions(-) diff --git a/openlp/plugins/songs/forms/songimportform.py b/openlp/plugins/songs/forms/songimportform.py index bfc1606f7..db66be4df 100644 --- a/openlp/plugins/songs/forms/songimportform.py +++ b/openlp/plugins/songs/forms/songimportform.py @@ -254,4 +254,4 @@ class ImportWizardForm(QtGui.QWizard, Ui_SongImportWizard): self.ImportProgressBar.setValue(self.ImportProgressBar.maximum()) self.finishButton.setVisible(True) self.cancelButton.setVisible(False) - Receiver.send_message(u'process_events') \ No newline at end of file + Receiver.send_message(u'process_events') diff --git a/openlp/plugins/songs/forms/songimportwizard.py b/openlp/plugins/songs/forms/songimportwizard.py index d740d42a5..57ad3d9cf 100644 --- a/openlp/plugins/songs/forms/songimportwizard.py +++ b/openlp/plugins/songs/forms/songimportwizard.py @@ -109,16 +109,16 @@ class Ui_SongImportWizard(object): self.OpenLyricsButtonLayout.setSpacing(8) self.OpenLyricsButtonLayout.setObjectName(u'OpenLyricsButtonLayout') self.OpenLyricsAddButton = QtGui.QPushButton(self.OpenLyricsPage) - self.OpenLyricsAddButton.setIcon( - build_icon(u':/general/general_open.png')) + openIcon = build_icon(u':/general/general_open.png') + self.OpenLyricsAddButton.setIcon(openIcon) self.OpenLyricsAddButton.setObjectName(u'OpenLyricsAddButton') self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsAddButton) self.OpenLyricsButtonSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.OpenLyricsButtonLayout.addItem(self.OpenLyricsButtonSpacer) self.OpenLyricsRemoveButton = QtGui.QPushButton(self.OpenLyricsPage) - self.OpenLyricsRemoveButton.setIcon( - build_icon(u':/general/general_delete.png')) + deleteIcon = build_icon(u':/general/general_delete.png') + self.OpenLyricsRemoveButton.setIcon(deleteIcon) self.OpenLyricsRemoveButton.setObjectName(u'OpenLyricsRemoveButton') self.OpenLyricsButtonLayout.addWidget(self.OpenLyricsRemoveButton) self.OpenLyricsLayout.addLayout(self.OpenLyricsButtonLayout) @@ -136,14 +136,14 @@ class Ui_SongImportWizard(object): self.OpenSongButtonLayout.setSpacing(8) self.OpenSongButtonLayout.setObjectName(u'OpenSongButtonLayout') self.OpenSongAddButton = QtGui.QPushButton(self.OpenSongPage) - self.OpenSongAddButton.setIcon(self.OpenIcon) + self.OpenSongAddButton.setIcon(openIcon) self.OpenSongAddButton.setObjectName(u'OpenSongAddButton') self.OpenSongButtonLayout.addWidget(self.OpenSongAddButton) self.OpenSongButtonSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.OpenSongButtonLayout.addItem(self.OpenSongButtonSpacer) self.OpenSongRemoveButton = QtGui.QPushButton(self.OpenSongPage) - self.OpenSongRemoveButton.setIcon(self.DeleteIcon) + self.OpenSongRemoveButton.setIcon(deleteIcon) self.OpenSongRemoveButton.setObjectName(u'OpenSongRemoveButton') self.OpenSongButtonLayout.addWidget(self.OpenSongRemoveButton) self.OpenSongLayout.addLayout(self.OpenSongButtonLayout) @@ -161,14 +161,14 @@ class Ui_SongImportWizard(object): self.CCLIButtonLayout.setSpacing(8) self.CCLIButtonLayout.setObjectName(u'CCLIButtonLayout') self.CCLIAddButton = QtGui.QPushButton(self.CCLIPage) - self.CCLIAddButton.setIcon(self.OpenIcon) + self.CCLIAddButton.setIcon(openIcon) self.CCLIAddButton.setObjectName(u'CCLIAddButton') self.CCLIButtonLayout.addWidget(self.CCLIAddButton) self.CCLIButtonSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.CCLIButtonLayout.addItem(self.CCLIButtonSpacer) self.CCLIRemoveButton = QtGui.QPushButton(self.CCLIPage) - self.CCLIRemoveButton.setIcon(self.DeleteIcon) + self.CCLIRemoveButton.setIcon(deleteIcon) self.CCLIRemoveButton.setObjectName(u'CCLIRemoveButton') self.CCLIButtonLayout.addWidget(self.CCLIRemoveButton) self.CCLILayout.addLayout(self.CCLIButtonLayout) @@ -190,7 +190,7 @@ class Ui_SongImportWizard(object): self.CSVFilenameEdit.setObjectName(u'CSVFilenameEdit') self.CSVFileLayout.addWidget(self.CSVFilenameEdit) self.CSVBrowseButton = QtGui.QToolButton(self.CSVPage) - self.CSVBrowseButton.setIcon(self.OpenIcon) + self.CSVBrowseButton.setIcon(openIcon) self.CSVBrowseButton.setObjectName(u'CSVBrowseButton') self.CSVFileLayout.addWidget(self.CSVBrowseButton) self.CSVLayout.setLayout(0, QtGui.QFormLayout.FieldRole, @@ -213,14 +213,11 @@ class Ui_SongImportWizard(object): self.ImportProgressBar.setObjectName(u'ImportProgressBar') self.ImportLayout.addWidget(self.ImportProgressBar) SongImportWizard.addPage(self.ImportPage) - self.retranslateUi(SongImportWizard) self.FormatStackedWidget.setCurrentIndex(0) - QtCore.QObject.connect( - self.FormatComboBox, + QtCore.QObject.connect(self.FormatComboBox, QtCore.SIGNAL(u'currentIndexChanged(int)'), - self.FormatStackedWidget.setCurrentIndex - ) + self.FormatStackedWidget.setCurrentIndex) QtCore.QMetaObject.connectSlotsByName(SongImportWizard) def retranslateUi(self, SongImportWizard): @@ -275,4 +272,3 @@ class Ui_SongImportWizard(object): translate('SongsPlugin.ImportWizardForm', 'Ready.')) self.ImportProgressBar.setFormat( translate('SongsPlugin.ImportWizardForm', '%p%')) - diff --git a/openlp/plugins/songs/lib/sofimport.py b/openlp/plugins/songs/lib/sofimport.py index d6f9ea08e..52fd38634 100644 --- a/openlp/plugins/songs/lib/sofimport.py +++ b/openlp/plugins/songs/lib/sofimport.py @@ -535,4 +535,3 @@ class SofImport(OooImport): if song_number == 1119: return 7 return None - From 885e5d8ea2ee690617a54a79403ef0d669ae3e26 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 17 Jul 2010 07:04:52 +0100 Subject: [PATCH 7/8] Fix bug #606437 --- openlp/core/ui/maindisplay.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index d449342ef..6183c23c2 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -264,6 +264,10 @@ class MainDisplay(DisplayWidget): (self.screen[u'size'].width() - splash_image.width()) / 2, (self.screen[u'size'].height() - splash_image.height()) / 2, splash_image) + #build a blank transparent image + self.transparent = QtGui.QPixmap( + self.screen[u'size'].width(), self.screen[u'size'].height()) + self.transparent.fill(QtCore.Qt.transparent) self.displayImage(self.initialFrame) self.repaint() #Build a Black screen @@ -274,12 +278,6 @@ class MainDisplay(DisplayWidget): QtGui.QImage.Format_ARGB32_Premultiplied) painter.begin(self.blankFrame) painter.fillRect(self.blankFrame.rect(), QtCore.Qt.black) - #build a blank transparent image - self.transparent = QtGui.QPixmap( - self.screen[u'size'].width(), self.screen[u'size'].height()) - self.transparent.fill(QtCore.Qt.transparent) -# self.displayText.setPixmap(self.transparent) - #self.frameView(self.transparent) # To display or not to display? if not self.screen[u'primary']: self.setVisible(True) @@ -410,6 +408,7 @@ class MainDisplay(DisplayWidget): self.imageDisplay.setPixmap(QtGui.QPixmap.fromImage(frame)) else: self.imageDisplay.setPixmap(frame) + self.frameView(self.transparent) self.videoDisplay.setHtml(u'') def displayVideo(self, path): From ca1d6c8675c9e2a835be1f53f870480a17bb4770 Mon Sep 17 00:00:00 2001 From: Billy Lange Date: Sat, 17 Jul 2010 21:53:17 +0200 Subject: [PATCH 8/8] Fixed spaces --- openlp/core/ui/thememanager.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/thememanager.py b/openlp/core/ui/thememanager.py index 01acf5549..02e23d75c 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -215,8 +215,8 @@ class ThemeManager(QtGui.QWidget): answer = QtGui.QMessageBox.question(self, translate('ThemeManager', 'Delete Confirmation'), translate('ThemeManager', 'Delete theme?'), - QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes| - QtGui.QMessageBox.No),QtGui.QMessageBox.No) + QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | + QtGui.QMessageBox.No), QtGui.QMessageBox.No) if answer == QtGui.QMessageBox.No: return # should be the same unless default