Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion BlocksScreen/lib/panels/mainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
from lib.ui.resources.graphic_resources_rc import *
from lib.ui.resources.icon_resources_rc import *
from lib.ui.resources.main_menu_resources_rc import *
from lib.ui.resources.system_resources_rc import *
from lib.ui.resources.top_bar_resources_rc import *
from lib.updater_worker import UpdaterWorker
from lib.utils.fonts import register_momcake
from PyQt6 import QtCore, QtGui, QtWidgets
from screensaver import ScreenSaver

Expand Down Expand Up @@ -122,6 +122,8 @@ def __init__(self):
"""Set up UI, instantiate subsystems, and wire all inter-component signals."""
super(MainWindow, self).__init__()
self.config: BlocksScreenConfig = get_configparser()
# Before setupUi: the topbar .svg icons carry text and paint on first show.
register_momcake()
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
self.screensaver = ScreenSaver(self)
Expand Down
9 changes: 0 additions & 9 deletions BlocksScreen/lib/panels/networkWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2828,9 +2828,6 @@ def _setup_saved_details_page(self) -> None:
self.low_priority_btn.setMaximumSize(QtCore.QSize(100, 100))
self.low_priority_btn.setCheckable(True)
self.low_priority_btn.setFlat(True)
self.low_priority_btn.setProperty(
"icon_pixmap", PixmapCache.get(":/ui/media/btn_icons/indf_svg.svg")
)
self.low_priority_btn.setText("Low")
self.low_priority_btn.setProperty("class", "back_btn")
self.low_priority_btn.setProperty("button_type", "icon")
Expand All @@ -2844,9 +2841,6 @@ def _setup_saved_details_page(self) -> None:
self.med_priority_btn.setCheckable(True)
self.med_priority_btn.setChecked(False) # Don't set default checked
self.med_priority_btn.setFlat(True)
self.med_priority_btn.setProperty(
"icon_pixmap", PixmapCache.get(":/ui/media/btn_icons/indf_svg.svg")
)
self.med_priority_btn.setText("Medium")
self.med_priority_btn.setProperty("class", "back_btn")
self.med_priority_btn.setProperty("button_type", "icon")
Expand All @@ -2860,9 +2854,6 @@ def _setup_saved_details_page(self) -> None:
self.high_priority_btn.setCheckable(True)
self.high_priority_btn.setChecked(False)
self.high_priority_btn.setFlat(True)
self.high_priority_btn.setProperty(
"icon_pixmap", PixmapCache.get(":/ui/media/btn_icons/indf_svg.svg")
)
self.high_priority_btn.setText("High")
self.high_priority_btn.setProperty("class", "back_btn")
self.high_priority_btn.setProperty("button_type", "icon")
Expand Down
18 changes: 0 additions & 18 deletions BlocksScreen/lib/panels/printTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,20 +428,6 @@ def _on_delete_file_confirmed(self, filename: str, directory: str) -> None:
except (RuntimeError, TypeError):
pass

def setProperty(self, name: str, value: typing.Any) -> bool:
"""Intercept the set property method

Args:
name (str): Name of the dynamic property
value (typing.Any): Value for the dynamic property

Returns:
bool: Returns to the super class
"""
if name == "backgroundPixmap":
self.background = value
return super().setProperty(name, value)

