Ejemplo n.º 1
0
 def _add_header_func(self, row, before, unused_user_data):
     """Adds a header for a new section in the model."""
     current_type = PluginManager.get_plugin_type(row.plugin_info)
     if before is not None:
         previous_type = PluginManager.get_plugin_type(before.plugin_info)
     else:
         previous_type = None
     if previous_type != current_type:
         self._set_header(row, current_type)
Ejemplo n.º 2
0
 def _add_header_func(self, row, before, unused_user_data):
     """Adds a header for a new section in the model."""
     current_type = PluginManager.get_plugin_type(row.plugin_info)
     if before is not None:
         previous_type = PluginManager.get_plugin_type(before.plugin_info)
     else:
         previous_type = None
     if previous_type != current_type:
         self._set_header(row, str(current_type))
Ejemplo n.º 3
0
 def reload(self):
     self.remove_all()
     plugins = self.app.plugin_manager.engine.get_plugin_list()
     # Firstly, sort the plugins according the number assigned to the
     # pluginmanager.PluginType object. Secondly, sort alphabetically.
     for plugin_info in sorted(plugins,
                               key=lambda x: (PluginManager.get_plugin_type(x), x.get_name())):
         item = PluginItem(self.app, plugin_info)
         self.append(item)
Ejemplo n.º 4
0
 def reload(self):
     self.remove_all()
     plugins = self.app.plugin_manager.engine.get_plugin_list()
     # Firstly, sort the plugins according the number assigned to the
     # pluginmanager.PluginType object. Secondly, sort alphabetically.
     for plugin_info in sorted(
             plugins,
             key=lambda x:
         (PluginManager.get_plugin_type(x), x.get_name())):
         self.append(PluginItem(plugin_info))
Ejemplo n.º 5
0
    def _setup(self):
        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        self.effects = EffectsManager()
        self.proxy_manager = ProxyManager(self)
        self.system = get_system()
        self.plugin_manager = PluginManager(self)

        self.project_manager.connect("new-project-loading",
                                     self._newProjectLoadingCb)
        self.project_manager.connect("new-project-loaded",
                                     self._newProjectLoaded)
        self.project_manager.connect("project-closed", self._projectClosed)

        self._createActions()
        self._syncDoUndo()
Ejemplo n.º 6
0
    def _setup(self):
        # pylint: disable=attribute-defined-outside-init
        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        self.effects = EffectsManager()
        self.proxy_manager = ProxyManager(self)
        self.system = get_system()
        self.plugin_manager = PluginManager(self)

        self.project_manager.connect("new-project-loaded",
                                     self._new_project_loaded_cb)
        self.project_manager.connect_after("project-closed",
                                           self._project_closed_cb)
        self.project_manager.connect("project-saved", self.__project_saved_cb)

        self._create_actions()
        self._sync_do_undo()
Ejemplo n.º 7
0
    def test_load_plugins_from_settings(self):
        """Checks if the plugin manager loads plugins from GlobalSettings."""
        class App(GObject.Object):
            """A representation of the Pitivi Application for test purposes."""
            __gsignals__ = {
                "window-added":
                (GObject.SignalFlags.RUN_LAST, None, (object, ))
            }

            def __init__(self):
                GObject.Object.__init__(self)
                self.settings = GlobalSettings()

        with mock.patch("pitivi.pluginmanager.get_plugins_dir") as get_plugins_dir,\
                mock.patch("pitivi.pluginmanager.get_user_plugins_dir") as get_user_plugins_dir,\
                tempfile.TemporaryDirectory() as temp_dir:

            plugin_content = ("[Plugin]\n"
                              "Module=pluginA\n"
                              "Name=PluginA\n"
                              "Loader=Python3")

            py_content = ("from gi.repository import GObject\n"
                          "class PluginA(GObject.GObject):\n"
                          "    def __init__(self):\n"
                          "        GObject.Object.__init__(self)")

            with open(os.path.join(temp_dir, "pluginA.plugin"),
                      "w") as plugin_file:
                plugin_file.write(plugin_content)
            with open(os.path.join(temp_dir, "pluginA.py"), "w") as py_file:
                py_file.write(py_content)

            get_plugins_dir.return_value = temp_dir
            get_user_plugins_dir.return_value = temp_dir

            app = App()
            app.settings.ActivePlugins = ["pluginA"]

            plugin_manager = PluginManager(app)
            app.emit("window-added", None)

            loaded_plugins = plugin_manager.engine.get_loaded_plugins()
            self.assertCountEqual(loaded_plugins, app.settings.ActivePlugins)
Ejemplo n.º 8
0
    def __init__(self):
        """
        initialize pitivi with the command line arguments
        """
        Loggable.__init__(self)

        # init logging as early as possible so we can log startup code
        enable_color = os.environ.get('PITIVI_DEBUG_NO_COLOR',
                                      '0') in ('', '0')
        log.init('PITIVI_DEBUG', enable_color)

        self.info('starting up')

        # store ourself in the instance global
        if instance.PiTiVi:
            raise RuntimeWarning(
                _("There is already a %s instance, please inform the developers by filing a bug at http://bugzilla.gnome.org/enter_bug.cgi?product=pitivi"
                  ) % APPNAME)
        instance.PiTiVi = self

        self.projects = []
        self.current = None

        # get settings
        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        #self.screencast = False

        self.plugin_manager = PluginManager(
            self.settings.get_local_plugin_path(),
            self.settings.get_plugin_settings_path())
        self.effects = Magician()
        self.deviceprobe = get_probe()

        self.projectManager = ProjectManager()
        self._connectToProjectManager(self.projectManager)

        self.action_log = UndoableActionLog()
        self.debug_action_log_observer = DebugActionLogObserver()
        self.debug_action_log_observer.startObserving(self.action_log)
        self.timelineLogObserver = TimelineLogObserver(self.action_log)
        self.sourcelist_log_observer = SourceListLogObserver(self.action_log)