Пример #1
0
    def __init__(self):

        Gtk.Paned.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)

        # Izquierda
        self.lista = Lista()

        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.lista)
        scroll.set_size_request(250, -1)

        self.pack1(scroll, resize=False, shrink=False)

        # Derecha
        self.textview = TextView()

        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.textview)

        self.pack2(scroll, resize=True, shrink=True)

        self.show_all()

        self.__llenar_lista()

        self.lista.connect('nueva-seleccion', self.__get_element)
Пример #2
0
class JAMediaGstreamer(Gtk.Paned):

    __gtype_name__ = 'JAMediaGstreamerPyGiHack'

    def __init__(self):

        Gtk.Paned.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)

        # Izquierda
        self.lista = Lista()
        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.lista)
        scroll.set_size_request(250, -1)
        self.pack1(scroll, resize=False, shrink=False)

        # Derecha
        self.textview = TextView()
        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.textview)
        self.pack2(scroll, resize=True, shrink=True)

        self.lista.connect('nueva-seleccion', self.__get_element)
        self.connect("realize", self.__llenar_lista)
        self.show_all()

    def __llenar_lista(self, widget):
        try:
            import gi
            gi.require_version('Gst', '1.0')
            from gi.repository import Gst
            Gst.init([])
            registry = Gst.Registry.get()
            plugins = registry.get_plugin_list()
        except:
            return

        _iter = self.lista.get_model().get_iter_first()
        for elemento in plugins:
            iteractual = self.lista.get_model().append(
                _iter, [elemento.get_name(), elemento.get_description()])
            features = registry.get_feature_list_by_plugin(elemento.get_name())
            if len(features) > 1:
                for feature in features:
                    self.lista.get_model().append(iteractual,
                        [feature.get_name(), elemento.get_description()])

    def __get_element(self, widget, path):
        self.textview.get_buffer().set_text(get_inspect(path))

    def buscar_mas(self, accion, texto):
        self.lista.buscar_mas(accion, texto)

    def zoom(self, zoom):
        self.textview.zoom(zoom)

    def get_estructura(self):
        return get_estructura(self.lista, self.lista.get_model())
Пример #3
0
    def __init__(self):

        Gtk.Window.__init__(self)
        GObject.threads_init()

        from Globales import get_estilo

        self.config = get_estilo()

        self.set_title("Ubuntu Radio")

        self.set_icon_from_file(
            os.path.join(os.path.dirname(__file__),
            "Iconos", "ubuntu_radio.svg"))

        self.set_size_request(200, 400)
        self.set_border_width(5)
        self.set_decorated(False)
        self.set_resizable(False)
        self.set_opacity(self.config["opacidad"])

        vbox = Gtk.VBox()

        menu = MenuBar()
        self.itemplayer = ItemPlayer()
        self.itemrecord = ItemRecord()
        self.lista = Lista()
        self.win_scroll = Gtk.ScrolledWindow()
        self.win_scroll.set_policy(
            Gtk.PolicyType.AUTOMATIC,
            Gtk.PolicyType.AUTOMATIC)
        self.win_scroll.add(self.lista)

        vbox.pack_start(menu, False, False, 3)
        vbox.pack_start(self.itemplayer, False, False, 3)
        vbox.pack_start(self.itemrecord, False, False, 3)
        vbox.pack_start(self.win_scroll, True, True, 0)

        self.add(vbox)

        self.connect("realize", self.__load_lista)

        self.show_all()

        menu.connect("lista", self.__show_lista)
        menu.connect("actualizar", self.__actualizar_lista)
        menu.connect("configurar", self.__configurar)
        menu.connect("salir", self.__exit)

        self.lista.connect(
            "button-press-event",
            self.__get_menu_lista)

        self.connect("delete-event", self.__exit)
Пример #4
0
    def __init__(self):

        gtk.Window.__init__(self)

        from Globales import get_estilo

        self.config = get_estilo()

        self.set_title("Ubuntu Radio")

        self.set_icon_from_file(
            os.path.join(os.path.dirname(__file__),
            "Iconos", "ubuntu_radio.svg"))

        self.set_size_request(-1, 400)
        self.set_border_width(5)
        #self.set_decorated(False)
        self.set_resizable(False)
        self.set_opacity(self.config["opacidad"])
        self.modify_bg(0, gtk.gdk.color_parse("#8ae234"))

        vbox = gtk.VBox()

        menu = MenuBar()
        self.itemplayer = ItemPlayer()
        self.itemrecord = ItemRecord()
        self.lista = Lista()
        self.win_scroll = gtk.ScrolledWindow()
        self.win_scroll.set_policy(
            gtk.POLICY_AUTOMATIC,
            gtk.POLICY_AUTOMATIC)
        self.win_scroll.add(self.lista)

        vbox.pack_start(menu, False, False, 3)
        vbox.pack_start(self.itemplayer, False, False, 3)
        vbox.pack_start(self.itemrecord, False, False, 3)
        vbox.pack_start(self.win_scroll, True, True, 0)

        self.add(vbox)

        self.connect("realize", self.__load_lista)

        self.show_all()

        menu.connect("lista", self.__show_lista)
        menu.connect("actualizar", self.__actualizar_lista)
        menu.connect("configurar", self.__configurar)
        menu.connect("salir", self.__exit)

        self.lista.connect(
            "button-press-event",
            self.__get_menu_lista)

        self.connect("delete-event", self.__exit)
