Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
byemaxx committed Dec 5, 2024
2 parents 687b014 + 5759b06 commit 3378ff7
Show file tree
Hide file tree
Showing 7 changed files with 8,712 additions and 7 deletions.
5 changes: 5 additions & 0 deletions Docs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

# Version: 1.119.8
## Date: 2024-12-5
### Changes:
- New: restore window size when open the MetaX.

# Version: 1.119.7
## Date: 2024-12-5
### Changes:
Expand Down
Binary file modified Docs/MetaX_Cookbook.assets/otf_heatmap.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 21 additions & 5 deletions metax/gui/main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from PyQt5.QtWidgets import QApplication, QListWidget, QListWidgetItem,QPushButton
from PyQt5.QtWidgets import QDialog, QVBoxLayout, QTextBrowser, QSizePolicy, QLayout
from PyQt5.QtGui import QIcon, QCursor
from PyQt5.QtCore import Qt, QTimer, QDir, QSettings
from PyQt5.QtCore import Qt, QTimer, QDir, QSettings, QSize

import qtawesome as qta
# from qt_material import apply_stylesheet
Expand Down Expand Up @@ -92,6 +92,7 @@
from metax.gui.metax_gui.ui_lca_help import UiLcaHelpDialog
from metax.gui.metax_gui.ui_func_threshold_help import UifuncHelpDialog
from metax.gui.metax_gui.generic_thread import FunctionExecutor
from metax.gui.metax_gui.resources import icon_rc

from metax.peptide_annotator.metalab2otf import MetaLab2OTF
from metax.peptide_annotator.peptable_annotator import PeptideAnnotator
Expand Down Expand Up @@ -136,7 +137,8 @@
from .metax_gui.ui_lca_help import UiLcaHelpDialog
from .metax_gui.ui_func_threshold_help import UifuncHelpDialog
from .metax_gui.generic_thread import FunctionExecutor

from .metax.gui.metax_gui.resources import icon_rc

from ..peptide_annotator.metalab2otf import MetaLab2OTF
from ..peptide_annotator.peptable_annotator import PeptideAnnotator

Expand All @@ -153,9 +155,10 @@ def __init__(self, MainWindow):
MainWindow.closeEvent = self.closeEvent
self.setupUi(MainWindow)
self.MainWindow = MainWindow
icon_path = os.path.join(os.path.dirname(__file__), "./MetaX_GUI/resources/logo.png")
# icon_path = os.path.join(os.path.dirname(__file__), "./MetaX_GUI/resources/logo.png")
# self.MainWindow.setWindowIcon(QIcon(icon_path))
self.MainWindow.setWindowIcon(QIcon(":/icon/logo.png"))

self.MainWindow.setWindowIcon(QIcon(icon_path))
self.MainWindow.resize(1200, 800)
self.MainWindow.setWindowTitle("MetaX v" + __version__)

Expand Down Expand Up @@ -951,6 +954,17 @@ def init_theme(self):
theme = "light_blue"
print(f"Loading default theme {theme}...")
self.change_theme(theme, silent=True)

# restore the window size
if self.settings.contains("window_size"):
size = self.settings.value("window_size", type=QSize)
# check if the size is smaller than the screen size
if size.width() < self.screen_width and size.height() < self.screen_height:
print(f"Restoring window size to {size}...")
self.MainWindow.resize(size)
else:
print("Restoring window size to default because the saved size is larger than the screen size.")



def change_theme(self, theme, silent=False):
Expand Down Expand Up @@ -1271,7 +1285,9 @@ def save_basic_settings(self, line_edit_name: str | None = None):
#save theme
if self.settings.contains("theme"):
self.settings.setValue("theme", self.settings.value("theme", type=str))


# save current window size
self.settings.setValue("window_size", self.MainWindow.size())


def save_set_multi_table_settings(self):
Expand Down
5 changes: 5 additions & 0 deletions metax/gui/metax_gui/resources/icon.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="icon">
<file>logo.png</file>
</qresource>
</RCC>
Loading

0 comments on commit 3378ff7

Please sign in to comment.