Beispiel #1
0
    def __init__(self, parent, ip_renewer_cls):
        """"""
        self.change_ip_th = ip_renewer_cls
        self.parent = parent

        self.id_list = []

        self.stop_all = self.parent.downloads.on_stop_all

        if self.can_change_ip():
            self.id_list = [
                download_item.id
                for download_item in api.get_active_downloads().values() +
                api.get_queue_downloads().values()
            ]
            self.stop_all()
            if conf.get_addon_option(OPTION_RENEW_SCRIPT_ACTIVE,
                                     default=False,
                                     is_bool=True):
                self.change_ip_th.start(
                    conf.get_addon_option(OPTION_IP_RENEW_SCRIPT_PATH,
                                          default=""))
            else:
                self.change_ip_th.start()

            self.status_msg = _("Changing IP...")
            self.parent.status_bar.push_msg(self.status_msg)

            self.timer = self.parent.idle_timeout(1000, self.update)
 def load(self):
     if conf.get_addon_option(OPTION_RENEW_SCRIPT_ACTIVE, default=False, is_bool=True):
         self.radio_script.setChecked(True) #emits toggle.
     else:
         self.radio_renew.setChecked(True)
     path = conf.get_addon_option(OPTION_IP_RENEW_SCRIPT_PATH, default="")
     self.entry_script_path.setText(path)
Beispiel #3
0
    def __init__(self, parent, ip_renewer_cls):
        """"""
        self.id_list = []

        self.stop_all = parent.downloads_list_gui.on_stop_all

        if self.can_change_ip():
            self.pending_events()
            self.id_list = [
                download_item.id
                for download_item in api.get_active_downloads().values() +
                api.get_queue_downloads().values()
            ]
            self.pending_events()
            self.stop_all()
            self.pending_events()
            self.change_ip_th = ip_renewer_cls
            if conf.get_addon_option(OPTION_RENEW_SCRIPT_ACTIVE,
                                     default=False,
                                     is_bool=True):
                self.change_ip_th.start(
                    conf.get_addon_option(OPTION_IP_RENEW_SCRIPT_PATH,
                                          default=""))
            else:
                self.change_ip_th.start()
            gobject.timeout_add(1000, self.update_status, parent)
            self.msg_id = parent.status_bar.push_msg(_("Changing IP..."))
Beispiel #4
0
 def load(self):
     """"""
     if conf.get_addon_option(clipboard_gui.OPTION_CLIPBOARD_ACTIVE,
                              default=True,
                              is_bool=True):
         self.exts_box.toggle()  #activate
     exts = conf.get_addon_option(
         clipboard_gui.OPTION_CLIPBOARD_EXTS) or clipboard_gui.EXTS
     self.exts_line.setText(exts)
 def check_supported(self, urls):
     """"""
     exts_active = conf.get_addon_option(OPTION_CLIPBOARD_ACTIVE, default=True, is_bool=True)
     exts = conf.get_addon_option(OPTION_CLIPBOARD_EXTS) or EXTS #may be an empty str
     exts = tuple(exts.split(";"))
     links = []
     for url in urls:
         if exts_active and exts and url.endswith(exts):
             links.append(url)
         else:
             for name in self.services:
                 if name in url:
                     links.append(url)
                     break
     return links
 def renew_active_choice(self, hbox_script):
     """"""
     if conf.get_addon_option(OPTION_RENEW_SCRIPT_ACTIVE, default=False, is_bool=True):
         self.renew_script.set_active(True)
         hbox_script.set_sensitive(True)
     else:
         self.renew_default.set_active(True)
 def __init__(self):
     """"""
     gtk.VBox.__init__(self, False, 10)
     
     hbox_script = gtk.HBox(False, 10)
     
     #choice-menu
     self.renew_default =  gtk.RadioButton(group=None, label=_("IP Renew (default)"))
     self.renew_default.connect("toggled", self.on_renew_default_toggle, hbox_script)
     self.renew_script =  gtk.RadioButton(group=self.renew_default, label=_("Run Custom Script"))
     self.renew_script.connect("toggled", self.on_renew_script_toggle, hbox_script)
     self.pack_start(self.renew_default, False, False)
     self.pack_start(self.renew_script, False, False)
     
     #renew script field
     label_renew_script = gtk.Label(_("Path:"))
     hbox_script.pack_start(label_renew_script, False, False)
     self.entry_renew_script = gtk.Entry()
     self.entry_renew_script.add_events(gtk.gdk.KEY_RELEASE_MASK)
     self.entry_renew_script.set_width_chars(25) #entry width
     #
     self.entry_renew_script.set_text(conf.get_addon_option(OPTION_IP_RENEW_SCRIPT_PATH, default=""))
     hbox_script.pack_start(self.entry_renew_script)
     button = gtk.Button(_("Examine..."))
     button.set_size_request(80, 35)
     button.connect("clicked", self.on_examine)
     hbox_script.pack_start(button, False, False)
     hbox_script.set_sensitive(False)
     
     self.renew_active_choice(hbox_script)
     
     self.pack_start(hbox_script, False, False)