Пример #5
0
    def __init__(self):

        super(Ventana, self).__init__()

        self.set_title("JAMedia Converter")

        self.set_icon_from_file(
            os.path.join(BASEPATH,
            "Iconos", "JAMediaConvert.svg"))

        self.set_resizable(True)
        self.set_size_request(640, 480)
        self.set_border_width(2)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.modify_bg(0, get_colors("window"))

        vbox = Gtk.VBox()
        base_panel = Gtk.HPaned()
        base_panel.modify_bg(0, get_colors("window"))

        self.toolbar = Toolbar()
        self.lista = Lista()
        self.widgettareas = WidgetTareas()

        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(
            Gtk.PolicyType.AUTOMATIC,
            Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.lista)

        base_panel.pack1(scroll, resize=False, shrink=False)
        base_panel.pack2(self.widgettareas, resize=False, shrink=False)

        vbox.pack_start(
            self.toolbar, False, False, 0)
        vbox.pack_start(
            base_panel, True, True, 0)

        self.add(vbox)

        self.show_all()
        self.realize()

        self.toolbar.connect(
            'salir', self.__salir)
        self.toolbar.connect(
            'load', self.__load_files)
        self.lista.connect(
            "nueva-seleccion", self.__selecction_file)
        self.widgettareas.connect(
            'copy_tarea', self.__copy_tarea)

        self.connect("delete-event", self.__salir)
Пример #6
0
class JAMediaGstreamer(Gtk.Paned):

    __gtype_name__ = 'JAMediaGstreamerPyGiHack'

    def __init__(self):

        Gtk.Paned.__init__(self, orientation=Gtk.Orientation.HORIZONTAL)

        # Izquierda
        self.lista = Lista()
        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.lista)
        scroll.set_size_request(250, -1)
        self.pack1(scroll, resize=False, shrink=False)

        # Derecha
        self.textview = TextView()
        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.textview)
        self.pack2(scroll, resize=True, shrink=True)

        self.show_all()
        self.__llenar_lista()
        self.lista.connect('nueva-seleccion', self.__get_element)

    def __llenar_lista(self):
        try:
            import gi
            gi.require_version('Gst', '1.0')
            from gi.repository import Gst

            Gst.init([])
            registry = Gst.Registry.get()
            plugins = registry.get_plugin_list()

        except:
            return

        _iter = self.lista.get_model().get_iter_first()

        for elemento in plugins:
            iteractual = self.lista.get_model().append(
                _iter, [elemento.get_name(),
                        elemento.get_description()])

            features = registry.get_feature_list_by_plugin(elemento.get_name())
            if len(features) > 1:
                for feature in features:
                    self.lista.get_model().append(
                        iteractual,
                        [feature.get_name(),
                         elemento.get_description()])

    def __get_element(self, widget, path):
        self.textview.get_buffer().set_text(get_inspect(path))
Пример #7
0
    def __init__(self):

        Gtk.Paned.__init__(self, orientation = Gtk.Orientation.HORIZONTAL)

        # Izquierda
        self.lista = Lista()
        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.lista)
        scroll.set_size_request(250, -1)
        self.pack1(scroll, resize = False, shrink = False)

        # Derecha
        self.textview = TextView()
        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.textview)
        self.pack2(scroll, resize = True, shrink = True)

        self.show_all()
        self.__llenar_lista()
        self.lista.connect('nueva-seleccion', self.__get_element)
