From a4d7a2c44ac9c18d035fbcbe6d9cee5f4740343f Mon Sep 17 00:00:00 2001 From: rainerosion Date: Sat, 9 Sep 2023 20:31:45 +0800 Subject: [PATCH] init. --- dm.py | 27 ++++++++++++++++++++------- gotify.py | 21 +++++++++++++++++++++ 2 files changed, 41 insertions(+), 7 deletions(-) create mode 100644 gotify.py diff --git a/dm.py b/dm.py index ad9ca91..8a80a59 100644 --- a/dm.py +++ b/dm.py @@ -12,7 +12,7 @@ class TableWidgetExample(QMainWindow): self.initUI() def initUI(self): - self.setWindowTitle("QTableWidget Example") + self.setWindowTitle("弹幕采集") self.setGeometry(100, 100, 800, 600) central_widget = QWidget() @@ -24,18 +24,27 @@ class TableWidgetExample(QMainWindow): top_layout = QVBoxLayout(top_widget) table = QTableWidget() - table.setColumnCount(3) + table.setColumnCount(2) - table.setHorizontalHeaderLabels(["URL", "状态", "操作"]) + table.setHorizontalHeaderLabels(["URL", "状态"]) header = table.horizontalHeader() header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch) data = [ - ["https://baidu.com", "队列中", "None"], - ["https://google.com", "队列中", "None"], - ["https://rainss.cn", "队列中", "None"] + ["https://baidu.com", "队列中"], + ["https://google.com", "队列中"], + ["https://rainss.cn", "队列中"], + ["https://baidu.com", "队列中"], + ["https://google.com", "队列中"], + ["https://rainss.cn", "队列中"], + ["https://baidu.com", "队列中"], + ["https://google.com", "队列中"], + ["https://rainss.cn", "队列中"], + ["https://baidu.com", "队列中"], + ["https://google.com", "队列中"], + ["https://rainss.cn", "队列中"] ] table.setRowCount(len(data)) @@ -50,12 +59,16 @@ class TableWidgetExample(QMainWindow): # 下部分布局 bottom_widget = QWidget() - bottom_widget.setFixedHeight(300) + bottom_widget.setFixedHeight(200) bottom_layout = QVBoxLayout(bottom_widget) input_text = QTextEdit() bottom_layout.addWidget(input_text) center_layout.addWidget(bottom_widget) + # 按钮部分 + + + if __name__ == "__main__": app = QApplication(sys.argv) diff --git a/gotify.py b/gotify.py new file mode 100644 index 0000000..65b61b6 --- /dev/null +++ b/gotify.py @@ -0,0 +1,21 @@ +# 发送通知信息类 +import requests + + +class Notify: + # 服务器地址 + url = 'https://gotify.rainss.cn/' + # 验证access_token + token = 'Ai_BR85._DZJL6L' + + def sendMessage(self, title, message): + s = requests.Session() + params = { + 'token': self.token, + } + files = { + 'title': (None, title), + 'message': (None, message), + 'priority': (None, '5'), + } + s.post('https://gotify.rainss.cn/message', params=params, files=files)