From d87f58747c991bb02850435592b5d4cde7efdcd5 Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Fri, 14 Aug 2009 20:12:14 +0100 Subject: [PATCH] Finish (for now) Impress start and Stop from Config --- openlp/core/ui/mainwindow.py | 6 +- .../presentations/lib/presentationtab.py | 57 +++---------------- .../presentations/presentationplugin.py | 20 +++---- 3 files changed, 20 insertions(+), 63 deletions(-) diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index 2a5e7764a..350cf5f4c 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -204,14 +204,12 @@ class Ui_MainWindow(object): QtGui.QIcon.Normal, QtGui.QIcon.Off) self.ToolsAlertItem.setIcon(AlertIcon) self.ToolsAlertItem.setObjectName(u'ToolsAlertItem') - self.PluginItem = QtGui.QAction(MainWindow) PluginIcon = QtGui.QIcon() PluginIcon.addPixmap(QtGui.QPixmap(u':/tools/tools_alert.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.PluginItem.setIcon(AlertIcon) self.PluginItem.setObjectName(u'PluginItem') - self.HelpDocumentationItem = QtGui.QAction(MainWindow) ContentsIcon = QtGui.QIcon() ContentsIcon.addPixmap(QtGui.QPixmap(u':/system/system_help_contents.png'), @@ -372,12 +370,10 @@ class Ui_MainWindow(object): self.ToolsAlertItem.setStatusTip( translate(u'mainWindow', u'Show an alert message')) self.ToolsAlertItem.setShortcut(translate(u'mainWindow', u'F7')) - self.PluginItem.setText(translate(u'mainWindow', u'&Plugin')) self.PluginItem.setStatusTip( translate(u'mainWindow', u'List the Plugins')) - self.PluginItem.setShortcut(translate(u'mainWindow', u'F8')) - + self.PluginItem.setShortcut(translate(u'mainWindow', u'Alt+F7')) self.HelpDocumentationItem.setText( translate(u'mainWindow', u'&User Guide')) self.HelpAboutItem.setText(translate(u'mainWindow', u'&About')) diff --git a/openlp/plugins/presentations/lib/presentationtab.py b/openlp/plugins/presentations/lib/presentationtab.py index 911638970..b343de0d8 100644 --- a/openlp/plugins/presentations/lib/presentationtab.py +++ b/openlp/plugins/presentations/lib/presentationtab.py @@ -20,14 +20,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA from PyQt4 import Qt, QtCore, QtGui -from openlp.core.lib import SettingsTab, translate +from openlp.core.lib import SettingsTab, translate, str_to_bool class PresentationTab(SettingsTab): """ PresentationsTab is the Presentations settings tab in the settings dialog. """ def __init__(self): - SettingsTab.__init__(self, translate(u'PresentationTab', u'Presentation'), u'Presentation') + SettingsTab.__init__(self, translate(u'PresentationTab', u'Presentation'), u'Presentations') def setupUi(self): self.setObjectName(u'PresentationTab') @@ -41,7 +41,6 @@ class PresentationTab(SettingsTab): self.PresentationLeftLayout.setObjectName(u'PresentationLeftLayout') self.PresentationLeftLayout.setSpacing(8) self.PresentationLeftLayout.setMargin(0) - self.VerseDisplayGroupBox = QtGui.QGroupBox(self) self.VerseDisplayGroupBox.setObjectName(u'VerseDisplayGroupBox') self.VerseDisplayLayout = QtGui.QGridLayout(self.VerseDisplayGroupBox) @@ -53,36 +52,25 @@ class PresentationTab(SettingsTab): self.VerseTypeLayout.setSpacing(8) self.VerseTypeLayout.setMargin(0) self.VerseTypeLayout.setObjectName(u'VerseTypeLayout') - self.PowerpointCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) + self.PowerpointCheckBox.setTristate(False) self.PowerpointCheckBox.setObjectName(u'PowerpointCheckBox') self.VerseDisplayLayout.addWidget(self.PowerpointCheckBox, 0, 0, 1, 1) - - self.PowerpointPath = QtGui.QLineEdit(self.VerseDisplayGroupBox) - self.PowerpointPath.setObjectName(u'PowerpointPath') - self.VerseDisplayLayout.addWidget(self.PowerpointPath, 1, 0, 1, 1) - self.ImpressCheckBox = QtGui.QCheckBox(self.VerseDisplayGroupBox) + self.ImpressCheckBox.setTristate(False) self.ImpressCheckBox.setObjectName(u'ImpressCheckBox') self.VerseDisplayLayout.addWidget(self.ImpressCheckBox, 2, 0, 1, 1) - - self.ImpressPath = QtGui.QLineEdit(self.VerseDisplayGroupBox) - self.ImpressPath.setObjectName(u'ImpressPath') - self.VerseDisplayLayout.addWidget(self.ImpressPath, 3, 0, 1, 1) - self.PresentationThemeWidget = QtGui.QWidget(self.VerseDisplayGroupBox) self.PresentationThemeWidget.setObjectName(u'PresentationThemeWidget') self.PresentationThemeLayout = QtGui.QHBoxLayout(self.PresentationThemeWidget) self.PresentationThemeLayout.setSpacing(8) self.PresentationThemeLayout.setMargin(0) self.PresentationThemeLayout.setObjectName(u'PresentationThemeLayout') - self.PresentationLeftLayout.addWidget(self.VerseDisplayGroupBox) self.PresentationLeftSpacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.PresentationLeftLayout.addItem(self.PresentationLeftSpacer) self.PresentationLayout.addWidget(self.PresentationLeftWidget) - self.PresentationRightWidget = QtGui.QWidget(self) self.PresentationRightWidget.setObjectName(u'PresentationRightWidget') self.PresentationRightLayout = QtGui.QVBoxLayout(self.PresentationRightWidget) @@ -94,42 +82,15 @@ class PresentationTab(SettingsTab): self.PresentationRightLayout.addItem(self.PresentationRightSpacer) self.PresentationLayout.addWidget(self.PresentationRightWidget) - # Signals and slots - #QtCore.QObject.connect(self.NewChaptersCheckBox, - # QtCore.SIGNAL(u'stateChanged(int)'), self.onNewChaptersCheckBoxChanged) - def retranslateUi(self): self.PowerpointCheckBox.setText(translate(u'PresentationTab', 'Powerpoint available:')) self.ImpressCheckBox.setText(translate(u'PresentationTab', 'Impress available:')) - self.PowerpointPath.setText(u'powerpoint.exe ') - self.ImpressPath.setText(u'openoffice.org -nologo -show ') - - def onNewChaptersCheckBoxChanged(self): - check_state = self.NewChaptersCheckBox.checkState() - self.show_new_chapters = False - if check_state == 2: # we have a set value convert to True/False - self.show_new_chapters = True - def load(self): - pass -# self.paragraph_style = (self.config.get_config(u'paragraph style', u'True')) -# self.show_new_chapters = (self.config.get_config(u'display new chapter', u"False')) -# self.display_style = int(self.config.get_config(u'display brackets', u'0')) -# self.Presentation_theme = int(self.config.get_config(u'Presentation theme', u'0')) -# self.Presentation_search = (self.config.get_config(u'search as type', u'True')) -# if self.paragraph_style: -# self.ParagraphRadioButton.setChecked(True) -# else: -# self.VerseRadioButton.setChecked(True) -# self.NewChaptersCheckBox.setChecked(self.show_new_chapters) -# self.DisplayStyleComboBox.setCurrentIndex(self.display_style) -# self.PresentationSearchCheckBox.setChecked(self.Presentation_search) + self.PowerpointCheckBox.setChecked(int(self.config.get_config(u'Powerpoint', 0))) + self.ImpressCheckBox.setChecked(int(self.config.get_config(u'Impress', 0))) def save(self): - pass -# self.config.set_config(u'paragraph style', unicode(self.paragraph_style)) -# self.config.set_config(u'display new chapter', unicode(self.show_new_chapters)) -# self.config.set_config(u'display brackets', unicode(self.display_style)) -# self.config.set_config(u'search as type', unicode(self.Presentation_search)) -# self.config.set_config(u'Presentation theme', unicode(self.Presentation_theme)) \ No newline at end of file + self.config.set_config(u'Powerpoint', unicode(self.PowerpointCheckBox.checkState())) + self.config.set_config(u'Impress', unicode(self.ImpressCheckBox.checkState())) + print self.PowerpointCheckBox.checkState(), unicode(self.PowerpointCheckBox.checkState()) diff --git a/openlp/plugins/presentations/presentationplugin.py b/openlp/plugins/presentations/presentationplugin.py index ca9facef5..8c78e131f 100644 --- a/openlp/plugins/presentations/presentationplugin.py +++ b/openlp/plugins/presentations/presentationplugin.py @@ -24,7 +24,7 @@ import logging from PyQt4 import QtCore, QtGui from openlp.core.lib import Plugin, MediaManagerItem -from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, impressToolbar +from openlp.plugins.presentations.lib import PresentationMediaItem, PresentationTab, impressController class PresentationPlugin(Plugin): @@ -66,17 +66,17 @@ class PresentationPlugin(Plugin): If Not do not install the plugin. """ log.debug('check_pre_conditions') - impress = True - try: - #Check to see if we have uno installed - import uno - #openoffice = impressToolbar() - #self.registerControllers(u'Impress', None) - except: - pass + + if int(self.config.get_config(u'Powerpoint', 0)) == 2: + try: + #Check to see if we have uno installed + import uno + #openoffice = impressController() + self.registerControllers(u'Impress', None) + except: + pass #If we have no controllers disable plugin if len(self.controllers) > 0: return True else: return False -# return self.openoffice.checkOoPid()