Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
恍兮惚兮 committed Dec 27, 2024
1 parent 73049fc commit bbb2b23
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 26 deletions.
27 changes: 1 addition & 26 deletions py/LunaTranslator/gui/dialog_savedgame_v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ def initStyleOption(self, opt: QStyleOptionViewItem, index: QModelIndex):


class MyQListWidget(QListWidget):
iscleared = pyqtSignal(bool)

def sethor(self, hor):
if hor:
Expand All @@ -208,11 +207,7 @@ def __init__(self, p=None):
self.loadTimer = QTimer(interval=25, timeout=self.loadImage)
self.loadTimer.start()

def islg1(self):
self.iscleared.emit(self.model().rowCount() > 1)

def loadImage(self):
self.islg1()
try:
start = self.indexAt(self.viewport().rect().topLeft()).row()
end = self.indexAt(self.viewport().rect().bottomRight()).row()
Expand Down Expand Up @@ -347,20 +342,13 @@ class viewpixmap_x(QWidget):
def sizeHint(self):
return QSize(400, 400)

def setnextable(self, b):
self.leftclick.setVisible(b)
self.rightclick.setVisible(b)

def __init__(self, parent=None) -> None:
super().__init__(parent)
self.pixmapviewer = pixmapviewer(self)
self.leftclick = hoverbtn("<-", self)
self.rightclick = hoverbtn("->", self)
self.pixmapviewer.tolastnext.connect(self.tolastnext)
self.maybehavecomment = hoverbtn(self)
self.bottombtn = hoverbtn("开始游戏", self)
self.bottombtn.clicked.connect(self.startgame)
self.leftclick.clicked.connect(lambda: self.tolastnext.emit(-1))
self.rightclick.clicked.connect(lambda: self.tolastnext.emit(1))
self.maybehavecomment.clicked.connect(self.viscomment)
self.commentedit = QPlainTextEdit(self)
self.commentedit.textChanged.connect(self.changecommit)
Expand Down Expand Up @@ -470,24 +458,12 @@ def resizeEvent(self, e: QResizeEvent):
self.pixmapviewer.resize(e.size())
self.pathview.resize(e.size().width(), self.pathview.height())
self.infoview.resize(e.size().width(), self.infoview.height())
self.leftclick.setGeometry(
0,
e.size().height() // 10,
e.size().width() // 5,
7 * e.size().height() // 10,
)
self.bottombtn.setGeometry(
e.size().width() // 5,
7 * e.size().height() // 10,
3 * e.size().width() // 5,
3 * e.size().height() // 10,
)
self.rightclick.setGeometry(
4 * e.size().width() // 5,
e.size().height() // 10,
e.size().width() // 5,
7 * e.size().height() // 10,
)
self.maybehavecomment.setGeometry(
e.size().width() // 5, 0, 3 * e.size().width() // 5, e.size().height() // 10
)
Expand Down Expand Up @@ -556,7 +532,6 @@ def __init__(self) -> None:
self.vlayout.setContentsMargins(0, 0, 0, 0)
self.pixview = viewpixmap_x(self)
self.pixview.startgame.connect(self.startgame)
self.previewimages.list.iscleared.connect(self.pixview.setnextable)
self.spliter = QSplitter(self)
self.vlayout.addWidget(self.spliter)
self.setrank(rank)
Expand Down
4 changes: 4 additions & 0 deletions py/LunaTranslator/gui/usefulwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -2277,6 +2277,10 @@ def __(_cb, _e, t):
class pixmapviewer(QWidget):
tolastnext = pyqtSignal(int)

def wheelEvent(self, e: QWheelEvent) -> None:
self.tolastnext.emit([-1, 1][e.angleDelta().y() < 0])
return super().wheelEvent(e)

def __init__(self, p=None) -> None:
super().__init__(p)
self.pix = None
Expand Down

0 comments on commit bbb2b23

Please sign in to comment.