示例#1
0
    def enable(self):
        self.builder = gtk.Builder()
        self.builder.add_from_file(get_resource("config.ui"))
        self.builder.connect_signals({
            "on_button_clear_clicked":
            self.on_button_clear_clicked,
        })

        component.get("Preferences").add_page(
            "TrafficLimits", self.builder.get_object("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs",
                                                     self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs",
                                                     self.on_show_prefs)

        self.status_item = component.get("StatusBar").add_item(
            image=get_resource("monitor.png"),
            text="",
            callback=self.on_status_item_clicked,
            tooltip="TrafficLimits plugin")

        def on_get_state(state):
            self.set_status(*state)

        self.state_deferred = client.trafficlimits.get_state().addCallback(
            on_get_state)
        client.register_event_handler("TrafficLimitUpdate",
                                      self.on_trafficlimit_update)
示例#2
0
    def enable(self):
        log.debug("Stats plugin enable called")
        self.config = deluge.configmanager.ConfigManager("stats.gtkui.conf", DEFAULT_CONF)
        self.glade = XML(common.get_resource("config.glade"))
        component.get("Preferences").add_page("Stats", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        self.on_show_prefs()

        self.graphs_tab = GraphsTab(XML(common.get_resource("tabs.glade")), self.config['colors'])
        self.torrent_details = component.get('TorrentDetails')
        self.torrent_details.add_tab(self.graphs_tab)
示例#3
0
    def enable(self):
        log.debug("Stats plugin enable called")
        self.config = deluge.configmanager.ConfigManager("stats.gtkui.conf", DEFAULT_CONF)
        self.glade = XML(common.get_resource("config.glade"))
        component.get("Preferences").add_page("Stats", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        self.on_show_prefs()

        self.graphs_tab = GraphsTab(XML(common.get_resource("tabs.glade")), self.config["colors"])
        self.torrent_details = component.get("TorrentDetails")
        self.torrent_details.add_tab(self.graphs_tab)
示例#4
0
class WebUI(WebPluginBase):

    scripts = [
        get_resource("sickbeard.js"),
        get_resource("moment-with-locales.js")
    ]
    debug_scripts = scripts

    #stylesheets   = [get_resource("sickbeard.css")]

    def enable(self):
        log.debug("Sickbeard WebUI plugin enable")

    def disable(self):
        log.debug("Sickbeard WebUI plugin disable")
示例#5
0
  def _finish_init(self):
    log.debug("[%s] Resuming initialization...", PLUGIN_NAME)

    self.config = {}

    self.ui = gtk.glade.XML(get_resource("wnd_preferences.glade"))

    lbl = self.ui.get_widget("lbl_general")
    lbl.set_markup("<b>%s</b>" % lbl.get_text())

    lbl = self.ui.get_widget("lbl_timeout")
    lbl.set_markup("<b>%s</b>" % lbl.get_text())

    component.get("Preferences").add_page(
        DISPLAY_NAME, self.ui.get_widget("blk_preferences"))
    component.get("PluginManager").register_hook(
        "on_apply_prefs", self._do_save_settings)
    component.get("PluginManager").register_hook(
        "on_show_prefs", self._do_load_settings)

    self.menu = self._create_menu()
    self.menu.show_all()

    self.sep = component.get("MenuBar").add_torrentmenu_separator()
    component.get("MenuBar").torrentmenu.append(self.menu)

    self._add_column()

    self._do_load_settings()
    log.debug("[%s] GtkUI enabled", PLUGIN_NAME)
示例#6
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        component.get("Preferences").add_page("Streaming", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)

        file_menu = self.get_widget('menu_file_tab')

        self.sep = gtk.SeparatorMenuItem()
        self.item = gtk.MenuItem(_("_Stream this file"))
        self.item.connect("activate", self.on_menuitem_stream)

        file_menu.append(self.sep)
        file_menu.append(self.item)

        self.sep.show()
        self.item.show()

        torrentmenu = component.get("MenuBar").torrentmenu

        self.sep_torrentmenu = gtk.SeparatorMenuItem()
        self.item_torrentmenu = gtk.MenuItem(_("_Stream this torrent"))
        self.item_torrentmenu.connect("activate", self.on_torrentmenu_menuitem_stream)

        torrentmenu.append(self.sep_torrentmenu)
        torrentmenu.append(self.item_torrentmenu)

        self.sep_torrentmenu.show()
        self.item_torrentmenu.show()
def get_data_from_url(page_url_list):
    """
    For get a resource for each url

    Parameters
    ----------

    page_url_list: list of str
        list of url search

    Output
    ------

    resource_list: list of str
        list of str containing resource

    """
    total_page_url = len(page_url_list)
    page_data_list = []
    for idx, page_url in enumerate(page_url_list):

        logging.info('Downloading page %d/%d %s', idx + 1, total_page_url,
                     page_url)
        try:
            data = get_resource(page_url, unverified_ctx=True)
            page_data_list.append(data)

        except Exception as e:
            logging.warning(e)

    return page_data_list
    def show(self, parent):	
        self.glade = gtk.glade.XML(get_resource("config_addrule.glade"))
	self.glade.signal_autoconnect({
            "on_rule_add":self.on_add,
            "on_rule_cancel":self.on_cancel})
	self.parent = parent
	
	liststore = gtk.ListStore(str)	

        def on_labels(labels):
            log.debug("Got Labels: %s", labels)
            for label in labels:
                liststore.append([label])

        def on_failure(failure):
            log.exception(failure)

	def on_get_enabled_plugins(result):
            if 'Label' in result:
                client.label.get_labels().addCallback(on_labels).addErrback(on_failure)

	client.core.get_enabled_plugins().addCallback(on_get_enabled_plugins)

	self.tbRule = self.glade.get_widget("tbRule")
	self.cbLabels = self.glade.get_widget("cbLabels")
	self.cbLabels.set_model(liststore)
	renderer_text = gtk.CellRendererText()
        self.cbLabels.pack_start(renderer_text, True)
        self.cbLabels.add_attribute(renderer_text, "text", 0)

        self.dialog = self.glade.get_widget("new_rule_dialog")
        self.dialog.set_transient_for(component.get("Preferences").pref_dialog)
	self.dialog.run()
示例#9
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        component.get("Preferences").add_page("Categorise", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        self.on_show_prefs()
示例#10
0
文件: gtkui.py 项目: Ashod/Deluge
    def enable(self):
        log.debug('Enabling %s FreeSpace', self.__class__.__name__)
        self.glade = gtk.glade.XML(get_resource("config.glade"))
        self.prefs = self.glade.get_widget('prefs_box')
        parent = self.prefs.get_parent()
        if parent:
            parent.remove(self.prefs)

        self.downloads_vbox = component.get("Preferences").builder.get_object('downloads_vbox')
        self.downloads_vbox.pack_start(self.prefs, False, True, 0)

        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)

        try:
            notifications = component.get("GtkPlugin.Notifications")
            notifications.register_custom_popup_notification(
                "LowDiskSpaceEvent", self.__custom_popup_notification
            )
            notifications.register_custom_blink_notification(
                "LowDiskSpaceEvent", self.__custom_blink_notification
            )
            notifications.register_custom_sound_notification(
                "LowDiskSpaceEvent", self.__custom_sound_notification
            )
        except KeyError:
            pass

        client.register_event_handler("PluginEnabledEvent", self.__on_plugin_enabled)
        client.register_event_handler("PluginDisabledEvent", self.__on_plugin_disabled)
示例#11
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))
	self.glade.signal_autoconnect({
            "on_new_rule":self.on_new_rule})
	self.glade.signal_autoconnect({
            "on_remove_rule":self.on_remove_rule})
	self.glade.signal_autoconnect({
            "on_enabledisable_rule":self.on_enabledisable_rule})

	self.add_new_rule_dialog = AddRuleDialog()

        component.get("Preferences").add_page("AutoLabeling", self.glade.get_widget("autoLabelingConfigContainer"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
	
	#enabled?, regex, label
	self.tsRules = gtk.TreeStore(bool, str, str)

	self.tvRules = self.glade.get_widget("tvRules")

	render = gtk.CellRendererToggle()
        render.connect("toggled", self._on_file_toggled)
        column = gtk.TreeViewColumn(None, render, active=0, inconsistent=4)
	self.tvRules.append_column(column)

	render = gtk.CellRendererText()
        column = gtk.TreeViewColumn(_("Pattern"), render, text=1)
        self.tvRules.append_column(column)

	render = gtk.CellRendererText()
        column = gtk.TreeViewColumn(_("Label"), render, text=2)
        self.tvRules.append_column(column)

	self.tvRules.set_model(self.tsRules)
示例#12
0
 def _load_ui(self, ui_file):
     """Load content using root object from ui file // test this later"""
     self.builder = gtk.Builder()
     self.builder.add_from_file(get_resource(ui_file))
     self.root = self.builder.get_object("root")
     self.get_content_area().pack_start(self.root)
     self.builder.connect_signals(self)
示例#13
0
    def __init__(self):
        Tab.__init__(self)
        
        glade_tab = gtk.glade.XML(get_resource("pieces_tab.glade"))
        
        self._child_widget = glade_tab.get_widget("pieces_tab")
        self._tab_label = glade_tab.get_widget("pieces_tab_label")

        self.multisquare = MultiSquare(
            num_squares=0,
            colors=['#000000', '#FF0000', '#0000FF'],
            display=self._child_widget.get_display(),
            menu=glade_tab.get_widget("priority_menu")
        )

        vbox = gtk.VBox()
        vbox.add(self.multisquare)
        
        self.checkbutton = gtk.CheckButton(label="Set priority of first un-downloaded piece to High")
        self.checkbutton.connect("toggled", self.on_priority_trigger)
        
        vbox.pack_end(self.checkbutton, expand=False, fill=False, padding=5)

        viewport = gtk.Viewport()
        viewport.set_shadow_type(gtk.SHADOW_NONE)
        viewport.add(vbox)

        self._child_widget.add(viewport)
        self._child_widget.get_parent().show_all()

        #keep track of the current selected torrent
        self._current = -1
        self.showed_priority_warning = False
示例#14
0
    def _finish_init(self):
        log.debug("[%s] Resuming initialization...", PLUGIN_NAME)

        self.config = {}

        self.ui = gtk.glade.XML(get_resource("wnd_preferences.glade"))

        lbl = self.ui.get_widget("lbl_general")
        lbl.set_markup("<b>%s</b>" % lbl.get_text())

        lbl = self.ui.get_widget("lbl_timeout")
        lbl.set_markup("<b>%s</b>" % lbl.get_text())

        component.get("Preferences").add_page(
            DISPLAY_NAME, self.ui.get_widget("blk_preferences"))
        component.get("PluginManager").register_hook("on_apply_prefs",
                                                     self._do_save_settings)
        component.get("PluginManager").register_hook("on_show_prefs",
                                                     self._do_load_settings)

        self.menu = self._create_menu()
        self.menu.show_all()

        self.sep = component.get("MenuBar").add_torrentmenu_separator()
        component.get("MenuBar").torrentmenu.append(self.menu)

        self._add_column()

        self._do_load_settings()
        log.debug("[%s] GtkUI enabled", PLUGIN_NAME)
示例#15
0
    def __init__(self):
        self.glade = gtk.glade.XML(get_resource("torrent_view.glade"))
        self.window = self.glade.get_widget("torrent_view_window")
        self.torrentview = self.glade.get_widget("torrent_view")
        self.glade.signal_autoconnect(self)
        self.store = gtk.ListStore(int, str, int, str)
        self.torrentview.set_model(self.store)

        # Set up columns
        renderer = gtk.CellRendererText()

        task_col = gtk.TreeViewColumn('Task', renderer)
        task_col.add_attribute(renderer, "text", 0)
        task_col.set_visible(False)
        self.torrentview.append_column(task_col)

        name_col = gtk.TreeViewColumn('Name', renderer)
        name_col.add_attribute(renderer, "text", 1)
        self.torrentview.append_column(name_col)

        p_renderer = gtk.CellRendererProgress()
        progress_col = gtk.TreeViewColumn('Progress', p_renderer)
        progress_col.add_attribute(p_renderer, "value", 2)
        self.torrentview.append_column(progress_col)

        dest_col = gtk.TreeViewColumn('Destination', renderer)
        dest_col.add_attribute(renderer, "text", 3)
        self.torrentview.append_column(dest_col)
示例#16
0
    def on_scheduler_event(self, state):
        self.state = state
        self.status_item.set_image_from_file(get_resource(self.state.lower() + ".png"))
        if self.state == "Yellow":
            # Prevent func calls in Statusbar if the config changes.
            self.statusbar.config_value_changed_dict.pop("max_download_speed", None)
            self.statusbar.config_value_changed_dict.pop("max_upload_speed", None)
            try:
                self.statusbar._on_max_download_speed(self.spin_download.get_value())
                self.statusbar._on_max_upload_speed(self.spin_upload.get_value())
            except AttributeError:
                # Skip error due to Plugin being enabled before statusbar items created on startup.
                pass
        else:
            self.statusbar.config_value_changed_dict["max_download_speed"] = self.statusbar._on_max_download_speed
            self.statusbar.config_value_changed_dict["max_upload_speed"] = self.statusbar._on_max_upload_speed

            def update_config_values(config):
                try:
                    self.statusbar._on_max_download_speed(config["max_download_speed"])
                    self.statusbar._on_max_upload_speed(config["max_upload_speed"])
                except AttributeError:
                    # Skip error due to Plugin being enabled before statusbar items created on startup.
                    pass
            client.core.get_config_values(["max_download_speed", "max_upload_speed"]).addCallback(update_config_values)
示例#17
0
    def enable(self):
        self.create_prefs_page()

        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        self.statusbar = component.get("StatusBar")
        self.status_item = self.statusbar.add_item(
            image=get_resource("green.png"),
            text="",
            callback=self.on_status_item_clicked,
            tooltip="MyScheduler")

        self.menu = gtk.CheckMenuItem(_("Force Start"))
        self.menu.connect("activate", self.on_menu_activated, None)        
        self.menu.show()
        
        torrentmenu = component.get("MenuBar").torrentmenu
        torrentmenu.connect("show", self.on_menu_show, None)
        torrentmenu.insert(self.menu, 4)

        def on_state_deferred(state):
            self.state = state
            self.on_scheduler_event(state)
        client.myscheduler.get_state().addCallback(on_state_deferred)
        client.register_event_handler("SchedulerEvent", self.on_scheduler_event)
示例#18
0
文件: config.py 项目: lileipku00/kite
    def __init__(self, *args, **kwargs):
        QtGui.QDialog.__init__(self, *args, **kwargs)
        loadUi(get_resource('dialog_config.ui'), self)

        self.ok_button.released.connect(self.setAttributes)
        self.ok_button.released.connect(self.close)

        self.apply_button.released.connect(self.setAttributes)

        self.vector_color_picker = QtGui.QColorDialog(self)
        self.vector_color_picker.\
            setCurrentColor(QtGui.QColor(*config.vector_color))
        self.vector_color_picker.\
            setOption(self.vector_color_picker.ShowAlphaChannel)
        self.vector_color_picker.colorSelected.connect(self.updateVectorColor)
        self.vector_color_picker.setModal(True)
        self.vector_color.clicked.connect(self.vector_color_picker.show)

        self.vector_color.setValue = self.setButtonColor
        self.vector_color.value = self.getButtonColor

        self.chooseStoreDirButton.released.connect(self.chooseStoreDir)
        self.completer_model.setRootPath('')
        self.completer.setParent(self.default_gf_dir)
        self.default_gf_dir.setCompleter(self.completer)

        self.getAttributes()
示例#19
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        component.get("Preferences").add_page(
            "AutoBot", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs",
                                                     self.on_apply_prefs)
示例#20
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        component.get("Preferences").add_page("Streaming", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        
        file_menu = component.get("MainWindow").main_glade.get_widget('menu_file_tab')
        
        self.sep = gtk.SeparatorMenuItem()
        self.item = gtk.MenuItem(_("_Stream this file"))
        self.item.connect("activate", self.on_menuitem_stream)
        
        file_menu.append(self.sep)
        file_menu.append(self.item)

        self.sep.show()
        self.item.show()
        
        torrentmenu = component.get("MenuBar").torrentmenu
        
        self.sep_torrentmenu = gtk.SeparatorMenuItem()
        self.item_torrentmenu = gtk.MenuItem(_("_Stream this torrent"))
        self.item_torrentmenu.connect("activate", self.on_torrentmenu_menuitem_stream)
        
        torrentmenu.append(self.sep_torrentmenu)
        torrentmenu.append(self.item_torrentmenu)

        self.sep_torrentmenu.show()
        self.item_torrentmenu.show()
        
        self.resource = LocalAddResource(self)
        self.site = server.Site(self.resource)
        self.listening = reactor.listenTCP(40747, self.site, interface='127.0.0.1')
示例#21
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("simpleextractor_prefs.glade"))

        component.get("Preferences").add_page(_("SimpleExtractor"), self.glade.get_widget("extractor_prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        self.on_show_prefs()
示例#22
0
    def enable(self):
        self.glade_cfg = gtk.glade.XML(get_resource("config.glade"))
        self._pieces_tab = PiecesTab()
        component.get("TorrentDetails").add_tab(self._pieces_tab)
        # client.pieces.get_config().addCallback(self.set_colors)

        component.get("Preferences").add_page("Pieces", self.glade_cfg.get_widget("prefs_box"))
示例#23
0
    def enable(self):
        log.debug('Enabling %s FreeSpace', self.__class__.__name__)
        self.glade = gtk.glade.XML(get_resource("config.glade"))
        self.prefs = self.glade.get_widget('prefs_box')
        parent = self.prefs.get_parent()
        if parent:
            parent.remove(self.prefs)

        self.downloads_vbox = component.get("Preferences").builder.get_object(
            'downloads_vbox')
        self.downloads_vbox.pack_start(self.prefs, False, True, 0)

        component.get("PluginManager").register_hook("on_apply_prefs",
                                                     self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs",
                                                     self.on_show_prefs)

        try:
            notifications = component.get("GtkPlugin.Notifications")
            notifications.register_custom_popup_notification(
                "LowDiskSpaceEvent", self.__custom_popup_notification)
            notifications.register_custom_blink_notification(
                "LowDiskSpaceEvent", self.__custom_blink_notification)
            notifications.register_custom_sound_notification(
                "LowDiskSpaceEvent", self.__custom_sound_notification)
        except KeyError:
            pass

        client.register_event_handler("PluginEnabledEvent",
                                      self.__on_plugin_enabled)
        client.register_event_handler("PluginDisabledEvent",
                                      self.__on_plugin_disabled)
示例#24
0
    def on_scheduler_event(self, state):
        self.state = state
        self.status_item.set_image_from_file(get_resource(self.state.lower() + ".png"))
        if self.state == "Yellow":
            # Prevent func calls in Statusbar if the config changes.
            self.statusbar.config_value_changed_dict.pop("max_download_speed", None)
            self.statusbar.config_value_changed_dict.pop("max_upload_speed", None)
            try:
                self.statusbar._on_max_download_speed(self.spin_download.get_value())
                self.statusbar._on_max_upload_speed(self.spin_upload.get_value())
            except AttributeError:
                # Skip error due to Plugin being enabled before statusbar items created on startup.
                pass
        else:
            self.statusbar.config_value_changed_dict["max_download_speed"] = self.statusbar._on_max_download_speed
            self.statusbar.config_value_changed_dict["max_upload_speed"] = self.statusbar._on_max_upload_speed

            def update_config_values(config):
                try:
                    self.statusbar._on_max_download_speed(config["max_download_speed"])
                    self.statusbar._on_max_upload_speed(config["max_upload_speed"])
                except AttributeError:
                    # Skip error due to Plugin being enabled before statusbar items created on startup.
                    pass
            client.core.get_config_values(["max_download_speed", "max_upload_speed"]).addCallback(update_config_values)
示例#25
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        component.get("Preferences").add_page(
            "Streaming", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs",
                                                     self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs",
                                                     self.on_show_prefs)

        file_menu = self.get_widget('menu_file_tab')

        self.sep = gtk.SeparatorMenuItem()
        self.item = gtk.MenuItem(_("_Stream this file"))
        self.item.connect("activate", self.on_menuitem_stream)

        file_menu.append(self.sep)
        file_menu.append(self.item)

        self.sep.show()
        self.item.show()

        torrentmenu = component.get("MenuBar").torrentmenu

        self.sep_torrentmenu = gtk.SeparatorMenuItem()
        self.item_torrentmenu = gtk.MenuItem(_("_Stream this torrent"))
        self.item_torrentmenu.connect("activate",
                                      self.on_torrentmenu_menuitem_stream)

        torrentmenu.append(self.sep_torrentmenu)
        torrentmenu.append(self.item_torrentmenu)

        self.sep_torrentmenu.show()
        self.item_torrentmenu.show()
示例#26
0
 def _load_ui(self, ui_file):
     """Load content using root object from ui file // test this later"""
     self.builder = gtk.Builder()
     self.builder.add_from_file(get_resource(ui_file))
     self.root = self.builder.get_object("root")
     self.get_content_area().pack_start(self.root)
     self.builder.connect_signals(self)
    def enable(self):
        self.builder = gtk.Builder();
        self.builder.add_from_file(get_resource("config.ui"))
        self.builder.connect_signals({
                "on_button_clear_clicked": self.on_button_clear_clicked,
                });
		self.builder.get_object("combobox_upload").new_text()
示例#28
0
    def show(self, options={}, watchdir_id=None):
        self.glade = gtk.glade.XML(get_resource("autoadd_options.glade"))
        self.glade.signal_autoconnect({
            "on_opts_add":self.on_add,
            "on_opts_apply":self.on_apply,
            "on_opts_cancel":self.on_cancel,
            "on_options_dialog_close":self.on_cancel,
            "on_toggle_toggled":self.on_toggle_toggled
        })
        self.dialog = self.glade.get_widget("options_dialog")
        self.dialog.set_transient_for(component.get("Preferences").pref_dialog)

        if watchdir_id:
            #We have an existing watchdir_id, we are editing
            self.glade.get_widget('opts_add_button').hide()
            self.glade.get_widget('opts_apply_button').show()
            self.watchdir_id = watchdir_id
        else:
            #We don't have an id, adding
            self.glade.get_widget('opts_add_button').show()
            self.glade.get_widget('opts_apply_button').hide()
            self.watchdir_id = None

        self.load_options(options)
        self.dialog.run()
示例#29
0
    def enable(self):
        self.create_prefs_page()

        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        self.statusbar = component.get("StatusBar")
        self.status_item = self.statusbar.add_item(
            image=get_resource("green.png"),
            text="",
            callback=self.on_status_item_clicked,
            tooltip="MyScheduler")

        self.menu = gtk.CheckMenuItem(_("Force Start"))
        self.menu.connect("activate", self.on_menu_activated, None)        
        self.menu.show()
        
        torrentmenu = component.get("MenuBar").torrentmenu
        torrentmenu.connect("show", self.on_menu_show, None)
        torrentmenu.append(self.menu)

        def on_state_deferred(state):
            self.state = state
            self.on_scheduler_event(state)
        client.scheduler.get_state().addCallback(on_state_deferred)
        client.register_event_handler("SchedulerEvent", self.on_scheduler_event)
示例#30
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))
        self.glade.signal_autoconnect({
            "on_add_button_clicked": self.on_add_button_clicked,
            "on_edit_button_clicked": self.on_edit_button_clicked,
            "on_remove_button_clicked": self.on_remove_button_clicked,
            "on_up_button_clicked": self.on_up_button_clicked,
            "on_down_button_clicked": self.on_down_button_clicked,
            "on_reload_now_clicked": self.on_reload_now_clicked,
        })

        component.get("Preferences").add_page("Default Trackers", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)

        self.trackers = []
        scrolled_window = self.glade.get_widget("scrolledwindow1")
        self.store = self.create_model()
        self.tree_view = gtk.TreeView(self.store)
        tree_selection = self.tree_view.get_selection()
        tree_selection.set_mode(gtk.SELECTION_MULTIPLE)
        self.tree_view.connect("cursor-changed", self.on_listitem_activated)
        self.tree_view.connect("row-activated", self.on_edit_button_clicked)
        self.tree_view.set_rules_hint(True)
        rendererText = gtk.CellRendererText()
        column = gtk.TreeViewColumn("URL", rendererText, text=0)
        self.tree_view.append_column(column)
        scrolled_window.add(self.tree_view)
        scrolled_window.show_all()

        self.opts_dialog = OptionsDialog(self)
示例#31
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        component.get("Preferences").add_page(
            "uTorrentImport", self.glade.get_widget("prefs_box"))

        component.get("PluginManager").register_hook("on_apply_prefs",
                                                     self.on_apply_prefs)

        component.get("PluginManager").register_hook("on_show_prefs",
                                                     self.on_show_prefs)
        signal_dictionary = {
            'on_import_button_clicked': self.on_import_button_clicked,
            'on_resume_toggled': self.on_resume_toggled
        }
        log.debug('utorrentimport: signals hooked!')
        self.glade.signal_autoconnect(signal_dictionary)
        self.use_wine_mappings = self.glade.get_widget('use_wine_mappings')
        self.force_recheck = self.glade.get_widget('force_recheck')
        self.resume = self.glade.get_widget('resume')
        self.resume_dat_entry = self.glade.get_widget('resume_dat_entry')
        self.log_view = self.glade.get_widget('log_view')

        client.register_event_handler('uTorrentImportLoggingEvent',
                                      self.log_to_user)
示例#32
0
    def __init__(self):
        Tab.__init__(self)
        glade_tab = gtk.glade.XML(get_resource("pieces_tab.glade"))

        self._name = "Pieces"
        self._child_widget = glade_tab.get_widget("pieces_tab")
        self._tab_label = glade_tab.get_widget("pieces_tab_label")

        self._ms = MultiSquare(0,['#000000','#FF0000','#0000FF'],
                               display=self._child_widget.get_display(),
                               menu=glade_tab.get_widget("priority_menu"))

        vb = gtk.VBox()
        vb.add(self._ms)
        self.cb = gtk.CheckButton(label="Set priority of first few un-downloaded pieces to High")
        self.cb.connect("toggled",self.onPrioTogg)
        vb.pack_end(self.cb,expand=False,fill=False,padding=5)

        vp = gtk.Viewport()
        vp.set_shadow_type(gtk.SHADOW_NONE)
        vp.add(vb)


        self._child_widget.add(vp)
        self._child_widget.get_parent().show_all()

        #keep track of the current selected torrent
        self._current = -1

        self._showed_prio_warn = False
示例#33
0
    def __init__(self):
        self.glade = gtk.glade.XML(get_resource("torrent_view.glade"))
        self.window = self.glade.get_widget("torrent_view_window")
        self.torrentview = self.glade.get_widget("torrent_view")
        self.glade.signal_autoconnect(self)
        self.store = gtk.ListStore(int, str, int, str)
        self.torrentview.set_model(self.store)

        # Set up columns
        renderer = gtk.CellRendererText()

        task_col = gtk.TreeViewColumn('Task', renderer)
        task_col.add_attribute(renderer, "text", 0)
        task_col.set_visible(False)
        self.torrentview.append_column(task_col)

        name_col = gtk.TreeViewColumn('Name', renderer)
        name_col.add_attribute(renderer, "text", 1)
        self.torrentview.append_column(name_col)

        p_renderer = gtk.CellRendererProgress()
        progress_col = gtk.TreeViewColumn('Progress', p_renderer)
        progress_col.add_attribute(p_renderer, "value", 2)
        self.torrentview.append_column(progress_col)

        dest_col = gtk.TreeViewColumn('Destination', renderer)
        dest_col.add_attribute(renderer, "text", 3)
        self.torrentview.append_column(dest_col)
示例#34
0
文件: gtkui.py 项目: praddy/Randomize
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("randomize.glade"))

        component.get("Preferences").add_page("Randomize", self.glade.get_widget("hbox1"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        self.on_show_prefs()
示例#35
0
    def show(self, options=None, item_id=None, item_index=None):
        self.glade = gtk.glade.XML(get_resource("options.glade"))
        self.glade.signal_autoconnect({
            "on_opts_add_button_clicked": self.on_add,
            "on_opts_apply_button_clicked": self.on_apply,
            "on_opts_cancel_button_clicked": self.on_cancel,
            "on_options_dialog_close": self.on_cancel,
        })
        self.dialog = self.glade.get_widget("options_dialog")
        self.dialog.set_transient_for(component.get("Preferences").pref_dialog)

        if item_id:
            #We have an existing item_id, we are editing
            self.glade.get_widget("opts_add_button").hide()
            self.glade.get_widget("opts_apply_button").show()
            self.item_id = item_id
        else:
            #We don't have an id, adding
            self.glade.get_widget("opts_add_button").show()
            self.glade.get_widget("opts_apply_button").hide()
            self.item_id = None
        self.item_index = item_index

        self.load_options(options)
        self.dialog.run()
        self.dialog.destroy()
示例#36
0
    def __init__(self):
        Tab.__init__(self)
        glade_tab = gtk.glade.XML(get_resource("pieces_tab.glade"))

        self._name = "Pieces"
        self._child_widget = glade_tab.get_widget("pieces_tab")
        self._tab_label = glade_tab.get_widget("pieces_tab_label")

        self._ms = MultiSquare(0,['#000000','#FF0000','#0000FF'],
                               display=self._child_widget.get_display(),
                               menu=glade_tab.get_widget("priority_menu"))

        self._prios = {}

        vb = gtk.VBox()
        vb.add(self._ms)

        self.cb = gtk.CheckButton(label="Prioritize early pieces")
        self.cb.connect("toggled",self.onPrioTogg)
        vb.pack_end(self.cb,expand=False,fill=False,padding=5)

        vp = gtk.Viewport()
        vp.set_shadow_type(gtk.SHADOW_NONE)
        vp.add(vb)

        self._child_widget.add(vp)
        self._child_widget.get_parent().show_all()

        #keep track of the current selected torrent
        self._current = -1

        self._showed_prio_warn = False
示例#37
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("lcextractor_prefs.glade"))

        component.get("Preferences").add_page(_("LCExtractor"), self.glade.get_widget("extractor_prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        self.on_show_prefs()
示例#38
0
    def enable(self):

        self.glade = gtk.glade.XML(get_resource("config.glade"))
        self.glade.signal_autoconnect({
            "on_add_button_clicked": self.on_add_button_clicked,
            "on_edit_button_clicked": self.on_edit_button_clicked,
            "on_remove_button_clicked": self.on_remove_button_clicked
        })
        self.opts_dialog = OptionsDialog()

        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        client.register_event_handler("AutoaddPlusOptionsChangedEvent", self.on_options_changed_event)

        self.watchdirs = {}

        vbox = self.glade.get_widget("watchdirs_vbox")
        sw = gtk.ScrolledWindow()
        sw.set_shadow_type(gtk.SHADOW_ETCHED_IN)
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        vbox.pack_start(sw, True, True, 0)

        self.store = self.create_model()

        self.treeView = gtk.TreeView(self.store)
        self.treeView.connect("cursor-changed", self.on_listitem_activated)
        self.treeView.connect("row-activated", self.on_edit_button_clicked)
        self.treeView.set_rules_hint(True)

        self.create_columns(self.treeView)
        sw.add(self.treeView)
        sw.show_all()
        component.get("Preferences").add_page(_("AutoAddPlus"), self.glade.get_widget("prefs_box"))
示例#39
0
 def __init__(self, msg):
     self.msg = msg
     self.glade = gtk.glade.XML(get_resource("already_contains_dialog.glade"))
     self.window = self.glade.get_widget("dialog")
     self.label = self.glade.get_widget("label")
     self.label.set_text('The destination folder already contains %s.'
         '\nTorrent storage will NOT be moved.' % msg.t_name)
     self.glade.signal_autoconnect(self)
示例#40
0
    def _load_ui(self, ui_file):
        """Load dialog content using root object from ui file."""
        self.builder = gtk.Builder()
        self.builder.add_from_file(get_resource(ui_file))
        self.root = self.builder.get_object('root')

        self.get_content_area().pack_start(self.root)
        self.builder.connect_signals(self)
示例#41
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        component.get("Preferences").add_page(_("WebUi"), self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        client.webui.get_config().addCallback(self.cb_get_config)
        client.webui.got_deluge_web().addCallback(self.cb_chk_deluge_web)
示例#42
0
 def enable(self):
     self.glade = gtk.glade.XML(get_resource("config.glade"))
     component.get("Preferences").add_page(
         "SequentialDownload", self.glade.get_widget("enabledMsg"))
     component.get("PluginManager").register_hook("on_apply_prefs",
                                                  self.on_apply_prefs)
     component.get("PluginManager").register_hook("on_show_prefs",
                                                  self.on_show_prefs)
示例#43
0
 def enable(self):
     self.glade = gtk.glade.XML(get_resource("config.glade"))
     component.get("Preferences").add_page("XBMCUpdater", self.glade.get_widget("vbox1"))
     component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
     component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
     client.register_event_handler("ReplacementAddedEvent", self.on_replacement_added_event)
     client.register_event_handler("ReplacementRemovedEvent", self.on_replacement_removed_event)
     self.load()
示例#44
0
    def _load_ui(self, ui_file):
        """Load dialog content using root object from ui file."""
        self.builder = gtk.Builder()
        self.builder.add_from_file(get_resource(ui_file))
        self.root = self.builder.get_object('root')

        self.get_content_area().pack_start(self.root)
        self.builder.connect_signals(self)
示例#45
0
class WebUI(WebPluginBase):
    scripts = [get_resource("sequentialdownload.js")]

    def enable(self):
        pass

    def disable(self):
        pass
示例#46
0
文件: gtkui.py 项目: Ashod/Deluge
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        component.get("Preferences").add_page(_("WebUi"), self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
        client.webui.get_config().addCallback(self.cb_get_config)
        client.webui.got_deluge_web().addCallback(self.cb_chk_deluge_web)
示例#47
0
    def enable(self):
        log.debug("Enabling AutoRemovePlus...")
        self.glade = gtk.glade.XML(get_resource("config.glade"))
        component.get("Preferences").add_page("AutoRemovePlus", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)

        # Create and fill remove rule list
        self.rules = gtk.ListStore(str, str)
        client.autoremoveplus.get_remove_rules().addCallback(self.cb_get_rules)

        # Fill list with logical functions
        self.sel_func_store = gtk.ListStore(str)
        self.sel_func_store.append(["and"])
        self.sel_func_store.append(["or"])

        cell = gtk.CellRendererText()

        cbo_remove = self.glade.get_widget("cbo_remove")
        cbo_remove.pack_start(cell, True)
        cbo_remove.add_attribute(cell, 'text', 1)
        cbo_remove.set_model(self.rules)

        cbo_remove1 = self.glade.get_widget("cbo_remove1")
        cbo_remove1.pack_start(cell, True)
        cbo_remove1.add_attribute(cell, 'text', 1)
        cbo_remove1.set_model(self.rules)

        cbo_sel_func = self.glade.get_widget("cbo_sel_func")
        cbo_sel_func.set_model(self.sel_func_store)
        cbo_sel_func.set_active(0)
        self.glade.get_widget("dummy").set_model(self.sel_func_store)

        self._new_tracker = self.glade.get_widget("new_tracker")
        self._new_tracker.connect("clicked", self._do_new_tracker)
        self._delete_tracker = self.glade.get_widget("delete_tracker")
        self._delete_tracker.connect("clicked", self._do_delete_tracker)

        self._blk_trackers = self.glade.get_widget("blk_trackers")
        self._view = self._build_view()
        window = gtk.ScrolledWindow()
        window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        window.set_shadow_type(gtk.SHADOW_IN)
        window.add(self._view)
        self._blk_trackers.add(window)
        self._blk_trackers.show_all()

        self.glade.get_widget("chk_remove").connect("toggled", self.on_click_remove)

        def on_menu_show(menu, (menu_item, toggled)):
            def set_ignored(ignored):
                # set_active will raise the 'toggled'/'activated' signals
                # so block it to not reset the value
                menu_item.handler_block(toggled)
                menu_item.set_active(False not in ignored)
                menu_item.handler_unblock(toggled)

            client.autoremoveplus.get_ignore([t for t in component.get("TorrentView").get_selected_torrents() ]).addCallback(set_ignored)
示例#48
0
 def show(self, feed=None):
     self.glade = gtk.glade.XML(get_resource("dialog_add_feed.glade"))
     self.glade.signal_autoconnect({
         "on_cancel":self.on_cancel,
         "on_button_add_clicked": self.on_button_add_clicked
     })
     self.dialog = self.glade.get_widget("dialog_add_feed")
     self.dialog.set_transient_for(component.get("Preferences").pref_dialog)
     self.dialog.run()
示例#49
0
    def enable(self):
        self.glade_cfg = gtk.glade.XML(get_resource("config.glade"))
        self._pieces_tab = PiecesTab()
        component.get("TorrentDetails").add_tab(self._pieces_tab)
        client.pieces.get_config().addCallback(self.set_colors)

        component.get("Preferences").add_page("Pieces", self.glade_cfg.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
示例#50
0
class WebUI(WebPluginBase):

    scripts = [get_resource("filebottool.js")]

    def enable(self):
        pass

    def disable(self):
        pass
示例#51
0
    def enable(self):
        self.glade = gtk.glade.XML(get_resource("config.glade"))

        # Get widgets, setup signals, etc
        self.setup_prefs_page()

        component.get("Preferences").add_page("AnnounceBot", self.glade.get_widget("prefs_box"))
        component.get("PluginManager").register_hook("on_apply_prefs", self.on_apply_prefs)
        component.get("PluginManager").register_hook("on_show_prefs", self.on_show_prefs)
示例#52
0
class WebUI(WebPluginBase):

    scripts = [get_resource("betteropenfolder.js")]

    def enable(self):
        pass

    def disable(self):
        pass
示例#53
0
class WebUI(WebPluginBase):

    scripts = [get_resource("autoadd.js")]

    def enable(self):
        pass

    def disable(self):
        pass
示例#54
0
class WebUI(WebPluginBase):

    scripts = [get_resource("utorrentimport.js")]

    def enable(self):
        pass

    def disable(self):
        pass
示例#55
0
class WebUI(WebPluginBase):
    def enable(self):
        pass

    def disable(self):
        pass

    scripts = [get_resource("simpleextractor.js")]
    debug_scripts = scripts
示例#56
0
class WebUI(WebPluginBase):

    scripts = [get_resource("lasttimeactive.js")]

    def enable(self):
        pass

    def disable(self):
        pass