class ItemRecord(gtk.Frame): #__gtype_name__ = 'UbuntuRadioItemRecord' def __init__(self): gtk.Frame.__init__(self) self.player_estado = "None" self.player = False self.nombre = "" self.set_label(" Grabando . . . ") self.label_info = gtk.Label("Grabación Detenida") eventbox = gtk.EventBox() eventbox.set_border_width(5) eventbox.modify_bg(0, gdk.color_parse("#8ae234")) vbox = gtk.VBox() hbox = gtk.HBox() self.stop_button = gtk.Button() self.image_button = gtk.Image() self.image_button.set_from_stock(gtk.STOCK_MEDIA_RECORD, gtk.ICON_SIZE_BUTTON) self.stop_button.set_image(self.image_button) self.label = gtk.Label("Nada para Grabar") hbox.pack_start(self.label, False, True, 0) hbox.pack_end(self.stop_button, False, True, 0) vbox.pack_start(hbox, False, True, 3) vbox.pack_start(self.label_info, False, True, 0) eventbox.add(vbox) self.add(eventbox) self.show_all() self.stop_button.connect("clicked", self.stop) def __update_info(self, player, info): self.label_info.set_text(info) def __endfile(self, player): self.image_button.set_from_stock(gtk.STOCK_MEDIA_RECORD, gtk.ICON_SIZE_BUTTON) self.label_info.set_text("Grabación Detenida") #gobject.idle_add(self.get_toplevel().queue_draw) def __update_estado(self, player, valor): self.player_estado = valor if valor == "playing": self.image_button.set_from_stock(gtk.STOCK_MEDIA_STOP, gtk.ICON_SIZE_BUTTON) else: self.image_button.set_from_stock(gtk.STOCK_MEDIA_RECORD, gtk.ICON_SIZE_BUTTON) self.label_info.set_text("Grabación Detenida") #gobject.idle_add(self.get_toplevel().queue_draw) def load(self, valor, formato): if self.player: self.player.stop() self.nombre, uri = valor self.label.set_text(self.nombre) from Record import MyPlayBin self.player = MyPlayBin(uri, formato) self.player.connect("estado", self.__update_estado) self.player.connect("endfile", self.__endfile) self.player.connect("update", self.__update_info) self.player.play(self.nombre) def stop(self, widget=False): if not self.player: return if self.player_estado == "playing": self.player.stop() else: self.player.play(self.nombre)
class ItemRecord(gtk.Frame): #__gtype_name__ = 'UbuntuRadioItemRecord' def __init__(self): gtk.Frame.__init__(self) self.player_estado = "None" self.player = False self.nombre = "" self.set_label(" Grabando . . . ") self.label_info = gtk.Label("Grabación Detenida") eventbox = gtk.EventBox() eventbox.set_border_width(5) eventbox.modify_bg(0, gdk.color_parse("#8ae234")) vbox = gtk.VBox() hbox = gtk.HBox() self.stop_button = gtk.Button() self.image_button = gtk.Image() self.image_button.set_from_stock( gtk.STOCK_MEDIA_RECORD, gtk.ICON_SIZE_BUTTON) self.stop_button.set_image(self.image_button) self.label = gtk.Label("Nada para Grabar") hbox.pack_start(self.label, False, True, 0) hbox.pack_end(self.stop_button, False, True, 0) vbox.pack_start(hbox, False, True, 3) vbox.pack_start(self.label_info, False, True, 0) eventbox.add(vbox) self.add(eventbox) self.show_all() self.stop_button.connect( "clicked", self.stop) def __update_info(self, player, info): self.label_info.set_text(info) def __endfile(self, player): self.image_button.set_from_stock( gtk.STOCK_MEDIA_RECORD, gtk.ICON_SIZE_BUTTON) self.label_info.set_text("Grabación Detenida") #gobject.idle_add(self.get_toplevel().queue_draw) def __update_estado(self, player, valor): self.player_estado = valor if valor == "playing": self.image_button.set_from_stock( gtk.STOCK_MEDIA_STOP, gtk.ICON_SIZE_BUTTON) else: self.image_button.set_from_stock( gtk.STOCK_MEDIA_RECORD, gtk.ICON_SIZE_BUTTON) self.label_info.set_text("Grabación Detenida") #gobject.idle_add(self.get_toplevel().queue_draw) def load(self, valor, formato): if self.player: self.player.stop() self.nombre, uri = valor self.label.set_text(self.nombre) from Record import MyPlayBin self.player = MyPlayBin(uri, formato) self.player.connect("estado", self.__update_estado) self.player.connect("endfile", self.__endfile) self.player.connect("update", self.__update_info) self.player.play(self.nombre) def stop(self, widget=False): if not self.player: return if self.player_estado == "playing": self.player.stop() else: self.player.play(self.nombre)
class ItemPlayer(gtk.Frame): #__gtype_name__ = 'UbuntuRadioItemPlayer' def __init__(self): gtk.Frame.__init__(self) self.player_estado = "None" self.set_label(" Reproduciendo . . . ") eventbox = gtk.EventBox() eventbox.set_border_width(5) eventbox.modify_bg(0, gdk.color_parse("#8ae234")) hbox = gtk.HBox() self.control_volumen = Volumen() self.stop_button = gtk.Button() self.image_button = gtk.Image() self.image_button.set_from_stock(gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_BUTTON) self.stop_button.set_image(self.image_button) self.label = gtk.Label("Nada para Reproducir") hbox.pack_start(self.label, False, True, 0) hbox.pack_end(self.stop_button, False, True, 0) hbox.pack_end(self.control_volumen, False, True, 0) eventbox.add(hbox) self.add(eventbox) self.control_volumen.set_value(0.10) self.show_all() self.control_volumen.connect("volumen", self.__set_volume) self.stop_button.connect("clicked", self.stop) from Player import MyPlayBin self.player = MyPlayBin() self.player.connect("estado", self.__update_estado) self.player.connect("endfile", self.__endfile) def __endfile(self, player): self.image_button.set_from_stock(gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_BUTTON) #gobject.idle_add(self.get_toplevel().queue_draw) def __update_estado(self, player, valor): self.player_estado = valor if valor == "playing": self.image_button.set_from_stock(gtk.STOCK_MEDIA_STOP, gtk.ICON_SIZE_BUTTON) else: self.image_button.set_from_stock(gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_BUTTON) #gobject.idle_add(self.get_toplevel().queue_draw) def __set_volume(self, widget, valor): self.player.set_volumen(valor) def load(self, valor): nombre, uri = valor self.label.set_text(nombre) self.player.load(uri) def stop(self, widget=False): if self.player_estado == "playing": self.player.stop() else: self.player.play()
class ItemPlayer(gtk.Frame): #__gtype_name__ = 'UbuntuRadioItemPlayer' def __init__(self): gtk.Frame.__init__(self) self.player_estado = "None" self.set_label(" Reproduciendo . . . ") eventbox = gtk.EventBox() eventbox.set_border_width(5) eventbox.modify_bg(0, gdk.color_parse("#8ae234")) hbox = gtk.HBox() self.control_volumen = Volumen() self.stop_button = gtk.Button() self.image_button = gtk.Image() self.image_button.set_from_stock( gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_BUTTON) self.stop_button.set_image(self.image_button) self.label = gtk.Label("Nada para Reproducir") hbox.pack_start(self.label, False, True, 0) hbox.pack_end(self.stop_button, False, True, 0) hbox.pack_end(self.control_volumen, False, True, 0) eventbox.add(hbox) self.add(eventbox) self.control_volumen.set_value(0.10) self.show_all() self.control_volumen.connect( "volumen", self.__set_volume) self.stop_button.connect( "clicked", self.stop) from Player import MyPlayBin self.player = MyPlayBin() self.player.connect("estado", self.__update_estado) self.player.connect("endfile", self.__endfile) def __endfile(self, player): self.image_button.set_from_stock( gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_BUTTON) #gobject.idle_add(self.get_toplevel().queue_draw) def __update_estado(self, player, valor): self.player_estado = valor if valor == "playing": self.image_button.set_from_stock( gtk.STOCK_MEDIA_STOP, gtk.ICON_SIZE_BUTTON) else: self.image_button.set_from_stock( gtk.STOCK_MEDIA_PLAY, gtk.ICON_SIZE_BUTTON) #gobject.idle_add(self.get_toplevel().queue_draw) def __set_volume(self, widget, valor): self.player.set_volumen(valor) def load(self, valor): nombre, uri = valor self.label.set_text(nombre) self.player.load(uri) def stop(self, widget=False): if self.player_estado == "playing": self.player.stop() else: self.player.play()