예제 #1
0
파일: notebook.py 프로젝트: 0x29a/guake
    def __init__(self, guake, *args, **kwargs):
        Gtk.Notebook.__init__(self, *args, **kwargs)
        self.guake = guake
        self.last_terminal_focused = None

        self.set_name("notebook-teminals")
        self.set_tab_pos(Gtk.PositionType.BOTTOM)
        self.set_property("show-tabs", True)
        self.set_property("enable-popup", False)
        self.set_property("scrollable", True)
        self.set_property("show-border", False)
        self.set_property("visible", True)
        self.set_property("has-focus", True)
        self.set_property("can-focus", True)
        self.set_property("is-focus", True)
        self.set_property("expand", True)

        GObject.signal_new('terminal-spawned', self, GObject.SIGNAL_RUN_LAST,
                           GObject.TYPE_NONE,
                           (GObject.TYPE_PYOBJECT, GObject.TYPE_INT))
        GObject.signal_new('page-deleted', self, GObject.SIGNAL_RUN_LAST,
                           GObject.TYPE_NONE, ())

        self.scroll_callback = NotebookScrollCallback(self)
        self.add_events(Gdk.EventMask.SCROLL_MASK)
        self.connect('scroll-event', self.scroll_callback.on_scroll)
예제 #2
0
    def __init__(self, *args, **kwargs):
        Gtk.Notebook.__init__(self, *args, **kwargs)
        self.last_terminal_focused = None

        self.set_name("notebook-teminals")
        self.set_tab_pos(Gtk.PositionType.BOTTOM)
        self.set_property("show-tabs", True)
        self.set_property("enable-popup", False)
        self.set_property("scrollable", True)
        self.set_property("show-border", False)
        self.set_property("visible", True)
        self.set_property("has-focus", True)
        self.set_property("can-focus", True)
        self.set_property("is-focus", True)
        self.set_property("expand", True)

        if GObject.signal_lookup('terminal-spawned', TerminalNotebook) == 0:
            GObject.signal_new('terminal-spawned', TerminalNotebook,
                               GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE,
                               (GObject.TYPE_PYOBJECT, GObject.TYPE_INT))
            GObject.signal_new('page-deleted', TerminalNotebook,
                               GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, ())

        self.scroll_callback = NotebookScrollCallback(self)
        self.add_events(Gdk.EventMask.SCROLL_MASK)
        self.connect('scroll-event', self.scroll_callback.on_scroll)
        self.connect("button-press-event", self.on_button_press, None)

        self.new_page_button = Gtk.Button(image=Gtk.Image.new_from_icon_name(
            "tab-new", Gtk.IconSize.MENU),
                                          visible=True)
        self.new_page_button.connect("clicked", self.on_new_tab)
        self.set_action_widget(self.new_page_button, Gtk.PackType.END)
예제 #3
0
    def __init__(self, *args, **kwargs):
        Gtk.Notebook.__init__(self, *args, **kwargs)
        self.last_terminal_focused = None

        self.set_name("notebook-teminals")
        self.set_tab_pos(Gtk.PositionType.BOTTOM)
        self.set_property("show-tabs", True)
        self.set_property("enable-popup", False)
        self.set_property("scrollable", True)
        self.set_property("show-border", False)
        self.set_property("visible", True)
        self.set_property("has-focus", True)
        self.set_property("can-focus", True)
        self.set_property("is-focus", True)
        self.set_property("expand", True)

        if GObject.signal_lookup("terminal-spawned", TerminalNotebook) == 0:
            GObject.signal_new(
                "terminal-spawned",
                TerminalNotebook,
                GObject.SIGNAL_RUN_LAST,
                GObject.TYPE_NONE,
                (GObject.TYPE_PYOBJECT, GObject.TYPE_INT),
            )
            GObject.signal_new(
                "page-deleted",
                TerminalNotebook,
                GObject.SIGNAL_RUN_LAST,
                GObject.TYPE_NONE,
                (),
            )

        self.scroll_callback = NotebookScrollCallback(self)
        self.add_events(Gdk.EventMask.SCROLL_MASK)
        self.connect("scroll-event", self.scroll_callback.on_scroll)
        self.notebook_on_button_press_id = self.connect(
            "button-press-event", self.on_button_press, None)

        # Action box
        self.new_page_button = Gtk.Button(
            image=Gtk.Image.new_from_icon_name("tab-new", Gtk.IconSize.MENU),
            visible=True,
        )
        self.new_page_button.connect("clicked", self.on_new_tab)

        self.hide_lose_focus_button = Gtk.Button(visible=True)
        self.hide_lose_focus_button.connect("clicked", self.on_hide_lose_focus)

        self.tab_selection_button = Gtk.Button(
            image=Gtk.Image.new_from_icon_name("pan-down-symbolic",
                                               Gtk.IconSize.MENU),
            visible=True,
        )
        self.popover = Gtk.Popover()
        self.popover_window = None
        self.tab_selection_button.connect("clicked", self.on_tab_selection)

        self.action_box = Gtk.Box(visible=True)
        self.action_box.pack_start(self.new_page_button, 0, 0, 0)
        self.action_box.pack_end(self.tab_selection_button, 0, 0, 0)
        self.set_action_widget(self.action_box, Gtk.PackType.END)
        self.set_action_widget(self.hide_lose_focus_button, Gtk.PackType.START)