Skip to content

Commit

Permalink
修改初始加载显示页面
Browse files Browse the repository at this point in the history
  • Loading branch information
LC044 committed Nov 29, 2023
1 parent 844eb93 commit 94e5064
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ data
sqlcipher-3.0.1
dist
venv
venv_decrypt
venv_main_pc
TEST
app/data/avatar
app/data/image2
Expand Down
7 changes: 5 additions & 2 deletions app/DataBase/merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ def merge_databases(source_paths, target_path):
db = sqlite3.connect(source_path)
cursor = db.cursor()
sql = '''
SELECT TalkerId,MsgsvrID,Type,SubType,IsSender,CreateTime,Sequence,StrTalker,StrContent,DisplayContent
SELECT TalkerId,MsgsvrID,Type,SubType,IsSender,CreateTime,Sequence,StrTalker,StrContent,DisplayContent,BytesExtra
FROM MSG;
'''
cursor.execute(sql)
result = cursor.fetchall()
# 附加源数据库
target_cursor.executemany(
"INSERT INTO MSG (TalkerId,MsgsvrID,Type,SubType,IsSender,CreateTime,Sequence,StrTalker,StrContent,DisplayContent) VALUES(?,?,?,?,?,?,?,?,?,?)",
"INSERT INTO MSG "
"(TalkerId,MsgsvrID,Type,SubType,IsSender,CreateTime,Sequence,StrTalker,StrContent,DisplayContent,"
"BytesExtra)"
"VALUES(?,?,?,?,?,?,?,?,?,?,?)",
result)
cursor.close()
db.close()
Expand Down
11 changes: 8 additions & 3 deletions app/ui_pc/mainview.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def __init__(self, username, parent=None):
self.listWidget.clear()
self.resize(QSize(800, 600))
self.action_desc.triggered.connect(self.about)
self.load_flag = False
self.load_data()
self.load_num = 0
self.label = QLabel(self)
Expand All @@ -96,6 +97,7 @@ def load_data(self, flag=True):
me.wx_dir = dic.get('wx_dir')
print('wx_dir', me.wx_dir)
self.set_my_info(wxid)
self.load_flag = True
else:
QMessageBox.information(
self,
Expand All @@ -120,14 +122,11 @@ def init_ui(self):
chat_item = QListWidgetItem(Icon.Chat_Icon, '聊天', self.listWidget)
contact_item = QListWidgetItem(Icon.Contact_Icon, '好友', self.listWidget)
myinfo_item = QListWidgetItem(Icon.MyInfo_Icon, '我的', self.listWidget)

tool_window = ToolWindow()
tool_window.get_info_signal.connect(self.set_my_info)
tool_window.decrypt_success_signal.connect(self.load_data)
tool_window.load_finish_signal.connect(self.loading)
self.stackedWidget.addWidget(tool_window)
self.listWidget.setCurrentRow(0)
self.stackedWidget.setCurrentIndex(0)
self.chat_window = ChatWindow()
# chat_window = QWidget()
self.stackedWidget.addWidget(self.chat_window)
Expand Down Expand Up @@ -185,6 +184,12 @@ def loading(self, a0):
self.okSignal.emit(True)
self.listWidget.setVisible(True)
self.stackedWidget.setVisible(True)
if self.load_flag:
self.listWidget.setCurrentRow(1)
self.stackedWidget.setCurrentIndex(1)
else:
self.listWidget.setCurrentRow(0)
self.stackedWidget.setCurrentIndex(0)

def output(self):
if self.sender() == self.action_output_CSV:
Expand Down
4 changes: 0 additions & 4 deletions main_pc.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ def loadMainWinView(self, username=None):
start = time.time()
self.viewMainWIndow = mainview.MainWinController(username=username)
self.viewMainWIndow.setWindowTitle("Chat")
# print(username)
self.viewMainWIndow.username = username
# self.viewMainWIn.exitSignal.connect(self.loadDecryptView) # 不需要回到登录界面可以省略

self.viewMainWIndow.show()
end = time.time()
print('ok', end - start)
Expand Down

0 comments on commit 94e5064

Please sign in to comment.