def handle_cancel_print(self) -> None:
"""Handles the print cancel action"""
if (
Expand Down Expand Up @@ -514,10 +500,6 @@ def setupMainPrintPage(self) -> None:
self.setSizePolicy(sizePolicy)
self.setMinimumSize(QtCore.QSize(710, 410))
self.setMaximumSize(QtCore.QSize(720, 420))
self.setProperty(
"backgroundPixmap",
QtGui.QPixmap(":/background/media/graphics/scroll_list_window.svg"),
)
self.print_page = QtWidgets.QWidget()
sizePolicy = QtWidgets.QSizePolicy(
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
Expand Down
3 changes: 0 additions & 3 deletions BlocksScreen/lib/panels/widgets/babystepPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,6 @@ def _setupUI(self) -> None:
self.bbp_z_offset_current_value.setText(
f"Z: {round(self._pending_z_offset, 3) or 0.0:.3f} mm"
)
self.bbp_z_offset_current_value.setPixmap(
QtGui.QPixmap(":/graphics/media/btn_icons/z_offset_adjust.svg")
)
self.bbp_z_offset_current_value.setAlignment(
QtCore.Qt.AlignmentFlag.AlignCenter
)
Expand Down
6 changes: 3 additions & 3 deletions BlocksScreen/lib/panels/widgets/basicFilamentPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,23 +639,23 @@ def _setupUi(self):
(
"load_pla_btn",
"PLA",
":/filament_related/media/topbar/pla_filament_topbar.svg",
":/top_bar_icons/media/topbar/pla_filament_topbar.svg",
0,
0,
FilamentTypes.PLA,
),
(
"load_petg_btn",
"PETG",
":/filament_related/media/topbar/petg_filament_topbar.svg",
":/top_bar_icons/media/topbar/petg_filament_topbar.svg",
0,
1,
FilamentTypes.PETG,
),
(
"load_abs_btn",
"ABS",
":/filament_related/media/topbar/abs_filament_topbar.svg",
":/top_bar_icons/media/topbar/abs_filament_topbar.svg",
1,
0,
FilamentTypes.ABS,
Expand Down
6 changes: 2 additions & 4 deletions BlocksScreen/lib/panels/widgets/inputshaperPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from lib.utils.blocks_button import BlocksCustomButton
from lib.utils.blocks_frame import BlocksCustomFrame
from lib.utils.fonts import register_momcake
from lib.utils.icon_button import IconButton
from lib.utils.list_model import EntryDelegate, EntryListModel, ListItem
from PyQt6 import QtCore, QtGui, QtWidgets
Expand Down Expand Up @@ -135,10 +136,7 @@ def add_type_entry(self, cli_name: str, recommended: str = "") -> None:

def _setupUI(self) -> None:
"""Setup UI for updatePage"""
font_id = QtGui.QFontDatabase.addApplicationFont(
":/font/media/fonts for text/Momcake-Bold.ttf"
)
font_family = QtGui.QFontDatabase.applicationFontFamilies(font_id)[0]
font_family = register_momcake()
sizePolicy = QtWidgets.QSizePolicy(
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
Expand Down
5 changes: 4 additions & 1 deletion BlocksScreen/lib/panels/widgets/popupDialogWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ def __init__(self, parent) -> None:
self.message_type: Popup.MessageType = Popup.MessageType.INFO
self.default_background_color = QtGui.QColor(164, 164, 164)
self.info_icon = QtGui.QPixmap(":ui/media/btn_icons/info.svg")
self.warning_icon = QtGui.QPixmap(":ui/media/btn_icons/warning.svg")
# no warning asset exists yet; the yellow ColorCode carries the severity
self.warning_icon = QtGui.QPixmap(":ui/media/btn_icons/error.svg")
self.error_icon = QtGui.QPixmap(":ui/media/btn_icons/error.svg")
self.setAttribute(QtCore.Qt.WidgetAttribute.WA_TranslucentBackground, True)
self.setMouseTracking(True)
Expand Down Expand Up @@ -179,6 +180,8 @@ def _add_popup(self) -> None:
self.icon_label.setPixmap(self.warning_icon)
case Popup.MessageType.ERROR:
self.icon_label.setPixmap(self.error_icon)
case _:
self.icon_label.clear()

end_rect = self._calculate_target_geometry()
start_rect = end_rect.translated(0, -end_rect.height() * 2)
Expand Down
3 changes: 0 additions & 3 deletions BlocksScreen/lib/panels/widgets/probeHelperPage.py
Original file line number Diff line number Diff line change
Expand Up @@ -946,9 +946,6 @@ def _setupUi(self) -> None:
self.current_offset_info.setFont(font)
self.current_offset_info.setStyleSheet("background: transparent; color: white;")
self.current_offset_info.setText("Z:0.000mm")
self.current_offset_info.setPixmap(
QtGui.QPixmap(":/graphics/media/btn_icons/z_offset_adjust.svg")
)
self.current_offset_info.setAlignment(QtCore.Qt.AlignmentFlag.AlignCenter)
self.current_offset_info.setObjectName("current_offset_info")
# Add graphic frame AFTER the offset buttons group box
Expand Down
6 changes: 2 additions & 4 deletions BlocksScreen/lib/panels/widgets/sensorsPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from lib.panels.widgets.sensorWidget import SensorWidget
from lib.utils.blocks_frame import BlocksCustomFrame
from lib.utils.fonts import register_momcake
from lib.utils.icon_button import IconButton
from lib.utils.list_model import EntryDelegate, EntryListModel, ListItem
from PyQt6 import QtCore, QtGui, QtWidgets
Expand Down Expand Up @@ -130,10 +131,7 @@ def create_sensor_widget(self, name: str) -> SensorWidget:

def _setupUi(self) -> None:
"""Setup UI for updatePage"""
font_id = QtGui.QFontDatabase.addApplicationFont(
":/font/media/fonts for text/Momcake-Bold.ttf"
)
font_family = QtGui.QFontDatabase.applicationFontFamilies(font_id)[0]
font_family = register_momcake()
sizePolicy = QtWidgets.QSizePolicy(
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
QtWidgets.QSizePolicy.Policy.MinimumExpanding,
Expand Down
2 changes: 1 addition & 1 deletion BlocksScreen/lib/panels/widgets/slider_selector_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, parent) -> None:
self.decrease_button_icon = QtGui.QPixmap(
":/arrow_icons/media/btn_icons/left_arrow.svg"
)
self.background = QtGui.QPixmap(":/ui/background/media/1st_background.png")
self.background = QtGui.QPixmap(":/background/media/1st_background.png")
self.setStyleSheet(
"#SliderPage{background-image: url(:/background/media/1st_background.png);}\n"
)
Expand Down
14 changes: 5 additions & 9 deletions BlocksScreen/lib/panels/widgets/updatePage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import typing
from types import MappingProxyType

from lib.utils.fonts import register_momcake
from PyQt6 import QtCore, QtGui, QtWidgets

from BlocksScreen.lib.panels.widgets.basePopup import BasePopup
Expand Down Expand Up @@ -492,15 +493,10 @@ def show_loading(self, loading: bool = False) -> None:
self.disable_popups.emit(loading)

def _setupUI(self) -> None:
bold_id = QtGui.QFontDatabase.addApplicationFont(
":/font/media/fonts for text/Momcake-Bold.ttf"
)
self._font_family = QtGui.QFontDatabase.applicationFontFamilies(bold_id)[0]
thin_id = QtGui.QFontDatabase.addApplicationFont(
":/font/media/fonts for text/Momcake-Thin.ttf"
)
thin_families = QtGui.QFontDatabase.applicationFontFamilies(thin_id)
_title_family = thin_families[0] if thin_families else ""
# Qt files the Thin and Bold faces under one family, so both ids gave the
# same name here; the weight is chosen per QFont, not per family.
self._font_family = register_momcake()
_title_family = self._font_family

self.setObjectName("updatePage")
self.setStyleSheet(
Expand Down
Loading
Loading