Beispiel #8
0
 def set_menu_item(self):
     """"""
     self.action = self.parent.menu.addAction(self.name, self.on_toggle) #can toggle
     self.action.setCheckable(True)
     if conf.get_addon_option(OPTION_IP_RENEW_ACTIVE, default=False, is_bool=True):
         self.action.setChecked(True)
         self.connect()
Beispiel #9
0
 def get_menu_item(self):
     """"""
     WIDGET, TITLE, CALLBACK, SENSITIVE = range(4)
     config_change_ip = (gtk.CheckMenuItem(), self.name, self.on_change_ip) #can toggle
     if conf.get_addon_option(OPTION_IP_RENEW_ACTIVE, default=False, is_bool=True):
         config_change_ip[WIDGET].set_active(True)
         self.connect()
     return config_change_ip
Beispiel #10
0
 def renew_active_choice(self, hbox_script):
     """"""
     if conf.get_addon_option(OPTION_RENEW_SCRIPT_ACTIVE,
                              default=False,
                              is_bool=True):
         self.renew_script.set_active(True)
         hbox_script.set_sensitive(True)
     else:
         self.renew_default.set_active(True)
Beispiel #11
0
 def check_supported(self, urls):
     """"""
     exts_active = conf.get_addon_option(OPTION_CLIPBOARD_ACTIVE,
                                         default=True,
                                         is_bool=True)
     exts = conf.get_addon_option(
         OPTION_CLIPBOARD_EXTS) or EXTS  #may be an empty str
     exts = tuple(exts.split(";"))
     links = []
     for url in urls:
         if exts_active and exts and url.endswith(exts):
             links.append(url)
         else:
             for name in self.services:
                 if name in url:
                     links.append(url)
                     break
     return links
Beispiel #12
0
 def __init__(self, parent, ip_renewer_cls):
     """"""
     self.id_list = []
     
     self.stop_all = parent.downloads_list_gui.on_stop_all
     
     if self.can_change_ip():
         self.pending_events()
         self.id_list = [download_item.id for download_item in api.get_active_downloads().values() + api.get_queue_downloads().values()]
         self.pending_events()
         self.stop_all()
         self.pending_events()
         self.change_ip_th = ip_renewer_cls
         if conf.get_addon_option(OPTION_RENEW_SCRIPT_ACTIVE, default=False, is_bool=True):
             self.change_ip_th.start(conf.get_addon_option(OPTION_IP_RENEW_SCRIPT_PATH, default=""))
         else:
             self.change_ip_th.start()
         gobject.timeout_add(1000, self.update_status, parent)
         self.msg_id = parent.status_bar.push_msg(_("Changing IP..."))
