コード例 #1
0
ファイル: customplugin.py プロジェクト: marmyshev/transitions
 def finalise(self):
     """
     Time to tidy up on exit
     """
     log.info(u'Custom Finalising')
     self.manager.finalise()
     Plugin.finalise(self)
コード例 #2
0
ファイル: remoteplugin.py プロジェクト: marmyshev/transitions
 def initialise(self):
     """
     Initialise the remotes plugin, and start the http server
     """
     log.debug(u'initialise')
     Plugin.initialise(self)
     self.server = HttpServer(self)
コード例 #3
0
ファイル: mediaplugin.py プロジェクト: marmyshev/transitions
 def __init__(self):
     Plugin.__init__(self, u'media', __default_settings__, MediaMediaItem)
     self.weight = -6
     self.iconPath = u':/plugins/plugin_media.png'
     self.icon = build_icon(self.iconPath)
     # passed with drag and drop messages
     self.dnd_id = u'Media'
コード例 #4
0
ファイル: mediaplugin.py プロジェクト: imkernel/openlp
 def finalise(self):
     """
     Time to tidy up on exit.
     """
     log.info('Media Finalising')
     self.media_controller.finalise()
     Plugin.finalise(self)
コード例 #5
0
ファイル: customplugin.py プロジェクト: feitianyiren/openlp
 def finalise(self):
     """
     Time to tidy up on exit
     """
     log.info('Custom Finalising')
     self.db_manager.finalise()
     Plugin.finalise(self)
コード例 #6
0
 def finalise(self):
     """
     Time to tidy up on exit.
     """
     log.info('Media Finalising')
     self.media_controller.finalise()
     Plugin.finalise(self)
コード例 #7
0
ファイル: alertsplugin.py プロジェクト: marmyshev/transitions
 def __init__(self):
     Plugin.__init__(self, u'alerts', __default_settings__, settings_tab_class=AlertsTab)
     self.weight = -3
     self.iconPath = u':/plugins/plugin_alerts.png'
     self.icon = build_icon(self.iconPath)
     self.alertsmanager = AlertsManager(self)
     self.manager = Manager(u'alerts', init_schema)
     self.alertForm = AlertForm(self)
コード例 #8
0
ファイル: remoteplugin.py プロジェクト: marmyshev/transitions
 def finalise(self):
     """
     Tidy up and close down the http server
     """
     log.debug(u'finalise')
     Plugin.finalise(self)
     if self.server:
         self.server.close()
コード例 #9
0
ファイル: remoteplugin.py プロジェクト: marmyshev/transitions
 def __init__(self):
     """
     remotes constructor
     """
     Plugin.__init__(self, u'remotes', __default_settings__, settings_tab_class=RemoteTab)
     self.iconPath = u':/plugins/plugin_remote.png'
     self.icon = build_icon(self.iconPath)
     self.weight = -1
     self.server = None
コード例 #10
0
ファイル: songsplugin.py プロジェクト: marmyshev/transitions
 def __init__(self):
     """
     Create and set up the Songs plugin.
     """
     Plugin.__init__(self, u'songs', __default_settings__, SongMediaItem, SongsTab)
     self.manager = Manager(u'songs', init_schema, upgrade_mod=upgrade)
     self.weight = -10
     self.iconPath = u':/plugins/plugin_songs.png'
     self.icon = build_icon(self.iconPath)
コード例 #11
0
ファイル: songsplugin.py プロジェクト: marmyshev/transitions
 def initialise(self):
     log.info(u'Songs Initialising')
     Plugin.initialise(self)
     self.songImportItem.setVisible(True)
     self.songExportItem.setVisible(True)
     self.toolsReindexItem.setVisible(True)
     action_list = ActionList.get_instance()
     action_list.add_action(self.songImportItem, UiStrings().Import)
     action_list.add_action(self.songExportItem, UiStrings().Export)
     action_list.add_action(self.toolsReindexItem, UiStrings().Tools)
コード例 #12
0
ファイル: imageplugin.py プロジェクト: marmyshev/bug_1117098
 def app_startup(self):
     """
     Perform tasks on application startup.
     """
     Plugin.app_startup(self)
     # Convert old settings-based image list to the database.
     files_from_config = Settings().get_files_from_config(self)
     if files_from_config:
         log.debug('Importing images list from old config: %s' % files_from_config)
         self.media_item.save_new_images_list(files_from_config)
