示例#1
0
    def __init__(self, parent):
        self.view = InspectView(self)
        pageutils.WindowAndActionBars.__init__(self, self.view)
        self.parent = parent

        self.back = pageutils.ImageButton("back")
        self.back.set_tooltip_text("Go back")
        self.back.set_sensitive(False)
        self.back.connect("clicked", self.onBackButton)
        self.addToLeftBar(self.back, 1)

        self.insert = pageutils.ImageButton("insert-object")
        self.insert.set_tooltip_text("Insert into results")
        self.insert.set_sensitive(False)
        self.insert.connect("clicked", self.onInsertButton)
        self.addToLeftBar(self.insert, 1)

        self.addToBottomBar(Gtk.Label("Path:"), 2)
        self.pathLabel = Gtk.Label("<No selection done yet>")
        self.addToBottomBar(self.pathLabel, 2)

        self.addToBottomBar(Gtk.Label("; Type:"), 2)
        self.typeLabel = Gtk.Label("")
        self.addToBottomBar(self.typeLabel, 2)
        self.addToBottomBar(Gtk.Label("; Name:"), 2)
        self.nameLabel = Gtk.Label("")
        self.addToBottomBar(self.nameLabel, 2)

        self.currentInspection = None
        self.stack = []
        lookingGlassProxy.addStatusChangeCallback(self.onStatusChange)
示例#2
0
    def __init__(self, parent):
        self.view = InspectView(self)
        pageutils.WindowAndActionBars.__init__(self, self.view)
        self.parent = parent

        self.back = pageutils.ImageButton("go-previous-symbolic")
        self.back.set_tooltip_text("Go back")
        self.back.connect("clicked", self.on_back_button)
        self.add_to_left_bar(self.back, 1)

        self.insert = pageutils.ImageButton("insert-object-symbolic")
        self.insert.set_tooltip_text("Insert into results")
        self.insert.set_sensitive(False)
        self.insert.connect("clicked", self.on_insert_button)
        self.add_to_left_bar(self.insert, 1)

        self.add_to_bottom_bar(Gtk.Label("Path:"), 2)
        self.path_label = Gtk.Label("<No selection done yet>")
        self.add_to_bottom_bar(self.path_label, 2)

        self.add_to_bottom_bar(Gtk.Label("; Type:"), 2)
        self.type_label = Gtk.Label("")
        self.add_to_bottom_bar(self.type_label, 2)
        self.add_to_bottom_bar(Gtk.Label("; Name:"), 2)
        self.name_label = Gtk.Label("")
        self.add_to_bottom_bar(self.name_label, 2)

        self.current_inspection = None
        self.stack = []
        self.parent.lg_proxy.add_status_change_callback(self.on_status_change)
示例#3
0
    def __init__(self, parent):
        self.view = MemoryView()
        pageutils.WindowAndActionBars.__init__(self, self.view)
        self.parent = parent

        refresh = pageutils.ImageButton("view-refresh")
        refresh.set_tooltip_text("Refresh")
        refresh.connect("clicked", self.view.getUpdates)
        self.addToLeftBar(refresh, 1)
        fullGc = pageutils.ImageButton("user-trash-full")
        fullGc.set_tooltip_text("Full Garbage Collection")
        fullGc.connect('clicked', self.view.onFullGc)

        self.addToLeftBar(fullGc, 1)
        self.addToBottomBar(Gtk.Label("Time since last GC:"), 2)
        self.view.secondsLabel = Gtk.Label("")
        self.addToBottomBar(self.view.secondsLabel, 2)
