mirror of
https://github.com/LC044/WeChatMsg
synced 2025-02-22 10:52:18 +08:00
修复第一次启动的显示问题
This commit is contained in:
parent
2714ca6577
commit
1995011f13
@ -4,9 +4,11 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="update readme">
|
||||
<list default="true" id="84e65474-7da9-466d-baf3-cc88dde3ffdd" name="变更" comment="修复时间插入位置">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/chat/chat_info.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/chat/chat_info.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/DataBase/misc.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/DataBase/misc.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/app/ui_pc/mainview.py" beforeDir="false" afterPath="$PROJECT_DIR$/app/ui_pc/mainview.py" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/readme.md" beforeDir="false" afterPath="$PROJECT_DIR$/readme.md" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@ -272,13 +274,6 @@
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1672848140146</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00030" summary="update readme">
|
||||
<created>1698248435600</created>
|
||||
<option name="number" value="00030" />
|
||||
<option name="presentableId" value="LOCAL-00030" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1698248435600</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00031" summary="增加群二维码">
|
||||
<created>1698248457797</created>
|
||||
<option name="number" value="00031" />
|
||||
@ -615,7 +610,14 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700290555508</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="79" />
|
||||
<task id="LOCAL-00079" summary="修复时间插入位置">
|
||||
<created>1700309638496</created>
|
||||
<option name="number" value="00079" />
|
||||
<option name="presentableId" value="LOCAL-00079" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1700309638496</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="80" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="UnknownFeatures">
|
||||
@ -651,7 +653,6 @@
|
||||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="增加几个图标" />
|
||||
<MESSAGE value="增加导航按钮效果" />
|
||||
<MESSAGE value="新增PC数据库解密" />
|
||||
<MESSAGE value="main首次加载解密界面" />
|
||||
@ -676,7 +677,8 @@
|
||||
<MESSAGE value="聊天消息自适应" />
|
||||
<MESSAGE value="新版本更新" />
|
||||
<MESSAGE value="update readme" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="update readme" />
|
||||
<MESSAGE value="修复时间插入位置" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="修复时间插入位置" />
|
||||
<option name="OPTIMIZE_IMPORTS_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
<option name="REFORMAT_BEFORE_PROJECT_COMMIT" value="true" />
|
||||
</component>
|
||||
|
@ -13,6 +13,16 @@ if os.path.exists(misc_path):
|
||||
cursor = DB.cursor()
|
||||
|
||||
|
||||
def init_database():
|
||||
global DB
|
||||
global cursor
|
||||
if not DB:
|
||||
if os.path.exists(misc_path):
|
||||
DB = sqlite3.connect(misc_path, check_same_thread=False)
|
||||
# '''创建游标'''
|
||||
cursor = DB.cursor()
|
||||
|
||||
|
||||
def get_avatar_buffer(userName):
|
||||
sql = '''
|
||||
select smallHeadBuf
|
||||
@ -21,6 +31,11 @@ def get_avatar_buffer(userName):
|
||||
'''
|
||||
try:
|
||||
lock.acquire(True)
|
||||
try:
|
||||
cursor.execute(sql, [userName])
|
||||
except AttributeError:
|
||||
init_database()
|
||||
finally:
|
||||
cursor.execute(sql, [userName])
|
||||
result = cursor.fetchall()
|
||||
# print(result[0][0])
|
||||
|
@ -8,6 +8,7 @@
|
||||
@comment : 主窗口
|
||||
"""
|
||||
import json
|
||||
import os.path
|
||||
from random import randint
|
||||
|
||||
from PyQt5.QtCore import *
|
||||
@ -72,24 +73,31 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.setStyleSheet(Stylesheet)
|
||||
self.listWidget.clear()
|
||||
self.resize(QSize(800, 600))
|
||||
# self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
|
||||
self.action_desc.triggered.connect(self.about)
|
||||
self.load_data()
|
||||
self.init_ui()
|
||||
self.load_num = 0
|
||||
|
||||
def load_data(self):
|
||||
if os.path.exists('./app/data/info.json'):
|
||||
with open('./app/data/info.json', 'r', encoding='utf-8') as f:
|
||||
dic = json.loads(f.read())
|
||||
wxid = dic.get('wxid')
|
||||
if wxid:
|
||||
me = MePC()
|
||||
self.set_my_info(wxid)
|
||||
else:
|
||||
QMessageBox.information(
|
||||
self,
|
||||
'温馨提示',
|
||||
'点击 工具->获取信息 重启后可以显示本人头像哦'
|
||||
)
|
||||
|
||||
def init_ui(self):
|
||||
# self.movie = QMovie("./app/data/loading.gif")
|
||||
self.label = QLabel(self)
|
||||
self.label.setGeometry(0, 0, self.width(), self.height())
|
||||
self.label.setVisible(False)
|
||||
# self.label.setMovie(self.movie)
|
||||
# self.movie.start()
|
||||
self.listWidget.currentRowChanged.connect(self.setCurrentIndex)
|
||||
@ -105,6 +113,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.listWidget.setCurrentRow(0)
|
||||
self.stackedWidget.setCurrentIndex(0)
|
||||
chat_window = ChatWindow()
|
||||
# chat_window = QWidget()
|
||||
self.stackedWidget.addWidget(chat_window)
|
||||
contact_window = ContactWindow()
|
||||
self.stackedWidget.addWidget(contact_window)
|
||||
@ -117,7 +126,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.stackedWidget.addWidget(label)
|
||||
tool_window.load_finish_signal.connect(self.loading)
|
||||
contact_window.load_finish_signal.connect(self.loading)
|
||||
chat_window.load_finish_signal.connect(self.loading)
|
||||
# chat_window.load_finish_signal.connect(self.loading)
|
||||
# self.load_window_thread = LoadWindowThread(self.stackedWidget)
|
||||
# self.load_window_thread.okSignal.connect(self.stop_loading)
|
||||
# self.load_window_thread.start()
|
||||
@ -126,6 +135,8 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.stackedWidget.setCurrentIndex(row)
|
||||
if row == 2:
|
||||
self.stackedWidget.currentWidget().show_contacts()
|
||||
if row == 1:
|
||||
self.stackedWidget.currentWidget().show_chats()
|
||||
|
||||
def setWindow(self, window):
|
||||
try:
|
||||
@ -136,7 +147,10 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
|
||||
def set_my_info(self, wxid):
|
||||
self.avatar = QPixmap()
|
||||
try:
|
||||
img_bytes = misc.get_avatar_buffer(wxid)
|
||||
except AttributeError:
|
||||
return
|
||||
if img_bytes[:4] == b'\x89PNG':
|
||||
self.avatar.loadFromData(img_bytes, format='PNG')
|
||||
else:
|
||||
@ -157,6 +171,7 @@ class MainWinController(QMainWindow, mainwindow.Ui_MainWindow):
|
||||
|
||||
def loading(self, a0):
|
||||
self.load_num += 1
|
||||
self.label.setVisible(False)
|
||||
# print('加载一个了')
|
||||
if self.load_num == 2:
|
||||
# print('ok了')
|
||||
|
@ -39,7 +39,8 @@ class Ui_MainWindow(object):
|
||||
" /*鼠标悬停颜色*/\n"
|
||||
" HistoryPanel::item:hover {\n"
|
||||
" background: rgb(52, 52, 52);\n"
|
||||
"}")
|
||||
" }\n"
|
||||
" ")
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
|
||||
@ -58,6 +59,11 @@ class Ui_MainWindow(object):
|
||||
self.myavatar.setObjectName("myavatar")
|
||||
self.listWidget = QtWidgets.QListWidget(self.frame_info)
|
||||
self.listWidget.setGeometry(QtCore.QRect(0, 230, 120, 331))
|
||||
self.listWidget.setMinimumSize(QtCore.QSize(120, 0))
|
||||
self.listWidget.setMaximumSize(QtCore.QSize(120, 16777215))
|
||||
self.listWidget.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.listWidget.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
|
||||
self.listWidget.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustIgnored)
|
||||
self.listWidget.setObjectName("listWidget")
|
||||
item = QtWidgets.QListWidgetItem()
|
||||
self.listWidget.addItem(item)
|
||||
@ -93,6 +99,8 @@ class Ui_MainWindow(object):
|
||||
self.menu_2.setObjectName("menu_2")
|
||||
self.menu_about = QtWidgets.QMenu(self.menubar)
|
||||
self.menu_about.setObjectName("menu_about")
|
||||
self.menu_3 = QtWidgets.QMenu(self.menubar)
|
||||
self.menu_3.setObjectName("menu_3")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
@ -118,6 +126,7 @@ class Ui_MainWindow(object):
|
||||
self.menubar.addAction(self.menu.menuAction())
|
||||
self.menubar.addAction(self.menu_2.menuAction())
|
||||
self.menubar.addAction(self.menu_about.menuAction())
|
||||
self.menubar.addAction(self.menu_3.menuAction())
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
@ -143,6 +152,7 @@ class Ui_MainWindow(object):
|
||||
self.menu.setTitle(_translate("MainWindow", "编辑"))
|
||||
self.menu_2.setTitle(_translate("MainWindow", "帮助"))
|
||||
self.menu_about.setTitle(_translate("MainWindow", "关于"))
|
||||
self.menu_3.setTitle(_translate("MainWindow", "不显示或者显示异常请重启应用"))
|
||||
self.action_3.setText(_translate("MainWindow", "保存"))
|
||||
self.action_4.setText(_translate("MainWindow", "退出"))
|
||||
self.action.setText(_translate("MainWindow", "关于"))
|
||||
|
@ -99,19 +99,19 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>230</y>
|
||||
<width>80</width>
|
||||
<width>120</width>
|
||||
<height>331</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>120</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<width>120</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -205,10 +205,16 @@
|
||||
</property>
|
||||
<addaction name="action_desc"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menu_3">
|
||||
<property name="title">
|
||||
<string>不显示或者显示异常请重启应用</string>
|
||||
</property>
|
||||
</widget>
|
||||
<addaction name="menu_F"/>
|
||||
<addaction name="menu"/>
|
||||
<addaction name="menu_2"/>
|
||||
<addaction name="menu_about"/>
|
||||
<addaction name="menu_3"/>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
<action name="action_3">
|
||||
|
Loading…
Reference in New Issue
Block a user