This commit is contained in:
rainerosion 2023-09-09 20:31:45 +08:00
parent 3b396f652f
commit a4d7a2c44a
2 changed files with 41 additions and 7 deletions

27
dm.py
View File

@ -12,7 +12,7 @@ class TableWidgetExample(QMainWindow):
self.initUI() self.initUI()
def initUI(self): def initUI(self):
self.setWindowTitle("QTableWidget Example") self.setWindowTitle("弹幕采集")
self.setGeometry(100, 100, 800, 600) self.setGeometry(100, 100, 800, 600)
central_widget = QWidget() central_widget = QWidget()
@ -24,18 +24,27 @@ class TableWidgetExample(QMainWindow):
top_layout = QVBoxLayout(top_widget) top_layout = QVBoxLayout(top_widget)
table = QTableWidget() table = QTableWidget()
table.setColumnCount(3) table.setColumnCount(2)
table.setHorizontalHeaderLabels(["URL", "状态", "操作"]) table.setHorizontalHeaderLabels(["URL", "状态"])
header = table.horizontalHeader() header = table.horizontalHeader()
header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)
header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch) header.setSectionResizeMode(0, QtWidgets.QHeaderView.Stretch)
data = [ data = [
["https://baidu.com", "队列中", "None"], ["https://baidu.com", "队列中"],
["https://google.com", "队列中", "None"], ["https://google.com", "队列中"],
["https://rainss.cn", "队列中", "None"] ["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)) table.setRowCount(len(data))
@ -50,12 +59,16 @@ class TableWidgetExample(QMainWindow):
# 下部分布局 # 下部分布局
bottom_widget = QWidget() bottom_widget = QWidget()
bottom_widget.setFixedHeight(300) bottom_widget.setFixedHeight(200)
bottom_layout = QVBoxLayout(bottom_widget) bottom_layout = QVBoxLayout(bottom_widget)
input_text = QTextEdit() input_text = QTextEdit()
bottom_layout.addWidget(input_text) bottom_layout.addWidget(input_text)
center_layout.addWidget(bottom_widget) center_layout.addWidget(bottom_widget)
# 按钮部分
if __name__ == "__main__": if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)

21
gotify.py Normal file
View File

@ -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)