Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
deeffest authored Apr 3, 2024
1 parent 262da27 commit 5ebc923
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 17 deletions.
44 changes: 44 additions & 0 deletions core/_init_styles.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
def _init_styles(self):
if self.settings.value("app_theme", "dark") == "dark":
self.setStyleSheet("""
QToolTip {
background-color: rgb(44,44,44);
border: 1px solid rgb(29,29,29);
color: white;
}
""")
self.menubar.setStyleSheet("""
QMenuBar {
background-color: rgb(32,32,32);
border-bottom: 1px solid rgb(29,29,29);
}
QFrame {
color: white;
}
""")
self.statusbar.setStyleSheet("""
QStatusBar {
background-color: rgb(32,32,32);
border-top: 1px solid rgb(29,29,29);
}
""")
else:
self.setStyleSheet("""
QToolTip {
background-color: rgb(249,249,249);
border: 1px solid rgb(229,229,229);
color: black;
}
""")
self.menubar.setStyleSheet("""
QMenuBar {
background-color: rgb(243,243,243);
border-bottom: 1px rgb(230,230,230);
}
""")
self.statusbar.setStyleSheet("""
QStatusBar {
background-color: rgb(243,243,243);
border-top: 1px solid rgb(230,230,230);
}
""")
19 changes: 14 additions & 5 deletions core/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from core._init_shortcuts import _init_shortcuts
from core._init_config import _init_config
from core._init_icons import _init_icons
from core._init_styles import _init_styles
from core._init_menu import _init_menu

class MainWindow(QMainWindow):
Expand Down Expand Up @@ -51,6 +52,7 @@ def _init(self):
_init_shortcuts(self)
_init_config(self)
_init_icons(self)
_init_styles(self)

self._init_window()
self.check_for_updates()
Expand Down Expand Up @@ -170,23 +172,30 @@ def toggle_dark_theme(self):
self.settings.setValue("app_theme", "light")

def full_screen(self):
if self.windowState() & Qt.WindowFullScreen:
if self.windowState() & Qt.WindowFullScreen:
self.menubar.show()
self.statusbar.show()
self.showNormal()
self.actionFull_Screen.setChecked(False)
else:
self.menubar.hide()
self.statusbar.hide()
self.setWindowState(Qt.WindowFullScreen)
self.actionFull_Screen.setChecked(True)

def check_for_updates(self):
try:
response = requests.get("https://api.github.com/repos/deeffest/DEEF-Lite-Image-Viewer/releases/latest")
response = requests.get(
"https://api.github.com/repos/deeffest/DEEF-Lite-Image-Viewer/releases/latest")
item_version = response.json()["name"]
item_download = response.json().get("html_url")

