Skip to content

Commit

Permalink
Fix:
Browse files Browse the repository at this point in the history
1. font size change was not work for some widgets.
2. some hyperlinks in cookbook were not work.
  • Loading branch information
byemaxx committed Dec 16, 2024
1 parent 3f9cc45 commit 8b0ddab
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 10 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -71,7 +71,11 @@ jobs:
html_content = re.sub(r'<img (.*?)>', r'<div style="text-align: center;"><img \1 class="img-fluid" style="max-width: 60%; min-width: 300px; height: auto; display: inline-block;"></div>', html_content)
html_content = re.sub(r'<table>', r'<div class="table-responsive"><table class="table table-striped table-bordered">', html_content)
html_content = re.sub(r'</table>', r'</table></div>', 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('''
<!DOCTYPE html>
Expand Down
5 changes: 5 additions & 0 deletions Docs/ChangeLog.md
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
28 changes: 22 additions & 6 deletions metax/gui/main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand All @@ -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 {{
Expand Down Expand Up @@ -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)

Expand Down
11 changes: 11 additions & 0 deletions metax/tests/test_metax.py
Original file line number Diff line number Diff line change
@@ -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()
2 changes: 1 addition & 1 deletion metax/utils/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
__version__ = '1.120.0'
__version__ = '1.120.1'
API_version = '4'
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand Down

0 comments on commit 8b0ddab

Please sign in to comment.