Skip to content

Commit a7896c2

Browse files
committed
Format code
1 parent 3c89d51 commit a7896c2

File tree

3 files changed

+19
-23
lines changed

3 files changed

+19
-23
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,6 @@ deploy:
8585
pyside6-project deploy .
8686

8787
appimage:
88-
pyinstaller --onedir -n AppRun src/__init__.py
88+
pyinstaller pysidedeploy.spec --onedir -n AppRun
8989
cp deploy/appimage/* dist/*/
9090
appimagetool dist/*/

src/models/page.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def __init__(self, data: bytes, title: str, number: int):
1818
self._data: bytes = data
1919
self._title: str = title
2020
self._number: int = number
21+
self._pixmap: QPixmap = QPixmap()
2122

2223
def getPixmap(self):
2324
"""
@@ -26,12 +27,16 @@ def getPixmap(self):
2627
Returns:
2728
None: The return value. Represents page pixmap.
2829
"""
29-
image = QImage()
3030

31-
if image.loadFromData(self._data):
32-
return QPixmap.fromImage(image)
31+
if self._pixmap.isNull():
32+
# Create a QImage from the binary data
33+
# and convert it to a QPixmap
34+
image = QImage()
3335

34-
return QPixmap()
36+
if image.loadFromData(self._data):
37+
self._pixmap = QPixmap.fromImage(image)
38+
39+
return self._pixmap
3540

3641
def getTitle(self) -> str:
3742
"""

src/views/main_window_view.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -899,19 +899,23 @@ def onActionFullscreenTriggered(self):
899899
"""
900900
logger.info("Fullscreen action triggered")
901901

902+
# Check if the window is currently in fullscreen mode
902903
if self.isFullScreen():
903-
self._toolBar.show()
904-
self.showNormal()
905-
self._mainController.updateCentralWidgetContent()
904+
self._toolBar.show() # Show the toolbar
905+
self.showNormal() # Restore the window to normal mode
906+
self._mainController.updateCentralWidgetContent() # Update the central widget content
906907

908+
# Disable global shortcuts when exiting fullscreen mode
907909
for shortcut in self._globalShortcuts:
908910
shortcut.setEnabled(False)
909911

910912
else:
911-
self.showFullScreen()
913+
# Enter fullscreen mode
914+
self.showFullScreen() # Switch the window to fullscreen mode
912915
self._toolBar.hide()
913-
self._mainController.updateCentralWidgetContent()
916+
self._mainController.updateCentralWidgetContent() # Update the central widget content
914917

918+
# Enable global shortcuts when entering fullscreen mode
915919
for shortcut in self._globalShortcuts:
916920
shortcut.setEnabled(True)
917921

@@ -977,17 +981,6 @@ def onActionAboutTriggered(self) -> None:
977981

978982
logger.debug("UI setup for AboutView completed")
979983

980-
# description = self.tr(
981-
# f'<h3>{APP_NAME} - v{VERSION}</h3><br/>A minimalist comic book reader.\
982-
# <br/><br/>GNU General Public License v3 (<a href="{LICENSE_URL}">GPLv3</a>) <br/><br/>{COPYRIGHT}<br/><br/>'
983-
# )
984-
985-
# QMessageBox.about(
986-
# self,
987-
# f"About {APP_NAME}",
988-
# description,
989-
# )
990-
991984
def closeEvent(self, event: "QCloseEvent") -> None:
992985
"""
993986
Handles the close event of the main window.
@@ -1001,5 +994,3 @@ def closeEvent(self, event: "QCloseEvent") -> None:
1001994

1002995
self._mainController.saveData()
1003996
event.accept()
1004-
1005-
# super().close()

0 commit comments

Comments
 (0)