def deactivate(self): """ Minden aktív torrent megállítása. """ config = utils.getConfig() for i in self.get_torrents(): if i[1]&1 == 1: config["torrents"].append(i[0]) self.action("stop", i[0]) utils.setConfig(config)
def set(self): config = utils.getConfig() config["netwatcher"]["one_day_limit"] = self.odl_sb.value() config["netwatcher"]["four_day_limit"] = self.fdl_sb.value() config["netwatcher"]["reactivate_limit1"] = self.odr_sb.value() config["netwatcher"]["reactivate_limit4"] = self.fdr_sb.value() config["netwatcher"]["refresh_time"] = self.ref_sb.value() config["webui"]["auth"] = base64.encodestring("%s:%s" % (self.usr_lt.text(), self.psw_lt.text())) config["webui"]["url"] = self.url_lt.text() config["webui"]["port"] = int(self.prt_lt.text()) config["general"]["send_email"] = self.email_chk.isChecked() config["general"]["email_address"] = self.email_lt.text() config["general"]["deactive"] = self.de_chk.isChecked() config["general"]["reactive"] = self.re_chk.isChecked() utils.setConfig(config) self.close()
def set_init_window(self): self.init_window_name.title("工具") # 窗口名 sw = (self.init_window_name.winfo_screenwidth() - 320) / 2 # 得到屏幕宽度 sh = (self.init_window_name.winfo_screenheight() - 700) / 2 # 宽320 高1000 居中 self.init_window_name.geometry("%dx%d+%d+%d" % (320, 700, sw, sh)) # 禁止改变窗口宽高 self.init_window_name.resizable(0, 0) self.saveButtonPath = Button(self.init_window_name, text="文件夹", command=self._saveButtonPathCallback) self.saveButtonPath.pack(fill=X, ipady=10) self._1688Button = Button(self.init_window_name, text="1688抓取图片工具", command=self._1688ButtonCallback) self._1688Button.pack(fill=X, ipady=10) if not DbManager().exists("GOODS"): DbManager().createGoods() utils.setConfig("maxId", DbManager().getMaxGoodsId())
def reactivate(self): """ A megállított torrentek elindítása. """ config = utils.getConfig() while len(config["torrents"]): self.action("start", config["torrents"].pop()) utils.setConfig(config)