@@ -50,6 +50,7 @@ def __init__(self) -> None:
5050 self ._statuses : dict [str , ComponentStatus ] = {}
5151 self ._chevron_btn : IconButton | None = None
5252 self ._details_widget : QtWidgets .QWidget | None = None
53+ self ._font_cache : dict [int , QtGui .QFont ] = {}
5354 self .update_all_btn .clicked .connect (self .on_update_all_clicked )
5455 self .update_back_btn .clicked .connect (self ._request_status_debounced )
5556 self ._status_debounce : QtCore .QTimer = QtCore .QTimer (self )
@@ -62,9 +63,6 @@ def __init__(self) -> None:
6263 self ._post_update_status_pending : bool = False
6364 self .show_loading (True )
6465
65- def deleteLater (self ) -> None :
66- return super ().deleteLater ()
67-
6866 def _request_status_debounced (self ) -> None :
6967 self ._status_debounce .start (500 )
7068
@@ -96,7 +94,9 @@ def _make_white_label(
9694 ),
9795 ) -> QtWidgets .QLabel :
9896 label = QtWidgets .QLabel (text , self )
99- label .setFont (QtGui .QFont (self ._font_family , size ))
97+ if size not in self ._font_cache :
98+ self ._font_cache [size ] = QtGui .QFont (self ._font_family , size )
99+ label .setFont (self ._font_cache [size ])
100100 label .setStyleSheet ("color: #FFFFFF;" )
101101 label .setAlignment (align )
102102 return label
@@ -138,9 +138,7 @@ def _make_summary_row(
138138 self ._chevron_btn = IconButton (card )
139139 self ._chevron_btn .setFixedSize (50 , 50 )
140140 self ._chevron_btn .setFlat (True )
141- self ._chevron_btn .setPixmap (
142- QtGui .QPixmap (":/arrow_icons/media/btn_icons/right_arrow.svg" )
143- )
141+ self ._chevron_btn .setPixmap (self ._chevron_right )
144142 self ._chevron_btn .clicked .connect (self ._toggle_details )
145143 row .addWidget (self ._chevron_btn )
146144 return card
@@ -226,13 +224,9 @@ def _toggle_details(self) -> None:
226224 return
227225 visible = not self ._details_widget .isVisible ()
228226 self ._details_widget .setVisible (visible )
229- pixmap = QtGui .QPixmap (":/arrow_icons/media/btn_icons/right_arrow.svg" )
230- if visible :
231- pixmap = pixmap .transformed (
232- QtGui .QTransform ().rotate (90 ),
233- QtCore .Qt .TransformationMode .SmoothTransformation ,
234- )
235- self ._chevron_btn .setPixmap (pixmap )
227+ self ._chevron_btn .setPixmap (
228+ self ._chevron_down if visible else self ._chevron_right
229+ )
236230
237231 def handle_status_ready (self , json_str : str ) -> None :
238232 """Update component statuses from a JSON payload and refresh the list."""
@@ -284,17 +278,21 @@ def show_loading(self, loading: bool = False) -> None:
284278 self .disable_popups .emit (loading )
285279
286280 def _setupUI (self ) -> None :
287- font_id = QtGui .QFontDatabase .addApplicationFont (
281+ bold_id = QtGui .QFontDatabase .addApplicationFont (
288282 ":/font/media/fonts for text/Momcake-Bold.ttf"
289283 )
290- self ._font_family = QtGui .QFontDatabase .applicationFontFamilies (font_id )[0 ]
284+ self ._font_family = QtGui .QFontDatabase .applicationFontFamilies (bold_id )[0 ]
285+ thin_id = QtGui .QFontDatabase .addApplicationFont (
286+ ":/font/media/fonts for text/Momcake-Thin.ttf"
287+ )
288+ thin_families = QtGui .QFontDatabase .applicationFontFamilies (thin_id )
289+ _title_family = thin_families [0 ] if thin_families else ""
291290
292291 self .setObjectName ("updatePage" )
293292 self .setStyleSheet (
294293 "#updatePage { background-image: url(:/background/media/1st_background.png); }"
295294 )
296- self .setMinimumSize (QtCore .QSize (710 , 400 ))
297- self .setMaximumSize (QtCore .QSize (720 , 420 ))
295+ self .setMinimumSize (QtCore .QSize (600 , 360 ))
298296 sp = QtWidgets .QSizePolicy (
299297 QtWidgets .QSizePolicy .Policy .MinimumExpanding ,
300298 QtWidgets .QSizePolicy .Policy .MinimumExpanding ,
@@ -317,8 +315,9 @@ def _setupUI(self) -> None:
317315 header .addWidget (self .reload_btn )
318316
319317 title = QtWidgets .QLabel ("Update Manager" , self )
320- title .setFont (QtGui .QFont (self ._font_family , 28 ))
321- title .setMinimumHeight (60 )
318+ title .setFont (QtGui .QFont (_title_family , 24 ))
319+ title .setMinimumSize (QtCore .QSize (100 , 60 ))
320+ title .setMaximumSize (QtCore .QSize (16777215 , 60 ))
322321 title .setSizePolicy (
323322 QtWidgets .QSizePolicy (
324323 QtWidgets .QSizePolicy .Policy .Expanding ,
@@ -328,6 +327,7 @@ def _setupUI(self) -> None:
328327 pal = title .palette ()
329328 pal .setColor (pal .ColorRole .WindowText , QtGui .QColor ("#FFFFFF" ))
330329 title .setPalette (pal )
330+ title .setLayoutDirection (QtCore .Qt .LayoutDirection .RightToLeft )
331331 title .setAlignment (QtCore .Qt .AlignmentFlag .AlignCenter )
332332 header .addWidget (title )
333333
@@ -378,3 +378,10 @@ def _setupUI(self) -> None:
378378 )
379379 content .addWidget (self .update_all_btn , 0 , QtCore .Qt .AlignmentFlag .AlignCenter )
380380 self .update_all_btn .hide ()
381+
382+ _arrow = QtGui .QPixmap (":/arrow_icons/media/btn_icons/arrow_right.svg" )
383+ self ._chevron_right : QtGui .QPixmap = _arrow
384+ self ._chevron_down : QtGui .QPixmap = _arrow .transformed (
385+ QtGui .QTransform ().rotate (90 ),
386+ QtCore .Qt .TransformationMode .SmoothTransformation ,
387+ )
0 commit comments