diff --git a/openlp/core/lib/dockwidget.py b/openlp/core/lib/dockwidget.py index 9c4187337..24841ec33 100644 --- a/openlp/core/lib/dockwidget.py +++ b/openlp/core/lib/dockwidget.py @@ -48,4 +48,3 @@ class OpenLPDockWidget(QtGui.QDockWidget): self.setObjectName(name) if icon: self.setWindowIcon(icon) - self.setFloating(False) diff --git a/openlp/core/ui/__init__.py b/openlp/core/ui/__init__.py index c806730c8..adb0d5679 100644 --- a/openlp/core/ui/__init__.py +++ b/openlp/core/ui/__init__.py @@ -29,9 +29,10 @@ The :mod:`ui` module provides the core user interface for OpenLP class HideMode(object): """ - This is basically an enumeration class which specifies the mode of a Bible. - Mode refers to whether or not a Bible in OpenLP is a full Bible or needs to - be downloaded from the Internet on an as-needed basis. + This is basically an enumeration class which specifies differnt hiding modes + for the display. The option ``Blank`` to cover the display black. The option + ``Theme`` removes the content from the theme. ``Screen`` finally hides the + output, so that the users desktop is usually shown. """ Blank = 1 Theme = 2 @@ -58,4 +59,4 @@ from thememanager import ThemeManager __all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager', - 'MediaDockManager', 'ServiceItemEditForm'] \ No newline at end of file + 'MediaDockManager', 'ServiceItemEditForm'] diff --git a/openlp/core/ui/advancedtab.py b/openlp/core/ui/advancedtab.py index 0e2a4e88d..da68956cb 100644 --- a/openlp/core/ui/advancedtab.py +++ b/openlp/core/ui/advancedtab.py @@ -133,13 +133,16 @@ class AdvancedTab(SettingsTab): def resizeEvent(self, event=None): """ - Rescale the theme preview thumbnail on resize events. + Resize the sides in two equal halves if the layout allows this. """ if event: SettingsTab.resizeEvent(self, event) - self.leftWidget.setMinimumWidth(max( - self.width() / 2 - self.advancedTabLayout.contentsMargins().left(), - self.leftWidget.minimumSizeHint().width())) + width = self.width() - self.advancedTabLayout.contentsMargins().left() \ + - self.advancedTabLayout.contentsMargins().right() + left_width = min(width - self.rightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) + self.leftWidget.setMinimumWidth(left_width) def load(self): """ diff --git a/openlp/core/ui/generaltab.py b/openlp/core/ui/generaltab.py index 6a54d9636..dfb876597 100644 --- a/openlp/core/ui/generaltab.py +++ b/openlp/core/ui/generaltab.py @@ -85,7 +85,6 @@ class GeneralTab(SettingsTab): Create the user interface for the general settings tab """ self.setObjectName(u'GeneralTab') - self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General') self.generalLayout = QtGui.QHBoxLayout(self) self.generalLayout.setSpacing(0) self.generalLayout.setObjectName(u'generalLayout') @@ -246,6 +245,7 @@ class GeneralTab(SettingsTab): """ Translate the general settings tab to the currently selected language """ + self.tabTitleVisible = translate('OpenLP.GeneralTab', 'General') self.monitorGroupBox.setTitle(translate('OpenLP.GeneralTab', 'Monitors')) self.monitorLabel.setText(translate('OpenLP.GeneralTab', @@ -301,13 +301,16 @@ class GeneralTab(SettingsTab): def resizeEvent(self, event=None): """ - Rescale the theme preview thumbnail on resize events. + Resize the sides in two equal halves if the layout allows this. """ if event: SettingsTab.resizeEvent(self, event) - self.leftWidget.setMinimumWidth(max( - self.width() / 2 - self.generalLayout.contentsMargins().left(), - self.leftWidget.minimumSizeHint().width())) + width = self.width() - self.generalLayout.contentsMargins().left() - \ + self.generalLayout.contentsMargins().right() + left_width = min(width - self.rightWidget.minimumSizeHint().width(), + width / 2) + left_width = max(left_width, self.leftWidget.minimumSizeHint().width()) + self.leftWidget.setMinimumWidth(left_width) def load(self): """ diff --git a/openlp/core/ui/maindisplay.py b/openlp/core/ui/maindisplay.py index dd24f172d..ef10b866a 100644 --- a/openlp/core/ui/maindisplay.py +++ b/openlp/core/ui/maindisplay.py @@ -31,7 +31,8 @@ import os from PyQt4 import QtCore, QtGui, QtWebKit from PyQt4.phonon import Phonon -from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte +from openlp.core.lib import Receiver, build_html, ServiceItem, image_to_byte, \ + translate from openlp.core.ui import HideMode log = logging.getLogger(__name__) @@ -102,7 +103,7 @@ class MainDisplay(DisplayWidget): self.isLive = live self.alertTab = None self.hideMode = None - self.setWindowTitle(u'OpenLP Display') + self.retranslateUi() self.setStyleSheet(u'border: 0px; margin: 0px; padding: 0px;') self.setWindowFlags(QtCore.Qt.FramelessWindowHint | QtCore.Qt.WindowStaysOnTopHint) @@ -112,6 +113,12 @@ class MainDisplay(DisplayWidget): QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'maindisplay_show'), self.showDisplay) + def retranslateUi(self): + """ + Setup the interface translation strings. + """ + self.setWindowTitle(translate('OpenLP.MainDisplay', 'OpenLP Display')) + def setup(self): """ Set up and build the output screen diff --git a/openlp/core/ui/mainwindow.py b/openlp/core/ui/mainwindow.py index a378dd633..ff2692566 100644 --- a/openlp/core/ui/mainwindow.py +++ b/openlp/core/ui/mainwindow.py @@ -66,25 +66,10 @@ class Ui_MainWindow(object): MainWindow.setObjectName(u'MainWindow') MainWindow.resize(self.settingsmanager.width, self.settingsmanager.height) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - MainWindow.sizePolicy().hasHeightForWidth()) - MainWindow.setSizePolicy(sizePolicy) - MainIcon = build_icon(u':/icon/openlp-logo-16x16.png') - MainWindow.setWindowIcon(MainIcon) - self.setDockNestingEnabled(True) + MainWindow.setWindowIcon(build_icon(u':/icon/openlp-logo-16x16.png')) + MainWindow.setDockNestingEnabled(True) # Set up the main container, which contains all the other form widgets. self.MainContent = QtGui.QWidget(MainWindow) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.MainContent.sizePolicy().hasHeightForWidth()) - self.MainContent.setSizePolicy(sizePolicy) self.MainContent.setObjectName(u'MainContent') self.MainContentLayout = QtGui.QHBoxLayout(self.MainContent) self.MainContentLayout.setSpacing(0) @@ -93,7 +78,6 @@ class Ui_MainWindow(object): MainWindow.setCentralWidget(self.MainContent) self.ControlSplitter = QtGui.QSplitter(self.MainContent) self.ControlSplitter.setOrientation(QtCore.Qt.Horizontal) - self.ControlSplitter.setOpaqueResize(False) self.ControlSplitter.setObjectName(u'ControlSplitter') self.MainContentLayout.addWidget(self.ControlSplitter) # Create slide controllers @@ -109,7 +93,6 @@ class Ui_MainWindow(object): self.liveController.Panel.setVisible(liveVisible) # Create menu self.MenuBar = QtGui.QMenuBar(MainWindow) - self.MenuBar.setGeometry(QtCore.QRect(0, 0, 1087, 27)) self.MenuBar.setObjectName(u'MenuBar') self.FileMenu = QtGui.QMenu(self.MenuBar) self.FileMenu.setObjectName(u'FileMenu') @@ -147,38 +130,33 @@ class Ui_MainWindow(object): self.MediaManagerDock.setStyleSheet(MEDIA_MANAGER_STYLE) self.MediaManagerDock.setMinimumWidth( self.settingsmanager.mainwindow_left) - self.MediaManagerContents = QtGui.QWidget(MainWindow) - self.MediaManagerContents.setObjectName(u'MediaManagerContents') - self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents) - self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0) - self.MediaManagerLayout.setObjectName(u'MediaManagerLayout') # Create the media toolbox - self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents) + self.MediaToolBox = QtGui.QToolBox(self.MediaManagerDock) self.MediaToolBox.setObjectName(u'MediaToolBox') - self.MediaManagerLayout.addWidget(self.MediaToolBox) - self.MediaManagerDock.setWidget(self.MediaManagerContents) - MainWindow.addDockWidget( - QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock) + self.MediaManagerDock.setWidget(self.MediaToolBox) + MainWindow.addDockWidget(QtCore.Qt.LeftDockWidgetArea, + self.MediaManagerDock) # Create the service manager self.ServiceManagerDock = OpenLPDockWidget( MainWindow, u'ServiceManagerDock', build_icon(u':/system/system_servicemanager.png')) self.ServiceManagerDock.setMinimumWidth( self.settingsmanager.mainwindow_right) - self.ServiceManagerContents = ServiceManager(self) + self.ServiceManagerContents = ServiceManager(MainWindow) self.ServiceManagerDock.setWidget(self.ServiceManagerContents) - MainWindow.addDockWidget( - QtCore.Qt.DockWidgetArea(2), self.ServiceManagerDock) + MainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, + self.ServiceManagerDock) # Create the theme manager self.ThemeManagerDock = OpenLPDockWidget( MainWindow, u'ThemeManagerDock', build_icon(u':/system/system_thememanager.png')) self.ThemeManagerDock.setMinimumWidth( self.settingsmanager.mainwindow_right) - self.ThemeManagerContents = ThemeManager(self) + self.ThemeManagerContents = ThemeManager(MainWindow) + self.ThemeManagerContents.setObjectName(u'ThemeManagerContents') self.ThemeManagerDock.setWidget(self.ThemeManagerContents) - MainWindow.addDockWidget( - QtCore.Qt.DockWidgetArea(2), self.ThemeManagerDock) + MainWindow.addDockWidget(QtCore.Qt.RightDockWidgetArea, + self.ThemeManagerDock) # Create the menu items self.FileNewItem = QtGui.QAction(MainWindow) self.FileNewItem.setIcon(build_icon(u':/general/general_new.png')) @@ -275,9 +253,12 @@ class Ui_MainWindow(object): self.AutoLanguageItem.setCheckable(True) MainWindow.actionList.add_action(self.AutoLanguageItem, u'Settings') self.LanguageGroup = QtGui.QActionGroup(MainWindow) + self.LanguageGroup.setExclusive(True) + self.LanguageGroup.setObjectName(u'LanguageGroup') + self.AutoLanguageItem.setChecked(LanguageManager.auto_language) + self.LanguageGroup.setDisabled(LanguageManager.auto_language) qmList = LanguageManager.get_qm_list() savedLanguage = LanguageManager.get_language() - self.AutoLanguageItem.setChecked(LanguageManager.auto_language) for key in sorted(qmList.keys()): languageItem = QtGui.QAction(MainWindow) languageItem.setObjectName(key) @@ -285,7 +266,6 @@ class Ui_MainWindow(object): if qmList[key] == savedLanguage: languageItem.setChecked(True) add_actions(self.LanguageGroup, [languageItem]) - self.LanguageGroup.setDisabled(LanguageManager.auto_language) self.SettingsShortcutsItem = QtGui.QAction(MainWindow) self.SettingsShortcutsItem.setIcon( build_icon(u':/system/system_configure_shortcuts.png')) @@ -334,15 +314,13 @@ class Ui_MainWindow(object): add_actions(self.SettingsMenu, (self.SettingsPluginListItem, self.SettingsLanguageMenu.menuAction(), None, self.SettingsShortcutsItem, self.SettingsConfigureItem)) - add_actions(self.ToolsMenu, - (self.ToolsAddToolItem, None)) - add_actions(self.HelpMenu, - (self.HelpDocumentationItem, self.HelpOnlineHelpItem, None, - self.HelpWebSiteItem, self.HelpAboutItem)) - add_actions(self.MenuBar, - (self.FileMenu.menuAction(), self.ViewMenu.menuAction(), - self.ToolsMenu.menuAction(), self.SettingsMenu.menuAction(), - self.HelpMenu.menuAction())) + add_actions(self.ToolsMenu, (self.ToolsAddToolItem, None)) + add_actions(self.HelpMenu, (self.HelpDocumentationItem, + self.HelpOnlineHelpItem, None, self.HelpWebSiteItem, + self.HelpAboutItem)) + add_actions(self.MenuBar, (self.FileMenu.menuAction(), + self.ViewMenu.menuAction(), self.ToolsMenu.menuAction(), + self.SettingsMenu.menuAction(), self.HelpMenu.menuAction())) # Initialise the translation self.retranslateUi(MainWindow) self.MediaToolBox.setCurrentIndex(0) diff --git a/openlp/core/ui/plugindialog.py b/openlp/core/ui/plugindialog.py index 63d7ae014..74b2d36c0 100644 --- a/openlp/core/ui/plugindialog.py +++ b/openlp/core/ui/plugindialog.py @@ -31,69 +31,41 @@ class Ui_PluginViewDialog(object): def setupUi(self, pluginViewDialog): pluginViewDialog.setObjectName(u'pluginViewDialog') pluginViewDialog.setWindowModality(QtCore.Qt.ApplicationModal) - pluginViewDialog.resize(554, 344) self.pluginLayout = QtGui.QVBoxLayout(pluginViewDialog) - self.pluginLayout.setSpacing(8) - self.pluginLayout.setMargin(8) self.pluginLayout.setObjectName(u'pluginLayout') self.listLayout = QtGui.QHBoxLayout() - self.listLayout.setSpacing(8) self.listLayout.setObjectName(u'listLayout') self.pluginListWidget = QtGui.QListWidget(pluginViewDialog) - sizePolicy = QtGui.QSizePolicy( - QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.pluginListWidget.sizePolicy().hasHeightForWidth()) - self.pluginListWidget.setSizePolicy(sizePolicy) - self.pluginListWidget.setMaximumSize(QtCore.QSize(192, 16777215)) self.pluginListWidget.setObjectName(u'pluginListWidget') self.listLayout.addWidget(self.pluginListWidget) self.pluginInfoGroupBox = QtGui.QGroupBox(pluginViewDialog) - self.pluginInfoGroupBox.setAlignment( - QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter) - self.pluginInfoGroupBox.setFlat(False) self.pluginInfoGroupBox.setObjectName(u'pluginInfoGroupBox') self.pluginInfoLayout = QtGui.QFormLayout(self.pluginInfoGroupBox) - self.pluginInfoLayout.setMargin(8) - self.pluginInfoLayout.setSpacing(8) self.pluginInfoLayout.setObjectName(u'pluginInfoLayout') - self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox) - self.versionLabel.setObjectName(u'versionLabel') - self.pluginInfoLayout.setWidget( - 1, QtGui.QFormLayout.LabelRole, self.versionLabel) - self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox) - self.versionNumberLabel.setObjectName(u'versionNumberLabel') - self.pluginInfoLayout.setWidget( - 1, QtGui.QFormLayout.FieldRole, self.versionNumberLabel) - self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox) - self.aboutLabel.setObjectName(u'aboutLabel') - self.pluginInfoLayout.setWidget( - 2, QtGui.QFormLayout.LabelRole, self.aboutLabel) self.statusLabel = QtGui.QLabel(self.pluginInfoGroupBox) self.statusLabel.setObjectName(u'statusLabel') - self.pluginInfoLayout.setWidget( - 0, QtGui.QFormLayout.LabelRole, self.statusLabel) self.statusComboBox = QtGui.QComboBox(self.pluginInfoGroupBox) + self.statusComboBox.addItems((u'', u'')) self.statusComboBox.setObjectName(u'statusComboBox') - self.statusComboBox.addItem(QtCore.QString()) - self.statusComboBox.addItem(QtCore.QString()) - self.pluginInfoLayout.setWidget( - 0, QtGui.QFormLayout.FieldRole, self.statusComboBox) + self.pluginInfoLayout.addRow(self.statusLabel, self.statusComboBox) + self.versionLabel = QtGui.QLabel(self.pluginInfoGroupBox) + self.versionLabel.setObjectName(u'versionLabel') + self.versionNumberLabel = QtGui.QLabel(self.pluginInfoGroupBox) + self.versionNumberLabel.setObjectName(u'versionNumberLabel') + self.pluginInfoLayout.addRow(self.versionLabel, self.versionNumberLabel) + self.aboutLabel = QtGui.QLabel(self.pluginInfoGroupBox) + self.aboutLabel.setObjectName(u'aboutLabel') self.aboutTextBrowser = QtGui.QTextBrowser(self.pluginInfoGroupBox) self.aboutTextBrowser.setTextInteractionFlags( QtCore.Qt.LinksAccessibleByMouse) self.aboutTextBrowser.setObjectName(u'aboutTextBrowser') - self.pluginInfoLayout.setWidget( - 2, QtGui.QFormLayout.FieldRole, self.aboutTextBrowser) + self.pluginInfoLayout.addRow(self.aboutLabel, self.aboutTextBrowser) self.listLayout.addWidget(self.pluginInfoGroupBox) self.pluginLayout.addLayout(self.listLayout) self.pluginListButtonBox = QtGui.QDialogButtonBox(pluginViewDialog) self.pluginListButtonBox.setStandardButtons(QtGui.QDialogButtonBox.Ok) self.pluginListButtonBox.setObjectName(u'pluginListButtonBox') self.pluginLayout.addWidget(self.pluginListButtonBox) - self.versionNumberLabel.setText(u'') self.retranslateUi(pluginViewDialog) QtCore.QObject.connect(self.pluginListButtonBox, QtCore.SIGNAL(u'accepted()'), pluginViewDialog.close) diff --git a/openlp/core/ui/pluginform.py b/openlp/core/ui/pluginform.py index 4d3177ef3..26e6cf06c 100644 --- a/openlp/core/ui/pluginform.py +++ b/openlp/core/ui/pluginform.py @@ -67,23 +67,24 @@ class PluginForm(QtGui.QDialog, Ui_PluginViewDialog): # sometimes when it's loaded from the config, it isn't cast to int. plugin.status = int(plugin.status) # Set the little status text in brackets next to the plugin name. - status_text = unicode( - translate('OpenLP.PluginForm', '%s (Inactive)')) - if plugin.status == PluginStatus.Active: - status_text = unicode( - translate('OpenLP.PluginForm', '%s (Active)')) - elif plugin.status == PluginStatus.Inactive: - status_text = unicode( - translate('OpenLP.PluginForm', '%s (Inactive)')) - elif plugin.status == PluginStatus.Disabled: + if plugin.status == PluginStatus.Disabled: status_text = unicode( translate('OpenLP.PluginForm', '%s (Disabled)')) + elif plugin.status == PluginStatus.Active: + status_text = unicode( + translate('OpenLP.PluginForm', '%s (Active)')) + else: + # PluginStatus.Inactive + status_text = unicode( + translate('OpenLP.PluginForm', '%s (Inactive)')) name_string = plugin.getString(StringContent.Name) item.setText(status_text % name_string[u'singular']) # If the plugin has an icon, set it! if plugin.icon: item.setIcon(plugin.icon) self.pluginListWidget.addItem(item) + self.pluginListWidget.setFixedWidth( + self.pluginListWidget.sizeHint().width()) def _clearDetails(self): self.statusComboBox.setCurrentIndex(-1)