コード例 #13
0
 def __init__(self):
     """
     PluginPresentation constructor.
     """
     log.debug('Initialised')
     self.controllers = {}
     Plugin.__init__(self, 'presentations', __default_settings__, __default_settings__)
     self.weight = -8
     self.icon_path = ':/plugins/plugin_presentations.png'
     self.icon = build_icon(self.icon_path)
コード例 #14
0
ファイル: presentationplugin.py プロジェクト: imkernel/openlp
 def __init__(self):
     """
     PluginPresentation constructor.
     """
     log.debug('Initialised')
     self.controllers = {}
     Plugin.__init__(self, 'presentations', __default_settings__, __default_settings__)
     self.weight = -8
     self.icon_path = ':/plugins/plugin_presentations.png'
     self.icon = build_icon(self.icon_path)
コード例 #15
0
ファイル: alertsplugin.py プロジェクト: marmyshev/transitions
 def finalise(self):
     """
     Tidy up on exit
     """
     log.info(u'Alerts Finalising')
     self.manager.finalise()
     Plugin.finalise(self)
     self.toolsAlertItem.setVisible(False)
     action_list = ActionList.get_instance()
     action_list.remove_action(self.toolsAlertItem, u'Tools')
コード例 #16
0
ファイル: bibleplugin.py プロジェクト: feitianyiren/openlp
 def finalise(self):
     """
     Tidy up on exit
     """
     log.info('Plugin Finalise')
     self.manager.finalise()
     Plugin.finalise(self)
     action_list = ActionList.get_instance()
     action_list.remove_action(self.import_bible_item, UiStrings().Import)
     self.import_bible_item.setVisible(False)
     self.export_bible_item.setVisible(False)
コード例 #17
0
ファイル: bibleplugin.py プロジェクト: crossroadchurch/paul
 def finalise(self):
     """
     Tidy up on exit
     """
     log.info('Plugin Finalise')
     self.manager.finalise()
     Plugin.finalise(self)
     action_list = ActionList.get_instance()
     action_list.remove_action(self.import_bible_item, UiStrings().Import)
     self.import_bible_item.setVisible(False)
     self.export_bible_item.setVisible(False)
コード例 #18
0
 def finalise(self):
     """
     Finalise the plugin. Ask all the enabled presentation applications
     to close down their applications and release resources.
     """
     log.info(u'Plugin Finalise')
     # Ask each controller to tidy up.
     for key in self.controllers:
         controller = self.controllers[key]
         if controller.enabled():
             controller.kill()
     Plugin.finalise(self)
コード例 #19
0
ファイル: bibleplugin.py プロジェクト: marmyshev/transitions
 def initialise(self):
     log.info(u'bibles Initialising')
     if self.manager is None:
         self.manager = BibleManager(self)
     Plugin.initialise(self)
     self.importBibleItem.setVisible(True)
     action_list = ActionList.get_instance()
     action_list.add_action(self.importBibleItem, UiStrings().Import)
     # Do not add the action to the list yet.
     #action_list.add_action(self.exportBibleItem, UiStrings().Export)
     # Set to invisible until we can export bibles
     self.exportBibleItem.setVisible(False)
     self.toolsUpgradeItem.setVisible(bool(self.manager.old_bible_databases))
コード例 #20
0
 def __init__(self):
     """
     PluginPresentation constructor.
     """
     log.debug('Initialised')
     self.controllers = {}
     Plugin.__init__(self, 'presentations', __default_settings__,
                     __default_settings__)
     self.weight = -8
     self.icon_path = UiIcons().presentation
     self.icon = build_icon(self.icon_path)
     register_endpoint(presentations_endpoint)
     register_endpoint(api_presentations_endpoint)
コード例 #21
0
ファイル: bibleplugin.py プロジェクト: marmyshev/transitions
 def app_startup(self):
     """
     Perform tasks on application startup
     """
     Plugin.app_startup(self)
     if self.manager.old_bible_databases:
         if QtGui.QMessageBox.information(self.main_window,
             translate('OpenLP', 'Information'),
             translate('OpenLP', 'Bible format has changed.\nYou have to upgrade your existing Bibles.\n'
                 'Should OpenLP upgrade now?'),
             QtGui.QMessageBox.StandardButtons(QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)) == \
                 QtGui.QMessageBox.Yes:
             self.onToolsUpgradeItemTriggered()
