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

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

项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, notebook_view, options=None):
        GObject.GObject.__init__(self)
        self.notebook_view = notebook_view
        self.search_entry = SearchEntry()
        self.search_entry.connect(
            "terms-changed", self.on_search_terms_changed)
        self.search_entry.connect(
            "key-press-event", self.on_search_entry_key_press_event)

        self.back_forward = BackForwardButton()
        self.back_forward.connect(
            "left-clicked", self.on_nav_back_clicked)
        self.back_forward.connect(
            "right-clicked", self.on_nav_forward_clicked)

        self.navhistory = NavigationHistory(self.back_forward, options)
        self.spinner = Gtk.Spinner()

        self.all_views = {}
        self.view_to_pane = {}
        self._globalise_instance()
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def _add_progress_ui(self):
        # create toolbar box
        self.header = Gtk.HBox()
        # add spinner
        self.spinner = Gtk.Spinner()
        self.header.pack_start(self.spinner, False, False, 6)
        # add a url to the toolbar
        self.url = Gtk.Label()
        self.url.set_ellipsize(Pango.EllipsizeMode.END)
        self.url.set_alignment(0.0, 0.5)
        self.url.set_text("")
        self.header.pack_start(self.url, True, True, 0)
        # frame around the box
        self.frame = Gtk.Frame()
        self.frame.set_border_width(3)
        self.frame.add(self.header)
        self.pack_start(self.frame, False, False, 6)
        # connect the webkit stuff
        self.webkit.connect("notify::uri", self._on_uri_changed)
        self.webkit.connect("notify::load-status",
            self._on_load_status_changed)
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, label_text=""):
        Gtk.Viewport.__init__(self)
        self.spinner = Gtk.Spinner()
        self.spinner.set_size_request(48, 48)

        # use a table for the spinner (otherwise the spinner is massive!)
        spinner_table = Gtk.Table(3, 3, False)
        self.spinner_label = Gtk.Label()
        self.spinner_label.set_markup('<big>%s</big>' % label_text)
        spinner_vbox = Gtk.VBox()
        spinner_vbox.pack_start(self.spinner, True, True, 0)
        spinner_vbox.pack_start(self.spinner_label, True, True, 10)
        spinner_table.attach(spinner_vbox, 1, 2, 1, 2,
            Gtk.AttachOptions.EXPAND, Gtk.AttachOptions.EXPAND)

        #~ self.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(1.0, 1.0, 1.0))
        self.add(spinner_table)
        self.set_shadow_type(Gtk.ShadowType.NONE)
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, notebook_view, options=None):
        GObject.GObject.__init__(self)
        self.notebook_view = notebook_view
        self.search_entry = SearchEntry()
        self.search_entry.connect(
            "terms-changed", self.on_search_terms_changed)
        self.search_entry.connect(
            "key-press-event", self.on_search_entry_key_press_event)

        self.back_forward = BackForwardButton()
        self.back_forward.connect(
            "left-clicked", self.on_nav_back_clicked)
        self.back_forward.connect(
            "right-clicked", self.on_nav_forward_clicked)

        self.navhistory = NavigationHistory(self.back_forward, options)
        self.spinner = Gtk.Spinner()

        self.all_views = {}
        self.view_to_pane = {}
        self._globalise_instance()
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def _add_progress_ui(self):
        # create toolbar box
        self.header = Gtk.HBox()
        # add spinner
        self.spinner = Gtk.Spinner()
        self.header.pack_start(self.spinner, False, False, 6)
        # add a url to the toolbar
        self.url = Gtk.Label()
        self.url.set_ellipsize(Pango.EllipsizeMode.END)
        self.url.set_alignment(0.0, 0.5)
        self.url.set_text("")
        self.header.pack_start(self.url, True, True, 0)
        # frame around the box
        self.frame = Gtk.Frame()
        self.frame.set_border_width(3)
        self.frame.add(self.header)
        self.pack_start(self.frame, False, False, 6)
        # connect the webkit stuff
        self.webkit.connect("notify::uri", self._on_uri_changed)
        self.webkit.connect("notify::load-status",
            self._on_load_status_changed)
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, label_text=""):
        Gtk.Viewport.__init__(self)
        self.spinner = Gtk.Spinner()
        self.spinner.set_size_request(48, 48)

        # use a table for the spinner (otherwise the spinner is massive!)
        spinner_table = Gtk.Table(3, 3, False)
        self.spinner_label = Gtk.Label()
        self.spinner_label.set_markup('<big>%s</big>' % label_text)
        spinner_vbox = Gtk.VBox()
        spinner_vbox.pack_start(self.spinner, True, True, 0)
        spinner_vbox.pack_start(self.spinner_label, True, True, 10)
        spinner_table.attach(spinner_vbox, 1, 2, 1, 2,
            Gtk.AttachOptions.EXPAND, Gtk.AttachOptions.EXPAND)

        #~ self.modify_bg(Gtk.StateType.NORMAL, Gdk.Color(1.0, 1.0, 1.0))
        self.add(spinner_table)
        self.set_shadow_type(Gtk.ShadowType.NONE)