Пример #8
0
class UbuntuRadio(gtk.Window):

    #__gtype_name__ = 'UbuntuRadio'

    def __init__(self):

        gtk.Window.__init__(self)

        from Globales import get_estilo

        self.config = get_estilo()

        self.set_title("Ubuntu Radio")

        self.set_icon_from_file(
            os.path.join(os.path.dirname(__file__), "Iconos",
                         "ubuntu_radio.svg"))

        self.set_size_request(-1, 400)
        self.set_border_width(5)
        #self.set_decorated(False)
        self.set_resizable(False)
        self.set_opacity(self.config["opacidad"])
        self.modify_bg(0, gtk.gdk.color_parse("#8ae234"))

        vbox = gtk.VBox()

        menu = MenuBar()
        self.itemplayer = ItemPlayer()
        self.itemrecord = ItemRecord()
        self.lista = Lista()
        self.win_scroll = gtk.ScrolledWindow()
        self.win_scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
        self.win_scroll.add(self.lista)

        vbox.pack_start(menu, False, False, 3)
        vbox.pack_start(self.itemplayer, False, False, 3)
        vbox.pack_start(self.itemrecord, False, False, 3)
        vbox.pack_start(self.win_scroll, True, True, 0)

        self.add(vbox)

        self.connect("realize", self.__load_lista)

        self.show_all()

        menu.connect("lista", self.__show_lista)
        menu.connect("actualizar", self.__actualizar_lista)
        menu.connect("configurar", self.__configurar)
        menu.connect("salir", self.__exit)

        self.lista.connect("button-press-event", self.__get_menu_lista)

        self.connect("delete-event", self.__exit)

    def __get_menu_lista(self, widget, event):
        """
        Despliega menu contextual de elemento en lista.
        """

        boton = event.button
        pos = (event.x, event.y)
        tiempo = event.time
        path, columna, xdefondo, ydefondo = (None, None, None, None)

        try:
            path_pos = widget.get_path_at_pos(int(pos[0]), int(pos[1]))
            path, columna, xdefondo, ydefondo = path_pos

        except:
            return

        from Widgets import MenuList

        menu = MenuList(widget, boton, pos, tiempo, path, widget.get_model())

        menu.connect('accion', self.__set_accion)
        gtk.Menu.popup(menu, None, None, None, boton, tiempo)

    def __set_accion(self, widget, lista, accion, _iter):
        """
        Responde a las selecciones en el menu contextual
        de elemento en lista.
        """

        name = lista.get_model().get_value(_iter, 1)
        uri = lista.get_model().get_value(_iter, 2)

        if accion == "play":
            self.__load_play((name, uri))

        if accion == "Grabar":
            self.__grabar((name, uri))

        #elif accion == "Copiar":
        #    print accion

        #elif accion == "Mover":
        #    print accion

        elif accion == "Quitar":
            items = self.inplay.get_children()

            for item in items:
                if name == item.name and uri == item.uri:
                    item.stop()
                    self.inplay.remove(item)
                    item.destroy()
                    break

            lista.get_model().remove(_iter)

        elif accion == "Borrar":
            items = self.inplay.get_children()

            for item in items:
                if name == item.name and uri == item.uri:
                    item.stop()
                    self.inplay.remove(item)
                    item.destroy()
                    break

            lista.get_model().remove(_iter)

            from Globales import eliminar_streaming

            eliminar_streaming(uri, "JAM-Radio")
            print "Streaming Eliminado:", name, uri

    def __configurar(self, widget):

        from Widgets import DialogoConfig

        dialog = DialogoConfig(parent=self.get_toplevel(), config=self.config)

        dialog.run()
        dialog.destroy()

    def __actualizar_lista(self, widget):
        """
        Actualiza la Lista de Streamings desde la Web
        """

        #FIXME: Agregar control de conexión para evitar errores.
        from Widgets import DialogoDescarga

        dialog = DialogoDescarga(parent=self.get_toplevel())
        dialog.run()

        self.__load_lista()

    def __load_lista(self, widget=None):
        """
        Carga La Lista de Radios.
        """

        from Globales import set_listas_default
        from Globales import get_data_directory
        from Globales import get_streamings

        set_listas_default()

        archivo = os.path.join(get_data_directory(), 'JAMediaRadio.JAMedia')

        items = get_streamings(archivo)
        self.lista.limpiar()
        self.lista.agregar_items(items)

    def __load_play(self, valor):
        """
        Reproduce un streaming.
        """

        self.itemplayer.stop()
        self.itemplayer.load(valor)

    def __grabar(self, valor):
        """
        Grabar desde un Streaming.
        """

        self.itemrecord.stop()
        self.itemrecord.load(valor, self.config["formato"])

    def __show_lista(self, widget):
        """
        Muestra u Oculta la Lista de Radios.
        """

        val = self.win_scroll.get_visible()

        if val:
            self.win_scroll.hide()
            a, b, c, d = self.win_scroll.get_allocation()
            x, y, w, h = self.get_allocation()
            self.set_size_request(-1, h - d)

        else:
            self.win_scroll.show()
            self.set_size_request(-1, 400)

    def __exit(self, widget=None, event=None):

        try:
            self.itemplayer.stop()
            self.itemrecord.stop()

        except:
            pass

        import sys
        sys.exit(0)
