Skip to content

Commit 5e57dc6

Browse files
committed
Add SMBIOS model selection
1 parent d12f62b commit 5e57dc6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

Scripts/pages/configuration_page.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,32 @@ def update_layout(self):
6565
layout_text = str(self.controller.hardware_state.audio_layout_id) if self.controller.hardware_state.audio_layout_id is not None else "Not configured"
6666
self.layoutLabel.setText(layout_text)
6767

68+
class SMBIOSModelCard(SettingCard):
69+
def __init__(self, controller, on_select_model, parent=None):
70+
super().__init__(
71+
FluentIcon.TAG,
72+
"SMBIOS Model",
73+
"Select Mac model identifier for your system",
74+
parent
75+
)
76+
self.controller = controller
77+
78+
model_text = self.controller.smbios_state.model_name if self.controller.smbios_state.model_name != "Not selected" else "Not configured"
79+
self.modelLabel = BodyLabel(model_text)
80+
self.modelLabel.setStyleSheet("color: {}; margin-right: 10px;".format(COLORS["text_secondary"]))
81+
82+
self.selectModelBtn = PushButton("Configure Model")
83+
self.selectModelBtn.clicked.connect(on_select_model)
84+
self.selectModelBtn.setFixedWidth(150)
85+
86+
self.hBoxLayout.addWidget(self.modelLabel)
87+
self.hBoxLayout.addWidget(self.selectModelBtn)
88+
self.hBoxLayout.addSpacing(16)
89+
90+
def update_model(self):
91+
model_text = self.controller.smbios_state.model_name if self.controller.smbios_state.model_name != "Not selected" else "Not configured"
92+
self.modelLabel.setText(model_text)
93+
6894
class ConfigurationPage(ScrollArea):
6995
def __init__(self, parent, ui_utils_instance=None):
7096
super().__init__(parent)
@@ -136,6 +162,9 @@ def _init_ui(self):
136162
self.audio_layout_card = AudioLayoutCard(self.controller, self.customize_audio_layout, self.scrollWidget)
137163
self.expandLayout.addWidget(self.audio_layout_card)
138164

165+
self.smbios_card = SMBIOSModelCard(self.controller, self.customize_smbios_model, self.scrollWidget)
166+
self.expandLayout.addWidget(self.smbios_card)
167+
139168
self.expandLayout.addStretch()
140169

141170
def _update_status_card(self):
@@ -257,6 +286,8 @@ def update_display(self):
257286
if hasattr(self, "macos_card"):
258287
self.macos_card.update_version()
259288
self._update_audio_layout_card_visibility()
289+
if hasattr(self, "smbios_card"):
290+
self.smbios_card.update_model()
260291

261292
def refresh(self):
262293
self.update_display()

0 commit comments

Comments
 (0)