项目:yt-browser    作者:juanfgs    | 项目源码 | 文件源码
def on_video_search1_activated(self,searchbox):
        """ Start searching when the user presses enter """

        # Show a spinner to the user while the results are being retrieved
        spinner = Gtk.Spinner()
        searching = Gtk.Label("Buscando...")

        # iterate through the list items and remove child items
        self.video_list.foreach(lambda child: self.video_list.remove(child))

        # Show the spinner and searching label
        self.video_list.add(spinner)
        self.video_list.add(searching)
        spinner.start()

        # Update the changes
        self.video_list.show_all()

        #we spawn a new thread to consume the api asynchronously
        def start_search():
            #for now we use a single backend

            self.search_response = self.backend.search(searchbox.get_text())
            for search_result in self.search_response.get("items",[]):
                if search_result["id"]["kind"] == "youtube#video":
                    GLib.idle_add(spinner.destroy)
                    GLib.idle_add(searching.destroy)
                    GLib.idle_add(self.update_list,search_result)
                    GLib.idle_add(self.video_list.show)


        self.download_thread = threading.Thread(target=start_search)
        self.download_thread.daemon = True
        self.download_thread.start()
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Grid.__init__(self)
        self.spinner = Gtk.Spinner(halign=Gtk.Align.CENTER, valign=Gtk.Align.CENTER, expand=True)
        self.spinner.start()
        self.add(self.spinner)
项目:apart-gtk    作者:alexheretic    | 项目源码 | 文件源码
def handle_message(self, msg: Dict):
        if msg['type'] in ['clone', 'restore']:
            self.last_message = msg
            self.progress_bar.set_fraction(msg['complete'])
            if not self.start:
                self.start = msg['start'].replace(tzinfo=msg['start'].tzinfo or timezone.utc)
                self.update()
            if msg.get('finish'):
                self.finish()
            else:
                self.rate.value_label.set_text(msg.get('rate') or 'Initializing')
                if not self.syncing and self.last_message.get('syncing'):
                    self.syncing = Gtk.Box()
                    label = Gtk.Label("Syncing")
                    label.get_style_context().add_class('info-key')
                    label.get_style_context().add_class('dim-label')
                    self.syncing.add(label)
                    self.syncing.add(Gtk.Spinner(active=True))
                    self.syncing.show_all()
                    self.stats.add(self.syncing)
                    self.estimated_completion.hide()
                    if not msg.get('rate'):
                        self.rate.hide()

        elif msg['type'] in ['clone-failed', 'restore-failed']:
            self.fail_message = msg
            self.finish()
项目:Icon-Requests    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self, desktop_file, notification):
        GObject.GObject.__init__(self)
        Gtk.ListBoxRow.__init__(self)
        self.desktop_file = desktop_file
        self.notification = notification
        self.spinner = Gtk.Spinner()
        self.generate()