コード例 #22
0
 def initialise(self):
     """
     Initialise the plugin. Determine which controllers are enabled
     are start their processes.
     """
     log.info(u'Presentations Initialising')
     Plugin.initialise(self)
     for controller in self.controllers:
         if self.controllers[controller].enabled():
             try:
                 self.controllers[controller].start_process()
             except Exception:
                 log.warn(u'Failed to start controller process')
                 self.controllers[controller].available = False
     self.mediaItem.buildFileMaskString()
コード例 #23
0
ファイル: pluginmanager.py プロジェクト: simhnna/openlp
 def find_plugins(self):
     """
     Scan a directory for objects inheriting from the ``Plugin`` class.
     """
     glob_pattern = os.path.join('plugins', '*', '[!.]*plugin.py')
     extension_loader(glob_pattern)
     plugin_classes = Plugin.__subclasses__()
     plugin_objects = []
     for p in plugin_classes:
         try:
             plugin = p()
             self.log_debug('Loaded plugin {plugin}'.format(plugin=str(p)))
             plugin_objects.append(plugin)
         except TypeError:
             self.log_exception(
                 'Failed to load plugin {plugin}'.format(plugin=str(p)))
     plugins_list = sorted(plugin_objects, key=lambda plugin: plugin.weight)
     for plugin in plugins_list:
         if plugin.check_pre_conditions():
             self.log_debug(
                 'Plugin {plugin} active'.format(plugin=str(plugin.name)))
             plugin.set_status()
         else:
             plugin.status = PluginStatus.Disabled
         self.plugins.append(plugin)
コード例 #24
0
ファイル: songsplugin.py プロジェクト: marmyshev/transitions
 def finalise(self):
     """
     Time to tidy up on exit
     """
     log.info(u'Songs Finalising')
     self.new_service_created()
     # Clean up files and connections
     self.manager.finalise()
     self.songImportItem.setVisible(False)
     self.songExportItem.setVisible(False)
     self.toolsReindexItem.setVisible(False)
     action_list = ActionList.get_instance()
     action_list.remove_action(self.songImportItem, UiStrings().Import)
     action_list.remove_action(self.songExportItem, UiStrings().Export)
     action_list.remove_action(self.toolsReindexItem, UiStrings().Tools)
     Plugin.finalise(self)
コード例 #25
0
ファイル: imageplugin.py プロジェクト: crossroadchurch/paul
 def app_startup(self):
     """
     Perform tasks on application startup.
     """
     # TODO: Can be removed when the upgrade path from 2.0.x to 2.2.x is no longer needed
     Plugin.app_startup(self)
     # Convert old settings-based image list to the database.
     files_from_config = Settings().get_files_from_config(self)
     if files_from_config:
         for file in files_from_config:
             filename = os.path.split(file)[1]
             thumb = os.path.join(self.media_item.service_path, filename)
             try:
                 os.remove(thumb)
             except:
                 pass
         log.debug('Importing images list from old config: %s' % files_from_config)
         self.media_item.save_new_images_list(files_from_config)
コード例 #26
0
 def app_startup(self):
     """
     Perform tasks on application startup.
     """
     # TODO: Can be removed when the upgrade path from 2.0.x to 2.2.x is no longer needed
     Plugin.app_startup(self)
     # Convert old settings-based image list to the database.
     files_from_config = Settings().get_files_from_config(self)
     if files_from_config:
         for file in files_from_config:
             filename = os.path.split(file)[1]
             thumb = os.path.join(self.media_item.service_path, filename)
             try:
                 os.remove(thumb)
             except:
                 pass
         log.debug('Importing images list from old config: %s' %
                   files_from_config)
         self.media_item.save_new_images_list(files_from_config)