Пример #9
0
class UbuntuRadio(gtk.Window):

    #__gtype_name__ = 'UbuntuRadio'

    def __init__(self):

        gtk.Window.__init__(self)

        from Globales import get_estilo

        self.config = get_estilo()

        self.set_title("Ubuntu Radio")

        self.set_icon_from_file(
            os.path.join(os.path.dirname(__file__),
            "Iconos", "ubuntu_radio.svg"))

        self.set_size_request(-1, 400)
        self.set_border_width(5)
        #self.set_decorated(False)
        self.set_resizable(False)
        self.set_opacity(self.config["opacidad"])
        self.modify_bg(0, gtk.gdk.color_parse("#8ae234"))

        vbox = gtk.VBox()

        menu = MenuBar()
        self.itemplayer = ItemPlayer()
        self.itemrecord = ItemRecord()
        self.lista = Lista()
        self.win_scroll = gtk.ScrolledWindow()
        self.win_scroll.set_policy(
            gtk.POLICY_AUTOMATIC,
            gtk.POLICY_AUTOMATIC)
        self.win_scroll.add(self.lista)

        vbox.pack_start(menu, False, False, 3)
        vbox.pack_start(self.itemplayer, False, False, 3)
        vbox.pack_start(self.itemrecord, False, False, 3)
        vbox.pack_start(self.win_scroll, True, True, 0)

        self.add(vbox)

        self.connect("realize", self.__load_lista)

        self.show_all()

        menu.connect("lista", self.__show_lista)
        menu.connect("actualizar", self.__actualizar_lista)
        menu.connect("configurar", self.__configurar)
        menu.connect("salir", self.__exit)

        self.lista.connect(
            "button-press-event",
            self.__get_menu_lista)

        self.connect("delete-event", self.__exit)

    def __get_menu_lista(self, widget, event):
        """
        Despliega menu contextual de elemento en lista.
        """

        boton = event.button
        pos = (event.x, event.y)
        tiempo = event.time
        path, columna, xdefondo, ydefondo = (None, None, None, None)

        try:
            path_pos = widget.get_path_at_pos(int(pos[0]), int(pos[1]))
            path, columna, xdefondo, ydefondo = path_pos

        except:
            return

        from Widgets import MenuList

        menu = MenuList(widget, boton, pos,
            tiempo, path, widget.get_model())

        menu.connect('accion', self.__set_accion)
        gtk.Menu.popup(menu, None, None, None, boton, tiempo)

    def __set_accion(self, widget, lista, accion, _iter):
        """
        Responde a las selecciones en el menu contextual
        de elemento en lista.
        """

        name = lista.get_model().get_value(_iter, 1)
        uri = lista.get_model().get_value(_iter, 2)

        if accion == "play":
            self.__load_play((name, uri))

        if accion == "Grabar":
            self.__grabar((name, uri))

        #elif accion == "Copiar":
        #    print accion

        #elif accion == "Mover":
        #    print accion

        elif accion == "Quitar":
            items = self.inplay.get_children()

            for item in items:
                if name == item.name and uri == item.uri:
                    item.stop()
                    self.inplay.remove(item)
                    item.destroy()
                    break

            lista.get_model().remove(_iter)

        elif accion == "Borrar":
            items = self.inplay.get_children()

            for item in items:
                if name == item.name and uri == item.uri:
                    item.stop()
                    self.inplay.remove(item)
                    item.destroy()
                    break

            lista.get_model().remove(_iter)

            from Globales import eliminar_streaming

            eliminar_streaming(uri, "JAM-Radio")
            print "Streaming Eliminado:", name, uri

    def __configurar(self, widget):

        from Widgets import DialogoConfig

        dialog = DialogoConfig(
            parent=self.get_toplevel(),
            config=self.config)

        dialog.run()
        dialog.destroy()

    def __actualizar_lista(self, widget):
        """
        Actualiza la Lista de Streamings desde la Web
        """

        #FIXME: Agregar control de conexión para evitar errores.
        from Widgets import DialogoDescarga

        dialog = DialogoDescarga(parent=self.get_toplevel())
        dialog.run()

        self.__load_lista()

    def __load_lista(self, widget=None):
        """
        Carga La Lista de Radios.
        """

        from Globales import set_listas_default
        from Globales import get_data_directory
        from Globales import get_streamings

        set_listas_default()

        archivo = os.path.join(
            get_data_directory(),
            'JAMediaRadio.JAMedia')

        items = get_streamings(archivo)
        self.lista.limpiar()
        self.lista.agregar_items(items)

    def __load_play(self, valor):
        """
        Reproduce un streaming.
        """

        self.itemplayer.stop()
        self.itemplayer.load(valor)

    def __grabar(self, valor):
        """
        Grabar desde un Streaming.
        """

        self.itemrecord.stop()
        self.itemrecord.load(valor, self.config["formato"])

    def __show_lista(self, widget):
        """
        Muestra u Oculta la Lista de Radios.
        """

        val = self.win_scroll.get_visible()

        if val:
            self.win_scroll.hide()
            a, b, c, d = self.win_scroll.get_allocation()
            x, y, w, h = self.get_allocation()
            self.set_size_request(-1, h - d)

        else:
            self.win_scroll.show()
            self.set_size_request(-1, 400)

    def __exit(self, widget=None, event=None):

        try:
            self.itemplayer.stop()
            self.itemrecord.stop()

        except:
            pass

        import sys
        sys.exit(0)