项目:revolt    作者:aperezdc    | 项目源码 | 文件源码
def __make_headerbar(self):
        header = Gtk.HeaderBar()
        header.set_show_close_button(True)
        header.get_style_context().add_class("revolt-slim")
        spinner = Gtk.Spinner()
        header.pack_end(spinner)
        self.bind_property("network-busy", spinner, "active",
                           GObject.BindingFlags.DEFAULT)
        header.show_all()
        return header
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, datadir, uifile):
        SimpleGtkbuilderApp.__init__(
            self, os.path.join(datadir, "ui/gtk3", uifile), "software-center")
        # generic data
        self.token = None
        self.display_name = None
        self._login_successful = False
        self._whoami_token_reset_nr = 0
        #persistent config
        configfile = os.path.join(
            SOFTWARE_CENTER_CONFIG_DIR, "submit_reviews.cfg")
        self.config = get_config(configfile)
        # status spinner
        self.status_spinner = Gtk.Spinner()
        self.status_spinner.set_size_request(32, 32)
        self.login_spinner_vbox.pack_start(self.status_spinner, False, False,
            0)
        self.login_spinner_vbox.reorder_child(self.status_spinner, 0)
        self.status_spinner.show()
        #submit status spinner
        self.submit_spinner = Gtk.Spinner()
        self.submit_spinner.set_size_request(*Gtk.icon_size_lookup(
            Gtk.IconSize.SMALL_TOOLBAR)[:2])
        #submit error image
        self.submit_error_img = Gtk.Image()
        self.submit_error_img.set_from_stock(Gtk.STOCK_DIALOG_ERROR,
            Gtk.IconSize.SMALL_TOOLBAR)
        #submit success image
        self.submit_success_img = Gtk.Image()
        self.submit_success_img.set_from_stock(Gtk.STOCK_APPLY,
            Gtk.IconSize.SMALL_TOOLBAR)
        #submit warn image
        self.submit_warn_img = Gtk.Image()
        self.submit_warn_img.set_from_stock(Gtk.STOCK_DIALOG_INFO,
            Gtk.IconSize.SMALL_TOOLBAR)
        #label size to prevent image or spinner from resizing
        self.label_transmit_status.set_size_request(-1,
            Gtk.icon_size_lookup(Gtk.IconSize.SMALL_TOOLBAR)[1])
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def show_spinner_with_message(self, message):
        try:
            self.install_first_label.hide()
        except AttributeError:
            pass

        a = Gtk.Alignment.new(0.5, 0.5, 1.0, 1.0)
        hb = Gtk.HBox(spacing=12)
        hb.show()
        a.add(hb)
        a.show()

        spinner = Gtk.Spinner()
        spinner.start()
        spinner.show()

        hb.pack_start(spinner, False, False, 0)

        l = Gtk.Label()
        l.set_markup(message)
        l.set_use_markup(True)
        l.show()

        hb.pack_start(l, False, False, 0)

        self.vbox.pack_start(a, False, False, 0)
        self.vbox.show()
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def _build_ui(self):
        self.set_border_width(3)
        # the frame around the screenshot (placeholder)
        self.screenshot = Gtk.VBox()
        self.pack_start(self.screenshot, True, True, 0)

        self.spinner = Gtk.Spinner()
        self.spinner.set_size_request(*self.SPINNER_SIZE)
        self.spinner.set_valign(Gtk.Align.CENTER)
        self.spinner.set_halign(Gtk.Align.CENTER)
        self.screenshot.add(self.spinner)

        # clickable screenshot button
        self.button = ScreenshotButton()
        self.screenshot.pack_start(self.button, True, False, 0)

        # unavailable layout
        self.unavailable = Gtk.Label(label=_(self.NOT_AVAILABLE_STRING))
        self.unavailable.set_alignment(0.5, 0.5)
        # force the label state to INSENSITIVE so we get the nice
        # subtle etched in look
        self.unavailable.set_state(Gtk.StateType.INSENSITIVE)
        self.screenshot.add(self.unavailable)

        self.thumbnails = ThumbnailGallery(self)
        self.thumbnails.set_margin_top(5)
        self.thumbnails.set_halign(Gtk.Align.CENTER)
        self.pack_end(self.thumbnails, False, False, 0)
        self.thumbnails.connect(
            "thumb-selected", self.on_thumbnail_selected)
        self.button.connect("clicked", self.on_clicked)
        self.button.connect('enter-notify-event', self._on_enter)
        self.button.connect('leave-notify-event', self._on_leave)
        self.show_all()
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, datadir, uifile):
        SimpleGtkbuilderApp.__init__(
            self, os.path.join(datadir, "ui/gtk3", uifile), "software-center")
        # generic data
        self.token = None
        self.display_name = None
        self._login_successful = False
        self._whoami_token_reset_nr = 0
        #persistent config
        configfile = os.path.join(
            SOFTWARE_CENTER_CONFIG_DIR, "submit_reviews.cfg")
        self.config = get_config(configfile)
        # status spinner
        self.status_spinner = Gtk.Spinner()
        self.status_spinner.set_size_request(32, 32)
        self.login_spinner_vbox.pack_start(self.status_spinner, False, False,
            0)
        self.login_spinner_vbox.reorder_child(self.status_spinner, 0)
        self.status_spinner.show()
        #submit status spinner
        self.submit_spinner = Gtk.Spinner()
        self.submit_spinner.set_size_request(*Gtk.icon_size_lookup(
            Gtk.IconSize.SMALL_TOOLBAR)[:2])
        #submit error image
        self.submit_error_img = Gtk.Image()
        self.submit_error_img.set_from_stock(Gtk.STOCK_DIALOG_ERROR,
            Gtk.IconSize.SMALL_TOOLBAR)
        #submit success image
        self.submit_success_img = Gtk.Image()
        self.submit_success_img.set_from_stock(Gtk.STOCK_APPLY,
            Gtk.IconSize.SMALL_TOOLBAR)
        #submit warn image
        self.submit_warn_img = Gtk.Image()
        self.submit_warn_img.set_from_stock(Gtk.STOCK_DIALOG_INFO,
            Gtk.IconSize.SMALL_TOOLBAR)
        #label size to prevent image or spinner from resizing
        self.label_transmit_status.set_size_request(-1,
            Gtk.icon_size_lookup(Gtk.IconSize.SMALL_TOOLBAR)[1])
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def _build_ui(self):
        self.set_border_width(3)
        # the frame around the screenshot (placeholder)
        self.screenshot = Gtk.VBox()
        self.pack_start(self.screenshot, True, True, 0)

        self.spinner = Gtk.Spinner()
        self.spinner.set_size_request(*self.SPINNER_SIZE)
        self.spinner.set_valign(Gtk.Align.CENTER)
        self.spinner.set_halign(Gtk.Align.CENTER)
        self.screenshot.add(self.spinner)

        # clickable screenshot button
        self.button = ScreenshotButton()
        self.screenshot.pack_start(self.button, True, False, 0)

        # unavailable layout
        self.unavailable = Gtk.Label(label=_(self.NOT_AVAILABLE_STRING))
        self.unavailable.set_alignment(0.5, 0.5)
        # force the label state to INSENSITIVE so we get the nice
        # subtle etched in look
        self.unavailable.set_state(Gtk.StateType.INSENSITIVE)
        self.screenshot.add(self.unavailable)

        self.thumbnails = ThumbnailGallery(self)
        self.thumbnails.set_margin_top(5)
        self.thumbnails.set_halign(Gtk.Align.CENTER)
        self.pack_end(self.thumbnails, False, False, 0)
        self.thumbnails.connect(
            "thumb-selected", self.on_thumbnail_selected)
        self.button.connect("clicked", self.on_clicked)
        self.button.connect('enter-notify-event', self._on_enter)
        self.button.connect('leave-notify-event', self._on_leave)
        self.show_all()
