Python gi.repository.Gtk.STOCK_MEDIA_PLAY Examples
The following are 4
code examples of gi.repository.Gtk.STOCK_MEDIA_PLAY().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
gi.repository.Gtk
, or try the search function
.
Example #1
Source File: modules.py From gpt with GNU General Public License v3.0 | 5 votes |
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()
Example #2
Source File: gnomecast.py From gnomecast with GNU General Public License v3.0 | 5 votes |
def update_media_button_states(self): mc = self.cast.media_controller if self.cast else None self.play_button.set_sensitive(bool(self.transcoder and self.cast and mc.status.player_state in ('BUFFERING','PLAYING','PAUSED','IDLE','UNKNOWN') and self.fn)) self.volume_button.set_sensitive(bool(self.cast)) self.stop_button.set_sensitive(bool(self.transcoder and self.cast and mc.status.player_state in ('BUFFERING','PLAYING','PAUSED'))) self.rewind_button.set_sensitive(bool(self.transcoder and self.cast and mc.status.player_state in ('BUFFERING','PLAYING','PAUSED'))) self.forward_button.set_sensitive(bool(self.transcoder and self.cast and mc.status.player_state in ('BUFFERING','PLAYING','PAUSED'))) self.play_button.set_image(Gtk.Image(stock=Gtk.STOCK_MEDIA_PAUSE) if self.cast and mc.status.player_state=='PLAYING' else Gtk.Image(stock=Gtk.STOCK_MEDIA_PLAY)) if self.transcoder and self.duration: self.scrubber_adj.set_upper(self.duration) self.scrubber.set_sensitive(True) else: self.scrubber.set_sensitive(False) self.update_button_visible()
Example #3
Source File: seek.py From gstreamer-python-player with MIT License | 5 votes |
def __init__(self): #constructing the window and setting up its size, and the destroy signal super(SeekingExample, self).__init__() self.set_size_request(600, 50) self.set_title("Simple audio player") self.connect("destroy", self.on_destroy) Gst.init() #setting up the playbin elements self.playbin = Gst.ElementFactory.make("playbin", "playbin") self.playbin.set_property("uri", "file:///tmp/lea.mp3") #setting up a simple Horizontal box layout, with a window size of 500 self.box = Gtk.Box(orientation = Gtk.Orientation.HORIZONTAL) self.add(self.box) #setting up controls with their signals and callbacks self.play_button = Gtk.Button.new_from_stock(Gtk.STOCK_MEDIA_PLAY) self.play_button.connect("clicked", self.on_play) self.pause_button = Gtk.Button.new_from_stock(Gtk.STOCK_MEDIA_PAUSE) self.pause_button.connect("clicked", self.on_pause) #creating a slider and calculating its range self.slider = Gtk.Scale.new_with_range(Gtk.Orientation.HORIZONTAL, 0, 100, 0.5) self.slider_handler_id = self.slider.connect("value-changed", self.on_slider_seek) #adding the controls to the layout self.box.pack_start(self.play_button, False, False, 2) self.box.pack_start(self.pause_button, False, False, 2) self.box.pack_start(self.slider, True, True, 2) #showing the GUI elements self.show_all()
Example #4
Source File: main_window.py From rednotebook with GNU General Public License v2.0 | 5 votes |
def on_tray_popup_menu(self, _status_icon, button, activate_time): """ Called when the user right-clicks the tray icon """ tray_menu_xml = """ <ui> <popup action="TrayMenu"> <menuitem action="Show"/> <menuitem action="Quit"/> </popup> </ui>""" # Create an ActionGroup actiongroup = Gtk.ActionGroup("TrayActionGroup") # Create actions actiongroup.add_actions( [ ( "Show", Gtk.STOCK_MEDIA_PLAY, _("Show RedNotebook"), None, None, lambda widget: self.show(), ), ("Quit", Gtk.STOCK_QUIT, None, None, None, self.on_quit_activate), ] ) # Add the actiongroup to the uimanager self.uimanager.insert_action_group(actiongroup, 0) # Add a UI description self.uimanager.add_ui_from_string(tray_menu_xml) # Create a Menu menu = self.uimanager.get_widget("/TrayMenu") menu.popup(None, None, None, None, button, activate_time)