Exemplo n.º 1
0
def _select_plugins(preselected=None):
    """ Display plugin selection dialog.

    :param preselected:     Names of currently selected plugins
    :return:                Names of newly selected plugins
    """
    if preselected is None:
        selected_plugins = []
    else:
        # Create a local clone of the preselected list
        selected_plugins = preselected[:]
    print("Please select your desired plugins from the following list:")
    available_plugins = plugin.available_plugins()
    while True:
        for pos, ext in enumerate(available_plugins, 1):
            print("  {0} {1}: {2}"
                  .format('x' if ext in selected_plugins else ' ', pos, ext))
        selection = raw_input("Select a plugin (or hit enter to finish): ")
        if not selection:
            break
        if not selection.isdigit() or int(selection) > len(available_plugins):
            print(colorize("Please select a number in the range of 1 to {0}"
                           .format(len(available_plugins)), colorama.Fore.RED))
            continue
        plugin_name = available_plugins[int(selection)-1]
        if plugin_name in selected_plugins:
            selected_plugins.remove(plugin_name)
        else:
            selected_plugins.append(plugin_name)
    return selected_plugins
Exemplo n.º 2
0
    def create_plugin_widgets(self):
        """ Create widgets for plugin-related actions. """
        available_plugins = plugin.available_plugins()

        # List of available boxes with checkboxes
        self.plugin_label = ttk.Label(self,
                                      text="Select plugins\n"
                                      "to be activated")
        self.plugin_label.grid(column=0, row=0, sticky="E")
        self.plugin_select = ttk.Treeview(self,
                                          height=len(available_plugins),
                                          show=["tree"])
        self.plugin_select.tag_configure('missingdep', foreground="red")
        for plug in available_plugins:
            self.plugin_select.insert('', 'end', plug, text=plug)
        self.plugin_select.bind("<<TreeviewSelect>>",
                                self.on_update_plugin_selection)
        self.plugin_select.grid(column=1, row=0, sticky="WE")

        # Widget to configure postprocessing plugin order
        self.processorder_label = ttk.Label(
            self, text="Select order of\npostprocessing plugins")
        self.processorder_label.grid(column=0, row=1, sticky="E")
        self.processorder_tree = ttk.Treeview(self,
                                              height=5,
                                              show=["tree"],
                                              selectmode="browse")
        self.processorder_tree.bind("<B1-Motion>",
                                    self.on_process_plugin_move,
                                    add='+')
        self.processorder_tree.grid(column=1, row=1)
Exemplo n.º 3
0
def _select_plugins(preselected=None):
    """ Display plugin selection dialog.

    :param preselected:     Names of currently selected plugins
    :return:                Names of newly selected plugins
    """
    if preselected is None:
        selected_plugins = []
    else:
        # Create a local clone of the preselected list
        selected_plugins = preselected[:]
    print("Please select your desired plugins from the following list:")
    available_plugins = plugin.available_plugins()
    while True:
        for pos, ext in enumerate(available_plugins, 1):
            print("  {0} {1}: {2}".format(
                'x' if ext in selected_plugins else ' ', pos, ext))
        selection = raw_input("Select a plugin (or hit enter to finish): ")
        if not selection:
            break
        if not selection.isdigit() or int(selection) > len(available_plugins):
            print(
                colorize(
                    "Please select a number in the range of 1 to {0}".format(
                        len(available_plugins)), colorama.Fore.RED))
            continue
        plugin_name = available_plugins[int(selection) - 1]
        if plugin_name in selected_plugins:
            selected_plugins.remove(plugin_name)
        else:
            selected_plugins.append(plugin_name)
    return selected_plugins
Exemplo n.º 4
0
    def create_plugin_widgets(self):
        """ Create widgets for plugin-related actions. """
        available_plugins = plugin.available_plugins()

        # List of available boxes with checkboxes
        self.plugin_label = ttk.Label(self, text="Select plugins\n"
                                                 "to be activated")
        self.plugin_label.grid(column=0, row=0, sticky="E")
        self.plugin_select = ttk.Treeview(self, height=len(available_plugins),
                                          show=["tree"])
        self.plugin_select.tag_configure('missingdep', foreground="red")
        for plug in available_plugins:
            self.plugin_select.insert('', 'end', plug, text=plug)
        self.plugin_select.bind(
            "<<TreeviewSelect>>", self.on_update_plugin_selection
        )
        self.plugin_select.grid(column=1, row=0, sticky="WE")

        # Widget to configure postprocessing plugin order
        self.processorder_label = ttk.Label(
            self, text="Select order of\npostprocessing plugins")
        self.processorder_label.grid(column=0, row=1, sticky="E")
        self.processorder_tree = ttk.Treeview(
            self, height=5, show=["tree"],
            selectmode="browse")
        self.processorder_tree.bind("<B1-Motion>", self.on_process_plugin_move,
                                    add='+')
        self.processorder_tree.grid(column=1, row=1)
Exemplo n.º 5
0
def _select_plugins(selected_plugins=None):
    if selected_plugins is None:
        selected_plugins = []
    print("Please select your desired plugins from the following list:")
    available_plugins = plugin.available_plugins()
    while True:
        for pos, ext in enumerate(available_plugins, 1):
            print("  {0} {1}: {2}"
                  .format('x' if ext in selected_plugins else ' ', pos, ext))
        selection = raw_input("Select a plugin (or hit enter to finish): ")
        if not selection:
            break
        if not selection.isdigit() or int(selection) > len(available_plugins):
            print(colorize("Please select a number in the range of 1 to {0}"
                           .format(len(available_plugins)), colorama.Fore.RED))
            continue
        plugin_name = available_plugins[int(selection)-1]
        if plugin_name in selected_plugins:
            selected_plugins.remove(plugin_name)
        else:
            selected_plugins.append(plugin_name)
    return selected_plugins
Exemplo n.º 6
0
def _select_plugins(selected_plugins=None):
    if selected_plugins is None:
        selected_plugins = []
    print("Please select your desired plugins from the following list:")
    available_plugins = plugin.available_plugins()
    while True:
        for pos, ext in enumerate(available_plugins, 1):
            print("  {0} {1}: {2}".format(
                'x' if ext in selected_plugins else ' ', pos, ext))
        selection = raw_input("Select a plugin (or hit enter to finish): ")
        if not selection:
            break
        if not selection.isdigit() or int(selection) > len(available_plugins):
            print(
                colorize(
                    "Please select a number in the range of 1 to {0}".format(
                        len(available_plugins)), colorama.Fore.RED))
            continue
        plugin_name = available_plugins[int(selection) - 1]
        if plugin_name in selected_plugins:
            selected_plugins.remove(plugin_name)
        else:
            selected_plugins.append(plugin_name)
    return selected_plugins