mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-21 01:52:35 +08:00
新增年度聊天报告qt入口
This commit is contained in:
parent
0d979b2e62
commit
d8118c8433
0
app/ui/home/__init__.py
Normal file
0
app/ui/home/__init__.py
Normal file
46
app/ui/home/home_window.py
Normal file
46
app/ui/home/home_window.py
Normal file
@ -0,0 +1,46 @@
|
||||
import time
|
||||
|
||||
from PyQt5.QtCore import Qt, pyqtSignal, QThread, QUrl
|
||||
from PyQt5.QtGui import QFont, QDesktopServices
|
||||
from PyQt5.QtWidgets import QWidget, QListWidgetItem, QLabel
|
||||
|
||||
from app.ui.Icon import Icon
|
||||
|
||||
from .home_windowUi import Ui_Dialog
|
||||
from ...person import Me
|
||||
|
||||
|
||||
class HomeWindow(QWidget, Ui_Dialog):
|
||||
load_finish_signal = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setupUi(self)
|
||||
self.init_ui()
|
||||
self.load_finish_signal.emit(True)
|
||||
self.btn_report.clicked.connect(self.report)
|
||||
|
||||
def init_ui(self):
|
||||
pass
|
||||
|
||||
def report(self):
|
||||
time_range = [0, time.time()]
|
||||
self.report_thread = ReportThread(Me(), time_range)
|
||||
self.report_thread.start()
|
||||
QDesktopServices.openUrl(QUrl(f"http://127.0.0.1:21314/"))
|
||||
|
||||
|
||||
class ReportThread(QThread):
|
||||
okSignal = pyqtSignal(bool)
|
||||
|
||||
def __init__(self, contact, time_range=None):
|
||||
super().__init__()
|
||||
self.contact = contact
|
||||
self.time_range = time_range
|
||||
|
||||
def run(self):
|
||||
from app.web_ui import web
|
||||
web.contact = self.contact
|
||||
web.time_range = self.time_range
|
||||
web.run(port='21314')
|
||||
self.okSignal.emit(True)
|
37
app/ui/home/home_windowUi.py
Normal file
37
app/ui/home/home_windowUi.py
Normal file
@ -0,0 +1,37 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'home_windowUi.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.10
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
Dialog.setObjectName("Dialog")
|
||||
Dialog.resize(590, 547)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("微软雅黑")
|
||||
Dialog.setFont(font)
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(Dialog)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.btn_report = QtWidgets.QPushButton(Dialog)
|
||||
font = QtGui.QFont()
|
||||
font.setFamily("微软雅黑")
|
||||
font.setPointSize(30)
|
||||
self.btn_report.setFont(font)
|
||||
self.btn_report.setObjectName("btn_report")
|
||||
self.verticalLayout.addWidget(self.btn_report)
|
||||
|
||||
self.retranslateUi(Dialog)
|
||||
QtCore.QMetaObject.connectSlotsByName(Dialog)
|
||||
|
||||
def retranslateUi(self, Dialog):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
|
||||
self.btn_report.setText(_translate("Dialog", "我的年度聊天报告"))
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -212,8 +212,9 @@ def get_image(filename):
|
||||
|
||||
@app.route('/month_count', methods=['POST'])
|
||||
def get_chart_options():
|
||||
time_range = (0, time.time())
|
||||
data = analysis.month_count(contact.wxid, time_range=time_range)
|
||||
wxid = request.json.get('wxid')
|
||||
time_range = request.json.get('time_range', [])
|
||||
data = analysis.month_count(wxid, time_range=time_range)
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@ -256,7 +257,7 @@ def get_counter():
|
||||
wxid = request.json.get('wxid')
|
||||
time_range = request.json.get('time_range', [])
|
||||
contact = get_contact(wxid)
|
||||
data = analysis.sender(contact.wxid, time_range=time_range, my_name=Me().name, ta_name=contact.remark)
|
||||
data = analysis.sender(wxid, time_range=time_range, my_name=Me().name, ta_name=contact.remark)
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user