Пример #10
0
class Ventana(Gtk.Window):

    __gtype_name__ = 'Ventana'

    def __init__(self):

        super(Ventana, self).__init__()

        self.set_title("JAMedia Converter")

        self.set_icon_from_file(
            os.path.join(BASEPATH,
            "Iconos", "JAMediaConvert.svg"))

        self.set_resizable(True)
        self.set_size_request(640, 480)
        self.set_border_width(2)
        self.set_position(Gtk.WindowPosition.CENTER)
        self.modify_bg(0, get_colors("window"))

        vbox = Gtk.VBox()
        base_panel = Gtk.HPaned()
        base_panel.modify_bg(0, get_colors("window"))

        self.toolbar = Toolbar()
        self.lista = Lista()
        self.widgettareas = WidgetTareas()

        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(
            Gtk.PolicyType.AUTOMATIC,
            Gtk.PolicyType.AUTOMATIC)
        scroll.add(self.lista)

        base_panel.pack1(scroll, resize=False, shrink=False)
        base_panel.pack2(self.widgettareas, resize=False, shrink=False)

        vbox.pack_start(
            self.toolbar, False, False, 0)
        vbox.pack_start(
            base_panel, True, True, 0)

        self.add(vbox)

        self.show_all()
        self.realize()

        self.toolbar.connect(
            'salir', self.__salir)
        self.toolbar.connect(
            'load', self.__load_files)
        self.lista.connect(
            "nueva-seleccion", self.__selecction_file)
        self.widgettareas.connect(
            'copy_tarea', self.__copy_tarea)

        self.connect("delete-event", self.__salir)

    def __copy_tarea(self, widget, tarea):
        """
        Extiende la tarea configurada a todos
        los archivos en la lista, siempre que estos
        sean del mismo tipo (audio o video) y si su formato
        actual lo permite (ejemplo: no se convierte mp3 a mp3).
        """

        model = self.lista.get_model()
        item = model.get_iter_first()

        it = None

        while item:
            it = item
            item = model.iter_next(item)

            if it:
                path = model.get_value(it, 2)
                widtarea = self.widgettareas.tareas.get(path, False)

                if not widtarea:
                    self.widgettareas.go_tarea(path)

        for key in self.widgettareas.tareas.keys():
            widtarea = self.widgettareas.tareas[key]

            if not widtarea.estado:
                widtarea.setear(tarea)

    def __selecction_file(self, widget, path):

        self.widgettareas.go_tarea(path)

    def __load_files(self, widget, lista):
        """
        Agrega archivos a la lista a procesar.
        """

        items = []

        for origen in lista:
            if os.path.isdir(origen):
                for archivo in os.listdir(origen):
                    arch = os.path.join(origen, archivo)
                    datos = get_data(arch)

                    if 'audio' in datos or \
                        'video' in datos or \
                        'application/ogg' in datos or \
                        'application/octet-stream' in datos:
                        items.append([os.path.basename(arch), arch])

            elif os.path.isfile(origen):
                datos = get_data(origen)

                if 'audio' in datos or \
                    'video' in datos or \
                    'application/ogg' in datos or \
                    'application/octet-stream' in datos:
                    items.append([os.path.basename(origen), origen])

        self.lista.limpiar()

        if items:
            self.lista.agregar_items(items)

    def __salir(self, widget=None, senial=None):

        for key in self.widgettareas.tareas.keys():
            widtarea = self.widgettareas.tareas[key]
            widtarea.stop()

        import sys
        sys.exit(0)