コード例 #27
0
 def find_plugins(self):
     """
     Scan a directory for objects inheriting from the ``Plugin`` class.
     """
     start_depth = len(os.path.abspath(self.base_path).split(os.sep))
     present_plugin_dir = os.path.join(self.base_path, 'presentations')
     self.log_debug('finding plugins in {path} at depth {depth:d}'.format(
         path=self.base_path, depth=start_depth))
     for root, dirs, files in os.walk(self.base_path):
         for name in files:
             if name.endswith('.py') and not name.startswith('__'):
                 path = os.path.abspath(os.path.join(root, name))
                 this_depth = len(path.split(os.sep))
                 if this_depth - start_depth > 2:
                     # skip anything lower down
                     break
                 module_name = name[:-3]
                 # import the modules
                 self.log_debug(
                     'Importing {name} from {root}. Depth {depth:d}'.format(
                         name=module_name, root=root, depth=this_depth))
                 try:
                     # Use the "imp" library to try to get around a problem with the PyUNO library which
                     # monkey-patches the __import__ function to do some magic. This causes issues with our tests.
                     # First, try to find the module we want to import, searching the directory in root
                     fp, path_name, description = imp.find_module(
                         module_name, [root])
                     # Then load the module (do the actual import) using the details from find_module()
                     imp.load_module(module_name, fp, path_name,
                                     description)
                 except ImportError as e:
                     self.log_exception(
                         'Failed to import module {name} on path {path}: '
                         '{args}'.format(name=module_name,
                                         path=path,
                                         args=e.args[0]))
     plugin_classes = Plugin.__subclasses__()
     plugin_objects = []
     for p in plugin_classes:
         try:
             plugin = p()
             self.log_debug('Loaded plugin {plugin}'.format(plugin=str(p)))
             plugin_objects.append(plugin)
         except TypeError:
             self.log_exception(
                 'Failed to load plugin {plugin}'.format(plugin=str(p)))
     plugins_list = sorted(plugin_objects, key=lambda plugin: plugin.weight)
     for plugin in plugins_list:
         if plugin.check_pre_conditions():
             self.log_debug(
                 'Plugin {plugin} active'.format(plugin=str(plugin.name)))
             plugin.set_status()
         else:
             plugin.status = PluginStatus.Disabled
         self.plugins.append(plugin)
コード例 #28
0
 def find_plugins(self):
     """
     Scan a directory for objects inheriting from the ``Plugin`` class.
     """
     log.info('Finding plugins')
     start_depth = len(os.path.abspath(self.base_path).split(os.sep))
     present_plugin_dir = os.path.join(self.base_path, 'presentations')
     log.debug('finding plugins in %s at depth %d', str(self.base_path), start_depth)
     for root, dirs, files in os.walk(self.base_path):
         if sys.platform == 'darwin' and root.startswith(present_plugin_dir):
             # TODO Presentation plugin is not yet working on Mac OS X.
             # For now just ignore it. The following code will ignore files from the presentation plugin directory
             # and thereby never import the plugin.
             continue
         for name in files:
             if name.endswith('.py') and not name.startswith('__'):
                 path = os.path.abspath(os.path.join(root, name))
                 this_depth = len(path.split(os.sep))
                 if this_depth - start_depth > 2:
                     # skip anything lower down
                     break
                 module_name = name[:-3]
                 # import the modules
                 log.debug('Importing %s from %s. Depth %d', module_name, root, this_depth)
                 try:
                     # Use the "imp" library to try to get around a problem with the PyUNO library which
                     # monkey-patches the __import__ function to do some magic. This causes issues with our tests.
                     # First, try to find the module we want to import, searching the directory in root
                     fp, path_name, description = imp.find_module(module_name, [root])
                     # Then load the module (do the actual import) using the details from find_module()
                     imp.load_module(module_name, fp, path_name, description)
                 except ImportError as e:
                     log.exception('Failed to import module %s on path %s: %s', module_name, path, e.args[0])
     plugin_classes = Plugin.__subclasses__()
     plugin_objects = []
     for p in plugin_classes:
         try:
             plugin = p()
             log.debug('Loaded plugin %s', str(p))
             plugin_objects.append(plugin)
         except TypeError:
             log.exception('Failed to load plugin %s', str(p))
     plugins_list = sorted(plugin_objects, key=lambda plugin: plugin.weight)
     for plugin in plugins_list:
         if plugin.check_pre_conditions():
             log.debug('Plugin %s active', str(plugin.name))
             plugin.set_status()
         else:
             plugin.status = PluginStatus.Disabled
         self.plugins.append(plugin)
コード例 #29
0
ファイル: mediaplugin.py プロジェクト: marmyshev/transitions
 def app_startup(self):
     """
     Do a couple of things when the app starts up. In this particular case
     we want to check if we have the old "Use Phonon" setting, and convert
     it to "enable Phonon" and "make it the first one in the list".
     """
     Plugin.app_startup(self)
     settings = Settings()
     settings.beginGroup(self.settingsSection)
     if settings.contains(u'use phonon'):
         log.info(u'Found old Phonon setting')
         players = self.media_controller.mediaPlayers.keys()
         has_phonon = u'phonon' in players
         if settings.value(u'use phonon')  and has_phonon:
             log.debug(u'Converting old setting to new setting')
             new_players = []
             if players:
                 new_players = [player for player in players if player != u'phonon']
             new_players.insert(0, u'phonon')
             self.media_controller.mediaPlayers[u'phonon'].isActive = True
             settings.setValue(u'players', u','.join(new_players))
             self.settingsTab.load()
         settings.remove(u'use phonon')
     settings.endGroup()
