From 635f5ce0c40652254565017d6a6bd37b83dd1f85 Mon Sep 17 00:00:00 2001 From: jiangxufeng Date: Sat, 17 Aug 2019 12:31:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DGUI=E6=93=8D=E4=BD=9Cbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- v2rayL-GUI/sub2conf_api.py | 4 ++- v2rayL-GUI/v2rayL_threads.py | 1 - v2rayL-GUI/v2rayLui.py | 49 ++++++++++++++++++++++++++++++++---- 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/v2rayL-GUI/sub2conf_api.py b/v2rayL-GUI/sub2conf_api.py index d80063a..e9f8036 100755 --- a/v2rayL-GUI/sub2conf_api.py +++ b/v2rayL-GUI/sub2conf_api.py @@ -159,7 +159,9 @@ def add_conf_by_uri(self): self.b642conf("ss", 0, op[1]) else: raise MyException("无法解析的链接格式") - except Exception: + except Exception as e: + if e.args[0] == "无法解析的链接格式": + raise MyException("无法解析的链接格式") raise MyException("解析失败,请在github提交错误") self.conf = dict(self.saved_conf['local'], **self.saved_conf['subs']) diff --git a/v2rayL-GUI/v2rayL_threads.py b/v2rayL-GUI/v2rayL_threads.py index 4bbf29a..a306c94 100755 --- a/v2rayL-GUI/v2rayL_threads.py +++ b/v2rayL-GUI/v2rayL_threads.py @@ -83,7 +83,6 @@ def run(self): self.sinOut.emit(("addr", "@@OK@@", "订阅地址更新成功!", None)) else: url = self.v2rayL.url - print(url) if not url: self.sinOut.emit(("update", "@@Fail@@", "不存在订阅地址,无法更新", None)) else: diff --git a/v2rayL-GUI/v2rayLui.py b/v2rayL-GUI/v2rayLui.py index f0eb892..ce14d2c 100644 --- a/v2rayL-GUI/v2rayLui.py +++ b/v2rayL-GUI/v2rayLui.py @@ -486,6 +486,10 @@ def change_subs_addr(self): self.update_addr_start.start() def update_subs(self): + """ + 手动更新订阅 + :return: + """ self.update_subs_start.v2rayL = self.v2rayL self.update_subs_start.subs_child_ui = None self.update_subs_start.start() @@ -505,6 +509,7 @@ def get_conf_from_uri(self): self.v2rayL.addconf(uri) except MyException as e: QMessageBox.critical(self, "错误", self.tr(e.args[0])) + self.confs_child_ui.lineEdit.setText("") else: QMessageBox.information(self, "完成", self.tr("配置添加成功!")) self.confs_ui_hide() @@ -513,6 +518,10 @@ def get_conf_from_uri(self): self.confs_child_ui.lineEdit.setText("") def del_conf(self): + """ + 移除一个配置 + :return: + """ row = self.tableView.currentIndex().row() region = self.tableView.model().item(row, 0).text() if self.v2rayL.current == region: @@ -526,7 +535,9 @@ def del_conf(self): self.display_all_conf() def start_conn_th(self): - """开启连接线程""" + """ + 开启连接线程 + """ self.connect_ui.setDisabled(True) self.disconnect_ui.setEnabled(True) self.statusbar.showMessage("正在连接.......") @@ -535,7 +546,9 @@ def start_conn_th(self): self.conn_start.start() def end_conn_th(self): - """开启断开连接线程""" + """ + 开启断开连接线程 + """ self.connect_ui.setEnabled(True) self.disconnect_ui.setDisabled(True) self.statusbar.showMessage("正在断开连接.......") @@ -544,7 +557,9 @@ def end_conn_th(self): self.disconn_start.start() def alert(self, tp): - """操作反馈""" + """ + 操作反馈 + """ tp, rs, ret, row = tp if rs == "@@OK@@": if tp == "conn": @@ -585,9 +600,13 @@ def alert(self, tp): self.statusbar.showMessage(self.status) else: QMessageBox.critical(self, "错误", self.tr(ret)) + if tp == "addr": + self.subs_child_ui.lineEdit.setText(self.v2rayL.url) def output_conf(self): - """导出配置文件""" + """ + 导出配置文件 + """ fileName, ok2 = QFileDialog.getSaveFileName(self, "文件保存", "/home", @@ -600,6 +619,10 @@ def output_conf(self): QMessageBox.information(self, "导出成功", self.tr("保存为: "+fileName)) def enable_auto_update(self): + """ + 开启自动更新 + :return: + """ self.action_8.setChecked(True) self.action_9.setChecked(False) self.v2rayL.subscribe(True) @@ -607,6 +630,10 @@ def enable_auto_update(self): self.statusbar.showMessage(self.status) def disable_auto_update(self): + """ + 关闭自动更新 + :return: + """ self.action_8.setChecked(False) self.action_9.setChecked(True) self.v2rayL.subscribe(False) @@ -614,16 +641,28 @@ def disable_auto_update(self): self.statusbar.showMessage(self.status) def start_ping_th(self): + """ + 开始ping测延时 + :return: + """ self.ping_start.start() def output_conf_by_uri(self): + """ + 输出分享链接 + :return: + """ row = self.tableView.currentIndex().row() region = self.tableView.model().item(row, 0).text() ret = self.v2rayL.subs.conf2b64(region) QMessageBox.information(self, "分享链接", self.tr(ret)) - def event(self, QEvent): + """ + 使得statusbar始终显示内容 + :param QEvent: + :return: + """ if QEvent.type() == QEvent.StatusTip: if QEvent.tip() == "": QEvent = QStatusTipEvent(self.status) # 此处为要始终显示的内容