Skip to content

Commit c9349a4

Browse files
committed
make toggle button small and top right
1 parent d12095c commit c9349a4

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

gui/main_window.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
QPushButton,
1414
QVBoxLayout,
1515
QWidget,
16+
QSpacerItem,
17+
QSizePolicy,
1618
)
1719

1820
class MainWindow(QMainWindow):
@@ -29,9 +31,19 @@ def __init__(self, app) -> None:
2931
self.setCentralWidget(central_widget)
3032

3133
outer_layout = QVBoxLayout()
32-
self.theme_button = QPushButton("Toggle Theme")
34+
35+
top_bar = QHBoxLayout()
36+
37+
spacer = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
38+
39+
self.theme_button = QPushButton("☀")
40+
self.theme_button.setFixedSize(32, 32)
3341
self.theme_button.clicked.connect(self.toggle_theme)
34-
outer_layout.addWidget(self.theme_button)
42+
43+
top_bar.addItem(spacer)
44+
top_bar.addWidget(self.theme_button)
45+
46+
outer_layout.addLayout(top_bar)
3547
central_widget.setLayout(outer_layout)
3648

3749
main_layout = QHBoxLayout()
@@ -109,4 +121,9 @@ def save_xml(self) -> None:
109121
QMessageBox.information(self, "Success", f"Saved Sysmon config to:\n{file_path}")
110122

111123
def toggle_theme(self):
112-
toggle(self.app)
124+
toggle(self.app)
125+
126+
if self.theme_button.text() == "☀":
127+
self.theme_button.setText("🌙")
128+
else:
129+
self.theme_button.setText("☀")

0 commit comments

Comments
 (0)