Fix Tab parentage

This commit is contained in:
Tim Bentley 2011-04-13 20:12:47 +01:00
parent 3a6b1def4a
commit 6454b88a83
16 changed files with 36 additions and 35 deletions

View File

@ -244,13 +244,13 @@ class Plugin(QtCore.QObject):
"""
pass
def getSettingsTab(self):
def getSettingsTab(self, parent):
"""
Create a tab for the settings window to display the configurable
options for this plugin to the user.
"""
if self.settings_tab_class:
return self.settings_tab_class(self.name,
return self.settings_tab_class(parent, self.name,
self.getString(StringContent.VisibleName)[u'title'],
self.icon_path)
return None

View File

@ -148,7 +148,7 @@ class PluginManager(object):
"""
for plugin in self.plugins:
if plugin.status is not PluginStatus.Disabled:
plugin.settings_tab = plugin.getSettingsTab()
plugin.settings_tab = plugin.getSettingsTab(settingsform)
visible_title = plugin.getString(StringContent.VisibleName)
if plugin.settings_tab and plugin.isActive():
log.debug(u'Inserting settings tab item from %s' %

View File

@ -31,7 +31,7 @@ class SettingsTab(QtGui.QWidget):
SettingsTab is a helper widget for plugins to define Tabs for the settings
dialog.
"""
def __init__(self, title, visible_title=None, icon_path=None):
def __init__(self, parent, title, visible_title=None, icon_path=None):
"""
Constructor to create the Settings tab item.
@ -41,7 +41,7 @@ class SettingsTab(QtGui.QWidget):
``visible_title``
The title of the tab, which is usually displayed on the tab.
"""
QtGui.QWidget.__init__(self)
QtGui.QWidget.__init__(self, parent)
self.tabTitle = title
self.tabTitleVisible = visible_title
self.settingsSection = self.tabTitle.lower()

View File

@ -37,12 +37,12 @@ class AdvancedTab(SettingsTab):
The :class:`AdvancedTab` manages the advanced settings tab including the UI
and the loading and saving of the displayed settings.
"""
def __init__(self):
def __init__(self, parent):
"""
Initialise the settings tab
"""
generalTranslated = translate('AdvancedTab', 'Advanced')
SettingsTab.__init__(self, u'Advanced', generalTranslated)
SettingsTab.__init__(self, parent ,u'Advanced', generalTranslated)
self.default_image = u':/graphics/openlp-splash-screen.png'
self.default_color = u'#ffffff'
self.icon_path = u':/icon/openlp-logo-16x16.png'

View File

@ -36,7 +36,7 @@ class GeneralTab(SettingsTab):
"""
GeneralTab is the general settings tab in the settings dialog.
"""
def __init__(self, screens):
def __init__(self, parent, screens):
"""
Initialise the general settings tab
"""
@ -46,7 +46,7 @@ class GeneralTab(SettingsTab):
self.overrideChanged = True
self.icon_path = u':/icon/openlp-logo-16x16.png'
generalTranslated = translate('GeneralTab', 'General')
SettingsTab.__init__(self, u'General', generalTranslated)
SettingsTab.__init__(self, parent, u'General', generalTranslated)
def preLoad(self):
"""

View File

@ -39,6 +39,7 @@ class Ui_SettingsDialog(object):
self.dialogLayout.setObjectName(u'dialogLayout')
self.dialogLayout.setMargin(0)
self.settingListWidget = QtGui.QListWidget(settingsDialog)
self.settingListWidget.setUniformItemSizes(True)
self.settingListWidget.setMinimumSize(QtCore.QSize(150, 0))
self.settingListWidget.setHorizontalScrollBarPolicy(
QtCore.Qt.ScrollBarAlwaysOff)

View File

@ -47,13 +47,13 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
QtGui.QDialog.__init__(self, parent)
self.setupUi(self)
# General tab
generalTab = GeneralTab(screens)
generalTab = GeneralTab(self, screens)
self.insertTab(generalTab, 1)
# Themes tab
themesTab = ThemesTab(mainWindow)
themesTab = ThemesTab(self, mainWindow)
self.insertTab(themesTab, 2)
# Advanced tab
advancedTab = AdvancedTab()
advancedTab = AdvancedTab(self, )
self.insertTab(advancedTab, 3)
def exec_(self):

View File

@ -34,10 +34,10 @@ class ThemesTab(SettingsTab):
"""
ThemesTab is the theme settings tab in the settings dialog.
"""
def __init__(self, parent):
self.parent = parent
def __init__(self, parent, mainwindow):
self.mainwindow = mainwindow
generalTranslated = translate('ThemeTab', 'Themes')
SettingsTab.__init__(self, u'Themes', generalTranslated)
SettingsTab.__init__(self, parent, u'Themes', generalTranslated)
self.icon_path = u':/themes/theme_new.png'
def setupUi(self):
@ -149,7 +149,7 @@ class ThemesTab(SettingsTab):
settings.setValue(u'global theme',
QtCore.QVariant(self.global_theme))
settings.endGroup()
self.parent.renderManager.set_global_theme(
self.mainwindow.renderManager.set_global_theme(
self.global_theme, self.theme_level)
Receiver.send_message(u'theme_update_global', self.global_theme)
@ -167,7 +167,7 @@ class ThemesTab(SettingsTab):
def onDefaultComboBoxChanged(self, value):
self.global_theme = unicode(self.DefaultComboBox.currentText())
self.parent.renderManager.set_global_theme(
self.mainwindow.renderManager.set_global_theme(
self.global_theme, self.theme_level)
self.__previewGlobalTheme()
@ -188,7 +188,7 @@ class ThemesTab(SettingsTab):
for theme in theme_list:
self.DefaultComboBox.addItem(theme)
find_and_set_in_combo_box(self.DefaultComboBox, self.global_theme)
self.parent.renderManager.set_global_theme(
self.mainwindow.renderManager.set_global_theme(
self.global_theme, self.theme_level)
if self.global_theme is not u'':
self.__previewGlobalTheme()
@ -197,7 +197,7 @@ class ThemesTab(SettingsTab):
"""
Utility method to update the global theme preview image.
"""
image = self.parent.themeManagerContents.getPreviewImage(
image = self.mainwindow.themeManagerContents.getPreviewImage(
self.global_theme)
preview = QtGui.QPixmap(unicode(image))
if not preview.isNull():

View File

@ -33,8 +33,8 @@ class AlertsTab(SettingsTab):
"""
AlertsTab is the alerts settings tab in the settings dialog.
"""
def __init__(self, name, visible_title, icon_path):
SettingsTab.__init__(self, name, visible_title, icon_path)
def __init__(self, parent, name, visible_title, icon_path):
SettingsTab.__init__(self, parent, name, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'AlertsTab')

View File

@ -40,11 +40,11 @@ class BiblesTab(SettingsTab):
"""
log.info(u'Bible Tab loaded')
def __init__(self, title, visible_title, icon_path):
def __init__(self, parent, title, visible_title, icon_path):
self.paragraph_style = True
self.show_new_chapters = False
self.display_style = 0
SettingsTab.__init__(self, title, visible_title, icon_path)
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'BiblesTab')