コード例 #30
0
ファイル: pluginmanager.py プロジェクト: imkernel/openlp
 def find_plugins(self):
     """
     Scan a directory for objects inheriting from the ``Plugin`` class.
     """
     start_depth = len(os.path.abspath(self.base_path).split(os.sep))
     present_plugin_dir = os.path.join(self.base_path, 'presentations')
     self.log_debug('finding plugins in {path} at depth {depth:d}'.format(path=self.base_path, depth=start_depth))
     for root, dirs, files in os.walk(self.base_path):
         for name in files:
             if name.endswith('.py') and not name.startswith('__'):
                 path = os.path.abspath(os.path.join(root, name))
                 this_depth = len(path.split(os.sep))
                 if this_depth - start_depth > 2:
                     # skip anything lower down
                     break
                 module_name = name[:-3]
                 # import the modules
                 self.log_debug('Importing {name} from {root}. Depth {depth:d}'.format(name=module_name,
                                                                                       root=root,
                                                                                       depth=this_depth))
                 try:
                     # Use the "imp" library to try to get around a problem with the PyUNO library which
                     # monkey-patches the __import__ function to do some magic. This causes issues with our tests.
                     # First, try to find the module we want to import, searching the directory in root
                     fp, path_name, description = imp.find_module(module_name, [root])
                     # Then load the module (do the actual import) using the details from find_module()
                     imp.load_module(module_name, fp, path_name, description)
                 except ImportError as e:
                     self.log_exception('Failed to import module {name} on path {path}: '
                                        '{args}'.format(name=module_name, path=path, args=e.args[0]))
     plugin_classes = Plugin.__subclasses__()
     plugin_objects = []
     for p in plugin_classes:
         try:
             plugin = p()
             self.log_debug('Loaded plugin {plugin}'.format(plugin=str(p)))
             plugin_objects.append(plugin)
         except TypeError:
             self.log_exception('Failed to load plugin {plugin}'.format(plugin=str(p)))
     plugins_list = sorted(plugin_objects, key=lambda plugin: plugin.weight)
     for plugin in plugins_list:
         if plugin.check_pre_conditions():
             self.log_debug('Plugin {plugin} active'.format(plugin=str(plugin.name)))
             plugin.set_status()
         else:
             plugin.status = PluginStatus.Disabled
         self.plugins.append(plugin)
コード例 #31
0
ファイル: bibleplugin.py プロジェクト: marmyshev/transitions
 def __init__(self):
     Plugin.__init__(self, u'bibles', __default_settings__, BibleMediaItem, BiblesTab)
     self.weight = -9
     self.iconPath = u':/plugins/plugin_bibles.png'
     self.icon = build_icon(self.iconPath)
     self.manager = None
コード例 #32
0
ファイル: customplugin.py プロジェクト: marmyshev/transitions
 def __init__(self):
     Plugin.__init__(self, u'custom', __default_settings__, CustomMediaItem, CustomTab)
     self.weight = -5
     self.manager = Manager(u'custom', init_schema)
     self.iconPath = u':/plugins/plugin_custom.png'
     self.icon = build_icon(self.iconPath)
コード例 #33
0
ファイル: imageplugin.py プロジェクト: marmyshev/transitions
 def __init__(self):
     Plugin.__init__(self, u'images', __default_settings__, ImageMediaItem, ImageTab)
     self.weight = -7
     self.iconPath = u':/plugins/plugin_images.png'
     self.icon = build_icon(self.iconPath)
     QtCore.QObject.connect(Receiver.get_receiver(), QtCore.SIGNAL(u'image_updated'), self.image_updated)
コード例 #34
0
ファイル: alertsplugin.py プロジェクト: marmyshev/transitions
 def initialise(self):
     log.info(u'Alerts Initialising')
     Plugin.initialise(self)
     self.toolsAlertItem.setVisible(True)
     action_list = ActionList.get_instance()
     action_list.add_action(self.toolsAlertItem, UiStrings().Tools)