Python gi.repository.Gtk 模块,StackSwitcher() 实例源码

我们从Python开源项目中,提取了以下6个代码示例,用于说明如何使用gi.repository.Gtk.StackSwitcher()

项目:Vulnerabilities-spider    作者:muhammad-bouabid    | 项目源码 | 文件源码
def __init__(self, parent):
      Gtk.Dialog.__init__(self, "Something", parent,
          Gtk.DialogFlags.MODAL, buttons=(
          Gtk.STOCK_NEW, Gtk.ResponseType.OK,
          Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))

      self.set_default_size(400, 600)

      box = self.get_content_area()

      label = Gtk.Label("Insert text you want to search for:")
      box.add(label)

#        self.entry = Gtk.Entry()
#        box.add(self.entry)

      self.main_area = Gtk.Stack()
      self.main_area.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)

      self.main_area.set_transition_duration(1000)

      self.entry = Gtk.Entry()
      self.main_area.add_titled(self.entry, "entry_name", "Entry Url")

      self.labelS = Gtk.Label()
      self.label_txt = """<big><i>you have choice to runn the scan directly or after setup the scanning process you want to follow on your target</i></big>"""
      self.labelS.set_markup(self.label_txt)
      self.labelS.set_line_wrap(True)
      self.main_area.add_titled(self.labelS, "label_name", "How Scan will Start")

      self.our_stackSwitcher = Gtk.StackSwitcher()
      self.our_stackSwitcher.set_stack(self.main_area)

      box.add(self.our_stackSwitcher)
      box.add(self.main_area)

      self.show_all()


#~~~~~~~~~~~~ History Dialog ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
项目:poseidon    作者:sidus-dev    | 项目源码 | 文件源码
def fix_dialog(self, dialog, text):

        if text: dialog.set_markup(text)
        dialog.set_modal(True)

        headerbar = dialog.get_header_bar()

        if headerbar:

            # This is a temporary fix for the duplicate buttons bug
            # in 'Gtk.AboutDialog' when 'use_header_bar' property is set.

            if type(dialog) == Gtk.AboutDialog:
                for i in headerbar:
                    if type(i) != Gtk.StackSwitcher: i.destroy()

        box = dialog.get_content_area()
        box.set_border_width(10)
项目:fpi    作者:solus-cold-storage    | 项目源码 | 文件源码
def headerbar(self):
        header = Gtk.HeaderBar()
        header.set_show_close_button(True)

        self.stack_switcher = Gtk.StackSwitcher()
        header.set_custom_title(self.stack_switcher)
        self.stack_switcher.set_stack(self.stack)
        return header
项目:draobpilc    作者:awamper    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()

        self.set_name('ProcessorBox')
        self.set_valign(Gtk.Align.CENTER)
        self.set_halign(Gtk.Align.CENTER)
        self.set_hexpand(True)
        self.set_vexpand(True)
        self.set_orientation(Gtk.Orientation.VERTICAL)

        self._stack = Gtk.Stack()
        self._stack.set_transition_type(Gtk.StackTransitionType.CROSSFADE)
        self._stack.set_transition_duration(300)
        self._stack.props.margin = ItemsProcessors.MARGIN

        self._switcher = Gtk.StackSwitcher()
        self._switcher.set_no_show_all(True)
        self._switcher.set_stack(self._stack)
        self._switcher.set_halign(Gtk.Align.CENTER)
        self._switcher.props.margin = ItemsProcessors.MARGIN
        self._switcher.show()

        self.add(self._switcher)
        self.add(self._stack)
        self.show_all()

        self._items = []
        self._timeout_id = 0
        self._show_switcher = True
项目:draobpilc    作者:awamper    | 项目源码 | 文件源码
def _on_button_clicked(self, button):
        dialog = Gtk.Dialog()
        dialog.set_transient_for(self)

        gpaste_settings = GPaste.SettingsUiWidget()

        for child in gpaste_settings.get_children():
            if isinstance(child, Gtk.StackSwitcher):
                toplevel = dialog.get_toplevel()
                if not toplevel: continue

                gpaste_settings.remove(child)

                header_bar = Gtk.HeaderBar()
                header_bar.set_show_close_button(True)
                header_bar.set_title(None)
                header_bar.set_subtitle(None)
                header_bar.set_custom_title(child)

                toplevel.set_titlebar(header_bar)

            if isinstance(child, Gtk.Stack):
                child.set_transition_type(
                    Gtk.StackTransitionType.SLIDE_LEFT_RIGHT
                )
                child.set_transition_duration(self._transition_duration)

        content_area = dialog.get_content_area()
        content_area.add(gpaste_settings)

        dialog.show_all()
        dialog.run()
        dialog.destroy()
项目:cavalcade    作者:worron    | 项目源码 | 文件源码
def __init__(self, mainapp):
        super().__init__("settings.glade", ("window", "mainbox"))
        self.gui["window"].set_keep_above(True)

        # build stack
        stack = Gtk.Stack()
        stack.set_transition_type(Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
        stack.set_transition_duration(500)

        # add visual page
        self.visualpage = VisualPage(mainapp, self.gui["window"])
        stack.add_titled(self.visualpage.gui["mainbox"], "visset", "Visual")

        # add cava page
        self.cavapage = CavaPage(mainapp)
        stack.add_titled(self.cavapage.gui["mainbox"], "cavaset", "CAVA")

        # add player page
        if mainapp.is_player_enabled:
            self.playerpage = PlayerPage(mainapp)
            stack.add_titled(self.playerpage.gui["mainbox"], "playset", "Player")

        # setup stack
        stack_switcher = Gtk.StackSwitcher(halign=Gtk.Align.CENTER)
        stack_switcher.set_stack(stack)

        self.gui["mainbox"].pack_start(stack_switcher, False, True, 0)
        self.gui["mainbox"].pack_start(stack, True, True, 0)

        # signals
        self.gui["window"].connect("delete-event", self.hide)
        self.visualpage.gui["hide_button"].connect("clicked", self.hide)
        self.visualpage.gui["exit_button"].connect("clicked", mainapp.close)