项目:games_nebula    作者:yancharkin    | 项目源码 | 文件源码
def update_goglib(self):

        self.window_update_message = Gtk.Window(
            title = _("Changes in library"),
            type = Gtk.WindowType.POPUP,
            window_position = Gtk.WindowPosition.CENTER_ALWAYS,
            resizable = False,
            icon = app_icon,
        )

        self.box_update_message = Gtk.Box(
            orientation = Gtk.Orientation.HORIZONTAL
        )

        self.label_update_message = Gtk.Label(
            label = _("Updating GOG library..."),
            margin_right = 10,
            margin_top = 20,
            margin_bottom = 20,
        )

        self.spinner_update_message = Gtk.Spinner(
            active = True,
            visible = True,
            margin_left = 10,
            width_request = 48,
            height_request = 48
        )

        self.box_update_message.pack_start(self.spinner_update_message, True, True, 0)
        self.box_update_message.pack_start(self.label_update_message, True, True, 0)

        self.window_update_message.add(self.box_update_message)

        self.main_window.hide()
        if len(self.additional_windows_list) != 0:
            for window in self.additional_windows_list:
                window.hide()

        while Gtk.events_pending():
            Gtk.main_iteration()

        self.window_update_message.show_all()

        command = ['lgogdownloader', '--exclude', '1,2,4,8,16,32','--list-details']

        pid, stdin, stdout, stderr = GLib.spawn_async(command,
                flags=GLib.SpawnFlags.SEARCH_PATH|GLib.SpawnFlags.DO_NOT_REAP_CHILD,
                standard_output=True,
                standard_error=True)

        io = GLib.IOChannel(stdout)

        self.source_id_out = io.add_watch(GLib.IO_IN|GLib.IO_HUP,
                                 self.watch_process,
                                 'update_goglib',
                                 priority=GLib.PRIORITY_HIGH)
