def __init__(self): """ Init toolbar """ Gtk.HeaderBar.__init__(self) self.set_title("Eolie") self.__toolbar_actions = ToolbarActions() self.__toolbar_actions.show() self.__toolbar_title = ToolbarTitle() self.__toolbar_title.show() self.__toolbar_end = ToolbarEnd() self.__toolbar_end.show() self.pack_start(self.__toolbar_actions) self.set_custom_title(self.__toolbar_title) self.pack_end(self.__toolbar_end)
def __init__(self, window): """ Init toolbar @param window as Window """ Gtk.EventBox.__init__(self) self.__headerbar = Gtk.HeaderBar() self.__headerbar.show() self.__headerbar.set_title("Eolie") self.__toolbar_actions = ToolbarActions(window) self.__toolbar_actions.show() self.__toolbar_title = ToolbarTitle(window) self.__toolbar_title.show() self.__toolbar_end = ToolbarEnd(window) self.__toolbar_end.show() self.__headerbar.pack_start(self.__toolbar_actions) self.__headerbar.set_custom_title(self.__toolbar_title) self.__headerbar.pack_end(self.__toolbar_end) self.connect("button-press-event", self.__on_button_press) self.add(self.__headerbar)
class Toolbar(Gtk.HeaderBar): """ Eolie toolbar """ def __init__(self): """ Init toolbar """ Gtk.HeaderBar.__init__(self) self.set_title("Eolie") self.__toolbar_actions = ToolbarActions() self.__toolbar_actions.show() self.__toolbar_title = ToolbarTitle() self.__toolbar_title.show() self.__toolbar_end = ToolbarEnd() self.__toolbar_end.show() self.pack_start(self.__toolbar_actions) self.set_custom_title(self.__toolbar_title) self.pack_end(self.__toolbar_end) @property def title(self): """ Toolbar title @return ToolbarTitle """ return self.__toolbar_title @property def actions(self): """ Toolbar actions @return ToolbarActions """ return self.__toolbar_actions
class Toolbar(Gtk.EventBox): """ Eolie toolbar """ def __init__(self, window): """ Init toolbar @param window as Window """ Gtk.EventBox.__init__(self) self.__headerbar = Gtk.HeaderBar() self.__headerbar.show() self.__headerbar.set_title("Eolie") self.__toolbar_actions = ToolbarActions(window) self.__toolbar_actions.show() self.__toolbar_title = ToolbarTitle(window) self.__toolbar_title.show() self.__toolbar_end = ToolbarEnd(window) self.__toolbar_end.show() self.__headerbar.pack_start(self.__toolbar_actions) self.__headerbar.set_custom_title(self.__toolbar_title) self.__headerbar.pack_end(self.__toolbar_end) self.connect("button-press-event", self.__on_button_press) self.add(self.__headerbar) def set_show_close_button(self, show): """ Forward to headerbar @param show as bool """ self.__headerbar.set_show_close_button(show) @property def title(self): """ Toolbar title @return ToolbarTitle """ return self.__toolbar_title @property def end(self): """ Toolbar end @return ToolbarEnd """ return self.__toolbar_end @property def actions(self): """ Toolbar actions @return ToolbarActions """ return self.__toolbar_actions ####################### # PRIVATE # ####################### def __on_button_press(self, widget, event): """ Hide popover if visible @param widget as Gtk.Widget @param event as Gdk.Event """ self.__toolbar_title.hide_popover()