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

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

项目:sbrick-controller    作者:wintersandroid    | 项目源码 | 文件源码
def __init__(self, sbrick_configuration, sbrick_communications_store):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=10, margin=5)
        self.set_homogeneous(False)
        self.sbrick_configuration = sbrick_configuration
        self.sbrick_communications_store = sbrick_communications_store
        self.sbrick_communications_store.add_observer(self)

        label = Gtk.Label(sbrick_configuration["name"])
        label.set_width_chars(20)
        label.set_justify(Gtk.Justification.LEFT)
        self.pack_start(label, False, True, 0)

        self.handler_ids = []
        self.sequence_player_handler_id = None

        self.button_play = Gtk.Button.new()
        self.button_play.set_image(Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON))
        self.button_play.connect("clicked", self.on_play_clicked)
        self.pack_start(self.button_play, False, True, 0)

        self.checkPause = Gtk.CheckButton("Pause in Play All")
        self.checkPause.connect("toggled", self.on_pause_changed)
        self.pack_start(self.checkPause, False, True, 0)
        self.sbrick_communications = None
        self.sequence_player = None
项目:sbrick-controller    作者:wintersandroid    | 项目源码 | 文件源码
def __init__(self, configuration, sbrick_communications_store):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL, spacing=3, margin=0)
        self.set_homogeneous(False)
        self.configuration = configuration
        self.sbrick_communications_store = sbrick_communications_store

        self.tool_bar = Gtk.Toolbar()
        self.pack_start(self.tool_bar, False, True, 0)

        self.action_play_all = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON),
                                                  "Play All")
        self.action_play_all.connect("clicked", self.on_play_all_clicked)
        self.tool_bar.insert(self.action_play_all, -1)
        self.action_stop_all = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_STOP, Gtk.IconSize.BUTTON),
                                                  "Stop All")
        self.action_stop_all.connect("clicked", self.on_stop_all_clicked)
        self.tool_bar.insert(self.action_stop_all, -1)
        self.content = Gtk.ListBox()

        self.scrollTree = Gtk.ScrolledWindow()
        self.scrollTree.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.scrollTree.add_with_viewport(self.content)
        self.scrollTree.set_min_content_height(100)
        self.pack_start(self.scrollTree, True, True, 0)

        self.sequence_count = 0
        if self.configuration is not None:
            for sbrick in self.configuration:
                stepbox = SequencePlayerBox(sbrick, sbrick_communications_store)
                stepbox.connect("sequence_finished", self.on_sequence_finished)
                self.content.add(stepbox)
                self.sequence_count = self.sequence_count + 1
        self.playing = False
        self.playing_sequence = None
        self.playing_index = -1
项目:cavalcade    作者:worron    | 项目源码 | 文件源码
def on_playstate_update(self, player, value):
        self.gui["playbutton"].set_visible(False)  # Fix this
        self.gui["playbutton"].set_icon_name(Gtk.STOCK_MEDIA_PAUSE if value else Gtk.STOCK_MEDIA_PLAY)
        self.gui["playbutton"].set_visible(True)
项目:gpt    作者:encarsia    | 项目源码 | 文件源码
def on_playpause_togglebutton_toggled(self,widget):
        if ply.playpause_button.get_active():
            img = Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PLAY,Gtk.IconSize.BUTTON)
            widget.set_property("image",img)
            ply.pause()
        else:
            img = Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PAUSE,Gtk.IconSize.BUTTON)
            widget.set_property("image",img)
            ply.play()
项目:hubangl    作者:soonum    | 项目源码 | 文件源码
def __init__(self):
        self.placeholder_image = Gtk.Image.new_from_icon_name(
            Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.DIALOG)
        self.new_feed_button = Gtk.Button("New Feed")

        self.new_feed_vbox = Gtk.Box(Gtk.Orientation.VERTICAL)
        self.new_feed_vbox.set_halign(Gtk.Align.CENTER)
        self.new_feed_vbox.set_valign(Gtk.Align.CENTER)
        _pack_widgets(self.new_feed_vbox,
                      self.placeholder_image,
                      self.new_feed_button)
项目:sbrick-controller    作者:wintersandroid    | 项目源码 | 文件源码
def __init__(self, configuration):
        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
        self.set_homogeneous(False)
        self.sequence_player = None

        self.tool_bar = Gtk.Toolbar()
        self.pack_start(self.tool_bar, False, True, 0)

        self.tool_add = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_ADD, Gtk.IconSize.BUTTON), "Add")
        self.tool_add.connect("clicked", self.on_add_clicked)
        self.tool_bar.insert(self.tool_add, -1)

        self.tool_delete = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_DELETE, Gtk.IconSize.BUTTON), "Delete")
        self.tool_delete.connect("clicked", self.on_delete_clicked)
        self.tool_bar.insert(self.tool_delete, -1)

        self.tool_bar.insert(Gtk.SeparatorToolItem.new(), -1)

        self.tool_up = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_GO_UP, Gtk.IconSize.BUTTON), "Add")
        self.tool_up.connect("clicked", self.on_up_clicked)
        self.tool_bar.insert(self.tool_up, -1)

        self.tool_down = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_GO_DOWN, Gtk.IconSize.BUTTON), "Add")
        self.tool_down.connect("clicked", self.on_down_clicked)
        self.tool_bar.insert(self.tool_down, -1)

        self.tool_bar.insert(Gtk.SeparatorToolItem.new(), -1)

        self.tool_play = Gtk.ToolButton.new(Gtk.Image.new_from_stock(Gtk.STOCK_MEDIA_PLAY, Gtk.IconSize.BUTTON), "Run")
        self.tool_play.connect("clicked", self.on_run_clicked)
        self.tool_bar.insert(self.tool_play, -1)
        self.enable_tools(True, False)

        self.content = Gtk.ListBox()

        self.scrollTree = Gtk.ScrolledWindow()
        self.scrollTree.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.scrollTree.add_with_viewport(self.content)
        self.scrollTree.set_min_content_height(100)
        self.pack_start(self.scrollTree, True, True, 0)

        self.sbrickConfiguration = configuration
        self.sbrick = None
        self.sequenceSteps = []

        if "sequence" in self.sbrickConfiguration:
            for step in self.sbrickConfiguration["sequence"]:
                stepbox = SequenceStepBox(step, self.sbrickConfiguration["functions"])
                self.content.add(stepbox)
                self.sequenceSteps.append(stepbox)
        else:
            self.sbrickConfiguration["sequence"] = []