项目:bcloud    作者:wangYanJava    | 项目源码 | 文件源码
def __init__(self, parent, username, cookie, tokens, codeString, vcodetype):
        super().__init__(_('Verification..'), parent, Gtk.DialogFlags.MODAL)

        self.set_default_size(280, 130)
        self.set_border_width(10)
        self.username = username
        self.cookie = cookie
        self.tokens = tokens
        self.codeString = codeString
        self.vcodetype = vcodetype

        box = self.get_content_area()
        box.set_spacing(5)

        self.vcode_img = Gtk.Image()
        box.pack_start(self.vcode_img, True, True, 0)

        button_box = Gtk.Box(spacing=5)
        box.pack_start(button_box, True, True, 0)

        self.vcode_entry = Gtk.Entry()
        self.vcode_entry.connect('activate', self.check_entry)
        button_box.pack_start(self.vcode_entry, True, True, 0)

        if Config.GTK_GE_312:
            vcode_refresh = Widgets.IconButton('view-refresh-symbolic')
        else:
            vcode_refresh = Gtk.Button.new_from_stock(Gtk.STOCK_REFRESH)
        vcode_refresh.props.valign = Gtk.Align.CENTER
        vcode_refresh.connect('clicked', self.on_vcode_refresh_clicked)
        button_box.pack_start(vcode_refresh, False, False, 0)

        # show loading process
        self.loading_spin = Gtk.Spinner()
        self.loading_spin.props.valign = Gtk.Align.CENTER
        button_box.pack_start(self.loading_spin, False, False, 0)

        vcode_confirm = Gtk.Button.new_from_stock(Gtk.STOCK_OK)
        vcode_confirm.connect('clicked', self.on_vcode_confirm_clicked)
        vcode_confirm.props.valign = Gtk.Align.END
        box.pack_start(vcode_confirm, False, False, 10)

        box.show_all()
        self.loading_spin.hide()

        gutil.async_call(auth.get_signin_vcode, cookie, codeString,
                         callback=self.update_img)