View File

@ -32,8 +32,8 @@ class CustomTab(SettingsTab):
"""
CustomTab is the Custom settings tab in the settings dialog.
"""
def __init__(self, title, visible_title, icon_path):
SettingsTab.__init__(self, title, visible_title, icon_path)
def __init__(self, parent, title, visible_title, icon_path):
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'CustomTab')

View File

@ -32,8 +32,8 @@ class MediaTab(SettingsTab):
"""
MediaTab is the Media settings tab in the settings dialog.
"""
def __init__(self, title, visible_title, icon_path):
SettingsTab.__init__(self, title, visible_title, icon_path)
def __init__(self, parent, title, visible_title, icon_path):
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'MediaTab')

View File

@ -33,12 +33,12 @@ class PresentationTab(SettingsTab):
"""
PresentationsTab is the Presentations settings tab in the settings dialog.
"""
def __init__(self, title, visible_title, controllers, icon_path):
def __init__(self, parent, title, visible_title, controllers, icon_path):
"""
Constructor
"""
self.controllers = controllers
SettingsTab.__init__(self, title, visible_title, icon_path)
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
"""

View File

@ -56,12 +56,12 @@ class PresentationPlugin(Plugin):
self.icon_path = u':/plugins/plugin_presentations.png'
self.icon = build_icon(self.icon_path)
def getSettingsTab(self):
def getSettingsTab(self, parent):
"""
Create the settings Tab
"""
visible_name = self.getString(StringContent.VisibleName)
return PresentationTab(self.name, visible_name[u'title'],
return PresentationTab(parent, self.name, visible_name[u'title'],
self.controllers, self.icon_path)
def initialise(self):

View File

@ -32,8 +32,8 @@ class RemoteTab(SettingsTab):
"""
RemoteTab is the Remotes settings tab in the settings dialog.
"""
def __init__(self, title, visible_title, icon_path):
SettingsTab.__init__(self, title, visible_title, icon_path)
def __init__(self, parent, title, visible_title, icon_path):
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'RemoteTab')

View File

@ -32,8 +32,8 @@ class SongsTab(SettingsTab):
"""
SongsTab is the Songs settings tab in the settings dialog.
"""
def __init__(self, title, visible_title, icon_path):
SettingsTab.__init__(self, title, visible_title, icon_path)
def __init__(self, parent, title, visible_title, icon_path):
SettingsTab.__init__(self, parent, title, visible_title, icon_path)
def setupUi(self):
self.setObjectName(u'SongsTab')