From 8b0ddabd48f1a8423a8c9d2da3664e8b881f381f Mon Sep 17 00:00:00 2001 From: Qing <44231502+byemaxx@users.noreply.github.com> Date: Mon, 16 Dec 2024 12:45:01 -0500 Subject: [PATCH] Fix: 1. font size change was not work for some widgets. 2. some hyperlinks in cookbook were not work. --- .github/workflows/jekyll-gh-pages.yml | 8 ++++++-- Docs/ChangeLog.md | 5 +++++ metax/gui/main_gui.py | 28 +++++++++++++++++++++------ metax/tests/test_metax.py | 11 +++++++++++ metax/utils/version.py | 2 +- pyproject.toml | 2 +- 6 files changed, 46 insertions(+), 10 deletions(-) diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index a2fbff7..ec25460 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -61,7 +61,7 @@ jobs: for heading in headings: level = len(heading[0]) title = heading[1] - anchor = re.sub(r'\W+', '-', title.lower()).strip('-') + anchor = re.sub(r'[^a-zA-Z0-9]+', '-', title.strip()).lower().strip('-') toc_items.append((level, title, anchor)) # Convert markdown to HTML @@ -71,7 +71,11 @@ jobs: html_content = re.sub(r'', r'
', html_content) html_content = re.sub(r'', r'
', html_content) html_content = re.sub(r'
', r'', html_content) - + html_content = re.sub( + r'href="##([^"]+)"', # 匹配类似 ##Module-4.-Peptide-Annotator 的链接 + lambda match: f'href="#{re.sub(r"[^a-zA-Z0-9]+", "-", match.group(1).strip()).lower().strip("-")}"', + html_content + ) # Jinja2 template for HTML output template = Template(''' diff --git a/Docs/ChangeLog.md b/Docs/ChangeLog.md index ff4cb3b..274cf37 100644 --- a/Docs/ChangeLog.md +++ b/Docs/ChangeLog.md @@ -1,3 +1,8 @@ +# Version: 1.120.1 +## Date: 2024-12-16 +### Changes: +- Fix: font size change was not work for some widgets. + # Version: 1.120.0 ## Date: 2024-12-15 ### Changes: diff --git a/metax/gui/main_gui.py b/metax/gui/main_gui.py index af10909..285d334 100644 --- a/metax/gui/main_gui.py +++ b/metax/gui/main_gui.py @@ -137,7 +137,7 @@ 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 .metax_gui.resources import icon_rc # noqa: F401 from ..peptide_annotator.metalab2otf import MetaLab2OTF from ..peptide_annotator.peptable_annotator import PeptideAnnotator @@ -1015,7 +1015,7 @@ def init_theme(self): def change_theme(self, theme, silent=False, is_load_font_size_from_settings=True): if not silent: - text = f"Changing...\n\nTheme: {theme}\nFont size: {self.font_size}" + text = f"Changing theme to {theme}...\n\nTheme: {theme}\nFont size: {self.font_size}" self.show_message(text) # save the theme to settings self.settings.setValue("theme", theme) @@ -1122,6 +1122,24 @@ def change_theme(self, theme, silent=False, is_load_font_size_from_settings=True margin: 2px; height: setted_height; }} + QTabBar {{ + font-size: setted_font_size; + }} + QMenuBar {{ + font-size: setted_font_size; + }} + QMenuBar::item {{ + font-size: setted_font_size; + }} + QTextBrowser {{ + font-size: setted_font_size; + }} + QTableWidget {{ + font-size: setted_font_size; + }} + QHeaderView::section {{ + font-size: setted_font_size; + }} '''.replace('setted_font_size', f'{font_size}px').replace('setted_height', f'{height}px') current_app = QtWidgets.QApplication.instance() @@ -1132,10 +1150,10 @@ def change_theme(self, theme, silent=False, is_load_font_size_from_settings=True # Apply the selected theme if "light" in theme: - self.msgbox_style = "QLabel{min-width: 400px; color: black; font-size: 12px;} QMessageBox{background-color: white;}" + self.msgbox_style = "QLabel{min-width: 400px; color: black; font-size: setted_font_size;} QMessageBox{background-color: white;}".replace('setted_font_size', f'{font_size}px') apply_stylesheet(current_app, theme=theme, invert_secondary=True, extra=extra) else: - self.msgbox_style = "QLabel{min-width: 400px; color: white; font-size: 12px;} QMessageBox{background-color: #333;}" + self.msgbox_style = "QLabel{min-width: 400px; color: white; font-size: setted_font_size;} QMessageBox{background-color: #333;}".replace('setted_font_size', f'{font_size}px') # set text color to white of QComboBox , QSpinBox and QDoubleSpinBox , lineEdit custom_css += ''' QComboBox {{ @@ -1820,8 +1838,6 @@ def show_message(self,message,title='Information'): self.msg.setWindowModality(Qt.NonModal) self.msg.setWindowTitle(title) - if not hasattr(self, 'msgbox_style'): - self.msgbox_style = "QLabel{min-width: 400px; color: black; font-size: 12px;} QMessageBox{background-color: white;}" self.msg.setStyleSheet(self.msgbox_style) self.msg.setText(message) diff --git a/metax/tests/test_metax.py b/metax/tests/test_metax.py index e69de29..56e80fb 100644 --- a/metax/tests/test_metax.py +++ b/metax/tests/test_metax.py @@ -0,0 +1,11 @@ +import sys +import os +script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in +parentDir = os.path.abspath(os.path.join(script_dir, os.pardir)) +grandParentDir = os.path.abspath(os.path.join(parentDir, os.pardir)) +sys.path.append(grandParentDir) + + +from metax.gui.main_gui import runGUI + +runGUI() \ No newline at end of file diff --git a/metax/utils/version.py b/metax/utils/version.py index 9d9ce7b..dd68a74 100644 --- a/metax/utils/version.py +++ b/metax/utils/version.py @@ -1,2 +1,2 @@ -__version__ = '1.120.0' +__version__ = '1.120.1' API_version = '4' \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index e72cca5..48287e9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "MetaXTools" -version = "1.120.0" +version = "1.120.1" description = "MetaXTools is a novel tool for linking peptide sequences with taxonomic and functional information in Metaproteomics." readme = "README_PyPi.md" license = { text = "NorthOmics" }