Beispiel #13
0
 def get_menu_item(self):
     """"""
     WIDGET, TITLE, CALLBACK, SENSITIVE = range(4)
     config_unrar = (gtk.CheckMenuItem(), self.name, self.on_unrar
                     )  #can toggle
     if conf.get_addon_option(OPTION_UNRAR_ACTIVE,
                              default=False,
                              is_bool=True):
         config_unrar[WIDGET].set_active(True)
         self.connect()
     return config_unrar
Beispiel #14
0
 def __init__(self, parent, ip_renewer_cls):
     """"""
     self.change_ip_th = ip_renewer_cls
     self.parent = parent
     
     self.id_list = []
     
     self.stop_all = self.parent.downloads.on_stop_all
     
     if self.can_change_ip():
         self.id_list = [download_item.id for download_item in api.get_active_downloads().values() + api.get_queue_downloads().values()]
         self.stop_all()
         if conf.get_addon_option(OPTION_RENEW_SCRIPT_ACTIVE, default=False, is_bool=True):
             self.change_ip_th.start(conf.get_addon_option(OPTION_IP_RENEW_SCRIPT_PATH, default=""))
         else:
             self.change_ip_th.start()
         
         self.status_msg = _("Changing IP...")
         self.parent.status_bar.push_msg(self.status_msg)
         
         self.timer = self.parent.idle_timeout(1000, self.update)
    def __init__(self, parent, ip_renewer):
        """"""
        self.ip_renewer = ip_renewer
        self.weak_parent = weakref.ref(parent)
        
        self.id_item_list = []
        self.is_working = True

        if self.can_change_ip():
            self.id_item_list = [download_item.id for download_item in api.get_active_downloads().values() + api.get_queue_downloads().values()]
            signals.on_stop_all.emit()
            if conf.get_addon_option(OPTION_RENEW_SCRIPT_ACTIVE, default=False, is_bool=True):
                self.ip_renewer.start_shell_script()
            else:
                self.ip_renewer.start_default_ip_renew()
            
            self.status_msg = _("Changing IP...")
            signals.status_bar_push_msg.emit(self.status_msg)
            
            self.timer = self.parent.idle_timeout(1000, self.update)
        else:
            self.is_working = False
Beispiel #16
0
    def __init__(self):
        """"""
        gtk.VBox.__init__(self, False, 10)

        hbox_script = gtk.HBox(False, 10)

        #choice-menu
        self.renew_default = gtk.RadioButton(group=None,
                                             label=_("IP Renew (default)"))
        self.renew_default.connect("toggled", self.on_renew_default_toggle,
                                   hbox_script)
        self.renew_script = gtk.RadioButton(group=self.renew_default,
                                            label=_("Run Custom Script"))
        self.renew_script.connect("toggled", self.on_renew_script_toggle,
                                  hbox_script)
        self.pack_start(self.renew_default, False, False)
        self.pack_start(self.renew_script, False, False)

        #renew script field
        label_renew_script = gtk.Label(_("Path:"))
        hbox_script.pack_start(label_renew_script, False, False)
        self.entry_renew_script = gtk.Entry()
        self.entry_renew_script.add_events(gtk.gdk.KEY_RELEASE_MASK)
        self.entry_renew_script.set_width_chars(25)  #entry width
        #
        self.entry_renew_script.set_text(
            conf.get_addon_option(OPTION_IP_RENEW_SCRIPT_PATH, default=""))
        hbox_script.pack_start(self.entry_renew_script)
        button = gtk.Button(_("Examine..."))
        button.set_size_request(80, 35)
        button.connect("clicked", self.on_examine)
        hbox_script.pack_start(button, False, False)
        hbox_script.set_sensitive(False)

        self.renew_active_choice(hbox_script)

        self.pack_start(hbox_script, False, False)
 def load(self):
     """"""
     if conf.get_addon_option(clipboard_gui.OPTION_CLIPBOARD_ACTIVE, default=True, is_bool=True):
         self.exts_box.toggle() #activate
     exts = conf.get_addon_option(clipboard_gui.OPTION_CLIPBOARD_EXTS) or clipboard_gui.EXTS
     self.exts_line.setText(exts)