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

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

项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self, parent, window, account):
        # Read default values
        self.window = window
        self.parent = parent
        self.account = account
        # Create needed widgets
        self.code_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.revealer = Gtk.Revealer()
        self.checkbox = Gtk.CheckButton()
        self.application_name = Gtk.Label(xalign=0)
        self.code_label = Gtk.Label(xalign=0)
        self.timer_label = Gtk.Label(xalign=0)
        self.accel = Gtk.AccelGroup()
        self.window.add_accel_group(self.accel)
        self.accel.connect(Gdk.keyval_from_name('C'), Gdk.ModifierType.CONTROL_MASK, 0, self.copy_code)
        self.accel.connect(Gdk.keyval_from_name("Enter"), Gdk.ModifierType.META_MASK, 0, self.toggle_code)
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self, message="", undo_action=None, timeout=5):
        Gtk.Revealer.__init__(self)
        self.timeout = timeout
        self.set_transition_type(Gtk.RevealerTransitionType.SLIDE_DOWN)
        self.message = message
        self.undo_action = undo_action
        self.generate_components()
        GLib.timeout_add_seconds(1, self.update_timer)
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def generate(self):
        Gtk.Revealer.__init__(self)
        box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)

        self.search_entry.set_width_chars(28)
        self.search_entry.connect("search-changed", self.filter_applications)

        box.pack_start(self.search_entry, True, False, 12)
        box.props.margin = 6

        self.add(box)
        self.set_reveal_child(False)
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def __init__(self, button_name, tooltip, callback):
        Gtk.Revealer.__init__(self)
        self.button = Gtk.Button.new_from_icon_name(button_name, Gtk.IconSize.SMALL_TOOLBAR)
        self.button.set_margin_left(5)
        self.button.connect('clicked', callback)
        self.button.set_tooltip_text(tooltip)
        self.set_reveal_child(False)
        self.set_transition_type(Gtk.RevealerTransitionType.SLIDE_LEFT)
        self.add(self.button)
项目:poseidon    作者:sidus-dev    | 项目源码 | 文件源码
def revealize(widget):

    revealer = Gtk.Revealer()
    revealer.add(widget)
    return revealer
项目:hubangl    作者:soonum    | 项目源码 | 文件源码
def _build_revealer(self):
        """
        """
        revealer = Gtk.Revealer()
        revealer.set_transition_type(Gtk.RevealerTransitionType.SLIDE_LEFT)
        revealer.set_transition_duration(250)
        return revealer
项目:hubangl    作者:soonum    | 项目源码 | 文件源码
def _build_revealer(self,
                        transition=Gtk.RevealerTransitionType.SLIDE_DOWN):
        """
        """
        revealer = Gtk.Revealer()
        revealer.set_transition_type(transition)
        revealer.set_transition_duration(400)
        return revealer
项目:sc-controller    作者:kozec    | 项目源码 | 文件源码
def __init__(self, label, message_type=Gtk.MessageType.INFO,
                                                        infobar=None, *buttons):
        """
        ... where label can be Gtk.Widget or str and buttons are tuples
        of (Gtk.Button, response_id)
        """
        # Init
        Gtk.Revealer.__init__(self)
        self._infobar = infobar or Gtk.InfoBar()
        self._values = {}
        self._label = None
        # Icon
        if infobar is None:
            icon_name = "dialog-information"
            if message_type == Gtk.MessageType.ERROR:
                icon_name = "dialog-error"
            elif message_type == Gtk.MessageType.WARNING:
                icon_name = "dialog-warning"
            icon = Gtk.Image()
            icon.set_from_icon_name(icon_name, Gtk.IconSize.DIALOG)
            self._infobar.get_content_area().pack_start(icon, False, False, 1)
            # Label
            if isinstance(label, Gtk.Widget):
                self._infobar.get_content_area().pack_start(label, True, True, 0)
                self._label = label
            else:
                self._label = Gtk.Label()
                self._label.set_size_request(300, -1)
                self._label.set_markup(label)
                self._label.set_alignment(0, 0.5)
                self._label.set_line_wrap(True)
                self._infobar.get_content_area().add(self._label)
        # Buttons
        for button, response_id in buttons:
            self.add_button(button, response_id)
        # Signals
        self._infobar.connect("close", self._cb_close)
        self._infobar.connect("response", self._cb_response)
        # Settings
        self._infobar.set_message_type(message_type)
        if hasattr(self._infobar, "set_show_close_button"):
            # GTK >3.8
            self._infobar.set_show_close_button(True)
        else:
            self.add_button(Gtk.Button("X"), 0)
        self.set_reveal_child(False)
        # Packing
        self.add(self._infobar)
        self.show_all()