From aa0b49290de0bfa66230ebcc56d91ad5ca2e2680 Mon Sep 17 00:00:00 2001 From: M2j Date: Thu, 20 Oct 2011 22:11:06 +0200 Subject: [PATCH 01/39] add version information for mako, migrate and uno to exceptionform --- openlp/core/ui/exceptionform.py | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index c5fc678e2..18b36914d 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -39,6 +39,11 @@ try: PHONON_VERSION = Phonon.phononVersion() except ImportError: PHONON_VERSION = u'-' +try: + import migrate + MIGRATE_VERSION = migrate.__version__ +except ImportError: + MIGRATE_VERSION = u'-' try: import chardet CHARDET_VERSION = chardet.__version__ @@ -54,6 +59,24 @@ try: SQLITE_VERSION = sqlite.version except ImportError: SQLITE_VERSION = u'-' +try: + import mako + MAKO_VERSION = mako.__version__ +except ImportError: + MAKO_VERSION = u'-' +try: + import uno + arg = uno.createUnoStruct(u'com.sun.star.beans.PropertyValue') + arg.Name = u'nodepath' + arg.Value = u'/org.openoffice.Setup/Product' + context = uno.getComponentContext() + provider = context.ServiceManager.createInstance( + u'com.sun.star.configuration.ConfigurationProvider') + node = provider.createInstanceWithArguments( + u'com.sun.star.configuration.ConfigurationAccess', (arg,)) + UNO_VERSION = node.getByName(u'ooSetupVersion') +except ImportError: + UNO_VERSION = u'-' from openlp.core.lib import translate, SettingsManager from openlp.core.lib.ui import UiStrings @@ -89,11 +112,14 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): u'Phonon: %s\n' % PHONON_VERSION + \ u'PyQt4: %s\n' % Qt.PYQT_VERSION_STR + \ u'SQLAlchemy: %s\n' % sqlalchemy.__version__ + \ + u'SQLAlchemy Migrate: %s\n' % MIGRATE_VERSION + \ u'BeautifulSoup: %s\n' % BeautifulSoup.__version__ + \ u'lxml: %s\n' % etree.__version__ + \ u'Chardet: %s\n' % CHARDET_VERSION + \ u'PyEnchant: %s\n' % ENCHANT_VERSION + \ - u'PySQLite: %s\n' % SQLITE_VERSION + u'PySQLite: %s\n' % SQLITE_VERSION + \ + u'Mako: %s\n' % MAKO_VERSION + \ + u'pyUNO bridge: %s\n' % UNO_VERSION if platform.system() == u'Linux': if os.environ.get(u'KDE_FULL_SESSION') == u'true': system = system + u'Desktop: KDE SC\n' From 5a415311a5abb89a6f3f49e77adb20668f3a89c3 Mon Sep 17 00:00:00 2001 From: M2j Date: Sat, 22 Oct 2011 14:30:21 +0200 Subject: [PATCH 02/39] Correction for Migrate version smaller than 0.7 --- openlp/core/ui/exceptionform.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 18b36914d..10fee7f6f 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -41,7 +41,7 @@ except ImportError: PHONON_VERSION = u'-' try: import migrate - MIGRATE_VERSION = migrate.__version__ + MIGRATE_VERSION = getattr(migrate, u'__version__', u'< 0.7') except ImportError: MIGRATE_VERSION = u'-' try: From 5f9ed32bfecc35905cd45bcdd69a43db660cadae Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 23 Oct 2011 18:22:11 +0100 Subject: [PATCH 03/39] Fix assignment error --- openlp/core/ui/exceptionform.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openlp/core/ui/exceptionform.py b/openlp/core/ui/exceptionform.py index 10fee7f6f..0cda4bd60 100644 --- a/openlp/core/ui/exceptionform.py +++ b/openlp/core/ui/exceptionform.py @@ -178,6 +178,8 @@ class ExceptionForm(QtGui.QDialog, Ui_ExceptionDialog): 'Please add the information that bug reports are favoured written ' 'in English.')) content = self._createReport() + source = u'' + exception = u'' for line in content[2].split(u'\n'): if re.search(r'[/\\]openlp[/\\]', line): source = re.sub(r'.*[/\\]openlp[/\\](.*)".*', r'\1', line) From b603017b1c43c86b77fd6d91b27e5119c4493a66 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 23 Oct 2011 19:47:15 +0200 Subject: [PATCH 04/39] started work on shortcuts allowing jumping between different verses Fixes: https://launchpad.net/bugs/827862 --- openlp/core/lib/ui.py | 1 + openlp/core/ui/slidecontroller.py | 104 +++++++++++++++++++++++++++++- 2 files changed, 102 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 756df36c3..2e9669e89 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -105,6 +105,7 @@ class UiStrings(object): self.PlaySlidesInLoop = translate('OpenLP.Ui','Play Slides in Loop') self.PlaySlidesToEnd = translate('OpenLP.Ui','Play Slides to End') self.Preview = translate('OpenLP.Ui', 'Preview') + self.PreviewToolbar = translate('OpenLP.Ui', 'Preview Toolbar') self.PrintService = translate('OpenLP.Ui', 'Print Service') self.ReplaceBG = translate('OpenLP.Ui', 'Replace Background') self.ReplaceLiveBG = translate('OpenLP.Ui', 'Replace live background.') diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 97c30436e..8b2409039 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -321,6 +321,78 @@ class SlideController(QtGui.QWidget): self.slidePreview.setObjectName(u'slidePreview') self.slideLayout.insertWidget(0, self.slidePreview) self.grid.addLayout(self.slideLayout, 0, 0, 1, 1) + self.verseShortcut1 = shortcut_action(self, 'verseShortcut1', + [QtGui.QKeySequence(u'V'), QtGui.QKeySequence(u'1')], + self.slideShortcutActivated, category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut2 = shortcut_action(self, 'verseShortcut2', + [QtGui.QKeySequence(u'2')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut3 = shortcut_action(self, 'verseShortcut3', + [QtGui.QKeySequence(u'3')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut4 = shortcut_action(self, 'verseShortcut4', + [QtGui.QKeySequence(u'4')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut5 = shortcut_action(self, 'verseShortcut5', + [QtGui.QKeySequence(u'5')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut6 = shortcut_action(self, 'verseShortcut6', + [QtGui.QKeySequence(u'6')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut7 = shortcut_action(self, 'verseShortcut7', + [QtGui.QKeySequence(u'7')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut8 = shortcut_action(self, 'verseShortcut8', + [QtGui.QKeySequence(u'8')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut9 = shortcut_action(self, 'verseShortcut9', + [QtGui.QKeySequence(u'9')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut10 = shortcut_action(self, 'verseShortcut10', + [QtGui.QKeySequence(u'0')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.chorusShortcut = shortcut_action(self, 'chorusShortcut', + [QtGui.QKeySequence(u'C')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.bridgeShortcut = shortcut_action(self, 'bridgeShortcut', + [QtGui.QKeySequence(u'B')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.preChorusShortcut = shortcut_action(self, 'preChorusShortcut', + [QtGui.QKeySequence(u'P')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.introShortcut = shortcut_action(self, 'introShortcut', + [QtGui.QKeySequence(u'I')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.endingShortcut = shortcut_action(self, 'endingShortcut', + [QtGui.QKeySequence(u'E')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.otherShortcut = shortcut_action(self, 'otherShortcut', + [QtGui.QKeySequence(u'O')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.previewListWidget.addActions([ + self.verseShortcut1, self.verseShortcut2, self.verseShortcut3, + self.verseShortcut4, self.verseShortcut5, self.verseShortcut6, + self.verseShortcut7, self.verseShortcut8, self.verseShortcut9, + self.verseShortcut10, self.chorusShortcut, self.bridgeShortcut, + self.preChorusShortcut, self.introShortcut, self.endingShortcut, + self.otherShortcut + ]) # Signals QtCore.QObject.connect(self.previewListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected) @@ -367,6 +439,32 @@ class SlideController(QtGui.QWidget): QtCore.SIGNAL(u'slidecontroller_%s_unblank' % self.typePrefix), self.onSlideUnblank) + def slideShortcutActivated(self): + """ + Called, when a shortcut + """ + verse_type = unicode(self.sender().objectName()) + keys = self.slideList.keys() + key = u'' + if verse_type.startswith(u'verseShortcut'): + key = u'V%s' % verse_type[13:] + elif verse_type == u'chorusShortcut': + key = u'C1' + elif verse_type == u'bridgeShortcut': + key = u'B1' + elif verse_type == u'preChorusShortcut': + key = u'P1' + elif verse_type == u'introShortcut': + key = u'I1' + elif verse_type == u'endingShortcut': + key = u'E1' + elif verse_type == u'otherShortcut': + key = u'O1' + if key in keys: + self.__checkUpdateSelectedSlide(self.slideList[key]) + self.slideSelected() + print self.slideList + def setPreviewHotkeys(self, parent=None): self.previousItem.setObjectName(u'previousItemPreview') self.nextItem.setObjectName(u'nextItemPreview') @@ -643,9 +741,9 @@ class SlideController(QtGui.QWidget): verse_def = u'%s%s' % (verse_def[0], verse_def[1:]) two_line_def = u'%s\n%s' % (verse_def[0], verse_def[1:]) row = two_line_def - if self.isLive: - if verse_def not in self.slideList: - self.slideList[verse_def] = framenumber + if verse_def not in self.slideList: + self.slideList[verse_def] = framenumber + if self.isLive: self.songMenu.menu().addAction(verse_def, self.onSongBarHandler) else: From cc186aff9d125184e6e4060817840a6a7ee725eb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 23 Oct 2011 20:28:42 +0200 Subject: [PATCH 05/39] clean ups + fixes --- openlp/core/ui/slidecontroller.py | 140 +++++++++++++++++++++--------- 1 file changed, 98 insertions(+), 42 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 8b2409039..e9f13c7db 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -321,70 +321,122 @@ class SlideController(QtGui.QWidget): self.slidePreview.setObjectName(u'slidePreview') self.slideLayout.insertWidget(0, self.slidePreview) self.grid.addLayout(self.slideLayout, 0, 0, 1, 1) - self.verseShortcut1 = shortcut_action(self, 'verseShortcut1', + if self.isLive: + category = UiStrings().LiveToolbar + else: + category = UiStrings().PreviewToolbar + self.verseShortcut1 = shortcut_action( + self, u'verseShortcut1%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'V'), QtGui.QKeySequence(u'1')], - self.slideShortcutActivated, category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + self.slideShortcutActivated, category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut2 = shortcut_action(self, 'verseShortcut2', + self.verseShortcut1.setText(translate( + 'OpenLP.SlideController', 'Go to "1. Verse"')) + self.verseShortcut2 = shortcut_action( + self, u'verseShortcut2%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'2')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut3 = shortcut_action(self, 'verseShortcut3', + self.verseShortcut2.setText(translate( + 'OpenLP.SlideController', 'Go to "2. Verse"')) + self.verseShortcut3 = shortcut_action( + self, u'verseShortcut3%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'3')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut4 = shortcut_action(self, 'verseShortcut4', + self.verseShortcut3.setText(translate( + 'OpenLP.SlideController', 'Go to "3. Verse"')) + self.verseShortcut4 = shortcut_action( + self, u'verseShortcut4%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'4')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut5 = shortcut_action(self, 'verseShortcut5', + self.verseShortcut4.setText(translate( + 'OpenLP.SlideController', 'Go to "4. Verse"')) + self.verseShortcut5 = shortcut_action( + self, u'verseShortcut5%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'5')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut6 = shortcut_action(self, 'verseShortcut6', + self.verseShortcut5.setText(translate( + 'OpenLP.SlideController', 'Go to "5. Verse"')) + self.verseShortcut6 = shortcut_action( + self, u'verseShortcut6%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'6')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut7 = shortcut_action(self, 'verseShortcut7', + self.verseShortcut6.setText(translate( + 'OpenLP.SlideController', 'Go to "6. Verse"')) + self.verseShortcut7 = shortcut_action( + self, u'verseShortcut7%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'7')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut8 = shortcut_action(self, 'verseShortcut8', + self.verseShortcut7.setText(translate( + 'OpenLP.SlideController', 'Go to "7. Verse"')) + self.verseShortcut8 = shortcut_action( + self, u'verseShortcut8%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'8')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut9 = shortcut_action(self, 'verseShortcut9', + self.verseShortcut8.setText(translate( + 'OpenLP.SlideController', 'Go to "8. Verse"')) + self.verseShortcut9 = shortcut_action( + self, u'verseShortcut9%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'9')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut10 = shortcut_action(self, 'verseShortcut10', + self.verseShortcut9.setText(translate( + 'OpenLP.SlideController', 'Go to "9. Verse"')) + self.verseShortcut10 = shortcut_action( + self, u'verseShortcut10%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'0')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.chorusShortcut = shortcut_action(self, 'chorusShortcut', + self.verseShortcut10.setText(translate( + 'OpenLP.SlideController', 'Go to "10. Verse"')) + self.chorusShortcut = shortcut_action( + self, u'chorusShortcut%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'C')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.bridgeShortcut = shortcut_action(self, 'bridgeShortcut', + self.chorusShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Chorus"')) + self.bridgeShortcut = shortcut_action( + self, u'bridgeShortcut%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'B')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.preChorusShortcut = shortcut_action(self, 'preChorusShortcut', + self.bridgeShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Bridge"')) + self.preChorusShortcut = shortcut_action( + self, u'preChorusShortcut%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'P')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.introShortcut = shortcut_action(self, 'introShortcut', + self.preChorusShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Pre-Chorus"')) + self.introShortcut = shortcut_action( + self, u'introShortcut%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'I')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.endingShortcut = shortcut_action(self, 'endingShortcut', + self.introShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Intro"')) + self.endingShortcut = shortcut_action( + self, u'endingShortcut%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'E')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.otherShortcut = shortcut_action(self, 'otherShortcut', + self.endingShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Ending"')) + self.otherShortcut = shortcut_action( + self, u'otherShortcut%s' % self.typePrefix.capitalize(), [QtGui.QKeySequence(u'O')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar if self.isLive else UiStrings().PreviewToolbar, + category=category, context=QtCore.Qt.WidgetWithChildrenShortcut) + self.otherShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Other"')) self.previewListWidget.addActions([ self.verseShortcut1, self.verseShortcut2, self.verseShortcut3, self.verseShortcut4, self.verseShortcut5, self.verseShortcut6, @@ -441,34 +493,38 @@ class SlideController(QtGui.QWidget): def slideShortcutActivated(self): """ - Called, when a shortcut + Called, when a shortcut has been activated to jump to a chorus, verse, + etc. """ + #FIXME: translatable verse types verse_type = unicode(self.sender().objectName()) - keys = self.slideList.keys() + # Remove the "Live" or "Preview" suffix. + verse_type = verse_type[:-len(self.typePrefix)] key = u'' if verse_type.startswith(u'verseShortcut'): key = u'V%s' % verse_type[13:] - elif verse_type == u'chorusShortcut': + elif verse_type.startswith(u'chorusShortcut'): key = u'C1' - elif verse_type == u'bridgeShortcut': + elif verse_type.startswith(u'bridgeShortcut'): key = u'B1' - elif verse_type == u'preChorusShortcut': + elif verse_type.startswith(u'preChorusShortcut'): key = u'P1' - elif verse_type == u'introShortcut': + elif verse_type.startswith(u'introShortcut'): key = u'I1' - elif verse_type == u'endingShortcut': + elif verse_type.startswith(u'endingShortcut'): key = u'E1' - elif verse_type == u'otherShortcut': + elif verse_type.startswith(u'otherShortcut'): key = u'O1' - if key in keys: + if key in self.slideList.keys(): self.__checkUpdateSelectedSlide(self.slideList[key]) self.slideSelected() - print self.slideList def setPreviewHotkeys(self, parent=None): self.previousItem.setObjectName(u'previousItemPreview') self.nextItem.setObjectName(u'nextItemPreview') action_list = ActionList.get_instance() + action_list.add_category( + UiStrings().PreviewToolbar, CategoryOrder.standardToolbar) action_list.add_action(self.previousItem) action_list.add_action(self.nextItem) From a42940b6bb43886458b90546225b2999032c9e0c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 24 Oct 2011 17:36:59 +0200 Subject: [PATCH 06/39] - shortcuts only for live controller - removed v shortcut --- openlp/core/ui/slidecontroller.py | 229 ++++++++++++++---------------- 1 file changed, 104 insertions(+), 125 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index e9f13c7db..aaecb7735 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -322,129 +322,110 @@ class SlideController(QtGui.QWidget): self.slideLayout.insertWidget(0, self.slidePreview) self.grid.addLayout(self.slideLayout, 0, 0, 1, 1) if self.isLive: - category = UiStrings().LiveToolbar - else: - category = UiStrings().PreviewToolbar - self.verseShortcut1 = shortcut_action( - self, u'verseShortcut1%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'V'), QtGui.QKeySequence(u'1')], - self.slideShortcutActivated, category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut1.setText(translate( - 'OpenLP.SlideController', 'Go to "1. Verse"')) - self.verseShortcut2 = shortcut_action( - self, u'verseShortcut2%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'2')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut2.setText(translate( - 'OpenLP.SlideController', 'Go to "2. Verse"')) - self.verseShortcut3 = shortcut_action( - self, u'verseShortcut3%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'3')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut3.setText(translate( - 'OpenLP.SlideController', 'Go to "3. Verse"')) - self.verseShortcut4 = shortcut_action( - self, u'verseShortcut4%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'4')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut4.setText(translate( - 'OpenLP.SlideController', 'Go to "4. Verse"')) - self.verseShortcut5 = shortcut_action( - self, u'verseShortcut5%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'5')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut5.setText(translate( - 'OpenLP.SlideController', 'Go to "5. Verse"')) - self.verseShortcut6 = shortcut_action( - self, u'verseShortcut6%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'6')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut6.setText(translate( - 'OpenLP.SlideController', 'Go to "6. Verse"')) - self.verseShortcut7 = shortcut_action( - self, u'verseShortcut7%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'7')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut7.setText(translate( - 'OpenLP.SlideController', 'Go to "7. Verse"')) - self.verseShortcut8 = shortcut_action( - self, u'verseShortcut8%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'8')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut8.setText(translate( - 'OpenLP.SlideController', 'Go to "8. Verse"')) - self.verseShortcut9 = shortcut_action( - self, u'verseShortcut9%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'9')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut9.setText(translate( - 'OpenLP.SlideController', 'Go to "9. Verse"')) - self.verseShortcut10 = shortcut_action( - self, u'verseShortcut10%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'0')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut10.setText(translate( - 'OpenLP.SlideController', 'Go to "10. Verse"')) - self.chorusShortcut = shortcut_action( - self, u'chorusShortcut%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'C')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.chorusShortcut.setText(translate( - 'OpenLP.SlideController', 'Go to "Chorus"')) - self.bridgeShortcut = shortcut_action( - self, u'bridgeShortcut%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'B')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.bridgeShortcut.setText(translate( - 'OpenLP.SlideController', 'Go to "Bridge"')) - self.preChorusShortcut = shortcut_action( - self, u'preChorusShortcut%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'P')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.preChorusShortcut.setText(translate( - 'OpenLP.SlideController', 'Go to "Pre-Chorus"')) - self.introShortcut = shortcut_action( - self, u'introShortcut%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'I')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.introShortcut.setText(translate( - 'OpenLP.SlideController', 'Go to "Intro"')) - self.endingShortcut = shortcut_action( - self, u'endingShortcut%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'E')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.endingShortcut.setText(translate( - 'OpenLP.SlideController', 'Go to "Ending"')) - self.otherShortcut = shortcut_action( - self, u'otherShortcut%s' % self.typePrefix.capitalize(), - [QtGui.QKeySequence(u'O')], self.slideShortcutActivated, - category=category, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.otherShortcut.setText(translate( - 'OpenLP.SlideController', 'Go to "Other"')) - self.previewListWidget.addActions([ - self.verseShortcut1, self.verseShortcut2, self.verseShortcut3, - self.verseShortcut4, self.verseShortcut5, self.verseShortcut6, - self.verseShortcut7, self.verseShortcut8, self.verseShortcut9, - self.verseShortcut10, self.chorusShortcut, self.bridgeShortcut, - self.preChorusShortcut, self.introShortcut, self.endingShortcut, - self.otherShortcut - ]) + self.verseShortcut1 = shortcut_action(self, u'verseShortcut1', + [QtGui.QKeySequence(u'1')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut1.setText(translate( + 'OpenLP.SlideController', 'Go to "1. Verse"')) + self.verseShortcut2 = shortcut_action(self, u'verseShortcut2', + [QtGui.QKeySequence(u'2')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut2.setText(translate( + 'OpenLP.SlideController', 'Go to "2. Verse"')) + self.verseShortcut3 = shortcut_action(self, u'verseShortcut3', + [QtGui.QKeySequence(u'3')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut3.setText(translate( + 'OpenLP.SlideController', 'Go to "3. Verse"')) + self.verseShortcut4 = shortcut_action(self, u'verseShortcut4', + [QtGui.QKeySequence(u'4')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut4.setText(translate( + 'OpenLP.SlideController', 'Go to "4. Verse"')) + self.verseShortcut5 = shortcut_action(self, u'verseShortcut5', + [QtGui.QKeySequence(u'5')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut5.setText(translate( + 'OpenLP.SlideController', 'Go to "5. Verse"')) + self.verseShortcut6 = shortcut_action(self, u'verseShortcut6', + [QtGui.QKeySequence(u'6')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut6.setText(translate( + 'OpenLP.SlideController', 'Go to "6. Verse"')) + self.verseShortcut7 = shortcut_action(self, u'verseShortcut7', + [QtGui.QKeySequence(u'7')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut7.setText(translate( + 'OpenLP.SlideController', 'Go to "7. Verse"')) + self.verseShortcut8 = shortcut_action(self, u'verseShortcut8', + [QtGui.QKeySequence(u'8')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut8.setText(translate( + 'OpenLP.SlideController', 'Go to "8. Verse"')) + self.verseShortcut9 = shortcut_action(self, u'verseShortcut9', + [QtGui.QKeySequence(u'9')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut9.setText(translate( + 'OpenLP.SlideController', 'Go to "9. Verse"')) + self.verseShortcut10 = shortcut_action(self, u'verseShortcut10', + [QtGui.QKeySequence(u'0')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut10.setText(translate( + 'OpenLP.SlideController', 'Go to "10. Verse"')) + self.chorusShortcut = shortcut_action(self, u'chorusShortcut', + [QtGui.QKeySequence(u'C')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.chorusShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Chorus"')) + self.bridgeShortcut = shortcut_action(self, u'bridgeShortcut', + [QtGui.QKeySequence(u'B')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.bridgeShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Bridge"')) + self.preChorusShortcut = shortcut_action(self, u'preChorusShortcut', + [QtGui.QKeySequence(u'P')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.preChorusShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Pre-Chorus"')) + self.introShortcut = shortcut_action(self, u'introShortcut', + [QtGui.QKeySequence(u'I')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.introShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Intro"')) + self.endingShortcut = shortcut_action(self, u'endingShortcut', + [QtGui.QKeySequence(u'E')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.endingShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Ending"')) + self.otherShortcut = shortcut_action(self, u'otherShortcut', + [QtGui.QKeySequence(u'O')], self.slideShortcutActivated, + category=UiStrings().LiveToolbar, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.otherShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Other"')) + self.previewListWidget.addActions([ + self.verseShortcut1, self.verseShortcut2, self.verseShortcut3, + self.verseShortcut4, self.verseShortcut5, self.verseShortcut6, + self.verseShortcut7, self.verseShortcut8, self.verseShortcut9, + self.verseShortcut10, self.chorusShortcut, self.bridgeShortcut, + self.preChorusShortcut, self.introShortcut, self.endingShortcut, + self.otherShortcut + ]) # Signals QtCore.QObject.connect(self.previewListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected) @@ -498,8 +479,6 @@ class SlideController(QtGui.QWidget): """ #FIXME: translatable verse types verse_type = unicode(self.sender().objectName()) - # Remove the "Live" or "Preview" suffix. - verse_type = verse_type[:-len(self.typePrefix)] key = u'' if verse_type.startswith(u'verseShortcut'): key = u'V%s' % verse_type[13:] From ee960bb88c083b98d31d187ad034872414ce815a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 24 Oct 2011 18:13:30 +0200 Subject: [PATCH 07/39] use '1' etc shortcuts for bible verses, images, etc --- openlp/core/lib/ui.py | 1 - openlp/core/ui/slidecontroller.py | 8 ++++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/openlp/core/lib/ui.py b/openlp/core/lib/ui.py index 2e9669e89..756df36c3 100644 --- a/openlp/core/lib/ui.py +++ b/openlp/core/lib/ui.py @@ -105,7 +105,6 @@ class UiStrings(object): self.PlaySlidesInLoop = translate('OpenLP.Ui','Play Slides in Loop') self.PlaySlidesToEnd = translate('OpenLP.Ui','Play Slides to End') self.Preview = translate('OpenLP.Ui', 'Preview') - self.PreviewToolbar = translate('OpenLP.Ui', 'Preview Toolbar') self.PrintService = translate('OpenLP.Ui', 'Print Service') self.ReplaceBG = translate('OpenLP.Ui', 'Replace Background') self.ReplaceLiveBG = translate('OpenLP.Ui', 'Replace live background.') diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index aaecb7735..6eb0bf2e4 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -497,13 +497,15 @@ class SlideController(QtGui.QWidget): if key in self.slideList.keys(): self.__checkUpdateSelectedSlide(self.slideList[key]) self.slideSelected() + elif key.startswith(u'V'): + if key[1:] in self.slideList.keys(): + self.__checkUpdateSelectedSlide(self.slideList[key[1:]]) + self.slideSelected() def setPreviewHotkeys(self, parent=None): self.previousItem.setObjectName(u'previousItemPreview') self.nextItem.setObjectName(u'nextItemPreview') action_list = ActionList.get_instance() - action_list.add_category( - UiStrings().PreviewToolbar, CategoryOrder.standardToolbar) action_list.add_action(self.previousItem) action_list.add_action(self.nextItem) @@ -783,6 +785,7 @@ class SlideController(QtGui.QWidget): self.onSongBarHandler) else: row += 1 + self.slideList[unicode(row)] = row - 1 item.setText(frame[u'text']) else: label = QtGui.QLabel() @@ -800,6 +803,7 @@ class SlideController(QtGui.QWidget): self.previewListWidget.setCellWidget(framenumber, 0, label) slideHeight = width * self.parent().renderer.screen_ratio row += 1 + self.slideList[unicode(row)] = row - 1 text.append(unicode(row)) self.previewListWidget.setItem(framenumber, 0, item) if slideHeight != 0: From 33960f9eb4515afeefd23135e65dea1dd66b411a Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 25 Oct 2011 18:31:22 +0200 Subject: [PATCH 08/39] allow all possible 'shortcut' combinations --- openlp/core/ui/slidecontroller.py | 134 +++++++++++++++--------------- 1 file changed, 68 insertions(+), 66 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 6eb0bf2e4..ed3572df3 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -322,66 +322,45 @@ class SlideController(QtGui.QWidget): self.slideLayout.insertWidget(0, self.slidePreview) self.grid.addLayout(self.slideLayout, 0, 0, 1, 1) if self.isLive: - self.verseShortcut1 = shortcut_action(self, u'verseShortcut1', - [QtGui.QKeySequence(u'1')], self.slideShortcutActivated, + self.old_shortcut = u'' + self.shortcutTimer = QtCore.QTimer() + self.shortcutTimer.setSingleShot(True) + self.verseShortcut = shortcut_action(self, u'verseShortcut', + [QtGui.QKeySequence(u'V')], self.slideShortcutActivated, category=UiStrings().LiveToolbar, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut1.setText(translate( - 'OpenLP.SlideController', 'Go to "1. Verse"')) - self.verseShortcut2 = shortcut_action(self, u'verseShortcut2', - [QtGui.QKeySequence(u'2')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut2.setText(translate( - 'OpenLP.SlideController', 'Go to "2. Verse"')) - self.verseShortcut3 = shortcut_action(self, u'verseShortcut3', - [QtGui.QKeySequence(u'3')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut3.setText(translate( - 'OpenLP.SlideController', 'Go to "3. Verse"')) - self.verseShortcut4 = shortcut_action(self, u'verseShortcut4', - [QtGui.QKeySequence(u'4')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut4.setText(translate( - 'OpenLP.SlideController', 'Go to "4. Verse"')) - self.verseShortcut5 = shortcut_action(self, u'verseShortcut5', - [QtGui.QKeySequence(u'5')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut5.setText(translate( - 'OpenLP.SlideController', 'Go to "5. Verse"')) - self.verseShortcut6 = shortcut_action(self, u'verseShortcut6', - [QtGui.QKeySequence(u'6')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut6.setText(translate( - 'OpenLP.SlideController', 'Go to "6. Verse"')) - self.verseShortcut7 = shortcut_action(self, u'verseShortcut7', - [QtGui.QKeySequence(u'7')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut7.setText(translate( - 'OpenLP.SlideController', 'Go to "7. Verse"')) - self.verseShortcut8 = shortcut_action(self, u'verseShortcut8', - [QtGui.QKeySequence(u'8')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut8.setText(translate( - 'OpenLP.SlideController', 'Go to "8. Verse"')) - self.verseShortcut9 = shortcut_action(self, u'verseShortcut9', - [QtGui.QKeySequence(u'9')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, - context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut9.setText(translate( - 'OpenLP.SlideController', 'Go to "9. Verse"')) - self.verseShortcut10 = shortcut_action(self, u'verseShortcut10', + self.verseShortcut.setText(translate( + 'OpenLP.SlideController', 'Go to "Verse"')) + self.verseShortcut0 = shortcut_action(self, u'0', [QtGui.QKeySequence(u'0')], self.slideShortcutActivated, - category=UiStrings().LiveToolbar, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut10.setText(translate( - 'OpenLP.SlideController', 'Go to "10. Verse"')) + self.verseShortcut1 = shortcut_action(self, u'1', + [QtGui.QKeySequence(u'1')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut2 = shortcut_action(self, u'2', + [QtGui.QKeySequence(u'2')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut3 = shortcut_action(self, u'3', + [QtGui.QKeySequence(u'3')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut4 = shortcut_action(self, u'4', + [QtGui.QKeySequence(u'4')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut5 = shortcut_action(self, u'5', + [QtGui.QKeySequence(u'5')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut6 = shortcut_action(self, u'6', + [QtGui.QKeySequence(u'6')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut7 = shortcut_action(self, u'7', + [QtGui.QKeySequence(u'7')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut8 = shortcut_action(self, u'8', + [QtGui.QKeySequence(u'8')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) + self.verseShortcut9 = shortcut_action(self, u'9', + [QtGui.QKeySequence(u'9')], self.slideShortcutActivated, + context=QtCore.Qt.WidgetWithChildrenShortcut) self.chorusShortcut = shortcut_action(self, u'chorusShortcut', [QtGui.QKeySequence(u'C')], self.slideShortcutActivated, category=UiStrings().LiveToolbar, @@ -418,14 +397,17 @@ class SlideController(QtGui.QWidget): context=QtCore.Qt.WidgetWithChildrenShortcut) self.otherShortcut.setText(translate( 'OpenLP.SlideController', 'Go to "Other"')) - self.previewListWidget.addActions([ + self.previewListWidget.addActions([self.verseShortcut, self.verseShortcut1, self.verseShortcut2, self.verseShortcut3, self.verseShortcut4, self.verseShortcut5, self.verseShortcut6, self.verseShortcut7, self.verseShortcut8, self.verseShortcut9, - self.verseShortcut10, self.chorusShortcut, self.bridgeShortcut, + self.verseShortcut0, self.chorusShortcut, self.bridgeShortcut, self.preChorusShortcut, self.introShortcut, self.endingShortcut, self.otherShortcut ]) + QtCore.QObject.connect( + self.shortcutTimer, QtCore.SIGNAL(u'timeout()'), + self.slideShortcutActivated) # Signals QtCore.QObject.connect(self.previewListWidget, QtCore.SIGNAL(u'clicked(QModelIndex)'), self.onSlideSelected) @@ -477,26 +459,46 @@ class SlideController(QtGui.QWidget): Called, when a shortcut has been activated to jump to a chorus, verse, etc. """ + return_ = False + if not self.old_shortcut or self.shortcutTimer.isActive(): + self.shortcutTimer.start(350) + return_ = True #FIXME: translatable verse types + # TODO: Do not restart timer, when the current key is valid (and there + # no other combination is valid). verse_type = unicode(self.sender().objectName()) key = u'' - if verse_type.startswith(u'verseShortcut'): - key = u'V%s' % verse_type[13:] + if verse_type.startswith(u'verseShortcut'): + key = u'V' elif verse_type.startswith(u'chorusShortcut'): - key = u'C1' + key = u'C' elif verse_type.startswith(u'bridgeShortcut'): - key = u'B1' + key = u'B' elif verse_type.startswith(u'preChorusShortcut'): - key = u'P1' + key = u'P' elif verse_type.startswith(u'introShortcut'): - key = u'I1' + key = u'I' elif verse_type.startswith(u'endingShortcut'): - key = u'E1' + key = u'E' elif verse_type.startswith(u'otherShortcut'): - key = u'O1' + key = u'O' + elif verse_type.isnumeric(): + key = verse_type + if return_: + self.old_shortcut += key + print u'old', self.old_shortcut + return + key = self.old_shortcut + key + print u'key', key + self.old_shortcut = u'' if key in self.slideList.keys(): self.__checkUpdateSelectedSlide(self.slideList[key]) self.slideSelected() + elif len(key) == 1: + key += u'1' + if key in self.slideList.keys(): + self.__checkUpdateSelectedSlide(self.slideList[key]) + self.slideSelected() elif key.startswith(u'V'): if key[1:] in self.slideList.keys(): self.__checkUpdateSelectedSlide(self.slideList[key[1:]]) From 35875b700809378f530c04a668c65bbed4102c12 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Tue, 25 Oct 2011 20:09:35 -0400 Subject: [PATCH 09/39] Added code to point pyinstaller to the OpenLP pyinstaller hooks directory --- scripts/windows-builder.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/windows-builder.py b/scripts/windows-builder.py index b7bf70472..b94ba93cc 100644 --- a/scripts/windows-builder.py +++ b/scripts/windows-builder.py @@ -48,10 +48,10 @@ Inno Setup 5 Sphinx This is used to build the documentation. The documentation trunk must be at - the same directory level as Openlp trunk and named "documentation" + the same directory level as Openlp trunk and named "documentation". HTML Help Workshop - This is used to create the help file + This is used to create the help file. PyInstaller PyInstaller should be a checkout of revision 1470 of trunk, and in a @@ -61,14 +61,10 @@ PyInstaller To install PyInstaller, first checkout trunk from Subversion. The easiest way is to install TortoiseSVN and then checkout the following URL to a - directory called "pyinstaller":: + directory called "pyinstaller". http://svn.pyinstaller.org/trunk - Then you need to copy the two hook-*.py files from the "pyinstaller" - subdirectory in OpenLP's "resources" directory into PyInstaller's - "PyInstaller/hooks" directory. - Bazaar You need the command line "bzr" client installed. @@ -79,7 +75,7 @@ OpenLP Visual C++ 2008 Express Edition This is to build pptviewlib.dll, the library for controlling the - PowerPointViewer + PowerPointViewer. windows-builder.py This script, of course. It should be in the "scripts" directory of OpenLP. @@ -89,6 +85,8 @@ psvince.dll running on the users machine prior to the setup. If OpenLP is running, the install will fail. The dll can be obtained from here: http://www.vincenzo.net/isxkb/index.php?title=PSVince) + + The dll is presently included in .\resources\windows Mako Mako Templates for Python. This package is required for building the @@ -149,6 +147,7 @@ build_path = os.path.join(branch_path, u'build') dist_path = os.path.join(branch_path, u'dist', u'OpenLP') pptviewlib_path = os.path.join(source_path, u'plugins', u'presentations', u'lib', u'pptviewlib') +hooks_path = os.path.join(branch_path , u'resources', u'pyinstaller') def update_code(): os.chdir(branch_path) @@ -173,7 +172,8 @@ def run_pyinstaller(): pyinstaller = Popen((python_exe, pyi_build, u'--noconfirm', u'--windowed', - u'--noupx', + u'--noupx', + u'--additional-hooks-dir', hooks_path, u'-o', branch_path, u'-i', win32_icon, u'-p', branch_path, From c12a7b09013e275b3312c958b582eba98c0e710d Mon Sep 17 00:00:00 2001 From: M2j Date: Wed, 26 Oct 2011 09:40:12 +0200 Subject: [PATCH 10/39] add uno to the dependency check --- scripts/check_dependencies.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/check_dependencies.py b/scripts/check_dependencies.py index dd2907ba9..d1ec2228b 100755 --- a/scripts/check_dependencies.py +++ b/scripts/check_dependencies.py @@ -73,6 +73,7 @@ MODULES = [ 'BeautifulSoup', 'mako', 'migrate', + 'uno', ] From c9c31990e2682f9d3efe08c27e58655b69ef88ef Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 26 Oct 2011 16:53:51 +0200 Subject: [PATCH 11/39] fixed detection --- openlp/core/ui/slidecontroller.py | 68 +++++++++++++++++-------------- 1 file changed, 37 insertions(+), 31 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index ed3572df3..4c3efcdbb 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -324,6 +324,7 @@ class SlideController(QtGui.QWidget): if self.isLive: self.old_shortcut = u'' self.shortcutTimer = QtCore.QTimer() + self.shortcutTimer.setObjectName(u'shortcutTimer') self.shortcutTimer.setSingleShot(True) self.verseShortcut = shortcut_action(self, u'verseShortcut', [QtGui.QKeySequence(u'V')], self.slideShortcutActivated, @@ -331,34 +332,34 @@ class SlideController(QtGui.QWidget): context=QtCore.Qt.WidgetWithChildrenShortcut) self.verseShortcut.setText(translate( 'OpenLP.SlideController', 'Go to "Verse"')) - self.verseShortcut0 = shortcut_action(self, u'0', + self.shortcut0 = shortcut_action(self, u'0', [QtGui.QKeySequence(u'0')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut1 = shortcut_action(self, u'1', + self.shortcut1 = shortcut_action(self, u'1', [QtGui.QKeySequence(u'1')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut2 = shortcut_action(self, u'2', + self.shortcut2 = shortcut_action(self, u'2', [QtGui.QKeySequence(u'2')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut3 = shortcut_action(self, u'3', + self.shortcut3 = shortcut_action(self, u'3', [QtGui.QKeySequence(u'3')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut4 = shortcut_action(self, u'4', + self.shortcut4 = shortcut_action(self, u'4', [QtGui.QKeySequence(u'4')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut5 = shortcut_action(self, u'5', + self.shortcut5 = shortcut_action(self, u'5', [QtGui.QKeySequence(u'5')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut6 = shortcut_action(self, u'6', + self.shortcut6 = shortcut_action(self, u'6', [QtGui.QKeySequence(u'6')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut7 = shortcut_action(self, u'7', + self.shortcut7 = shortcut_action(self, u'7', [QtGui.QKeySequence(u'7')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut8 = shortcut_action(self, u'8', + self.shortcut8 = shortcut_action(self, u'8', [QtGui.QKeySequence(u'8')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) - self.verseShortcut9 = shortcut_action(self, u'9', + self.shortcut9 = shortcut_action(self, u'9', [QtGui.QKeySequence(u'9')], self.slideShortcutActivated, context=QtCore.Qt.WidgetWithChildrenShortcut) self.chorusShortcut = shortcut_action(self, u'chorusShortcut', @@ -397,11 +398,11 @@ class SlideController(QtGui.QWidget): context=QtCore.Qt.WidgetWithChildrenShortcut) self.otherShortcut.setText(translate( 'OpenLP.SlideController', 'Go to "Other"')) - self.previewListWidget.addActions([self.verseShortcut, - self.verseShortcut1, self.verseShortcut2, self.verseShortcut3, - self.verseShortcut4, self.verseShortcut5, self.verseShortcut6, - self.verseShortcut7, self.verseShortcut8, self.verseShortcut9, - self.verseShortcut0, self.chorusShortcut, self.bridgeShortcut, + self.previewListWidget.addActions([ + self.shortcut0. self.shortcut1, self.shortcut2, self.shortcut3, + self.shortcut4, self.shortcut5, self.shortcut6, self.shortcut7, + self.shortcut8, self.shortcut9, self.verseShortcut, + self.chorusShortcut, self.bridgeShortcut, self.preChorusShortcut, self.introShortcut, self.endingShortcut, self.otherShortcut ]) @@ -459,13 +460,7 @@ class SlideController(QtGui.QWidget): Called, when a shortcut has been activated to jump to a chorus, verse, etc. """ - return_ = False - if not self.old_shortcut or self.shortcutTimer.isActive(): - self.shortcutTimer.start(350) - return_ = True #FIXME: translatable verse types - # TODO: Do not restart timer, when the current key is valid (and there - # no other combination is valid). verse_type = unicode(self.sender().objectName()) key = u'' if verse_type.startswith(u'verseShortcut'): @@ -484,25 +479,36 @@ class SlideController(QtGui.QWidget): key = u'O' elif verse_type.isnumeric(): key = verse_type - if return_: + # The timer was not interrupted by a user input, thus it timed out. + elif verse_type == u'shortcutTimer': + key = self.old_shortcut + self.old_shortcut = u'' + keys = self.slideList.keys() + if verse_type != u'shortcutTimer': self.old_shortcut += key - print u'old', self.old_shortcut + self.shortcutTimer.start(350) return +# matches = [match for match in keys if match.startswith(key)] +# # Stop here and start the timer. +# if len(matches) > 1: +# self.shortcutTimer.start(350) +# return +# # Stop the timer and use the match we have. +# elif len(matches) == 1: +# print u'exactly one match', matches[0] +# self.shortcutTimer.stop() +# key = matches[0] +# self.old_shortcut = u'' key = self.old_shortcut + key - print u'key', key - self.old_shortcut = u'' - if key in self.slideList.keys(): + if key in keys: self.__checkUpdateSelectedSlide(self.slideList[key]) self.slideSelected() + #TODO: remove and use list with matches. elif len(key) == 1: key += u'1' - if key in self.slideList.keys(): + if key in keys: self.__checkUpdateSelectedSlide(self.slideList[key]) self.slideSelected() - elif key.startswith(u'V'): - if key[1:] in self.slideList.keys(): - self.__checkUpdateSelectedSlide(self.slideList[key[1:]]) - self.slideSelected() def setPreviewHotkeys(self, parent=None): self.previousItem.setObjectName(u'previousItemPreview') From 360843baf72a3662de9668c37225e6eebf6c4180 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 26 Oct 2011 21:19:42 +0200 Subject: [PATCH 12/39] fixed spelling mistake --- openlp/core/ui/slidecontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 4c3efcdbb..5512ee36d 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -399,7 +399,7 @@ class SlideController(QtGui.QWidget): self.otherShortcut.setText(translate( 'OpenLP.SlideController', 'Go to "Other"')) self.previewListWidget.addActions([ - self.shortcut0. self.shortcut1, self.shortcut2, self.shortcut3, + self.shortcut0, self.shortcut1, self.shortcut2, self.shortcut3, self.shortcut4, self.shortcut5, self.shortcut6, self.shortcut7, self.shortcut8, self.shortcut9, self.verseShortcut, self.chorusShortcut, self.bridgeShortcut, From fe3453a7a5f2b7810dc3a3800409cab9dfe8434d Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Thu, 27 Oct 2011 17:06:40 -0400 Subject: [PATCH 13/39] Fixed the documentation section of the script --- scripts/windows-builder.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/windows-builder.py b/scripts/windows-builder.py index b94ba93cc..170d15e83 100644 --- a/scripts/windows-builder.py +++ b/scripts/windows-builder.py @@ -61,7 +61,7 @@ PyInstaller To install PyInstaller, first checkout trunk from Subversion. The easiest way is to install TortoiseSVN and then checkout the following URL to a - directory called "pyinstaller". + directory called "pyinstaller":: http://svn.pyinstaller.org/trunk @@ -83,17 +83,19 @@ windows-builder.py psvince.dll This dll is used during the actual install of OpenLP to check if OpenLP is running on the users machine prior to the setup. If OpenLP is running, - the install will fail. The dll can be obtained from here: - http://www.vincenzo.net/isxkb/index.php?title=PSVince) + the install will fail. The dll can be obtained from here:: + + http://www.vincenzo.net/isxkb/index.php?title=PSVince) - The dll is presently included in .\resources\windows + The dll is presently included in .\\resources\\windows Mako Mako Templates for Python. This package is required for building the remote plugin. It can be installed by going to your python_directory\scripts\.. and running "easy_install Mako". If you do not - have easy_install, the Mako package can be obtained here: - http://www.makotemplates.org/download.html + have easy_install, the Mako package can be obtained here:: + + http://www.makotemplates.org/download.html """ From f522c79b1ea90b4d3f08d75a5d86a2baf3066e8b Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Fri, 28 Oct 2011 09:28:57 -0400 Subject: [PATCH 14/39] Added sqlalchemy-migrate to comments section. Made some changes to comments section to preserve links. --- scripts/windows-builder.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/windows-builder.py b/scripts/windows-builder.py index 170d15e83..9076971cb 100644 --- a/scripts/windows-builder.py +++ b/scripts/windows-builder.py @@ -83,7 +83,7 @@ windows-builder.py psvince.dll This dll is used during the actual install of OpenLP to check if OpenLP is running on the users machine prior to the setup. If OpenLP is running, - the install will fail. The dll can be obtained from here:: + the install will fail. The dll can be obtained from here: http://www.vincenzo.net/isxkb/index.php?title=PSVince) @@ -93,10 +93,16 @@ Mako Mako Templates for Python. This package is required for building the remote plugin. It can be installed by going to your python_directory\scripts\.. and running "easy_install Mako". If you do not - have easy_install, the Mako package can be obtained here:: + have easy_install, the Mako package can be obtained here: http://www.makotemplates.org/download.html - + +Sqlalchemy Migrate + Required for the data-bases used in OpenLP. The package can be + obtained here: + + http://code.google.com/p/sqlalchemy-migrate/ + """ import os From 8e853f10b1d2f4b79b7b062e624069b00678eb5b Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 29 Oct 2011 10:33:48 +0100 Subject: [PATCH 15/39] Fix crash with alerts over video Change default to bottom from middle Remove unused from from previous merge Fixes: https://launchpad.net/bugs/875798, https://launchpad.net/bugs/883414 --- openlp/core/lib/htmlbuilder.py | 21 --------------------- openlp/core/ui/maindisplay.py | 6 +++--- openlp/plugins/alerts/lib/alertsmanager.py | 5 +++-- openlp/plugins/alerts/lib/alertstab.py | 2 +- 4 files changed, 7 insertions(+), 27 deletions(-) diff --git a/openlp/core/lib/htmlbuilder.py b/openlp/core/lib/htmlbuilder.py index 863943e40..5dfe00d36 100644 --- a/openlp/core/lib/htmlbuilder.py +++ b/openlp/core/lib/htmlbuilder.py @@ -610,24 +610,3 @@ def build_footer_css(item, height): theme.font_footer_size, theme.font_footer_color) return lyrics_html -def build_alert_css(alertTab, width): - """ - Build the display of the footer - - ``alertTab`` - Details from the Alert tab for fonts etc - """ - style = u""" - width: %spx; - vertical-align: %s; - font-family: %s; - font-size: %spt; - color: %s; - background-color: %s; - """ - if not alertTab: - return u'' - align = VerticalType.Names[alertTab.location] - alert = style % (width, align, alertTab.font_face, alertTab.font_size, - alertTab.font_color, alertTab.bg_color) - return alert diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index aa94454b7..4077181ab 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -213,7 +213,7 @@ class MainDisplay(QtGui.QGraphicsView): self.frame.evaluateJavaScript(u'show_text("%s")' % slide.replace(u'\\', u'\\\\').replace(u'\"', u'\\\"')) - def alert(self, text): + def alert(self, text, location): """ Display an alert. @@ -241,10 +241,10 @@ class MainDisplay(QtGui.QGraphicsView): alert_height = int(height.toString()) shrinkItem.resize(self.width(), alert_height) shrinkItem.setVisible(True) - if self.alertTab.location == 1: + if location == 1: shrinkItem.move(self.screen[u'size'].left(), (self.screen[u'size'].height() - alert_height) / 2) - elif self.alertTab.location == 2: + elif location == 2: shrinkItem.move(self.screen[u'size'].left(), self.screen[u'size'].height() - alert_height) else: diff --git a/openlp/plugins/alerts/lib/alertsmanager.py b/openlp/plugins/alerts/lib/alertsmanager.py index 8e91aecf5..e73273fe7 100644 --- a/openlp/plugins/alerts/lib/alertsmanager.py +++ b/openlp/plugins/alerts/lib/alertsmanager.py @@ -85,7 +85,7 @@ class AlertsManager(QtCore.QObject): return text = self.alertList.pop(0) alertTab = self.parent().settings_tab - self.parent().liveController.display.alert(text) + self.parent().liveController.display.alert(text, alertTab.location) # Check to see if we have a timer running. if self.timer_id == 0: self.timer_id = self.startTimer(int(alertTab.timeout) * 1000) @@ -100,7 +100,8 @@ class AlertsManager(QtCore.QObject): """ log.debug(u'timer event') if event.timerId() == self.timer_id: - self.parent().liveController.display.alert(u'') + alertTab = self.parent().settings_tab + self.parent().liveController.display.alert(u'', alertTab.location) self.killTimer(self.timer_id) self.timer_id = 0 self.generateAlert() diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 8720c5111..8fd2cb3aa 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -159,7 +159,7 @@ class AlertsTab(SettingsTab): self.font_face = unicode(settings.value( u'font face', QtCore.QVariant(QtGui.QFont().family())).toString()) self.location = settings.value( - u'location', QtCore.QVariant(1)).toInt()[0] + u'location', QtCore.QVariant(2)).toInt()[0] settings.endGroup() self.fontSizeSpinBox.setValue(self.font_size) self.timeoutSpinBox.setValue(self.timeout) From ea4cb7f7edc99ad660f921d41a52f32918412208 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 29 Oct 2011 14:21:54 +0100 Subject: [PATCH 16/39] Add Class instead of magic numbers --- openlp/core/ui/__init__.py | 18 ++++++++++++++++++ openlp/core/ui/maindisplay.py | 6 +++--- openlp/plugins/alerts/lib/alertstab.py | 3 ++- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 7d2dfa0ba..f5fece1f0 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -52,6 +52,24 @@ class HideMode(object): Theme = 2 Screen = 3 +class Location(object): + """ + This is an enumeration class which specifies the different modes of hiding + the display. + + ``Top`` + Place the text at the top of the screen. + + ``Middle`` + Place the text in the middle of the screen. + + ``Bottom`` + Place the text at the bottom of the screen. + """ + Top = 0 + Middle = 1 + Bottom = 2 + from firsttimeform import FirstTimeForm from firsttimelanguageform import FirstTimeLanguageForm from themelayoutform import ThemeLayoutForm diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 4077181ab..90203922f 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -37,7 +37,7 @@ from PyQt4.phonon import Phonon from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \ translate, PluginManager -from openlp.core.ui import HideMode, ScreenList +from openlp.core.ui import HideMode, ScreenList, Location log = logging.getLogger(__name__) @@ -241,10 +241,10 @@ class MainDisplay(QtGui.QGraphicsView): alert_height = int(height.toString()) shrinkItem.resize(self.width(), alert_height) shrinkItem.setVisible(True) - if location == 1: + if location == Location.Middle: shrinkItem.move(self.screen[u'size'].left(), (self.screen[u'size'].height() - alert_height) / 2) - elif location == 2: + elif location == Location.Bottom: shrinkItem.move(self.screen[u'size'].left(), self.screen[u'size'].height() - alert_height) else: diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 8fd2cb3aa..10bec702d 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -28,6 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate, Receiver +from openlp.core.ui import Location from openlp.core.lib.ui import UiStrings, create_valign_combo class AlertsTab(SettingsTab): @@ -159,7 +160,7 @@ class AlertsTab(SettingsTab): self.font_face = unicode(settings.value( u'font face', QtCore.QVariant(QtGui.QFont().family())).toString()) self.location = settings.value( - u'location', QtCore.QVariant(2)).toInt()[0] + u'location', QtCore.QVariant(Location.Bottom)).toInt()[0] settings.endGroup() self.fontSizeSpinBox.setValue(self.font_size) self.timeoutSpinBox.setValue(self.timeout) From c8e9496db1717692bc7ec6584f7b195f1a47919b Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sat, 29 Oct 2011 20:13:11 +0100 Subject: [PATCH 17/39] Fix up review comments --- openlp/core/ui/__init__.py | 6 +++--- openlp/core/ui/maindisplay.py | 6 +++--- openlp/plugins/alerts/lib/alertstab.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index f5fece1f0..6a04a080b 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -52,10 +52,10 @@ class HideMode(object): Theme = 2 Screen = 3 -class Location(object): +class AlertLocation(object): """ - This is an enumeration class which specifies the different modes of hiding - the display. + This is an enumeration class which controls where Alerts are placed on the + screen. ``Top`` Place the text at the top of the screen. diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 90203922f..0f932c2f5 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -37,7 +37,7 @@ from PyQt4.phonon import Phonon from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \ translate, PluginManager -from openlp.core.ui import HideMode, ScreenList, Location +from openlp.core.ui import HideMode, ScreenList, AlertLocation log = logging.getLogger(__name__) @@ -241,10 +241,10 @@ class MainDisplay(QtGui.QGraphicsView): alert_height = int(height.toString()) shrinkItem.resize(self.width(), alert_height) shrinkItem.setVisible(True) - if location == Location.Middle: + if location == AlertLocation.Middle: shrinkItem.move(self.screen[u'size'].left(), (self.screen[u'size'].height() - alert_height) / 2) - elif location == Location.Bottom: + elif location == AlertLocation.Bottom: shrinkItem.move(self.screen[u'size'].left(), self.screen[u'size'].height() - alert_height) else: diff --git a/openlp/plugins/alerts/lib/alertstab.py b/openlp/plugins/alerts/lib/alertstab.py index 10bec702d..bd879fef3 100644 --- a/openlp/plugins/alerts/lib/alertstab.py +++ b/openlp/plugins/alerts/lib/alertstab.py @@ -28,7 +28,7 @@ from PyQt4 import QtCore, QtGui from openlp.core.lib import SettingsTab, translate, Receiver -from openlp.core.ui import Location +from openlp.core.ui import AlertLocation from openlp.core.lib.ui import UiStrings, create_valign_combo class AlertsTab(SettingsTab): @@ -160,7 +160,7 @@ class AlertsTab(SettingsTab): self.font_face = unicode(settings.value( u'font face', QtCore.QVariant(QtGui.QFont().family())).toString()) self.location = settings.value( - u'location', QtCore.QVariant(Location.Bottom)).toInt()[0] + u'location', QtCore.QVariant(AlertLocation.Bottom)).toInt()[0] settings.endGroup() self.fontSizeSpinBox.setValue(self.font_size) self.timeoutSpinBox.setValue(self.timeout) From 0ed66b6a9c488d22343c6d361b1023d712280f2d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 30 Oct 2011 21:24:04 +0100 Subject: [PATCH 18/39] fixed alert position not being recalculated properly when changing options --- openlp/plugins/alerts/alertsplugin.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/alerts/alertsplugin.py b/openlp/plugins/alerts/alertsplugin.py index 213c6814f..493f08ba0 100644 --- a/openlp/plugins/alerts/alertsplugin.py +++ b/openlp/plugins/alerts/alertsplugin.py @@ -71,11 +71,24 @@ JAVASCRIPT = """ function update_css(align, font, size, color, bgcolor){ var text = document.getElementById('alert'); - text.style.verticalAlign = align; text.style.fontSize = size + "pt"; text.style.fontFamily = font; text.style.color = color; text.style.backgroundColor = bgcolor; + switch(align) + { + case 'top': + text.style.top = '0px'; + break; + case 'middle': + text.style.top = ((window.innerHeight - text.clientHeight) / 2) + + 'px'; + break; + case 'bottom': + text.style.top = (window.innerHeight - text.clientHeight) + + 'px'; + break; + } } """ CSS = """ From 15e19f9700f57e4ee4dc01b1f8e5dd5b11426839 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sun, 30 Oct 2011 22:38:02 +0100 Subject: [PATCH 19/39] fixed rename errors --- openlp/plugins/songs/lib/oooimport.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/plugins/songs/lib/oooimport.py b/openlp/plugins/songs/lib/oooimport.py index 4a97e43b0..f817bfb45 100644 --- a/openlp/plugins/songs/lib/oooimport.py +++ b/openlp/plugins/songs/lib/oooimport.py @@ -65,7 +65,7 @@ class OooImport(SongImport): if not isinstance(self.importSource, list): return try: - self.start_ooo() + self.startOoo() except NoConnectException as exc: self.logError( self.importSource[0], @@ -145,7 +145,7 @@ class OooImport(SongImport): process.waitForStarted() self.processStarted = True except: - log.exception("start_ooo_process failed") + log.exception("startOooProcess failed") def openOooFile(self, filepath): """ @@ -171,7 +171,7 @@ class OooImport(SongImport): self.importWizard.incrementProgressBar( u'Processing file ' + filepath, 0) except AttributeError: - log.exception("open_ooo_file failed: %s", url) + log.exception("openOooFile failed: %s", url) return def closeOooFile(self): From d1030a7c2d34ddac2e41fbfb0a4d87141849eff9 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 08:08:51 +0100 Subject: [PATCH 20/39] Corrected comment --- openlp/core/ui/maindisplay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index a0b6675a4..fcbfc9108 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -51,7 +51,7 @@ class MainDisplay(QtGui.QGraphicsView): def __init__(self, parent, imageManager, live): if live: QtGui.QGraphicsView.__init__(self) - # Do not overwrite the parent() method. + # Overwrite the parent() method. self.parent = lambda: parent else: QtGui.QGraphicsView.__init__(self, parent) From 2458ffc3bc56d9e04a62ce17acb40311cddb2904 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 08:41:28 +0100 Subject: [PATCH 21/39] completed detection + cleaned detection --- openlp/core/ui/slidecontroller.py | 62 ++++++++++++------------------- 1 file changed, 23 insertions(+), 39 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 5512ee36d..dab9f0744 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -322,7 +322,7 @@ class SlideController(QtGui.QWidget): self.slideLayout.insertWidget(0, self.slidePreview) self.grid.addLayout(self.slideLayout, 0, 0, 1, 1) if self.isLive: - self.old_shortcut = u'' + self.current_shortcut = u'' self.shortcutTimer = QtCore.QTimer() self.shortcutTimer.setObjectName(u'shortcutTimer') self.shortcutTimer.setSingleShot(True) @@ -462,53 +462,37 @@ class SlideController(QtGui.QWidget): """ #FIXME: translatable verse types verse_type = unicode(self.sender().objectName()) - key = u'' if verse_type.startswith(u'verseShortcut'): - key = u'V' + print u'"%s"' % self.current_shortcut + self.current_shortcut = u'V' elif verse_type.startswith(u'chorusShortcut'): - key = u'C' + self.current_shortcut = u'C' elif verse_type.startswith(u'bridgeShortcut'): - key = u'B' + self.current_shortcut = u'B' elif verse_type.startswith(u'preChorusShortcut'): - key = u'P' + self.current_shortcut = u'P' elif verse_type.startswith(u'introShortcut'): - key = u'I' + self.current_shortcut = u'I' elif verse_type.startswith(u'endingShortcut'): - key = u'E' + self.current_shortcut = u'E' elif verse_type.startswith(u'otherShortcut'): - key = u'O' + self.current_shortcut = u'O' elif verse_type.isnumeric(): - key = verse_type - # The timer was not interrupted by a user input, thus it timed out. - elif verse_type == u'shortcutTimer': - key = self.old_shortcut - self.old_shortcut = u'' - keys = self.slideList.keys() - if verse_type != u'shortcutTimer': - self.old_shortcut += key - self.shortcutTimer.start(350) - return -# matches = [match for match in keys if match.startswith(key)] -# # Stop here and start the timer. -# if len(matches) > 1: -# self.shortcutTimer.start(350) -# return -# # Stop the timer and use the match we have. -# elif len(matches) == 1: -# print u'exactly one match', matches[0] -# self.shortcutTimer.stop() -# key = matches[0] -# self.old_shortcut = u'' - key = self.old_shortcut + key - if key in keys: - self.__checkUpdateSelectedSlide(self.slideList[key]) + self.current_shortcut += verse_type + matches = [match for match in self.slideList.keys() + if match.startswith(self.current_shortcut)] + if len(matches) == 1: + self.shortcutTimer.stop() + self.current_shortcut = u'' + self.__checkUpdateSelectedSlide(self.slideList[matches[0]]) self.slideSelected() - #TODO: remove and use list with matches. - elif len(key) == 1: - key += u'1' - if key in keys: - self.__checkUpdateSelectedSlide(self.slideList[key]) - self.slideSelected() + elif verse_type != u'shortcutTimer': + # Start the time as we did not have any match. + self.shortcutTimer.start(350) + else: + # Reset the key sequenze as we do not have any match and the timer + # timed out. + self.current_shortcut = u'' def setPreviewHotkeys(self, parent=None): self.previousItem.setObjectName(u'previousItemPreview') From ffafcaaadc55e022bca6a3de631fd861c67ca09d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 09:44:38 +0100 Subject: [PATCH 22/39] fix for translated verse tags --- openlp/core/ui/slidecontroller.py | 50 +++++++++++++++++++++++++------ 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index dab9f0744..03ec3c16b 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -460,25 +460,57 @@ class SlideController(QtGui.QWidget): Called, when a shortcut has been activated to jump to a chorus, verse, etc. """ - #FIXME: translatable verse types + try: + from openlp.plugins.songs.lib import VerseTypae + SONGS_PLUGIN_AVAILABLE = True + except ImportError: + SONGS_PLUGIN_AVAILABLE = False verse_type = unicode(self.sender().objectName()) if verse_type.startswith(u'verseShortcut'): - print u'"%s"' % self.current_shortcut - self.current_shortcut = u'V' + if SONGS_PLUGIN_AVAILABLE: + self.current_shortcut = \ + VerseType.TranslatedTags[VerseType.Verse] + else: + self.current_shortcut = u'V' elif verse_type.startswith(u'chorusShortcut'): - self.current_shortcut = u'C' + if SONGS_PLUGIN_AVAILABLE: + self.current_shortcut = \ + VerseType.TranslatedTags[VerseType.Chorus] + else: + self.current_shortcut = u'C' elif verse_type.startswith(u'bridgeShortcut'): - self.current_shortcut = u'B' + if SONGS_PLUGIN_AVAILABLE: + self.current_shortcut = \ + VerseType.TranslatedTags[VerseType.Bridge] + else: + self.current_shortcut = u'B' elif verse_type.startswith(u'preChorusShortcut'): - self.current_shortcut = u'P' + if SONGS_PLUGIN_AVAILABLE: + self.current_shortcut = \ + VerseType.TranslatedTags[VerseType.PreChorus] + else: + self.current_shortcut = u'P' elif verse_type.startswith(u'introShortcut'): - self.current_shortcut = u'I' + if SONGS_PLUGIN_AVAILABLE: + self.current_shortcut = \ + VerseType.TranslatedTags[VerseType.Intro] + else: + self.current_shortcut = u'I' elif verse_type.startswith(u'endingShortcut'): - self.current_shortcut = u'E' + if SONGS_PLUGIN_AVAILABLE: + self.current_shortcut = \ + VerseType.TranslatedTags[VerseType.Ending] + else: + self.current_shortcut = u'E' elif verse_type.startswith(u'otherShortcut'): - self.current_shortcut = u'O' + if SONGS_PLUGIN_AVAILABLE: + self.current_shortcut = \ + VerseType.TranslatedTags[VerseType.Other] + else: + self.current_shortcut = u'O' elif verse_type.isnumeric(): self.current_shortcut += verse_type + self.current_shortcut = self.current_shortcut.upper() matches = [match for match in self.slideList.keys() if match.startswith(self.current_shortcut)] if len(matches) == 1: From f346ebebe0354d01421e2a0a2f685580de63df89 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 09:53:18 +0100 Subject: [PATCH 23/39] fixed import and added note --- openlp/core/ui/slidecontroller.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 03ec3c16b..d24cc2784 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -459,9 +459,15 @@ class SlideController(QtGui.QWidget): """ Called, when a shortcut has been activated to jump to a chorus, verse, etc. + + **Note**: This implementation is based on shortcuts. But it rather works + like "key sequenzes". You have to press one key after the other and + **not** at the same time. + For example to jump to "V3" you have to press "V" and afterwards but + within a timeframe of 350ms you have to press "3". """ try: - from openlp.plugins.songs.lib import VerseTypae + from openlp.plugins.songs.lib import VerseType SONGS_PLUGIN_AVAILABLE = True except ImportError: SONGS_PLUGIN_AVAILABLE = False From cac0728d0bdebc7682b92c69c2cd49a7d94f103d Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 09:54:04 +0100 Subject: [PATCH 24/39] fixed spelling --- openlp/core/ui/slidecontroller.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index d24cc2784..a2b7c76de 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -461,7 +461,7 @@ class SlideController(QtGui.QWidget): etc. **Note**: This implementation is based on shortcuts. But it rather works - like "key sequenzes". You have to press one key after the other and + like "key sequences". You have to press one key after the other and **not** at the same time. For example to jump to "V3" you have to press "V" and afterwards but within a timeframe of 350ms you have to press "3". From 5348139cfe23e85fa65153de3af86b793ab3f83f Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 09:55:59 +0100 Subject: [PATCH 25/39] fixed spelling --- openlp/core/ui/slidecontroller.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index a2b7c76de..82d7a6629 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -461,10 +461,10 @@ class SlideController(QtGui.QWidget): etc. **Note**: This implementation is based on shortcuts. But it rather works - like "key sequences". You have to press one key after the other and + like "key sequenes". You have to press one key after the other and **not** at the same time. For example to jump to "V3" you have to press "V" and afterwards but - within a timeframe of 350ms you have to press "3". + within a time frame of 350ms you have to press "3". """ try: from openlp.plugins.songs.lib import VerseType @@ -528,7 +528,7 @@ class SlideController(QtGui.QWidget): # Start the time as we did not have any match. self.shortcutTimer.start(350) else: - # Reset the key sequenze as we do not have any match and the timer + # Reset the key sequence as we do not have any match and the timer # timed out. self.current_shortcut = u'' From 94c99d1b3d9819ff1b3b7a83190e2f7b744cb264 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 10:13:25 +0100 Subject: [PATCH 26/39] fixed detection for more than one match --- openlp/core/ui/slidecontroller.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 82d7a6629..5ccb4dde9 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -517,7 +517,8 @@ class SlideController(QtGui.QWidget): elif verse_type.isnumeric(): self.current_shortcut += verse_type self.current_shortcut = self.current_shortcut.upper() - matches = [match for match in self.slideList.keys() + keys = self.slideList.keys() + matches = [match for match in keys if match.startswith(self.current_shortcut)] if len(matches) == 1: self.shortcutTimer.stop() @@ -528,8 +529,14 @@ class SlideController(QtGui.QWidget): # Start the time as we did not have any match. self.shortcutTimer.start(350) else: - # Reset the key sequence as we do not have any match and the timer - # timed out. + # The timer timed out. + if self.current_shortcut in keys: + # We had more than one match (e. g. "V1" and "V10", but "V1" was + # the slide we wanted to go. + self.__checkUpdateSelectedSlide( + self.slideList[self.current_shortcut]) + self.slideSelected() + # Reset the shortcut. self.current_shortcut = u'' def setPreviewHotkeys(self, parent=None): From 71c6a7315ccdde27873fe38be6a3e41d48d38b4e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 10:14:07 +0100 Subject: [PATCH 27/39] fixed comment --- openlp/core/ui/slidecontroller.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openlp/core/ui/slidecontroller.py b/openlp/core/ui/slidecontroller.py index 5ccb4dde9..d871dc474 100644 --- a/openlp/core/ui/slidecontroller.py +++ b/openlp/core/ui/slidecontroller.py @@ -531,8 +531,8 @@ class SlideController(QtGui.QWidget): else: # The timer timed out. if self.current_shortcut in keys: - # We had more than one match (e. g. "V1" and "V10", but "V1" was - # the slide we wanted to go. + # We had more than one match for example "V1" and "V10", but + # "V1" was the slide we wanted to go. self.__checkUpdateSelectedSlide( self.slideList[self.current_shortcut]) self.slideSelected() From e402b72d58437c7962769501784c1e8532ed9596 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 15:11:54 +0100 Subject: [PATCH 28/39] - fixed bug #872975 (Importing from v1 fails with error about missing 'settings' table) Fixes: https://launchpad.net/bugs/872975 --- openlp/plugins/songs/lib/olp1import.py | 39 ++++++++++++++++---------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/openlp/plugins/songs/lib/olp1import.py b/openlp/plugins/songs/lib/olp1import.py index 72bd5f952..44a621304 100644 --- a/openlp/plugins/songs/lib/olp1import.py +++ b/openlp/plugins/songs/lib/olp1import.py @@ -81,27 +81,31 @@ class OpenLP1SongImport(SongImport): # Determine if we're using a new or an old DB. cursor.execute(u'SELECT name FROM sqlite_master ' u'WHERE type = \'table\' AND name = \'tracks\'') - new_db = len(cursor.fetchall()) > 0 + db_has_tracks = len(cursor.fetchall()) > 0 + cursor.execute(u'SELECT name FROM sqlite_master ' + u'WHERE type = \'table\' AND name = \'settings\'') + db_has_themes = len(cursor.fetchall()) > 0 # "cache" our list of authors. cursor.execute(u'-- types int, unicode') cursor.execute(u'SELECT authorid, authorname FROM authors') authors = cursor.fetchall() - if new_db: + if db_has_tracks: # "cache" our list of tracks. cursor.execute(u'-- types int, unicode') cursor.execute(u'SELECT trackid, fulltrackname FROM tracks') tracks = cursor.fetchall() - # "cache" our list of themes. - cursor.execute(u'-- types int, unicode') - cursor.execute(u'SELECT settingsid, settingsname FROM settings') - themes = {} - for theme_id, theme_name in cursor.fetchall(): - if theme_name in self.availableThemes: - themes[theme_id] = theme_name + if db_has_themes: + # "cache" our list of themes. + themes = {} + cursor.execute(u'-- types int, unicode') + cursor.execute(u'SELECT settingsid, settingsname FROM settings') + for theme_id, theme_name in cursor.fetchall(): + if theme_name in self.availableThemes: + themes[theme_id] = theme_name # Import the songs. - cursor.execute(u'-- types int, unicode, unicode, unicode, int') - cursor.execute(u'SELECT songid, songtitle, lyrics || \'\' AS lyrics, ' - u'copyrightinfo, settingsid FROM songs') + cursor.execute(u'-- types int, unicode, unicode, unicode') + cursor.execute(u'SELECT songid, songtitle, lyrics || \'\' AS ' \ + u'lyrics, copyrightinfo FROM songs') songs = cursor.fetchall() self.importWizard.progressBar.setMaximum(len(songs)) for song in songs: @@ -112,8 +116,13 @@ class OpenLP1SongImport(SongImport): self.title = song[1] lyrics = song[2].replace(u'\r\n', u'\n') self.addCopyright(song[3]) - if themes.has_key(song[4]): - self.themeName = themes[song[4]] + if db_has_themes: + cursor.execute(u'-- types int') + cursor.execute( + u'SELECT settingsid FROM songs WHERE songid = %s' % song_id) + theme_id = cursor.fetchone()[0] + if themes.has_key(theme_id): + self.themeName = themes[theme_id] verses = lyrics.split(u'\n\n') for verse in verses: if verse.strip(): @@ -131,7 +140,7 @@ class OpenLP1SongImport(SongImport): break if self.stopImportFlag: break - if new_db: + if db_has_tracks: cursor.execute(u'-- types int, int') cursor.execute(u'SELECT trackid, listindex ' u'FROM songtracks ' From dad7e86f0608db74e30b76985392fae3ec906c52 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Mon, 31 Oct 2011 15:18:22 +0100 Subject: [PATCH 29/39] added/fixed comments --- openlp/plugins/songs/lib/olp1import.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openlp/plugins/songs/lib/olp1import.py b/openlp/plugins/songs/lib/olp1import.py index 44a621304..fa43d94cf 100644 --- a/openlp/plugins/songs/lib/olp1import.py +++ b/openlp/plugins/songs/lib/olp1import.py @@ -78,10 +78,11 @@ class OpenLP1SongImport(SongImport): connection = sqlite.connect(self.importSource, mode=0444, encoding=(encoding, 'replace')) cursor = connection.cursor() - # Determine if we're using a new or an old DB. + # Determine if the db supports linking audio to songs. cursor.execute(u'SELECT name FROM sqlite_master ' u'WHERE type = \'table\' AND name = \'tracks\'') db_has_tracks = len(cursor.fetchall()) > 0 + # Determine if the db contains theme information. cursor.execute(u'SELECT name FROM sqlite_master ' u'WHERE type = \'table\' AND name = \'settings\'') db_has_themes = len(cursor.fetchall()) > 0 From 14527bf3570383fea03df0308f21aefca943c075 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Mon, 31 Oct 2011 18:20:10 +0000 Subject: [PATCH 30/39] Fix my stupidity --- openlp/core/ui/maindisplay.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index 5c46bd831..01d356674 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -171,7 +171,7 @@ class MainDisplay(QtGui.QGraphicsView): serviceItem = ServiceItem() serviceItem.bg_image_bytes = image_to_byte(self.initialFrame) self.webView.setHtml(build_html(serviceItem, self.screen, - self.isLive, None, self.plugins)) + self.isLive, None, plugins=self.plugins)) self.__hideMouse() # To display or not to display? if not self.screen[u'primary']: From e3cfffb7b9591c143e0fd809ba4ac368b3e12275 Mon Sep 17 00:00:00 2001 From: Stevan Pettit Date: Mon, 31 Oct 2011 15:21:30 -0400 Subject: [PATCH 31/39] Modified inno setup script to remove the 'support' directory (created when OpenLP is executed) during un-install --- resources/windows/OpenLP-2.0.iss | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/resources/windows/OpenLP-2.0.iss b/resources/windows/OpenLP-2.0.iss index 119b73900..9805787e5 100644 --- a/resources/windows/OpenLP-2.0.iss +++ b/resources/windows/OpenLP-2.0.iss @@ -67,7 +67,7 @@ Name: quicklaunchicon; Description: {cm:CreateQuickLaunchIcon}; GroupDescription Source: ..\..\dist\OpenLP\*; DestDir: {app}; Flags: ignoreversion recursesubdirs createallsubdirs ; DLL used to check if the target program is running at install time Source: psvince.dll; flags: dontcopy -; psvince is installed in {app} folder, so it will be loaded at +; psvince is installed in {app} folder, so it will be loaded at ; uninstall time to check if the target program is running Source: psvince.dll; DestDir: {app} @@ -84,10 +84,16 @@ Name: {userappdata}\Microsoft\Internet Explorer\Quick Launch\{#AppName}; Filenam Filename: {app}\{#AppExeName}; Description: {cm:LaunchProgram,{#AppName}}; Flags: nowait postinstall skipifsilent [Registry] -Root: HKCR; Subkey: ".osz"; ValueType: string; ValueName: ""; ValueData: "OpenLP"; Flags: uninsdeletevalue -Root: HKCR; Subkey: "OpenLP"; ValueType: string; ValueName: ""; ValueData: "OpenLP Service"; Flags: uninsdeletekey -Root: HKCR; Subkey: "OpenLP\DefaultIcon"; ValueType: string; ValueName: ""; ValueData: "{app}\OpenLP.exe,0" -Root: HKCR; Subkey: "OpenLP\shell\open\command"; ValueType: string; ValueName: ""; ValueData: """{app}\OpenLP.exe"" ""%1""" +Root: HKCR; Subkey: .osz; ValueType: string; ValueName: ; ValueData: OpenLP; Flags: uninsdeletevalue +Root: HKCR; Subkey: OpenLP; ValueType: string; ValueName: ; ValueData: OpenLP Service; Flags: uninsdeletekey +Root: HKCR; Subkey: OpenLP\DefaultIcon; ValueType: string; ValueName: ; ValueData: {app}\OpenLP.exe,0 +Root: HKCR; Subkey: OpenLP\shell\open\command; ValueType: string; ValueName: ; ValueData: """{app}\OpenLP.exe"" ""%1""" + +[UninstallDelete] +; Remove support directory created when program is run: +Type: filesandordirs; Name: {app}\support +; Remove program directory if empty: +Name: {app}; Type: dirifempty [Code] // Function to call psvince.dll at install time @@ -173,4 +179,6 @@ begin Result := false; end; end; -end; \ No newline at end of file +// Unload psvince.dll, otherwise it is not deleted + UnloadDLL(ExpandConstant('{app}\psvince.dll')); +end; From 1bf1ffc848cef246bbee123c41059cc3b21e0f3e Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Tue, 1 Nov 2011 18:32:31 +0100 Subject: [PATCH 32/39] fixed bug 884826 Fixes: https://launchpad.net/bugs/884826 --- openlp/plugins/songs/lib/mediaitem.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/openlp/plugins/songs/lib/mediaitem.py b/openlp/plugins/songs/lib/mediaitem.py index d98a55c00..29f5d6a18 100644 --- a/openlp/plugins/songs/lib/mediaitem.py +++ b/openlp/plugins/songs/lib/mediaitem.py @@ -419,8 +419,7 @@ class SongMediaItem(MediaManagerItem): item_id = (self.editItem.data(QtCore.Qt.UserRole)).toInt()[0] old_song = self.plugin.manager.get_object(Song, item_id) song_xml = self.openLyrics.song_to_xml(old_song) - new_song_id = self.openLyrics.xml_to_song(song_xml) - new_song = self.plugin.manager.get_object(Song, new_song_id) + new_song = self.openLyrics.xml_to_song(song_xml) new_song.title = u'%s <%s>' % (new_song.title, translate('SongsPlugin.MediaItem', 'copy', 'For song cloning')) From 3bd0ad91817f29354844972cb6c3cce08d0cd5e5 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 2 Nov 2011 18:58:46 +0000 Subject: [PATCH 33/39] Fix crash with two soft breaks --- openlp/core/lib/renderer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index 02f6970ac..bcb1f2b70 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -229,6 +229,7 @@ class Renderer(object): # Songs and Custom elif item.is_capable(ItemCapabilities.CanSoftBreak): pages = [] + # if u'[---]' in text: while True: slides = text.split(u'\n[---]\n', 2) @@ -250,7 +251,12 @@ class Renderer(object): # render the first virtual slide. text_contains_break = u'[---]' in text if text_contains_break: - text_to_render, text = text.split(u'\n[---]\n', 1) + try: + text_to_render, text = \ + text.split(u'\n[---]\n', 1) + except: + text_to_render = text.split(u'\n[---]\n')[0] + text = u'' else: text_to_render = text text = u'' From 0304057e0035d1d55209cbec99f3824932943436 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Wed, 2 Nov 2011 20:09:06 +0000 Subject: [PATCH 34/39] remove # --- openlp/core/lib/renderer.py | 1 - 1 file changed, 1 deletion(-) diff --git a/openlp/core/lib/renderer.py b/openlp/core/lib/renderer.py index bcb1f2b70..226e8b472 100644 --- a/openlp/core/lib/renderer.py +++ b/openlp/core/lib/renderer.py @@ -229,7 +229,6 @@ class Renderer(object): # Songs and Custom elif item.is_capable(ItemCapabilities.CanSoftBreak): pages = [] - # if u'[---]' in text: while True: slides = text.split(u'\n[---]\n', 2) From d71f0594330776bd05691b44b999716bf2be424e Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 4 Nov 2011 20:09:35 +0000 Subject: [PATCH 35/39] Fix impress and service theme problems --- openlp/core/lib/serviceitem.py | 7 ++++++- openlp/core/ui/aboutdialog.py | 2 +- openlp/core/utils/__init__.py | 7 ++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index 0eb0c866f..f69f861c7 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -118,6 +118,7 @@ class ServiceItem(object): self.from_service = False self.image_border = u'#000000' self.background_audio = [] + self.theme_overwritten = False self._new_item() def _new_item(self): @@ -273,7 +274,8 @@ class ServiceItem(object): u'start_time': self.start_time, u'end_time': self.end_time, u'media_length': self.media_length, - u'background_audio': self.background_audio + u'background_audio': self.background_audio, + u'theme_overwritten': self.theme_overwritten } service_data = [] if self.service_item_type == ServiceItemType.Text: @@ -323,6 +325,8 @@ class ServiceItem(object): self.media_length = header[u'media_length'] if u'background_audio' in header: self.background_audio = header[u'background_audio'] + if u'theme_overwritten' in header: + self.theme_overwritten = header[u'theme_overwritten'] if self.service_item_type == ServiceItemType.Text: for slide in serviceitem[u'serviceitem'][u'data']: self._raw_frames.append(slide) @@ -484,6 +488,7 @@ class ServiceItem(object): ``theme`` The new theme to be replaced in the service item """ + self.theme_overwritten = False if theme == None else True self.theme = theme self._new_item() self.render() diff --git a/openlp/core/ui/aboutdialog.py b/openlp/core/ui/aboutdialog.py index f4a732fb6..8216d3e7a 100644 --- a/openlp/core/ui/aboutdialog.py +++ b/openlp/core/ui/aboutdialog.py @@ -123,7 +123,7 @@ class Ui_AboutDialog(object): testers = [u'Philip "Phill" Ridout', u'Wesley "wrst" Stout', u'John "jseagull1" Cegalis (lead)'] packagers = ['Thomas "tabthorpe" Abthorpe (FreeBSD)', - u'Tim "TRB143" Bentley (Fedora)', + u'Tim "TRB143" Bentley (Fedora and Android)', u'Matthias "matthub" Hub (Mac OS X)', u'Stevan "ElderP" Pettit (Windows)', u'Raoul "superfly" Snyman (Ubuntu)'] diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index fbf185474..736e7756c 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -480,11 +480,12 @@ def get_uno_command(): Returns the UNO command to launch an openoffice.org instance. """ COMMAND = u'soffice' - OPTIONS = u'-nologo -norestore -minimized -nodefault -nofirststartwizard' + OPTIONS = u'--nologo --norestore --minimized --nodefault' \ + u' --nofirststartwizard' if UNO_CONNECTION_TYPE == u'pipe': - CONNECTION = u'"-accept=pipe,name=openlp_pipe;urp;"' + CONNECTION = u'"--accept=pipe,name=openlp_pipe;urp;"' else: - CONNECTION = u'"-accept=socket,host=localhost,port=2002;urp;"' + CONNECTION = u'"--accept=socket,host=localhost,port=2002;urp;"' return u'%s %s %s' % (COMMAND, OPTIONS, CONNECTION) def get_uno_instance(resolver): From 46643ab832472d7b04de564a2f6e03b283f345b3 Mon Sep 17 00:00:00 2001 From: Raoul Snyman Date: Mon, 7 Nov 2011 23:22:35 -0700 Subject: [PATCH 36/39] Added the quoting to database fields. --- openlp/core/lib/db.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openlp/core/lib/db.py b/openlp/core/lib/db.py index 1b8d086df..cafc867b3 100644 --- a/openlp/core/lib/db.py +++ b/openlp/core/lib/db.py @@ -29,6 +29,7 @@ The :mod:`db` module provides the core database functionality for OpenLP """ import logging import os +from urllib import quote_plus as urlquote from PyQt4 import QtCore from sqlalchemy import Table, MetaData, Column, types, create_engine @@ -193,10 +194,10 @@ class Manager(object): AppLocation.get_section_data_path(plugin_name), plugin_name) else: self.db_url = u'%s://%s:%s@%s/%s' % (db_type, - unicode(settings.value(u'db username').toString()), - unicode(settings.value(u'db password').toString()), - unicode(settings.value(u'db hostname').toString()), - unicode(settings.value(u'db database').toString())) + urlquote(unicode(settings.value(u'db username').toString())), + urlquote(unicode(settings.value(u'db password').toString())), + urlquote(unicode(settings.value(u'db hostname').toString())), + urlquote(unicode(settings.value(u'db database').toString()))) settings.endGroup() if upgrade_mod: db_ver, up_ver = upgrade_db(self.db_url, upgrade_mod) From 516dda5ec3e249dd18086fb48fdc4d62bdab6e99 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 13 Nov 2011 08:57:29 +0000 Subject: [PATCH 37/39] Fixes --- openlp/core/lib/serviceitem.py | 5 ++--- openlp/core/utils/__init__.py | 7 +++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/openlp/core/lib/serviceitem.py b/openlp/core/lib/serviceitem.py index f69f861c7..b12a27f1d 100644 --- a/openlp/core/lib/serviceitem.py +++ b/openlp/core/lib/serviceitem.py @@ -325,8 +325,7 @@ class ServiceItem(object): self.media_length = header[u'media_length'] if u'background_audio' in header: self.background_audio = header[u'background_audio'] - if u'theme_overwritten' in header: - self.theme_overwritten = header[u'theme_overwritten'] + self.theme_overwritten = header.get(u'theme_overwritten', False) if self.service_item_type == ServiceItemType.Text: for slide in serviceitem[u'serviceitem'][u'data']: self._raw_frames.append(slide) @@ -488,7 +487,7 @@ class ServiceItem(object): ``theme`` The new theme to be replaced in the service item """ - self.theme_overwritten = False if theme == None else True + self.theme_overwritten = (theme == None) self.theme = theme self._new_item() self.render() diff --git a/openlp/core/utils/__init__.py b/openlp/core/utils/__init__.py index 736e7756c..fbf185474 100644 --- a/openlp/core/utils/__init__.py +++ b/openlp/core/utils/__init__.py @@ -480,12 +480,11 @@ def get_uno_command(): Returns the UNO command to launch an openoffice.org instance. """ COMMAND = u'soffice' - OPTIONS = u'--nologo --norestore --minimized --nodefault' \ - u' --nofirststartwizard' + OPTIONS = u'-nologo -norestore -minimized -nodefault -nofirststartwizard' if UNO_CONNECTION_TYPE == u'pipe': - CONNECTION = u'"--accept=pipe,name=openlp_pipe;urp;"' + CONNECTION = u'"-accept=pipe,name=openlp_pipe;urp;"' else: - CONNECTION = u'"--accept=socket,host=localhost,port=2002;urp;"' + CONNECTION = u'"-accept=socket,host=localhost,port=2002;urp;"' return u'%s %s %s' % (COMMAND, OPTIONS, CONNECTION) def get_uno_instance(resolver): From 04b965d166149dee2badecc943ed9b62b7388022 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 13 Nov 2011 16:31:08 +0000 Subject: [PATCH 38/39] Fix incorrect signal --- openlp/plugins/remotes/lib/httpserver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openlp/plugins/remotes/lib/httpserver.py b/openlp/plugins/remotes/lib/httpserver.py index 522c354b8..acbe103a7 100644 --- a/openlp/plugins/remotes/lib/httpserver.py +++ b/openlp/plugins/remotes/lib/httpserver.py @@ -411,7 +411,7 @@ class HttpConnection(object): ``action`` This is the action, either ``hide`` or ``show``. """ - event = u'maindisplay_%s' % action + event = u'live_display_%s' % action Receiver.send_message(event, HideMode.Blank) return HttpResponse(json.dumps({u'results': {u'success': True}}), {u'Content-Type': u'application/json'}) From d5331f50b396e818bc9eb81f4fae23c5ad18c293 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 18 Nov 2011 19:34:04 +0000 Subject: [PATCH 39/39] Amend check for files and delete if not used any more Fixes: https://launchpad.net/bugs/891781 --- 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 b472ccef0..6fc2a7ea5 100644 --- a/openlp/core/ui/thememanager.py +++ b/openlp/core/ui/thememanager.py @@ -370,7 +370,7 @@ class ThemeManager(QtGui.QWidget): def onExportTheme(self): """ - Save the theme in a zip file + Export the theme in a zip file """ item = self.themeListWidget.currentItem() if item is None: @@ -625,7 +625,7 @@ class ThemeManager(QtGui.QWidget): theme_dir = os.path.join(self.path, name) check_directory_exists(theme_dir) theme_file = os.path.join(theme_dir, name + u'.xml') - if imageTo and self.oldBackgroundImage and \ + if self.oldBackgroundImage and \ imageTo != self.oldBackgroundImage: delete_file(self.oldBackgroundImage) outfile = None