forked from openlp/openlp
More dock hiding work
This commit is contained in:
parent
79cfb6d843
commit
25c730a8f2
@ -257,5 +257,7 @@ class Plugin(object):
|
||||
"""
|
||||
Called by plugin to replace toolbar
|
||||
"""
|
||||
self.mediadock.insertDock(self.name)
|
||||
self.settings.insertTab(self.name)
|
||||
if self.media_item is not None:
|
||||
self.mediadock.insertDock(self.media_item, self.icon, self.weight)
|
||||
if self.settings_tab is not None:
|
||||
self.settings.insertTab(self.settings_tab, self.weight)
|
||||
|
@ -90,7 +90,8 @@ class PluginManager(object):
|
||||
try:
|
||||
__import__(modulename, globals(), locals(), [])
|
||||
except ImportError, e:
|
||||
log.error(u'Failed to import module %s on path %s for reason %s', modulename, path, e.args[0])
|
||||
log.error(u'Failed to import module %s on path %s for reason %s',
|
||||
modulename, path, e.args[0])
|
||||
plugin_classes = Plugin.__subclasses__()
|
||||
self.plugins = []
|
||||
plugin_objects = []
|
||||
@ -139,8 +140,7 @@ class PluginManager(object):
|
||||
if plugin.media_item is not None:
|
||||
log.debug(u'Inserting media manager item from %s' % \
|
||||
plugin.name)
|
||||
mediadock.addDock(plugin.name,
|
||||
plugin.media_item, plugin.icon)
|
||||
mediadock.addDock(plugin.media_item, plugin.icon, plugin.weight)
|
||||
|
||||
def hook_settings_tabs(self, settingsform=None):
|
||||
"""
|
||||
|
@ -31,21 +31,21 @@ class MediaDockManager(object):
|
||||
def __init__(self, mediaDock):
|
||||
self.mediaDock = mediaDock
|
||||
|
||||
def addDock(self, name, media_item, icon):
|
||||
log.info(u'Adding %s dock' % name)
|
||||
def addDock(self, media_item, icon, weight):
|
||||
log.info(u'Adding %s dock' % media_item.title)
|
||||
id = self.mediaDock.addItem(
|
||||
media_item, icon, media_item.title)
|
||||
media_item, icon, media_item.title)
|
||||
print "add", media_item.title, id, weight
|
||||
|
||||
def insertDock(self, name):
|
||||
log.debug(u'Inserting %s dock' % name)
|
||||
for tab_index in range(0, self.mediaDock.count()):
|
||||
#print self.mediaDock.widget(tab_index).ConfigSection, name
|
||||
if self.mediaDock.widget(tab_index).ConfigSection == name.lower():
|
||||
self.mediaDock.setItemEnabled(tab_index, True)
|
||||
def insertDock(self, media_item, icon, weight):
|
||||
log.debug(u'Inserting %s dock' % media_item.title)
|
||||
if self.mediaDock.widget(weight + 10) is None:
|
||||
self.mediaDock.insertItem(weight + 10, media_item, icon, media_item.title)
|
||||
print "insert", media_item.title, weight
|
||||
|
||||
def removeDock(self, name):
|
||||
log.debug(u'remove %s dock' % name)
|
||||
for tab_index in range(0, self.mediaDock.count()):
|
||||
#print "rd", self.mediaDock.widget(tab_index).ConfigSection, name
|
||||
if self.mediaDock.widget(tab_index).ConfigSection == name.lower():
|
||||
self.mediaDock.setItemEnabled(tab_index, False)
|
||||
for dock_index in range(0, self.mediaDock.count()):
|
||||
if self.mediaDock.widget(dock_index) is not None:
|
||||
if self.mediaDock.widget(dock_index).ConfigSection == name.lower():
|
||||
self.mediaDock.removeItem(dock_index)
|
||||
|
@ -48,16 +48,18 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
||||
|
||||
def addTab(self, name, tab):
|
||||
log.info(u'Adding %s tab' % tab.title())
|
||||
id = self.SettingsTabWidget.addTab(tab, tab.title())
|
||||
self.SettingsTabWidget.addTab(tab, tab.title())
|
||||
|
||||
def insertTab(self, name):
|
||||
log.debug(u'Inserting %s tab' % name)
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
def insertTab(self, tab, location):
|
||||
log.debug(u'Inserting %s tab' % tab.title())
|
||||
self.SettingsTabWidget.insertTab(location + 13, tab, tab.title())
|
||||
#for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
#print self.SettingsTabWidget.widget(tab_index).title()
|
||||
if self.SettingsTabWidget.widget(tab_index).title() == name:
|
||||
#if self.SettingsTabWidget.widget(tab_index).title() == name:
|
||||
#print "Insert match"
|
||||
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||
self.SettingsTabWidget.setTabEnabled(tab_index, True)
|
||||
#self.SettingsTabWidget.setTabEnabled(tab_index, True)
|
||||
#self.SettingsTabWidget.removeTab(tab_index)
|
||||
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||
|
||||
|
||||
@ -65,12 +67,14 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
||||
log.debug(u'remove %s tab' % name)
|
||||
#print ">>>>>>>>>>> remove settings"
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
#print "rt", self.SettingsTabWidget.widget(tab_index).title(), name
|
||||
if self.SettingsTabWidget.widget(tab_index).title() == name:
|
||||
#print "remove match"
|
||||
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||
self.SettingsTabWidget.setTabEnabled(tab_index, False)
|
||||
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||
if self.SettingsTabWidget.widget(tab_index) is not None:
|
||||
#print "rt", self.SettingsTabWidget.widget(tab_index).title(), name
|
||||
if self.SettingsTabWidget.widget(tab_index).title() == name:
|
||||
#print "remove match"
|
||||
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||
#self.SettingsTabWidget.setTabEnabled(tab_index, False)
|
||||
self.SettingsTabWidget.removeTab(tab_index)
|
||||
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||
|
||||
def accept(self):
|
||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||
|
Loading…
Reference in New Issue
Block a user