Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
* Add auto downloading for new version(if accessible).
* Add coloring for cards on field.
* Add Esc-exiting for subwindows.
* Add delayed updating for fields to hide latency.
* Add config file to save config.
* Fix blur searching with both name and effect desp.
* Fix losing selection on copying list when operation list is updated.
* Fix card renaming for copying list.
* Fix crash of cleaning cards in copying list.
* Fix speed for pasting much operations.
* Update cards.cdb.
  • Loading branch information
Wind2009-Louse committed Aug 9, 2020
2 parents 07a2c98 + c93d237 commit 17d28d8
Show file tree
Hide file tree
Showing 6 changed files with 232 additions and 76 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,7 @@ __pycache__/
build/
dist/
main.spec
*.cdb
*.json
*.jsn
!version.json
9 changes: 8 additions & 1 deletion about.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@


class UI_About(QWidget):
def __init__(self, idx=12):
def __init__(self, idx=12, parent=None):
self.last_version_idx = idx
self.parent = parent

super(UI_About, self).__init__()
self.setWindowTitle("About")
Expand Down Expand Up @@ -41,13 +42,19 @@ def check_update(self):
json_result = json.loads(requests.get(url, timeout=5).content.decode("utf-8", errors="ignore"))
if json_result["version"] > self.last_version_idx:
self.label_3.setText("当前有最新版本:%s"%json_result["name"])
if self.parent != None:
self.parent.update_signal.emit(json_result["name"])
elif json_result["version"] == self.last_version_idx:
self.label_3.setText("当前已是最新版本")
else:
self.label_3.setText("当前正在使用抢先版本")
except Exception as e:
print(e)
self.label_3.setText("检查更新失败")

def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape:
self.close()

if __name__ == "__main__":
app = QApplication(sys.argv)
Expand Down
9 changes: 6 additions & 3 deletions calculator.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#encoding:utf-8
import sys

from PyQt5 import QtCore
from PyQt5.QtCore import QRect, QRegExp
from PyQt5.QtCore import QRect, QRegExp, Qt
from PyQt5.QtGui import QColor, QRegExpValidator
from PyQt5.QtWidgets import (QApplication, QLabel, QLineEdit, QListWidget,
QTextBrowser, QWidget)
Expand Down Expand Up @@ -75,7 +74,7 @@ def __init__(self):

# hide scroll bar
for bar in [self.atk_line, self.def_line, self.add_line, self.sub_line, self.mul_line, self.div_line]:
bar.setVerticalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOff)
bar.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
bar.setTextColor(QColor('green'))

# connect
Expand Down Expand Up @@ -147,6 +146,10 @@ def show_ad(self):
args = self.card_data[cardname]
self.atk_line.setText(str(args[0]))
self.def_line.setText(str(args[1]))

def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape:
self.close()

if __name__ == "__main__":
app = QApplication(sys.argv)
Expand Down
Binary file modified cards.cdb
Binary file not shown.
Loading

0 comments on commit 17d28d8

Please sign in to comment.