Skip to content

Commit

Permalink
fix 2 bugs in layout
Browse files Browse the repository at this point in the history
  • Loading branch information
1MLightyears committed Oct 11, 2020
1 parent d0d861f commit 203df94
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 47 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
history.json
*.bmp
*.exe

*.bat


# Byte-compiled / optimized / DLL files
Expand Down
4 changes: 1 addition & 3 deletions make.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@echo off
set QT_QPA_PLATFORM_PLUGIN_PATH=D:\anaconda3Lib\site-packages\PySide2\plugins
set QT_QPA_PLATFORM_PLUGIN_PATH=D:\anaconda3\Lib\site-packages\PySide2\plugins
pyinstaller -i AuraProII.ico -p D:\anaconda3\envs\auraproii\lib\site-packages\PyQt5\Qt\bin -w -F src\AuraProII.py
REM D:\anaconda3\Lib\site-packages\PySide2\plugins
REM base
11 changes: 8 additions & 3 deletions patch.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
v0.1.0
v0.1.2

- 初始版本
- 修复了一个km信息显示位置错误的漏洞
- 修复了一个使用鼠标滚轮后提示信息消失的漏洞

v0.1.1

- 修复了一个获取信息的时候鼠标操作会崩溃的漏洞
- 修复了一个获取女妖级km(harpy)时会崩溃的漏洞
- 现在km信息显示在km链接下
- 现在信息位置会被记录了
- 现在信息位置会被记录了

v0.1.0

