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)
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.lower().endswith(exts): links.append(url) else: for name in self.services: if name in url: links.append(url) break return links
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()
def load(self): """""" if conf.get_addon_option(OPTION_UNRAR_REMOVE_FILES, default=True, is_bool=True): self.remove_files_box.toggle() #activate self.load_pwd()
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
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.lower().endswith(exts): links.append(url) else: for name in self.services: if name in url: links.append(url) break return links
def start_shell_script(self): if not self.is_running(): path = conf.get_addon_option(OPTION_IP_RENEW_SCRIPT_PATH, default="") self.th = threading.Thread(group=None, target=self.shell_script, name=None, args=(path, )) self.th.start()
def run(self): """""" passwords = self.passwords_list or None try: extract_file(self.file_path, dest_path=self.dest_path, password_list=passwords) except Exception as err: self.err_msg = str(err) logger.exception(err) else: if conf.get_addon_option(preferences_gui.OPTION_UNRAR_REMOVE_FILES, default=True, is_bool=True): self.remove_files()
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
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)