项目:dell-recovery    作者:dell    | 项目源码 | 文件源码
def __init__(self, recovery, version, media, target, overwrite):

        #Run the normal init first
        #This sets up lots of common variables as well as translation domain
        DellRecoveryToolGTK.__init__(self, recovery)

        #init the UI and translate widgets/connect signals
        self.widgets = Gtk.Builder()
        self.widgets.add_from_file(os.path.join(UIDIR,
                                   'recovery_media_creator.ui'))

        #insert pages in reverse order
        wizard = self.widgets.get_object('wizard')
        titles = {'conf_page': _("Confirm Selections"),
                 'media_type_page': _("Media Type")
                }
        for page in ['conf_page', 'media_type_page']:
            wizard.insert_page(self.widgets.get_object(page), 0)
            wizard.set_page_title(wizard.get_nth_page(0), titles[page])

        Gtk.Window.set_default_icon_from_file(os.path.join(SVGDIR, 'dell-dvd.svg'))
        translate_widgets(self.widgets)
        self.widgets.connect_signals(self)

        #setup spinner
        self.spinner = Gtk.Spinner()
        self.widgets.get_object('spinner_box').add(self.spinner)
        self.widgets.get_object('spinner_box').show_all()

        self._dbus_iface = None
        self.timeout = 0
        self.image = ''

        (self.dvd_burn_cmd, self.usb_burn_cmd) = find_burners()

        try:
            self.release = fetch_output(['lsb_release', '-r', '-s']).strip('\n')
            self.distributor = fetch_output(['lsb_release', '-i', '-s']).strip('\n').lower()
        except RuntimeError:
            self.release = '0.00'
            self.distributor = 'unknown'

        self.arch = ''

        for item in ['server', 'enterprise']:
            if item in self.distributor:
                self.distributor = self.distributor.split(item)[0]

        #set any command line arguments for this frontend
        self.widgets.get_object('version').set_text(version)
        self.media = media
        self.path = target
        self.overwrite = overwrite
项目:dell-recovery    作者:dell    | 项目源码 | 文件源码
def __init__(self, controller, *args, **kwargs):
        self.plugin_widgets = None

        oem = 'UBIQUITY_OEM_USER_CONFIG' in os.environ

        self.efi = False
        with misc.raised_privileges():
            self.genuine = magic.check_vendor()

        if not oem:
            gi.require_version('Gtk', '3.0')
            from gi.repository import Gtk
            builder = Gtk.Builder()
            builder.add_from_file('/usr/share/ubiquity/gtk/stepDellBootstrap.ui')
            builder.connect_signals(self)
            self.controller = controller
            self.controller.add_builder(builder)
            self.plugin_widgets = builder.get_object('stepDellBootstrap')
            self.automated_recovery = builder.get_object('automated_recovery')
            self.automated_recovery_box = builder.get_object('automated_recovery_box')
            self.automated_combobox = builder.get_object('hard_drive_combobox')
            self.interactive_recovery = builder.get_object('interactive_recovery')
            self.interactive_recovery_box = builder.get_object('interactive_recovery_box')
            self.hdd_recovery = builder.get_object('hdd_recovery')
            self.hdd_recovery_box = builder.get_object('hdd_recovery_box')
            self.hidden_radio = builder.get_object('hidden_radio')
            self.info_box = builder.get_object('info_box')
            self.info_spinner = Gtk.Spinner()
            builder.get_object('info_spinner_box').add(self.info_spinner)
            self.restart_box = builder.get_object('restart_box')
            self.err_dialog = builder.get_object('err_dialog')
            self.log_dialog = builder.get_object('log_dialog')

            #advanced page widgets
            icon = builder.get_object('dell_image')
            icon.set_tooltip_markup("Dell Recovery Advanced Options")
            self.advanced_page = builder.get_object('advanced_window')
            self.version_detail = builder.get_object('version_detail')
            self.mount_detail = builder.get_object('mountpoint_detail')
            self.memory_detail = builder.get_object('memory_detail')

            if not (self.genuine and 'UBIQUITY_AUTOMATIC' in os.environ):
                builder.get_object('error_box').show()
            PluginUI.__init__(self, controller, *args, **kwargs)