if response.json()["name"] != self.version:
if item_version != self.version:
reply = QMessageBox.question(self, self.name,
"A new version is available! Want to download and install?",
QMessageBox.Yes | QMessageBox.No)
if reply == QMessageBox.Yes:
webbrowser.open_new_tab(response.json().get("html_url") )
webbrowser.open_new_tab(item_download)
sys.exit(0)
else:
self.statusbar.showMessage("No new versions were found.", 2000)
Expand Down Expand Up @@ -235,4 +244,4 @@ def eventFilter(self, source, event):
def closeEvent(self, event):
self.settings.setValue('window_state', self.saveState())
self.settings.setValue('window_size', self.size())
super().closeEvent(event)
super().closeEvent(event)
42 changes: 39 additions & 3 deletions core/ui/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
<x>0</x>
<y>0</y>
<width>416</width>
<height>481</height>
<height>483</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
Expand Down Expand Up @@ -92,7 +92,7 @@
<x>0</x>
<y>0</y>
<width>696</width>
<height>22</height>
<height>21</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
Expand Down Expand Up @@ -133,7 +133,7 @@
<widget class="QStatusBar" name="statusbar"/>
<widget class="QDockWidget" name="dockWidget">
<property name="features">
<set>QDockWidget::DockWidgetClosable|QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable</set>
<set>QDockWidget::AllDockWidgetFeatures</set>
</property>
<property name="windowTitle">
<string>Folder Contents</string>
Expand Down Expand Up @@ -163,9 +163,15 @@
<height>30</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Previous</string>
</property>
<property name="statusTip">
<string>Opens the previous image in the folder.</string>
</property>
<property name="text">
<string>...</string>
</property>
Expand All @@ -182,9 +188,15 @@
<height>30</height>
</size>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="toolTip">
<string>Next</string>
</property>
<property name="statusTip">
<string>Opens the next image in the folder.</string>
</property>
<property name="text">
<string>...</string>
</property>
Expand Down Expand Up @@ -212,6 +224,9 @@
<property name="text">
<string>Open Image...</string>
</property>
<property name="statusTip">
<string>After selecting the desired image, displays it in the app.</string>
</property>
<property name="shortcut">
<string>Ctrl+O</string>
</property>
Expand All @@ -223,6 +238,9 @@
<property name="text">
<string>About...</string>
</property>
<property name="statusTip">
<string>Provides some information about this app.</string>
</property>
</action>
<action name="actionFull_Screen">
<property name="checkable">
Expand All @@ -231,6 +249,9 @@
<property name="text">
<string>Full Screen</string>
</property>
<property name="statusTip">
<string>Opens the app in full screen mode.</string>
</property>
<property name="shortcut">
<string>F11</string>
</property>
Expand All @@ -250,6 +271,9 @@
<property name="text">
<string>Previous</string>
</property>
<property name="statusTip">
<string>Opens the previous image in the folder.</string>
</property>
<property name="shortcut">
<string>Left</string>
</property>
Expand All @@ -264,6 +288,9 @@
<property name="text">
<string>Next</string>
</property>
<property name="statusTip">
<string>Opens the next image in the folder.</string>
</property>
<property name="shortcut">
<string>Right</string>
</property>
Expand Down Expand Up @@ -303,6 +330,9 @@
<property name="text">
<string>About Qt</string>
</property>
<property name="statusTip">
<string>Provides some information about the framework used to create this app interface.</string>
</property>
</action>
<action name="actionExit">
<property name="text">
Expand All @@ -316,6 +346,9 @@
<property name="text">
<string>Check for Updates</string>
</property>
<property name="statusTip">
<string>Checks if new versions of the app are publicly available.</string>
</property>
</action>
<action name="actionDark_Theme">
<property name="checkable">
Expand All @@ -324,6 +357,9 @@
<property name="text">
<string>Dark Theme</string>
</property>
<property name="statusTip">
<string>Includes a dark app theme (requires a reboot to apply).</string>
</property>
</action>
</widget>
<resources/>
Expand Down
4 changes: 2 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from core.main_window import MainWindow

name = "DEEF Lite Image Viewer"
version = "2.0"
version = "2.0.1"
current_dir = os.path.dirname(os.path.abspath(__file__))

def set_app_palette():
Expand Down Expand Up @@ -58,4 +58,4 @@ def set_app_palette():
image_path=image_path
)

sys.exit(app.exec_())
sys.exit(app.exec_())
10 changes: 3 additions & 7 deletions notes.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
Update 2.0!
- Complete abandonment of PyQt Fluent Widgets interface, now only standard widgets from PyQt5 are used.
- Viewing images is now done via QLabel instead of QGraphicsView.
- Removed almost all functionality of the app (temporarily).
- You can now view folder content through the Dock widget (you can hide it if you want).
- Replaced the standard method of checking a file (extension list) by checking its mimetype.
- Added the ability to open full screen mode.
Update 2.0.1!
- Styles to components such as QToolTip, QMenuBar and QStatusBar have been added to the app.
- Other fixes and improvements.

0 comments on commit 5ebc923

Please sign in to comment.