From 29088db51633403762ca8cd0a55387b551e25fbd Mon Sep 17 00:00:00 2001 From: Tim Bentley Date: Sun, 20 Feb 2011 15:35:52 +0000 Subject: [PATCH] Start to move DisplayTag dialog --- openlp/core/ui/__init__.py | 1 + openlp/core/ui/displaytagdialog.py | 51 +++++++++++++++++++ .../{displaytagtab.py => displaytagform.py} | 7 +-- openlp/core/ui/mainwindow.py | 18 ++++++- openlp/core/ui/settingsform.py | 22 ++++---- 5 files changed, 83 insertions(+), 16 deletions(-) create mode 100644 openlp/core/ui/displaytagdialog.py rename openlp/core/ui/{displaytagtab.py => displaytagform.py} (98%) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index 45218802e..5763b3470 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -67,6 +67,7 @@ from displaytagtab import DisplayTagTab from aboutform import AboutForm from pluginform import PluginForm from settingsform import SettingsForm +from displaytagform import DisplayTagForm from shortcutlistform import ShortcutListForm from mediadockmanager import MediaDockManager from servicemanager import ServiceManager diff --git a/openlp/core/ui/displaytagdialog.py b/openlp/core/ui/displaytagdialog.py new file mode 100644 index 000000000..f7d4b5175 --- /dev/null +++ b/openlp/core/ui/displaytagdialog.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 + +############################################################################### +# OpenLP - Open Source Lyrics Projection # +# --------------------------------------------------------------------------- # +# Copyright (c) 2008-2011 Raoul Snyman # +# Portions copyright (c) 2008-2011 Tim Bentley, Jonathan Corwin, Michael # +# Gorven, Scott Guerrieri, Meinert Jordan, Andreas Preikschat, Christian # +# Richter, Philip Ridout, Maikel Stuivenberg, Martin Thompson, Jon Tibble, # +# Carsten Tinggaard, Frode Woldsund # +# --------------------------------------------------------------------------- # +# This program is free software; you can redistribute it and/or modify it # +# under the terms of the GNU General Public License as published by the Free # +# Software Foundation; version 2 of the License. # +# # +# This program is distributed in the hope that it will be useful, but WITHOUT # +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # +# more details. # +# # +# You should have received a copy of the GNU General Public License along # +# with this program; if not, write to the Free Software Foundation, Inc., 59 # +# Temple Place, Suite 330, Boston, MA 02111-1307 USA # +############################################################################### + +from PyQt4 import QtCore, QtGui + +from openlp.core.lib import translate, build_icon +from openlp.core.lib.ui import create_accept_reject_button_box + +class Ui_DisplayTagDialog(object): + def setupUi(self, settingsDialog): + settingsDialog.setObjectName(u'settingsDialog') + settingsDialog.resize(700, 500) + settingsDialog.setWindowIcon( + build_icon(u':/system/system_settings.png')) + self.settingsLayout = QtGui.QVBoxLayout(settingsDialog) + self.settingsLayout.setObjectName(u'settingsLayout') + self.settingsTabWidget = QtGui.QTabWidget(settingsDialog) + self.settingsTabWidget.setObjectName(u'settingsTabWidget') + self.settingsLayout.addWidget(self.settingsTabWidget) + + self.buttonBox = create_accept_reject_button_box(settingsDialog, True) + self.settingsLayout.addWidget(self.buttonBox) + self.retranslateUi(settingsDialog) + QtCore.QMetaObject.connectSlotsByName(settingsDialog) + + def retranslateUi(self, settingsDialog): + settingsDialog.setWindowTitle(translate('OpenLP.SettingsForm', + 'Configure OpenLP')) diff --git a/openlp/core/ui/displaytagtab.py b/openlp/core/ui/displaytagform.py similarity index 98% rename from openlp/core/ui/displaytagtab.py rename to openlp/core/ui/displaytagform.py index 30c593d36..5216fcd61 100644 --- a/openlp/core/ui/displaytagtab.py +++ b/openlp/core/ui/displaytagform.py @@ -33,10 +33,11 @@ import cPickle from PyQt4 import QtCore, QtGui -from openlp.core.lib import SettingsTab, translate, DisplayTags +from openlp.core.lib import translate, DisplayTags from openlp.core.lib.ui import UiStrings, critical_error_message_box +from openlp.core.ui.displaytagdialog import Ui_DisplayTagDialog -class DisplayTagTab(SettingsTab): +class DisplayTagForm(QtGui.QDialog, Ui_DisplayTagDialog): """ The :class:`DisplayTagTab` manages the settings tab . """ @@ -44,7 +45,7 @@ class DisplayTagTab(SettingsTab): """ Initialise the settings tab """ - SettingsTab.__init__(self, u'Display Tags') + #SettingsTab.__init__(self, u'Display Tags') def resizeEvent(self, event=None): pass diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index aedd9cf4f..82d95dd40 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -34,7 +34,7 @@ from openlp.core.lib.ui import UiStrings, base_action, checkable_action, \ icon_action from openlp.core.ui import AboutForm, SettingsForm, ServiceManager, \ ThemeManager, SlideController, PluginForm, MediaDockManager, \ - ShortcutListForm + ShortcutListForm, DisplayTagForm from openlp.core.utils import AppLocation, add_actions, LanguageManager, \ ActionList @@ -242,6 +242,8 @@ class Ui_MainWindow(object): self.SettingsShortcutsItem = icon_action(mainWindow, u'SettingsShortcutsItem', u':/system/system_configure_shortcuts.png') + self.DisplayTagItem = icon_action(mainWindow, + u'DisplayTagItem', u':/system/system_settings.png') self.SettingsConfigureItem = icon_action(mainWindow, u'SettingsConfigureItem', u':/system/system_settings.png') mainWindow.actionList.add_action(self.SettingsShortcutsItem, @@ -277,7 +279,8 @@ class Ui_MainWindow(object): add_actions(self.SettingsLanguageMenu, self.LanguageGroup.actions()) add_actions(self.SettingsMenu, (self.settingsPluginListItem, self.SettingsLanguageMenu.menuAction(), None, - self.SettingsShortcutsItem, self.SettingsConfigureItem)) + self.SettingsShortcutsItem, self.DisplayTagItem, + self.SettingsConfigureItem)) add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None)) add_actions(self.ToolsMenu, (self.ToolsOpenDataFolder, None)) add_actions(self.HelpMenu, (self.HelpDocumentationItem, @@ -361,6 +364,8 @@ class Ui_MainWindow(object): translate('OpenLP.MainWindow', '&Language')) self.SettingsShortcutsItem.setText( translate('OpenLP.MainWindow', 'Configure &Shortcuts...')) + self.DisplayTagItem.setText( + translate('OpenLP.MainWindow', '&Configure Display Tags')) self.SettingsConfigureItem.setText( translate('OpenLP.MainWindow', '&Configure OpenLP...')) self.ViewMediaManagerItem.setText( @@ -476,6 +481,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): self.settingsmanager = SettingsManager(screens) self.aboutForm = AboutForm(self, applicationVersion) self.settingsForm = SettingsForm(self.screens, self, self) + self.displayTagForm = DisplayTagForm() self.shortcutForm = ShortcutListForm(self) self.recentFiles = QtCore.QStringList() # Set up the path with plugins @@ -523,6 +529,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): QtCore.SIGNAL(u'triggered()'), self.onToolsOpenDataFolderClicked) QtCore.QObject.connect(self.settingsPluginListItem, QtCore.SIGNAL(u'triggered()'), self.onPluginItemClicked) + QtCore.QObject.connect(self.DisplayTagItem, + QtCore.SIGNAL(u'triggered()'), self.onDisplayTagItemClicked) QtCore.QObject.connect(self.SettingsConfigureItem, QtCore.SIGNAL(u'triggered()'), self.onSettingsConfigureItemClicked) QtCore.QObject.connect(self.SettingsShortcutsItem, @@ -716,6 +724,12 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow): path = AppLocation.get_data_path() QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + path)) + def onDisplayTagItemClicked(self): + """ + Show the Settings dialog + """ + self.displayTagForm.exec_() + def onSettingsConfigureItemClicked(self): """ Show the Settings dialog diff --git a/openlp/core/ui/settingsform.py b/openlp/core/ui/settingsform.py index afea928b6..3fd640acd 100644 --- a/openlp/core/ui/settingsform.py +++ b/openlp/core/ui/settingsform.py @@ -47,17 +47,17 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): QtGui.QDialog.__init__(self, parent) self.setupUi(self) # General tab - self.generalTab = GeneralTab(screens) - self.addTab(u'General', self.generalTab) + generalTab = GeneralTab(screens) + self.addTab(u'General', generalTab) # Themes tab - self.themesTab = ThemesTab(mainWindow) - self.addTab(u'Themes', self.themesTab) + themesTab = ThemesTab(mainWindow) + self.addTab(u'Themes', themesTab) # Advanced tab - self.advancedTab = AdvancedTab() - self.addTab(u'Advanced', self.advancedTab) - # Edit Display Tags tab - self.displayTagTab = DisplayTagTab() - self.addTab(u'Display Tags', self.displayTagTab) + advancedTab = AdvancedTab() + self.addTab(u'Advanced', advancedTab) + ## Edit Display Tags tab + #self.displayTagTab = DisplayTagTab() + #self.addTab(u'Display Tags', self.displayTagTab) def addTab(self, name, tab): """ @@ -71,9 +71,9 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog): Add a tab to the form at a specific location """ log.debug(u'Inserting %s tab' % tab.tabTitle) - # 15 : There are 4 tables currently and locations starts at -10 + # 14 : There are 3 tables currently and locations starts at -10 self.settingsTabWidget.insertTab( - location + 15, tab, tab.tabTitleVisible) + location + 14, tab, tab.tabTitleVisible) def removeTab(self, tab): """