项目:draobpilc    作者:awamper    | 项目源码 | 文件源码
def __init__(self):
        super().__init__()

        self.set_name('SearchBox')
        self.set_valign(Gtk.Align.START)
        self.set_halign(Gtk.Align.FILL)
        self.set_vexpand(False)
        self.set_hexpand(True)
        self.set_orientation(Gtk.Orientation.HORIZONTAL)

        self.entry = Gtk.Entry()
        self.entry.set_hexpand(True)
        self.entry.set_halign(Gtk.Align.FILL)
        self.entry.set_valign(Gtk.Align.START)
        self.entry.set_placeholder_text(ENTRY_PLACE_HOLDER)
        self.entry.connect(
            'icon-release',
            lambda *a, **kw: self.reset()
        )
        self.entry.set_tooltip_text(
            _('You can add "-{flags}" at the end to search for types.') +
            _('\n\tt - text\n\tl - links\n\tf - files\n\ti - images') +
            _('\n\nUse #{number} to filter by index number')
        )

        self.spinner = Gtk.Spinner()
        self.spinner.set_halign(Gtk.Align.END)
        self.spinner.set_valign(Gtk.Align.CENTER)
        self.spinner.set_margin_right(10)

        overlay = Gtk.Overlay()
        overlay.add(self.entry)
        overlay.add_overlay(self.spinner)

        self.buffer.connect('notify::text', self._on_text_changed)

        self._timeout_id = 0
        self.flags = []

        self.add(overlay)
        self.show_all()
        self._update_icon()
项目:x-mario-center    作者:fossasia    | 项目源码 | 文件源码
def __init__(self, review_data=None, app_version=None,
                 logged_in_person=None, useful_votes=None,
                 first_for_version=True):
        GObject.GObject.__init__(self)
        self.set_spacing(StockEms.SMALL)

        self.version_label = Gtk.Label()
        self.version_label.set_alignment(0, 0.5)

        self.header = Gtk.HBox()
        self.header.set_spacing(StockEms.MEDIUM)
        self.body = Gtk.VBox()
        self.footer = Gtk.HBox()

        self.useful = None
        self.yes_like = None
        self.no_like = None
        self.status_box = Gtk.HBox()
        self.delete_status_box = Gtk.HBox()
        self.delete_error_img = Gtk.Image()
        self.delete_error_img.set_from_stock(
                                Gtk.STOCK_DIALOG_ERROR,
                                Gtk.IconSize.SMALL_TOOLBAR)
        self.submit_error_img = Gtk.Image()
        self.submit_error_img.set_from_stock(
                                Gtk.STOCK_DIALOG_ERROR,
                                Gtk.IconSize.SMALL_TOOLBAR)
        self.submit_status_spinner = Gtk.Spinner()
        self.submit_status_spinner.set_size_request(12, 12)
        self.delete_status_spinner = Gtk.Spinner()
        self.delete_status_spinner.set_size_request(12, 12)
        self.acknowledge_error = Gtk.Button()
        label = Gtk.Label()
        label.set_markup('<small>%s</small>' % _("OK"))
        self.acknowledge_error.add(label)
        self.delete_acknowledge_error = Gtk.Button()
        delete_label = Gtk.Label()
        delete_label.set_markup('<small>%s</small>' % _("OK"))
        self.delete_acknowledge_error.add(delete_label)
        self.usefulness_error = False
        self.delete_error = False
        self.modify_error = False
        if first_for_version:
            self.pack_start(self.version_label, False, False, 0)
        self.pack_start(self.header, False, False, 0)
        self.pack_start(self.body, False, False, 0)
        self.pack_start(self.footer, False, False, StockEms.SMALL)

        self.logged_in_person = logged_in_person
        self.person = None
        self.id = None
        self.useful_votes = useful_votes

        self._allocation = None

        if review_data:
            self._build(review_data,
                        app_version,
                        logged_in_person,
                        useful_votes)