Skip to content

Commit e955be7

Browse files
committed
Looking glass: Usability improvements
- Centered window - Don't keep window above other windows - Remove unnecessary about dialog - Call Melange "Looking Glass" (it makes no sense for users to distinguish between the two), and that's what the tool is called in the keybindings and in the panel troubleshooting menu - Have the logs shown by default (that's why most users want to see)
1 parent 6029c9a commit e955be7

File tree

2 files changed

+8
-36
lines changed

2 files changed

+8
-36
lines changed

files/usr/share/cinnamon/cinnamon-looking-glass/cinnamon-looking-glass.py

+8-35
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ def do_command_line(self, command_line):
388388
def do_startup(self):
389389
Gtk.Application.do_startup(self)
390390
self.lg_proxy = LookingGlassProxy()
391-
# The status label is shown iff we are not okay
391+
# The status label is shown if we are not okay
392392
self.lg_proxy.connect("status-changed", self.update_status_from_proxy)
393393

394394
if self.window is None:
@@ -430,18 +430,14 @@ def inspect(self):
430430

431431
def construct_window(self):
432432
self.window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
433-
self.window.set_title("Melange")
433+
headerbar = Gtk.HeaderBar()
434+
headerbar.set_title("Looking Glass")
435+
headerbar.set_subtitle("Cinnamon Troubleshooting Tool")
436+
headerbar.set_show_close_button(True)
437+
self.window.set_titlebar(headerbar)
434438
self.window.set_icon_name("system-search")
435439
self.window.set_default_size(1000, 400)
436-
self.window.set_position(Gtk.WindowPosition.MOUSE)
437-
438-
# I can't think of a way to reliably detect if the window
439-
# is active to determine if we need to present or hide
440-
# in show(). Since the window briefly loses focus during
441-
# shortcut press we'd be unable to detect it at that time.
442-
# Keeping the window on top ensures the window is never
443-
# obscured so we can just hide if visible.
444-
self.window.set_keep_above(True)
440+
self.window.set_position(Gtk.WindowPosition.CENTER)
445441

446442
self.window.connect("delete_event", self.on_delete)
447443
self.window.connect("key-press-event", self.on_key_press)
@@ -463,18 +459,13 @@ def construct_window(self):
463459
self.notebook.set_show_border(True)
464460
self.notebook.set_show_tabs(True)
465461

466-
label = Gtk.Label(label="Melange")
467-
label.set_markup("<u>Melange - Cinnamon Debugger</u> ")
468-
label.show()
469-
self.notebook.set_action_widget(label, Gtk.PackType.END)
470-
471462
self.pages = {}
472463
self.custom_pages = {}
464+
self.create_page("Logs", "log")
473465
self.create_page("Results", "results")
474466
self.create_page("Inspect", "inspect")
475467
self.create_page("Windows", "windows")
476468
self.create_page("Extensions", "extensions")
477-
self.create_page("Log", "log")
478469

479470
table.attach(self.notebook, 0, num_columns, 0, 1)
480471

@@ -531,7 +522,6 @@ def construct_window(self):
531522

532523
table.attach(box, column, column+1, 1, 2, 0, 0, 1)
533524

534-
# self.activate_page("results")
535525
self.status_label.hide()
536526
self.window.set_focus(self.command_line)
537527

@@ -551,7 +541,6 @@ def create_action_button(self):
551541
menu.append(self.create_menu_item('Crash Cinnamon', crash_func))
552542
menu.append(self.create_menu_item('Reset Cinnamon Settings', self.on_reset_clicked))
553543
menu.append(Gtk.SeparatorMenuItem())
554-
menu.append(self.create_menu_item('About Melange', self.on_about_clicked))
555544
menu.append(self.create_menu_item('Quit', self.on_delete))
556545
menu.show_all()
557546

@@ -579,22 +568,6 @@ def on_close_tab(self, label, content):
579568
content.destroy()
580569
del self.custom_pages[label]
581570

582-
def on_about_clicked(self, menu_item):
583-
dialog = Gtk.MessageDialog(self.window, 0,
584-
Gtk.MessageType.QUESTION, Gtk.ButtonsType.CLOSE)
585-
586-
dialog.set_title("About Melange")
587-
dialog.set_markup("""\
588-
<b>Melange</b> is a GTK3 alternative to the built-in javascript debugger <i>Looking Glass</i>
589-
590-
Pressing <i>Escape</i> while Melange has focus will hide the window.
591-
If you want to exit Melange, use ALT+F4 or the <u>Actions</u> menu button.
592-
593-
If you defined a hotkey for Melange, pressing it while Melange is visible it will be hidden.""")
594-
595-
dialog.run()
596-
dialog.destroy()
597-
598571
def on_reset_clicked(self, menu_item):
599572
dialog = Gtk.MessageDialog(self.window, 0,
600573
Gtk.MessageType.WARNING, Gtk.ButtonsType.YES_NO,

files/usr/share/cinnamon/cinnamon-looking-glass/page_results.py

-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ def get_updates(self, proxy=None):
6161
item["tooltip"],
6262
item["object"]])
6363
self._changed = True
64-
self.parent.activate_page("results")
6564
except Exception as exc:
6665
print(exc)
6766

0 commit comments

Comments
 (0)