- 初始版本
2 changes: 1 addition & 1 deletion settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"//17":"(字符串)状态栏字色,该项为rgba四元素元组形式的字符串",
"clStatusBar":"(127,127,127,127)",
"//18":"(字符串)工作目录",
"workingDir":"",
"workingDir":"..\\",
"//19":"(字符串)字体文件(暂时无法生效)",
"font_path":{
"zh":"fonts\\OPPOSans-M.ttf"
Expand Down
2 changes: 1 addition & 1 deletion src/Base.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#历史记录
history = {}
#版本
version="v0.1.1"
version="v0.1.2"

def LoadFile(file_name:str,default={}):
"""
Expand Down
87 changes: 50 additions & 37 deletions src/MainForm.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,12 @@ def run(self):
self.Msg = self.func(*self.args)

class TMsgLabel(QLabel):
def __init__(self,text:str='',left=0,top=0,style_str:str="",ClickEvent=None,ClickArgs=None,no=-1):
def __init__(self, text: str = '',
left=0, top=0,
style_str: str = "",
ClickEvent=None,
ClickArgs=None,
no=-1):
super(TMsgLabel, self).__init__()
self.ClickEvent = None
self.ClickArgs = None
Expand Down Expand Up @@ -309,6 +314,7 @@ def setupUi(self, MainWindow):
self.LabelList = []
self.LabelList_buffer = []
self.LabelList_click_no = -1
self.LabelList_pos=0

#窗体创建完毕
log("窗体创建完毕")
Expand Down Expand Up @@ -394,30 +400,32 @@ def TrayIconClickEvent(self, reason):
self.show()

def wheelEvent(self, event):
if len(self.LabelList) == 0:
return

self.on_events=True
ori=event.angleDelta().y()/120
if ori > 0:
#向上移
if self.LabelList[0].geometry().top() < self.EdtName.geometry().height()+self.EdtName.geometry().top():
for i in self.LabelList:
i.move(i.geometry().left(),i.geometry().top() + 10)
else:
#向下移
if self.LabelList[-1].geometry().top() + self.LabelList[-1].geometry().height() > self.StatusBar.geometry().top():
for i in self.LabelList:
i.move(i.geometry().left(),i.geometry().top() - 10)
event.accept()
self.on_events=False
if len(self.LabelList)>0:
self.on_events = True
ori=event.angleDelta().y()/120 if not isinstance(event,int) else event
if ori > 0:
#向上移
if self.LabelList[0].geometry().top() < self.EdtName.geometry().height()+self.EdtName.geometry().top():
self.LabelList_pos+=1
for i in self.LabelList:
i.move(i.geometry().left(),i.geometry().top() + 10)
else:
#向下移
if self.LabelList[-1].geometry().top() + self.LabelList[-1].geometry().height() > self.StatusBar.geometry().top():
self.LabelList_pos-=1
for i in self.LabelList:
i.move(i.geometry().left(),i.geometry().top() - 10)
if not isinstance(event, int):
event.accept()
self.on_events = False

def BtnSearchClickEvent(self):
return self.StartSearchName()

def EndSearchEvent(self,e=None):
"""
搜索结束事件。
将传递信息的线程传来的
"""
if isinstance(self.sender(), TThread):
log("EndSearch:"+str(self.sender().__name__))
Expand All @@ -432,7 +440,8 @@ def EndSearchEvent(self,e=None):

#由SearchName返回
if "getKMList" in Msg:#完成了一轮完整的搜索流程
self.MsgList = {}#清空显示
self.MsgList = {}
self.MsgList.update(Msg)
self.statusBar().showMessage("搜索完成")
self.EdtName.setStyleSheet("""
TEdtName{
Expand All @@ -448,6 +457,7 @@ def EndSearchEvent(self,e=None):
} """)
elif "Error" in Msg: #SearchName返回错误
self.MsgList = {}
self.MsgList.update(Msg)
if Msg["Error"] == "getKMListError":
self.MsgList.update({"ErrorLabel": TMsgEntry("获取KM列表失败",style_str=MDStyleStr(color=settings["clFailed"],font_size=settings["labelFontSize"]))})
elif Msg["Error"] == "zkbError":
Expand Down Expand Up @@ -478,13 +488,19 @@ def EndSearchEvent(self,e=None):
if "addName" not in self.MsgList:
self.MsgList["addName"]=[]
self.MsgList["addName"] += Msg["addName"]
Msg=self.MsgList.copy()

#由SearchKM返回
elif "SearchKM" in Msg:
if self.LabelList_click_no != -1:
#需要找到被单击的Label在self.MsgList中的位置
for i in range(len(self.MsgList["getKMList"])):
#如果getKMList中记录的killmail_id==LabelList中记录的killmail_id
if (self.MsgList["getKMList"][i][0][0]==self.LabelList[self.LabelList_click_no].ClickArgs[1]):
self.MsgList["getKMList"][i][2]=Msg
break
self.statusBar().showMessage("KM已获取")
MutEndSearch.unlock()
self.RefreshLabelList(Msg,self.LabelList_click_no)
self.RefreshLabelList()

#custom
def MultiThreadRun(self, *args, **kwargs):
Expand All @@ -504,7 +520,7 @@ def MultiThreadRun(self, *args, **kwargs):
self.quit()
return t.start()

def RefreshLabelList(self, Msg=None, insert=-1):
def RefreshLabelList(self, Msg=None):
"""
刷新LabelList显示。
Msg(None or dict):作为回调时需要在self.MsgList中添加的信息
Expand All @@ -528,27 +544,17 @@ def RefreshLabelList(self, Msg=None, insert=-1):
self.LabelList_buffer=self.LabelList[:]
self.LabelList = []

top_start=self.LabelList_buffer[0].geometry().top() if len(self.LabelList_buffer)>0 else 50
top_start-=50
if isinstance(Msg,dict):
self.MsgList.update(Msg)
#把MsgList展平
if isinstance(Msg, dict):
if insert == -1:
#如果没有insert需求就直接更新MsgList
self.MsgList.update(Msg)
new_label_list = SerializeMsgEntry(self.MsgList)
if insert > -1:
#如果有就先把Msg展平再插入
insert_list=SerializeMsgEntry(Msg)
for i in insert_list:
insert+=1
new_label_list.insert(insert,i)
new_label_list = SerializeMsgEntry(self.MsgList)

count=-1
for i in new_label_list:
#每个i都是一个TMsgEntry
count+=1
count += 1
self.LabelList.append(TMsgLabel(i.text,
i.left, top_start+i.top + (len(self.LabelList))* settings["labelFontSize"]*6,
i.left, i.top + (len(self.LabelList))* settings["labelFontSize"]*6,
style_str=i.style_str,
ClickEvent = i.ClickEvent,
ClickArgs=i.ClickArgs, no=count))
Expand All @@ -557,6 +563,13 @@ def RefreshLabelList(self, Msg=None, insert=-1):
i.setOpenExternalLinks(True)
i.show()
i.lower()
#向上滚动至之前位置
wheel_pos = self.LabelList_pos
self.LabelList_pos=0
for i in range(abs(wheel_pos)):
if i != -self.LabelList_pos:
break
self.wheelEvent(int(wheel_pos / abs(wheel_pos)))
log("RefreshLabelList:"+','.join([i.text() for i in self.LabelList]))
MutLabelList.unlock()
return ret
Expand Down
2 changes: 1 addition & 1 deletion src/Search.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ def SearchName(name: str = '',ID:int=-1,is_strict=False):
ClickEvent=SearchKM,
ClickArgs=(ID, killmail_pairs[i][0], killmail_pairs[i][1])) for i in range(len(killmail_pairs))]
for i in killmail_pairs:
remap.append([i, label_list[0]])
remap.append([i, label_list[0], {}])
label_list = label_list[1:]
Msg.update({"getKMList": remap})
log("getKMList:完成")
Expand Down
37 changes: 37 additions & 0 deletions src/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
altgraph==0.17
attrs==20.2.0
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
cycler==0.10.0
future==0.18.2
idna==2.10
kiwisolver==1.2.0
matplotlib @ file:///D:/bld/matplotlib-base_1597952542171/work
multidict==4.7.6
numpy @ file:///D:/bld/numpy_1597938567428/work
olefile==0.46
packaging==20.4
pefile==2019.4.18
Pillow @ file:///D:/bld/pillow_1594213048891/work
pyinstaller==4.0
pyinstaller-hooks-contrib==2020.8
pyparsing==2.4.7
PyQt5==5.15.0
PyQt5-sip==12.8.1
pyqt5-tools==5.15.0.1.7.1
PyQtWebEngine==5.12.1
PySide2==5.15.1
python-dateutil==2.8.1
python-dotenv==0.14.0
pywin32==225
pywin32-ctypes==0.2.0
requests==2.24.0
shiboken2==5.15.1
sip==5.4.0
six @ file:///home/conda/feedstock_root/build_artifacts/six_1590081179328/work
toml==0.10.1
typing-extensions==3.7.4.3
urllib3==1.25.10
wincertstore==0.2
yarl==1.5.1

0 comments on commit 203df94

Please sign in to comment.