Python gi.repository.Gtk.StackSwitcher() Examples

The following are 4 code examples of gi.repository.Gtk.StackSwitcher(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gi.repository.Gtk , or try the search function .
Example #1
Source File: combinedview.py    From addons-source with GNU General Public License v2.0 6 votes vote down vote up
def build_widget(self):
        """
        Build the widget that contains the view, see
        :class:`~gui.views.pageview.PageView
        """
        container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        container.set_border_width(12)

        self.header = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.header.show()

        self.stack = Gtk.Stack()
        ss = Gtk.StackSwitcher()
        ss.set_stack(self.stack)
        self.stack.show()
        ss.show()

        container.set_spacing(6)
        container.pack_start(self.header, False, False, 0)
        container.pack_start(Gtk.Separator(), False, False, 0)
        container.pack_start(ss, False, False, 0)
        container.pack_start(self.stack, True, True, 0)
        container.show_all()

        return container 
Example #2
Source File: settings.py    From Authenticator with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self):
        Gtk.Window.__init__(self)
        self.set_transient_for(Window.get_default())
        self.set_position(Gtk.WindowPosition.CENTER_ON_PARENT)
        self.set_size_request(600, 600)
        self.set_title(_("Settings"))
        self.resize(600, 600)

        self.stack_switcher = Gtk.StackSwitcher()
        self.stack = Gtk.Stack()

        self._build_widgets() 
Example #3
Source File: main.py    From hazzy with GNU General Public License v2.0 5 votes vote down vote up
def on_screen_stack_children_changed(self, stack, child):
        if len(self.screen_stack.get_children()) > 1:
            # Display the StackSwitcher
            self.header_bar.set_custom_title(self.stack_switcher)
        else:
            # Display the Title / Subtitle
            self.header_bar.set_custom_title(None) 
Example #4
Source File: preferences.py    From drawing with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, is_beta, wants_csd, **kwargs):
		super().__init__(**kwargs)
		if wants_csd:
			header_bar = Gtk.HeaderBar(visible=True, title=_("Preferences"), \
			                                             show_close_button=True)
			self.set_titlebar(header_bar)
			stack_switcher = Gtk.StackSwitcher(visible=True, stack=self.stack, \
			                                            halign=Gtk.Align.CENTER)
			header_bar.set_custom_title(stack_switcher)
			self.set_default_size(480, 500)
		else:
			stack_sidebar = Gtk.StackSidebar(visible=True, stack=self.stack)
			stack_sidebar.set_size_request(140, -1)
			self.content_area.pack_start(stack_sidebar, False, False, 0)
			self.set_default_size(600, 400) # Not high enough but the golden
			# ratio is more important than usability

		self.page_builder_images()
		self.page_builder_tools()
		self.page_builder_advanced(is_beta)

	# Each page_* attribute is a GtkGrid. The page_builder_* methods declare
	# their grid to be the currently filled one, and reset the counter.
	# Then, the page_builder_* methods will call the add_* methods, who will
	# build accurate widgets to be packed on the grid by the attach_* methods.

	############################################################################