Python gi.repository.Gtk 模块,STOCK_GO_FORWARD 实例源码

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

项目:bokken    作者:thestr4ng3r    | 项目源码 | 文件源码
def create_seek_buttons(self):
        self.hbox = Gtk.HBox(False, 1)

        self.back = Gtk.Button()
        self.back_img = Gtk.Image()
        self.back_img.set_from_stock(Gtk.STOCK_GO_BACK, Gtk.IconSize.MENU)
        self.back.set_image(self.back_img)
        self.back.set_relief(Gtk.ReliefStyle.NONE)
        self.back.connect('clicked', self.do_seek, 'b')

        self.forward = Gtk.Button()
        self.forward_img = Gtk.Image()
        self.forward_img.set_from_stock(Gtk.STOCK_GO_FORWARD, Gtk.IconSize.MENU)
        self.forward.set_image(self.forward_img)
        self.forward.set_relief(Gtk.ReliefStyle.NONE)
        self.forward.connect('clicked', self.do_seek, 'f')

        self.seek = Gtk.Entry()
        self.seek.set_max_length(30)
        self.seek.set_icon_from_stock(1, Gtk.STOCK_JUMP_TO)
        self.seek.set_activates_default(True)
        self.seek.connect("activate", self.goto)
        self.seek.connect("icon-press", self.goto)
        self.seek.set_icon_tooltip_text(1, 'Go')

        self.hbox.pack_start(self.back, False, False, 0)
        self.hbox.pack_start(self.forward, False, False, 0)
        self.hbox.pack_start(self.seek, True, True, 0)

        return self.hbox
项目:king-phisher-plugins    作者:securestate    | 项目源码 | 文件源码
def _sync_view(self, sftp_tasks=None):
        # This value was set to True to prevent the treeview from freezing.
        if not self.queue.mutex.acquire(blocking=True):
            return
        if not self._tv_lock.acquire(blocking=False):
            self.queue.mutex.release()
            return
        sftp_tasks = (sftp_tasks or self.queue.queue)
        for task in sftp_tasks:
            if not isinstance(task, tasks.TransferTask):
                continue
            if task.treerowref is None:
                parent_treeiter = None
                if task.parent:
                    parent_treerowref = task.parent.treerowref
                    if parent_treerowref is None:
                        continue
                    parent_treepath = parent_treerowref.get_path()
                    if parent_treepath is None:
                        continue
                    parent_treeiter = self._tv_model.get_iter(parent_treepath)
                direction = Gtk.STOCK_GO_FORWARD if task.transfer_direction == 'upload' else Gtk.STOCK_GO_BACK
                image = self.treeview_transfer.render_icon(direction, Gtk.IconSize.BUTTON, None) if parent_treeiter is None else Gtk.Image()
                treeiter = self._tv_model.append(parent_treeiter, [
                    image,
                    task.local_path,
                    task.remote_path,
                    task.state,
                    0,
                    None if (task.size is None or isinstance(task, tasks.TransferDirectoryTask)) else boltons.strutils.bytes2human(task.size),
                    task
                ])
                task.treerowref = Gtk.TreeRowReference.new(self._tv_model, self._tv_model.get_path(treeiter))
            elif task.treerowref.valid():
                row = self._tv_model[task.treerowref.get_path()]  # pylint: disable=unsubscriptable-object
                row[3] = task.state
                row[4] = task.progress
        self.queue.mutex.release()
        return False