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( 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", icon="fa.chrome",
constcolor="#FF69B4", constcolor="#FF69B4",
), ),
@ -1482,9 +1486,10 @@ class dialog_savedgame_new(saveposwindow):
def tagschanged(self, tags): def tagschanged(self, tags):
self.currtags = tags self.currtags = tags
newtags = tags newtags = tags
print(tags)
ItemWidget.clearfocus() ItemWidget.clearfocus()
self.formLayout.removeWidget(self.flow) self.formLayout.removeWidget(self.flow)
self.flow.deleteLater()
self.idxsave.clear() self.idxsave.clear()
self.flow = ScrollFlow() self.flow = ScrollFlow()
self.flow.bgclicked.connect(ItemWidget.clearfocus) self.flow.bgclicked.connect(ItemWidget.clearfocus)
@ -1522,6 +1527,7 @@ class dialog_savedgame_new(saveposwindow):
if notshow: if notshow:
continue continue
self.newline(k) self.newline(k)
if len(self.idxsave) < 10 or len(self.idxsave) % 10 == 0:
QApplication.processEvents() QApplication.processEvents()
def showmenu(self, p): def showmenu(self, p):

View File

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

View File

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