示例#4
0
    def run(self):
        self.window = Gtk.Window(type=Gtk.WindowType.TOPLEVEL)
        self.window.set_title("Melange")
        self.window.set_icon_name("system-search")
        self.window.set_default_size(1000, 400)
        self.window.set_position(Gtk.WindowPosition.MOUSE)

        # I can't think of a way to reliably detect if the window
        # is active to determine if we need to present or hide
        # in show(). Since the window briefly loses focus during
        # shortcut press we'd be unable to detect it at that time.
        # Keeping the window on top ensures the window is never
        # obscured so we can just hide if visible.
        self.window.set_keep_above(True)

        self.window.connect("delete_event", self.on_delete)
        self.window.connect("key-press-event", self.on_key_press)
        self._minimized = False
        self.window.connect("window-state-event", self.on_window_state)

        num_rows = 3
        num_columns = 6
        table = Gtk.Table(n_rows=num_rows,
                          n_columns=num_columns,
                          homogeneous=False)
        table.set_margin_start(6)
        table.set_margin_end(6)
        table.set_margin_top(6)
        table.set_margin_bottom(6)
        self.window.add(table)

        self.notebook = Gtk.Notebook()
        self.notebook.set_tab_pos(Gtk.PositionType.BOTTOM)
        self.notebook.show()
        self.notebook.set_show_border(True)
        self.notebook.set_show_tabs(True)

        label = Gtk.Label(label="Melange")
        label.set_markup("<u>Melange - Cinnamon Debugger</u> ")
        label.show()
        self.notebook.set_action_widget(label, Gtk.PackType.END)

        self.pages = {}
        self.custom_pages = {}
        self.create_page("Results", "results")
        self.create_page("Inspect", "inspect")
        self.create_page("Windows", "windows")
        self.create_page("Extensions", "extensions")
        self.create_page("Log", "log")

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

        column = 0
        picker_button = pageutils.ImageButton("color-select-symbolic")
        picker_button.set_tooltip_text("Select an actor to inspect")
        picker_button.connect("clicked", self.on_picker_clicked)
        table.attach(picker_button, column, column + 1, 1, 2, 0, 0, 2)
        column += 1

        full_gc = pageutils.ImageButton("user-trash-full-symbolic")
        full_gc.set_tooltip_text("Invoke garbage collection")
        # ignore signal arg
        full_gc.connect('clicked', lambda source: self.lg_proxy.FullGc())
        table.attach(full_gc, column, column + 1, 1, 2, 0, 0, 2)
        column += 1

        self.command_line = CommandLine(self.lg_proxy.Eval)
        self.command_line.set_tooltip_text("Evaluate javascript")
        table.attach(self.command_line, column, column + 1, 1, 2,
                     Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 3,
                     2)
        column += 1

        self.status_label = Gtk.Label(label="Status")
        self.status_label.set_markup(
            " <span foreground='red'>[ Cinnamon is OFFLINE! ]</span> ")
        self.status_label.set_tooltip_text(
            "The connection to cinnamon is broken")
        self.status_label.set_no_show_all(True)
        table.attach(self.status_label, column, column + 1, 1, 2, 0, 0, 1)
        column += 1

        box = Gtk.HBox()
        settings = Gio.Settings(schema="org.cinnamon.desktop.keybindings")
        arr = settings.get_strv("looking-glass-keybinding")
        if len(arr) > 0:
            # only the first mapped keybinding
            [accel_key, mask] = Gtk.accelerator_parse(arr[0])
            if accel_key == 0 and mask == 0:
                # failed to parse, fallback to plain accel string
                label = Gtk.Label(label=arr[0])
            else:
                label = Gtk.Label(
                    label=Gtk.accelerator_get_label(accel_key, mask))
            label.set_tooltip_text("Toggle shortcut")
            box.pack_start(label, False, False, 3)

        action_button = self.create_action_button()
        box.pack_start(action_button, False, False, 3)

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

        self.activate_page("results")
        self.status_label.hide()
        self.window.set_focus(self.command_line)
    def run(self):
        self.window = Gtk.Window(Gtk.WindowType.TOPLEVEL)
        self.window.set_title("Melange")
        self.window.set_icon_name("system-search")
        self.window.set_default_size(1000, 400)
        self.window.set_position(Gtk.WindowPosition.MOUSE)

        # I can't think of a way to reliably detect if the window
        # is active to determine if we need to present or hide
        # in show(). Since the window briefly loses focus during
        # shortcut press we'd be unable to detect it at that time.
        # Keeping the window on top ensures the window is never
        # obscured so we can just hide if visible.
        self.window.set_keep_above(True)

        self.window.connect("delete_event", self.onDelete)
        self.window.connect("key-press-event", self.onKeyPress)
        self._minimized = False
        self.window.connect("window-state-event", self.onWindowState)

        numRows = 3
        numColumns = 6
        table = Gtk.Table(numRows, numColumns, False)
        table.set_margin_start(6)
        table.set_margin_end(6)
        table.set_margin_top(6)
        table.set_margin_bottom(6)
        self.window.add(table)

        self.notebook = Gtk.Notebook()
        self.notebook.set_tab_pos(Gtk.PositionType.BOTTOM)
        self.notebook.show()
        self.notebook.set_show_border(True)
        self.notebook.set_show_tabs(True)

        label = Gtk.Label("Melange")
        label.set_markup("<u>Melange - Cinnamon Debugger</u> ")
        label.show()
        self.notebook.set_action_widget(label, Gtk.PackType.END)

        self.pages = {}
        self.customPages = {}
        self.createPage("Results", "results")
        self.createPage("Inspect", "inspect")
        # self.createPage("Memory", "memory") - TODO: re-implement get_memory_info from cjs
        self.createPage("Windows", "windows")
        self.createPage("Extensions", "extensions")
        self.createPage("Log", "log")

        table.attach(self.notebook, 0, numColumns, 0, 1)

        column = 0
        pickerButton = pageutils.ImageButton("color-select-symbolic")
        pickerButton.connect("clicked", self.onPickerClicked)
        table.attach(pickerButton, column, column + 1, 1, 2, 0, 0, 2)
        column += 1

        table.attach(Gtk.Label("Exec:"), column, column + 1, 1, 2, 0, 0, 3)
        column += 1

        self.commandline = CommandLine()
        table.attach(self.commandline, column, column + 1, 1, 2,
                     Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, 0, 3,
                     2)
        column += 1

        self.statusLabel = Gtk.Label("Status")
        self.statusLabel.set_markup(
            " <span foreground='red'>[ Cinnamon is OFFLINE! ]</span> ")
        self.statusLabel.set_tooltip_text(
            "The connection to cinnamon is broken")
        self.statusLabel.set_no_show_all(True)
        table.attach(self.statusLabel, column, column + 1, 1, 2, 0, 0, 1)
        column += 1

        settings = Gio.Settings("org.cinnamon.desktop.keybindings")
        arr = settings.get_strv("looking-glass-keybinding")
        accel = ""
        done_one = False

        for element in arr:
            if done_one:
                accel += ", "

            accel += element.replace("<", "&lt;").replace(">", "&gt;")
            if not done_one:
                done_one = True

        keybinding = Gtk.Label()
        keybinding.set_markup('<i>Toggle shortcut: %s</i>' % accel)

        actionButton = self.createActionButton()

        box = Gtk.HBox()
        box.pack_start(keybinding, False, False, 3)
        box.pack_start(actionButton, False, False, 3)

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

        self.activatePage("results")
        self.statusLabel.hide()
        self.window.set_focus(self.commandline)