Skip to content

Commit c2d832e

Browse files
committed
refactor: Update toolbar button icons and improve styling for better clarity and usability
1 parent 2650af7 commit c2d832e

1 file changed

Lines changed: 47 additions & 35 deletions

File tree

alem_app/ui/right_panel.py

Lines changed: 47 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ def create_right_panel(main_window):
157157
toolbar_layout.addLayout(format_group)
158158

159159
formatting_buttons = [
160-
("B", "Bold", main_window.toggle_bold, QStyle.StandardPixmap.SP_DialogApplyButton),
160+
("B", "Bold", main_window.toggle_bold, None),
161161
("I", "Italic", main_window.toggle_italic, None),
162162
("U", "Underline", main_window.toggle_underline, None),
163163
("", "sep", None, None),
164-
("", "Align Left", lambda: main_window.set_alignment(Qt.AlignmentFlag.AlignLeft), None),
165-
("", "Center", lambda: main_window.set_alignment(Qt.AlignmentFlag.AlignCenter), None),
166-
("", "Align Right", lambda: main_window.set_alignment(Qt.AlignmentFlag.AlignRight), None),
164+
("", "Align Left", lambda: main_window.set_alignment(Qt.AlignmentFlag.AlignLeft), None),
165+
("", "Center", lambda: main_window.set_alignment(Qt.AlignmentFlag.AlignCenter), None),
166+
("", "Align Right", lambda: main_window.set_alignment(Qt.AlignmentFlag.AlignRight), None),
167167
("", "sep", None, None),
168168
("Link", "Insert Link", main_window.insert_link, None),
169169
("Img", "Insert Image", main_window.insert_image, None),
@@ -178,40 +178,41 @@ def create_right_panel(main_window):
178178
toolbar_layout.addWidget(sep)
179179
continue
180180
btn = QPushButton(text)
181-
btn.setFixedSize(32, 32)
181+
btn.setFixedSize(40, 32)
182182
btn.setToolTip(tooltip)
183183

184-
# Set proper icons for buttons
185-
try:
186-
if text == "B":
187-
btn.setIcon(main_window.style().standardIcon(QStyle.StandardPixmap.SP_FileDialogDetailedView))
188-
elif text == "I":
189-
btn.setIcon(main_window.style().standardIcon(QStyle.StandardPixmap.SP_DialogApplyButton))
190-
elif text == "U":
191-
btn.setIcon(main_window.style().standardIcon(QStyle.StandardPixmap.SP_DialogCancelButton))
192-
elif text == "◀":
193-
btn.setIcon(main_window.style().standardIcon(QStyle.StandardPixmap.SP_ArrowLeft))
194-
elif text == "▶":
195-
btn.setIcon(main_window.style().standardIcon(QStyle.StandardPixmap.SP_ArrowRight))
196-
elif text == "▬":
197-
btn.setIcon(main_window.style().standardIcon(QStyle.StandardPixmap.SP_DialogResetButton))
198-
199-
if btn.icon():
200-
btn.setIconSize(QSize(16, 16))
201-
btn.setText("") # Remove text if icon is set
202-
except Exception:
203-
pass # Fallback to text if icons fail
204-
184+
# Keep text labels - they're clearer than confusing icons
205185
if text in ["B", "I", "U"]:
206186
btn.setCheckable(True)
207187
main_window.format_buttons[text] = btn
208188
if action:
209189
btn.clicked.connect(action)
210190
btn.setStyleSheet(
211191
"""
212-
QPushButton { background: rgba(71,85,105,.3); color:#94a3b8; border:1px solid rgba(71,85,105,.4); border-radius:6px; font-weight:600; font-size:11px; min-width:28px; min-height:28px; }
213-
QPushButton:checked { background: rgba(59,130,246,.3); color:#3b82f6; border:1px solid rgba(59,130,246,.4); }
214-
QPushButton:hover { background: rgba(71,85,105,.4); color:#cbd5e1; }
192+
QPushButton {
193+
background: rgba(71,85,105,.3);
194+
color: #e2e8f0;
195+
border: 1px solid rgba(71,85,105,.4);
196+
border-radius: 6px;
197+
font-weight: 600;
198+
font-size: 11px;
199+
font-family: 'Segoe UI', system-ui, sans-serif;
200+
min-width: 36px;
201+
min-height: 28px;
202+
}
203+
QPushButton:checked {
204+
background: rgba(59,130,246,.4);
205+
color: #ffffff;
206+
border: 1px solid rgba(59,130,246,.6);
207+
}
208+
QPushButton:hover {
209+
background: rgba(71,85,105,.5);
210+
color: #f1f5f9;
211+
border: 1px solid rgba(71,85,105,.6);
212+
}
213+
QPushButton:pressed {
214+
background: rgba(59,130,246,.3);
215+
}
215216
"""
216217
)
217218
toolbar_layout.addWidget(btn)
@@ -222,19 +223,30 @@ def create_right_panel(main_window):
222223
size_label = QLabel("Size:")
223224
size_label.setStyleSheet("color:#94a3b8;font-weight:500;font-size:12px;")
224225
size_controls.addWidget(size_label)
225-
size_down_btn = QPushButton("")
226+
size_down_btn = QPushButton("A-")
226227
size_down_btn.setToolTip("Decrease font size")
227-
size_down_btn.setFixedSize(28, 28)
228+
size_down_btn.setFixedSize(32, 28)
228229
size_down_btn.clicked.connect(lambda: main_window.content_editor.zoomOut(1))
229-
size_up_btn = QPushButton("+")
230+
size_up_btn = QPushButton("A+")
230231
size_up_btn.setToolTip("Increase font size")
231-
size_up_btn.setFixedSize(28, 28)
232+
size_up_btn.setFixedSize(32, 28)
232233
size_up_btn.clicked.connect(lambda: main_window.content_editor.zoomIn(1))
233234
for b in [size_down_btn, size_up_btn]:
234235
b.setStyleSheet(
235236
"""
236-
QPushButton { background: rgba(71,85,105,.3); color:#94a3b8; border:1px solid rgba(71,85,105,.4); border-radius:6px; font-weight:bold; font-size:12px; }
237-
QPushButton:hover { background: rgba(71,85,105,.4); color:#cbd5e1; }
237+
QPushButton {
238+
background: rgba(71,85,105,.3);
239+
color: #e2e8f0;
240+
border: 1px solid rgba(71,85,105,.4);
241+
border-radius: 6px;
242+
font-weight: 600;
243+
font-size: 10px;
244+
font-family: 'Segoe UI', system-ui, sans-serif;
245+
}
246+
QPushButton:hover {
247+
background: rgba(71,85,105,.4);
248+
color: #f1f5f9;
249+
}
238250
"""
239251
)
240252
size_controls.addWidget(size_down_btn)

0 commit comments

Comments
 (0)