forked from openlp/openlp
Cleanup hinding code and move to disable for now
This commit is contained in:
parent
ceeb8c39b4
commit
cfc82e7407
@ -119,9 +119,6 @@ class Plugin(object):
|
|||||||
self.icon = None
|
self.icon = None
|
||||||
self.config = PluginConfig(self.name)
|
self.config = PluginConfig(self.name)
|
||||||
self.weight = 0
|
self.weight = 0
|
||||||
self.media_id = -1
|
|
||||||
self.settings_id = -1
|
|
||||||
self.media_active = False
|
|
||||||
self.status = PluginStatus.Inactive
|
self.status = PluginStatus.Inactive
|
||||||
# Set up logging
|
# Set up logging
|
||||||
self.log = logging.getLogger(self.name)
|
self.log = logging.getLogger(self.name)
|
||||||
@ -130,7 +127,7 @@ class Plugin(object):
|
|||||||
self.render_manager = plugin_helpers[u'render']
|
self.render_manager = plugin_helpers[u'render']
|
||||||
self.service_manager = plugin_helpers[u'service']
|
self.service_manager = plugin_helpers[u'service']
|
||||||
self.settings = plugin_helpers[u'settings']
|
self.settings = plugin_helpers[u'settings']
|
||||||
self.mediatoolbox = plugin_helpers[u'toolbox']
|
self.mediadock = plugin_helpers[u'toolbox']
|
||||||
QtCore.QObject.connect(Receiver.get_receiver(),
|
QtCore.QObject.connect(Receiver.get_receiver(),
|
||||||
QtCore.SIGNAL(u'%s_add_service_item'% self.name), self.process_add_service_event)
|
QtCore.SIGNAL(u'%s_add_service_item'% self.name), self.process_add_service_event)
|
||||||
|
|
||||||
@ -253,21 +250,12 @@ class Plugin(object):
|
|||||||
"""
|
"""
|
||||||
Called by the plugin to remove toolbar
|
Called by the plugin to remove toolbar
|
||||||
"""
|
"""
|
||||||
if self.media_id is not -1:
|
self.mediadock.removeDock(self.name)
|
||||||
self.mediatoolbox.removeItem(self.media_id)
|
self.settings.removeTab(self.name)
|
||||||
if self.settings_id is not -1:
|
|
||||||
self.settings.removeTab(self.settings_id)
|
|
||||||
self.media_active = False
|
|
||||||
|
|
||||||
def insert_toolbox_item(self):
|
def insert_toolbox_item(self):
|
||||||
"""
|
"""
|
||||||
Called by plugin to replace toolbar
|
Called by plugin to replace toolbar
|
||||||
"""
|
"""
|
||||||
if not self.media_active:
|
self.mediadock.insertDock(self.name)
|
||||||
if self.media_id is not -1:
|
self.settings.insertTab(self.name)
|
||||||
self.mediatoolbox.insertItem(
|
|
||||||
self.media_id, self.media_item, self.icon, self.media_item.title)
|
|
||||||
if self.settings_id is not -1:
|
|
||||||
self.settings.insertTab(
|
|
||||||
self.settings_id, self.settings_tab)
|
|
||||||
self.media_active = True
|
|
||||||
|
@ -125,7 +125,7 @@ class PluginManager(object):
|
|||||||
"""
|
"""
|
||||||
return cmp(x.weight, y.weight)
|
return cmp(x.weight, y.weight)
|
||||||
|
|
||||||
def hook_media_manager(self, mediatoolbox):
|
def hook_media_manager(self, mediadock):
|
||||||
"""
|
"""
|
||||||
Loop through all the plugins. If a plugin has a valid media manager
|
Loop through all the plugins. If a plugin has a valid media manager
|
||||||
item, add it to the media manager.
|
item, add it to the media manager.
|
||||||
@ -139,9 +139,8 @@ class PluginManager(object):
|
|||||||
if plugin.media_item is not None:
|
if plugin.media_item is not None:
|
||||||
log.debug(u'Inserting media manager item from %s' % \
|
log.debug(u'Inserting media manager item from %s' % \
|
||||||
plugin.name)
|
plugin.name)
|
||||||
plugin.media_id = mediatoolbox.addItem(
|
mediadock.addDock(plugin.name,
|
||||||
plugin.media_item, plugin.icon, plugin.media_item.title)
|
plugin.media_item, plugin.icon)
|
||||||
plugin.media_active = True
|
|
||||||
|
|
||||||
def hook_settings_tabs(self, settingsform=None):
|
def hook_settings_tabs(self, settingsform=None):
|
||||||
"""
|
"""
|
||||||
@ -157,7 +156,7 @@ class PluginManager(object):
|
|||||||
plugin.settings_tab = plugin.get_settings_tab()
|
plugin.settings_tab = plugin.get_settings_tab()
|
||||||
if plugin.settings_tab is not None:
|
if plugin.settings_tab is not None:
|
||||||
log.debug(u'Inserting settings tab item from %s' % plugin.name)
|
log.debug(u'Inserting settings tab item from %s' % plugin.name)
|
||||||
plugin.settings_id = settingsform.addTab(plugin.settings_tab)
|
settingsform.addTab(plugin.name, plugin.settings_tab)
|
||||||
else:
|
else:
|
||||||
log.debug(u'No tab settings in %s' % plugin.name)
|
log.debug(u'No tab settings in %s' % plugin.name)
|
||||||
|
|
||||||
@ -202,11 +201,12 @@ class PluginManager(object):
|
|||||||
Loop through all the plugins and give them an opportunity to
|
Loop through all the plugins and give them an opportunity to
|
||||||
initialise themselves.
|
initialise themselves.
|
||||||
"""
|
"""
|
||||||
log.info(u'initialising plugins')
|
|
||||||
for plugin in self.plugins:
|
for plugin in self.plugins:
|
||||||
|
log.info(u'initialising plugins %s in a %s state'
|
||||||
|
% (plugin.name, plugin.is_active()))
|
||||||
if plugin.is_active():
|
if plugin.is_active():
|
||||||
plugin.initialise()
|
plugin.initialise()
|
||||||
if plugin.media_item is not None and not plugin.is_active():
|
if not plugin.is_active():
|
||||||
plugin.remove_toolbox_item()
|
plugin.remove_toolbox_item()
|
||||||
|
|
||||||
def finalise_plugins(self):
|
def finalise_plugins(self):
|
||||||
|
@ -34,10 +34,11 @@ from about import AboutForm
|
|||||||
from alertform import AlertForm
|
from alertform import AlertForm
|
||||||
from plugindialoglistform import PluginForm
|
from plugindialoglistform import PluginForm
|
||||||
from settingsform import SettingsForm
|
from settingsform import SettingsForm
|
||||||
|
from mediadockmanager import MediaDockManager
|
||||||
from servicemanager import ServiceManager
|
from servicemanager import ServiceManager
|
||||||
from thememanager import ThemeManager
|
from thememanager import ThemeManager
|
||||||
from mainwindow import MainWindow
|
from mainwindow import MainWindow
|
||||||
|
|
||||||
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainWindow',
|
__all__ = ['SplashScreen', 'AboutForm', 'SettingsForm', 'MainWindow',
|
||||||
'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
|
'MainDisplay', 'SlideController', 'ServiceManager', 'ThemeManager',
|
||||||
'AmendThemeForm']
|
'AmendThemeForm', 'MediaDockManager']
|
||||||
|
@ -29,9 +29,10 @@ from PyQt4 import QtCore, QtGui
|
|||||||
|
|
||||||
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
|
from openlp.core.ui import AboutForm, SettingsForm, AlertForm, \
|
||||||
ServiceManager, ThemeManager, MainDisplay, SlideController, \
|
ServiceManager, ThemeManager, MainDisplay, SlideController, \
|
||||||
PluginForm
|
PluginForm, MediaDockManager
|
||||||
from openlp.core.lib import translate, RenderManager, PluginConfig, \
|
from openlp.core.lib import translate, RenderManager, PluginConfig, \
|
||||||
OpenLPDockWidget, SettingsManager, PluginManager, Receiver, buildIcon
|
OpenLPDockWidget, SettingsManager, PluginManager, Receiver, \
|
||||||
|
buildIcon
|
||||||
|
|
||||||
|
|
||||||
class Ui_MainWindow(object):
|
class Ui_MainWindow(object):
|
||||||
@ -489,6 +490,8 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
#ThemeManager needs to call RenderManager
|
#ThemeManager needs to call RenderManager
|
||||||
self.RenderManager = RenderManager(self.ThemeManagerContents,
|
self.RenderManager = RenderManager(self.ThemeManagerContents,
|
||||||
self.screenList, self.getMonitorNumber())
|
self.screenList, self.getMonitorNumber())
|
||||||
|
#Define the media Dock Manager
|
||||||
|
self.mediaDockManager = MediaDockManager(self.MediaToolBox)
|
||||||
log.info(u'Load Plugins')
|
log.info(u'Load Plugins')
|
||||||
#make the controllers available to the plugins
|
#make the controllers available to the plugins
|
||||||
self.plugin_helpers[u'preview'] = self.PreviewController
|
self.plugin_helpers[u'preview'] = self.PreviewController
|
||||||
@ -496,7 +499,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.plugin_helpers[u'render'] = self.RenderManager
|
self.plugin_helpers[u'render'] = self.RenderManager
|
||||||
self.plugin_helpers[u'service'] = self.ServiceManagerContents
|
self.plugin_helpers[u'service'] = self.ServiceManagerContents
|
||||||
self.plugin_helpers[u'settings'] = self.settingsForm
|
self.plugin_helpers[u'settings'] = self.settingsForm
|
||||||
self.plugin_helpers[u'toolbox'] = self.MediaToolBox
|
self.plugin_helpers[u'toolbox'] = self.mediaDockManager
|
||||||
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
|
self.plugin_manager.find_plugins(pluginpath, self.plugin_helpers)
|
||||||
# hook methods have to happen after find_plugins. Find plugins needs
|
# hook methods have to happen after find_plugins. Find plugins needs
|
||||||
# the controllers hence the hooks have moved from setupUI() to here
|
# the controllers hence the hooks have moved from setupUI() to here
|
||||||
@ -505,7 +508,7 @@ class MainWindow(QtGui.QMainWindow, Ui_MainWindow):
|
|||||||
self.plugin_manager.hook_settings_tabs(self.settingsForm)
|
self.plugin_manager.hook_settings_tabs(self.settingsForm)
|
||||||
# Find and insert media manager items
|
# Find and insert media manager items
|
||||||
log.info(u'hook media')
|
log.info(u'hook media')
|
||||||
self.plugin_manager.hook_media_manager(self.MediaToolBox)
|
self.plugin_manager.hook_media_manager(self.mediaDockManager)
|
||||||
# Call the hook method to pull in import menus.
|
# Call the hook method to pull in import menus.
|
||||||
log.info(u'hook menus')
|
log.info(u'hook menus')
|
||||||
self.plugin_manager.hook_import_menu(self.FileImportMenu)
|
self.plugin_manager.hook_import_menu(self.FileImportMenu)
|
||||||
|
@ -35,29 +35,44 @@ class SettingsForm(QtGui.QDialog, Ui_SettingsDialog):
|
|||||||
|
|
||||||
def __init__(self, screen_list, mainWindow, parent=None):
|
def __init__(self, screen_list, mainWindow, parent=None):
|
||||||
QtGui.QDialog.__init__(self, None)
|
QtGui.QDialog.__init__(self, None)
|
||||||
|
self.tabs = {}
|
||||||
self.setupUi(self)
|
self.setupUi(self)
|
||||||
# General tab
|
# General tab
|
||||||
self.GeneralTab = GeneralTab(screen_list)
|
self.GeneralTab = GeneralTab(screen_list)
|
||||||
self.addTab(self.GeneralTab)
|
self.addTab(u'General', self.GeneralTab)
|
||||||
# Themes tab
|
# Themes tab
|
||||||
self.ThemesTab = ThemesTab(mainWindow)
|
self.ThemesTab = ThemesTab(mainWindow)
|
||||||
self.addTab(self.ThemesTab)
|
self.addTab(u'Themes', self.ThemesTab)
|
||||||
# Alert tab
|
# Alert tab
|
||||||
self.AlertsTab = AlertsTab()
|
self.AlertsTab = AlertsTab()
|
||||||
self.addTab(self.AlertsTab)
|
self.addTab(u'Alerts', self.AlertsTab)
|
||||||
|
|
||||||
def addTab(self, tab):
|
def addTab(self, name, tab):
|
||||||
log.info(u'Adding %s tab' % tab.title())
|
log.info(u'Adding %s tab' % tab.title())
|
||||||
return self.SettingsTabWidget.addTab(tab, tab.title())
|
id = self.SettingsTabWidget.addTab(tab, tab.title())
|
||||||
|
self.tabs[name] = ({u'data': tab, u'id': id, u'active':True})
|
||||||
|
|
||||||
def insertTab(self, id, tab):
|
def insertTab(self, name):
|
||||||
log.debug(u'Inserting %s tab' % tab.title())
|
log.debug(u'Inserting %s tab' % name)
|
||||||
self.SettingsTabWidget.insertTab(id, 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:
|
||||||
|
#print "Insert match"
|
||||||
|
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||||
|
self.SettingsTabWidget.widget(tab_index).setEnabled(True)
|
||||||
|
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||||
|
|
||||||
def removeTab(self, id):
|
|
||||||
log.debug(u'remove %s no tab' % unicode(id))
|
|
||||||
self.SettingsTabWidget.removeTab(id)
|
|
||||||
|
|
||||||
|
def removeTab(self, name):
|
||||||
|
log.debug(u'remove %s tab' % name)
|
||||||
|
#print ">>>>>>>>>>> remove settings"
|
||||||
|
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||||
|
#print 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.widget(tab_index).setEnabled(False)
|
||||||
|
#print self.SettingsTabWidget.widget(tab_index).isVisible()
|
||||||
|
|
||||||
def accept(self):
|
def accept(self):
|
||||||
for tab_index in range(0, self.SettingsTabWidget.count()):
|
for tab_index in range(0, self.SettingsTabWidget.count()):
|
||||||
|
@ -31,7 +31,7 @@ class ImageTab(SettingsTab):
|
|||||||
ImageTab is the Image settings tab in the settings dialog.
|
ImageTab is the Image settings tab in the settings dialog.
|
||||||
"""
|
"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
SettingsTab.__init__(self, translate(u'ImageTab', u'Image'), u'Image')
|
SettingsTab.__init__(self, translate(u'ImageTab', u'Images'), u'Image')
|
||||||
|
|
||||||
def setupUi(self):
|
def setupUi(self):
|
||||||
self.setObjectName(u'ImageTab')
|
self.setObjectName(u'ImageTab')
|
||||||
|
@ -41,6 +41,8 @@ class RemotesPlugin(Plugin):
|
|||||||
|
|
||||||
def initialise(self):
|
def initialise(self):
|
||||||
log.debug(u'initialise')
|
log.debug(u'initialise')
|
||||||
|
Plugin.initialise(self)
|
||||||
|
self.insert_toolbox_item()
|
||||||
self.server = QtNetwork.QUdpSocket()
|
self.server = QtNetwork.QUdpSocket()
|
||||||
self.server.bind(int(self.config.get_config(u'remote port', 4316)))
|
self.server.bind(int(self.config.get_config(u'remote port', 4316)))
|
||||||
QtCore.QObject.connect(self.server,
|
QtCore.QObject.connect(self.server,
|
||||||
@ -48,6 +50,7 @@ class RemotesPlugin(Plugin):
|
|||||||
|
|
||||||
def finalise(self):
|
def finalise(self):
|
||||||
log.debug(u'finalise')
|
log.debug(u'finalise')
|
||||||
|
self.remove_toolbox_item()
|
||||||
if self.server is not None:
|
if self.server is not None:
|
||||||
self.server.close()
|
self.server.close()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user