| | |
| | | result, need_delegate = LocalKanPanNetworkDelegate.http_delegate_request(url) |
| | | if not need_delegate: |
| | | result = network_util.http_get(url) |
| | | print(url, "请求结果:", result) |
| | | print(url, f"请求结果:{len(result.encode('utf-8'))}", result) |
| | | self.signal_request.emit(callback_info[0], callback_info[1], result) |
| | | return result |
| | | except Exception as e: |
| | |
| | | result = network_util.socket_request(text, port=port) |
| | | else: |
| | | result = network_util.socket_request(text) |
| | | print("请求结果:", result) |
| | | print(f"请求结果:{len(result.encode('utf-8'))}", result) |
| | | self.signal_request.emit(callback_info[0], callback_info[1], result) |
| | | return result |
| | | except Exception as e: |
| | |
| | | common_window = CommonWindow(title, key, size, parent=self.__webview.window()) |
| | | common_window.loadUrl(url) |
| | | common_window.show() |
| | | |
| | | @pyqtSlot(str) |
| | | def set_target_code(self, code): |
| | | # 设置目标代码 |
| | | window_msg_queue.put_nowait({"type": "set_target_code", "data": {"code": code}}) |
| | | |
| | | |
| | | class SecondWindowBridgeClass(BaseBridgeClass): |
| | |
| | | self.webview.settings().setAttribute(QWebEngineSettings.JavascriptEnabled, True) |
| | | self.webview.page().setZoomFactor(1) |
| | | self.setCentralWidget(self.webview) |
| | | |
| | | # JS桥设置 |
| | | channel = QWebChannel(self.webview.page()) |
| | | self.webview.page().setWebChannel(channel) |
| | |
| | | :param parent: |
| | | """ |
| | | super(CommonWindow, self).__init__(parent) |
| | | self.setWindowFlags(self.windowFlags() & ~Qt.WindowMaximizeButtonHint) |
| | | |
| | | self.setWindowTitle(title) |
| | | window_info = setting.get_window_info(f"{key}_window_info") |
| | | if window_info: |
| | |
| | | (self.pos().x(), self.pos().y(), self.size().width(), self.size().height())) |
| | | except Exception as e: |
| | | print("") |
| | | self.webview.close() |
| | | # self.webview.close() |
| | | |
| | | |
| | | class WebEnginePage(QWebEnginePage): |
| | |
| | | def __show_delegating_window(): |
| | | self.delegatingWindow.show() |
| | | |
| | | def __show_want_buy_codes_window(): |
| | | self.wantBuyCodesWindow.show() |
| | | |
| | | def __show_his_msg_window(): |
| | | self.msgListWindow.loadUrl(URL_MSG_LIST) |
| | | self.msgListWindow.show() |
| | |
| | | action.triggered.connect(__show_delegating_window) |
| | | view_.addAction(action) |
| | | |
| | | action = QAction("&打开想买单", self) |
| | | action.triggered.connect(__show_want_buy_codes_window) |
| | | view_.addAction(action) |
| | | |
| | | action = QAction("&打开历史消息", self) |
| | | action.triggered.connect(__show_his_msg_window) |
| | | view_.addAction(action) |
| | |
| | | # 设置副屏 |
| | | self.secondWindow = SecondWindow(self) |
| | | self.delegatingWindow = DelegatingWindow(self) |
| | | self.wantBuyCodesWindow = CommonWindow("想买单", "want_buy_codes", (500, 1000), parent=self) |
| | | |
| | | self.setCentralWidget(self.webview) |
| | | self.show() |
| | |
| | | self.delegatingWindow.loadUrl(f"http://{constant.WEB_HOST}/kp/delegating_list.html") |
| | | else: |
| | | self.delegatingWindow.loadUrl("http://127.0.0.1:8848/kp/delegating_list.html") |
| | | |
| | | if not constant.IS_TEST: |
| | | self.wantBuyCodesWindow.loadUrl(f"http://{constant.WEB_HOST}/kp/want_buy_codes_list.html") |
| | | else: |
| | | self.wantBuyCodesWindow.loadUrl("http://127.0.0.1:8848/kp/want_buy_codes_list.html") |
| | | |
| | | self.wantBuyCodesWindow.show() |
| | | |
| | | # 绑定槽函数 |
| | | self.signal_update_code.connect(self.set_target_code) |
| | | # self.statusBar().showMessage("这是条测试数据额", 10000) |