This commit is contained in:
恍兮惚兮 2024-04-12 13:25:37 +08:00
parent 5df8e0600a
commit cbfdbd85ce
3 changed files with 27 additions and 11 deletions

View File

@ -563,7 +563,11 @@ class dialog_setting_game(QDialog):
getcolorbutton(
"",
"",
lambda: os.startfile('https://vndb.org/v{}'.format(savehook_new_data[exepath]["vid"])),
lambda: os.startfile(
"https://vndb.org/v{}".format(
savehook_new_data[exepath]["vid"]
)
),
icon="fa.chrome",
constcolor="#FF69B4",
),
@ -1482,9 +1486,10 @@ class dialog_savedgame_new(saveposwindow):
def tagschanged(self, tags):
self.currtags = tags
newtags = tags
print(tags)
ItemWidget.clearfocus()
self.formLayout.removeWidget(self.flow)
self.flow.deleteLater()
self.idxsave.clear()
self.flow = ScrollFlow()
self.flow.bgclicked.connect(ItemWidget.clearfocus)
@ -1522,7 +1527,8 @@ class dialog_savedgame_new(saveposwindow):
if notshow:
continue
self.newline(k)
QApplication.processEvents()
if len(self.idxsave) < 10 or len(self.idxsave) % 10 == 0:
QApplication.processEvents()
def showmenu(self, p):
menu = QMenu(self)

View File

@ -8,7 +8,7 @@ from PyQt5.QtWidgets import (
from PyQt5.QtCore import QPoint, QRect, QSize, Qt, pyqtSignal
from PyQt5.QtWidgets import QLayout
from traceback import print_exc
from myutils.wrapper import trypass
class chartwidget(QWidget):
def __init__(self) -> None:
@ -128,11 +128,11 @@ class ScrollFlow(QWidget):
def __init__(self):
super(ScrollFlow, self).__init__()
class _QListWidget(QListWidget):
class qw(QWidget):
def mousePressEvent(_, _2) -> None:
self.bgclicked.emit()
self.listWidget = _QListWidget(self)
self.listWidget = qw(self)
# self.listWidget.setFixedWidth(600)
self.l = FlowLayout()
@ -142,20 +142,20 @@ class ScrollFlow(QWidget):
self.qscrollarea = QScrollArea(self)
self.qscrollarea.setWidgetResizable(True)
self.qscrollarea.setWidget(self.listWidget)
@trypass
def addwidget(self, wid):
self.l.addWidget(wid)
@trypass
def insertwidget(self, idx, wid):
self.l.insertWidget(idx, wid)
@trypass
def removeidx(self, index):
_ = self.l.takeAt(index)
_.widget().hide()
@trypass
def setfocus(self, idx):
self.widget(idx).setFocus()
@trypass
def widget(self, idx):
idx = min(idx, len(self.l._item_list) - 1)
idx = max(idx, 0)

View File

@ -85,6 +85,16 @@ def threader(func):
return _wrapper
def trypass(func):
def _wrapper(*args, **kwargs):
try:
return func(*args, **kwargs)
except:
pass
return _wrapper
def timer(func):
def _wrapper(*args, **kwargs):
t = time.time()