Skip to content

Commit 4d5c9b2

Browse files
baremetalgoCopilot
andcommitted
Polish application theme and menus
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
1 parent a711677 commit 4d5c9b2

3 files changed

Lines changed: 164 additions & 12 deletions

File tree

interface/core/window_core.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,26 @@ def _install_ui_event_logging(self, root: QWidget) -> None:
152152
lambda item=widget: self._log_ui_event("edited", item, item.text())
153153
)
154154

155+
def edit_focused_widget(self, method_name: str) -> None:
156+
"""Run a standard edit operation on the currently focused editor.
157+
158+
Args:
159+
method_name: Qt editor method to invoke, such as ``copy`` or
160+
``selectAll``.
161+
"""
162+
widget = QApplication.focusWidget()
163+
method = getattr(widget, method_name, None) if widget is not None else None
164+
if callable(method):
165+
method()
166+
167+
def show_about_dialog(self) -> None:
168+
"""Display the application identity and version."""
169+
QMessageBox.information(
170+
self,
171+
f"About {APP_NAME}",
172+
f"{APP_NAME} {APP_VERSION}\n\nA desktop environment for building, training, and using LLMs.",
173+
)
174+
155175
def _log_ui_event(self, action: str, widget: QWidget, value: Any) -> None:
156176
"""Log a UI action or parameter value.
157177

interface/styles.qss

Lines changed: 116 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,29 @@ QCheckBox {
116116
spacing: 8px;
117117
}
118118

119+
QCheckBox::indicator {
120+
width: 14px;
121+
height: 14px;
122+
background: #111111;
123+
border: 1px solid #6a6a6a;
124+
border-radius: 3px;
125+
}
126+
127+
QCheckBox::indicator:hover {
128+
border-color: #f5b041;
129+
background: #1d1d1d;
130+
}
131+
132+
QCheckBox::indicator:checked {
133+
background: #c94343;
134+
border-color: #f07171;
135+
}
136+
137+
QCheckBox::indicator:checked:hover {
138+
background: #e05a5a;
139+
border-color: #ff9292;
140+
}
141+
119142
QPushButton {
120143
background: #242424;
121144
color: #eeeeee;
@@ -185,7 +208,7 @@ QTextEdit {
185208
font-size: 12px;
186209
}
187210

188-
QTableWidget {
211+
QTableWidget, QTreeWidget {
189212
background: #111111;
190213
alternate-background-color: #1b1b1b;
191214
color: #eeeeee;
@@ -196,6 +219,16 @@ QTableWidget {
196219
selection-color: #ffffff;
197220
}
198221

222+
QTableWidget::item, QTreeWidget::item {
223+
background: #111111;
224+
color: #eeeeee;
225+
}
226+
227+
QTableWidget::item:selected, QTreeWidget::item:selected {
228+
background: #3a2d19;
229+
color: #ffffff;
230+
}
231+
199232
QHeaderView::section {
200233
background: #202020;
201234
color: #f5b041;
@@ -206,6 +239,88 @@ QHeaderView::section {
206239
font-weight: 800;
207240
}
208241

242+
QScrollBar:vertical {
243+
background: #171717;
244+
width: 8px;
245+
margin: 2px 0;
246+
}
247+
248+
QScrollBar::handle:vertical {
249+
background: #c98216;
250+
min-height: 24px;
251+
border-radius: 4px;
252+
}
253+
254+
QScrollBar::handle:vertical:hover {
255+
background: #f5b041;
256+
}
257+
258+
QScrollBar::add-line:vertical, QScrollBar::sub-line:vertical {
259+
height: 0;
260+
}
261+
262+
QScrollBar:horizontal {
263+
background: #171717;
264+
height: 8px;
265+
margin: 0 2px;
266+
}
267+
268+
QScrollBar::handle:horizontal {
269+
background: #c98216;
270+
min-width: 24px;
271+
border-radius: 4px;
272+
}
273+
274+
QScrollBar::handle:horizontal:hover {
275+
background: #f5b041;
276+
}
277+
278+
QScrollBar::add-line:horizontal, QScrollBar::sub-line:horizontal {
279+
width: 0;
280+
}
281+
282+
QMenuBar {
283+
background: #1f1f1f;
284+
color: #eeeeee;
285+
border: 1px solid #3d3d3d;
286+
border-radius: 7px;
287+
padding: 2px;
288+
}
289+
290+
QMenuBar::item {
291+
background: transparent;
292+
padding: 6px 10px;
293+
border-radius: 5px;
294+
}
295+
296+
QMenuBar::item:selected {
297+
background: #f5b041;
298+
color: #151515;
299+
}
300+
301+
QMenu {
302+
background: #242424;
303+
color: #eeeeee;
304+
border: 1px solid #555555;
305+
padding: 4px;
306+
}
307+
308+
QMenu::item {
309+
padding: 6px 28px 6px 12px;
310+
border-radius: 4px;
311+
}
312+
313+
QMenu::item:selected {
314+
background: #f5b041;
315+
color: #151515;
316+
}
317+
318+
QMenu::separator {
319+
height: 1px;
320+
background: #3d3d3d;
321+
margin: 4px 8px;
322+
}
323+
209324
QTextBrowser {
210325
background: #111111;
211326
color: #eeeeee;

interface/widgets/app_shell.py

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
QHBoxLayout,
99
QLabel,
1010
QLineEdit,
11+
QMenuBar,
1112
QPushButton,
1213
QSizePolicy,
1314
QStackedWidget,
@@ -53,16 +54,33 @@ def build_top_bar(window, app_name: str) -> QWidget:
5354
window.search_box.setPlaceholderText("Project name...")
5455
window.search_box.setMaximumWidth(260)
5556
window._tip(window.search_box, f"Project name used when saving or reopening a {app_name} project.")
56-
for name, text, slot in (
57-
("new_project_button", "New Project", window.new_project),
58-
("save_project_button", "Save Project", window.save_project),
59-
("open_project_button", "Open Project", window.open_project),
57+
window.menu_bar = QMenuBar()
58+
window.menu_bar.setObjectName("AppMenuBar")
59+
window.file_menu = window.menu_bar.addMenu("File")
60+
window.new_project_action = window.file_menu.addAction("New Project", window.new_project)
61+
window.new_project_action.setShortcut("Ctrl+N")
62+
window.save_project_action = window.file_menu.addAction("Save Project", window.save_project)
63+
window.save_project_action.setShortcut("Ctrl+S")
64+
window.open_project_action = window.file_menu.addAction("Open Project", window.open_project)
65+
window.open_project_action.setShortcut("Ctrl+O")
66+
67+
window.edit_menu = window.menu_bar.addMenu("Edit")
68+
for text, method, shortcut in (
69+
("Undo", "undo", "Ctrl+Z"),
70+
("Redo", "redo", "Ctrl+Shift+Z"),
71+
("Cut", "cut", "Ctrl+X"),
72+
("Copy", "copy", "Ctrl+C"),
73+
("Paste", "paste", "Ctrl+V"),
74+
("Select All", "selectAll", "Ctrl+A"),
6075
):
61-
button = QPushButton(text)
62-
button.setMaximumWidth(130)
63-
button.clicked.connect(slot)
64-
window._tip(button, f"{text} in the current project.")
65-
setattr(window, name, button)
76+
action = window.edit_menu.addAction(text)
77+
action.setShortcut(shortcut)
78+
action.triggered.connect(
79+
lambda _checked=False, method=method: window.edit_focused_widget(method)
80+
)
81+
82+
window.about_menu = window.menu_bar.addMenu("About")
83+
window.about_menu.addAction(f"About {app_name}", window.show_about_dialog)
6684

6785
for name, text in (
6886
("dataset_status", "Dataset: not prepared"),
@@ -82,8 +100,7 @@ def build_top_bar(window, app_name: str) -> QWidget:
82100
layout.addWidget(logo)
83101
layout.addSpacing(12)
84102
layout.addWidget(window.search_box)
85-
for name in ("new_project_button", "save_project_button", "open_project_button"):
86-
layout.addWidget(getattr(window, name))
103+
layout.addWidget(window.menu_bar)
87104
layout.addSpacing(10)
88105
for name in ("dataset_status", "train_status", "export_status", "chat_status"):
89106
layout.addWidget(getattr(window, name))

0 commit comments

Comments
 (0)