Exemplo n.º 1
0
    def __switch_to_visor(self, path):
        """
        Entra en el Visor de Imágenes.
        """

        self.interface = VisorImagenes(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        self.interface.connect('salir', self.__salir)
Exemplo n.º 2
0
    def __switch_to_visor(self, path):
        """
        Entra en el Visor de Imágenes.
        """

        self.interface = VisorImagenes(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        self.interface.connect('salir', self.__salir)
Exemplo n.º 3
0
    def __switch_to_preview(self, path):
        """
        Entra en la Vista preview.
        """

        self.interface = Previews(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        self.interface.connect('camara', self.__switch_to_camara)
        self.interface.connect('salir', self.__salir)
Exemplo n.º 4
0
    def __switch_to_preview(self, path):
        """
        Entra en la Vista preview.
        """

        self.interface = Previews(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        self.interface.connect('camara', self.__switch_to_camara)
        self.interface.connect('salir', self.__salir)
Exemplo n.º 5
0
class JAMediaImagenes(Gtk.Plug):
    """
    JAMImagenes:
        Visor de Imagenes.

        Implementado sobre:
            python 2.7.3 y Gtk 3

        Es un Gtk.Plug para embeber en cualquier contenedor
        dentro de otra aplicacion.
    """

    __gtype_name__ = 'JAMImagenesPlugBase'

    __gsignals__ = {
    'salir': (GObject.SIGNAL_RUN_FIRST,
        GObject.TYPE_NONE, [])}

    def __init__(self):
        """
        JAMImagenes: Gtk.Plug para embeber en otra aplicación.
        """

        Gtk.Plug.__init__(self, 0L)

        self.basebox = Gtk.VBox(
            orientation=Gtk.Orientation.VERTICAL)

        self.interface = False
        #self.acelerometro = Acelerometro()

        self.add(self.basebox)

        self.show_all()
        self.realize()

        #self.acelerometro.connect("angulo", self.__rotar)

    '''
    def __rotar(self, widget, angulo):
        """
        Rota la pantalla según el ángulo
        enviado por el acelerometro.
        """

        import commands

        if angulo == 270:
            commands.getoutput('xrandr --output lvds --rotate right')

        elif angulo == 90:
            commands.getoutput('xrandr --output lvds --rotate left')

        elif angulo == 180:
            commands.getoutput('xrandr --output lvds --rotate inverted')

        elif angulo == 0:
            commands.getoutput('xrandr --output lvds --rotate normal')
    '''

    def switch_to(self, widget, path):
        """
        Empaqueta toolbar y visor de Vista Preview o
        de vista Visor de Imágenes según valor.
        """

        if not path:
            return

        if not os.path.exists(path):
            return

        if not os.access(path, os.R_OK):
            return

        if path == os.path.dirname(os.environ["HOME"]):
            return

        ### Quitar Interfaz Anterior.
        for child in self.basebox.get_children():
            self.basebox.remove(child)
            child.destroy()

        if os.path.isdir(path):
            self.__switch_to_preview(path)

        elif os.path.isfile(path):
            self.__switch_to_visor(os.path.dirname(path))

    def __switch_to_editor(self, path):

        pass
        '''
        self.interface = VisorImagenes(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.show_all()
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        #self.interface.connect('ver', self.__switch_to_visor)
        #self.interface.connect('camara', self.__switch_to_camara)
        self.interface.connect('salir', self.__salir)'''

    def __switch_to_camara(self, widget):
        """
        Entra en la vista de Cámara.
        """

        print "Ir al Visor de la Cámara"

    def __switch_to_preview(self, path):
        """
        Entra en la Vista preview.
        """

        self.interface = Previews(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        self.interface.connect('camara', self.__switch_to_camara)
        self.interface.connect('salir', self.__salir)

    def __switch_to_visor(self, path):
        """
        Entra en el Visor de Imágenes.
        """

        self.interface = VisorImagenes(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        self.interface.connect('salir', self.__salir)

    def __salir(self, widget):

        #self.__rotar(None, 0) Devuelve la pantalla a su estado original.
        self.emit("salir")
Exemplo n.º 6
0
class JAMediaImagenes(Gtk.Plug):
    """
    JAMImagenes:
        Visor de Imagenes.

        Implementado sobre:
            python 2.7.3 y Gtk 3

        Es un Gtk.Plug para embeber en cualquier contenedor
        dentro de otra aplicacion.
    """

    __gtype_name__ = 'JAMImagenesPlugBase'

    __gsignals__ = {'salir': (GObject.SIGNAL_RUN_FIRST, GObject.TYPE_NONE, [])}

    def __init__(self):
        """
        JAMImagenes: Gtk.Plug para embeber en otra aplicación.
        """

        Gtk.Plug.__init__(self, 0L)

        self.basebox = Gtk.VBox(orientation=Gtk.Orientation.VERTICAL)

        self.interface = False
        #self.acelerometro = Acelerometro()

        self.add(self.basebox)

        self.show_all()
        self.realize()

        #self.acelerometro.connect("angulo", self.__rotar)

    '''
    def __rotar(self, widget, angulo):
        """
        Rota la pantalla según el ángulo
        enviado por el acelerometro.
        """

        import commands

        if angulo == 270:
            commands.getoutput('xrandr --output lvds --rotate right')

        elif angulo == 90:
            commands.getoutput('xrandr --output lvds --rotate left')

        elif angulo == 180:
            commands.getoutput('xrandr --output lvds --rotate inverted')

        elif angulo == 0:
            commands.getoutput('xrandr --output lvds --rotate normal')
    '''

    def switch_to(self, widget, path):
        """
        Empaqueta toolbar y visor de Vista Preview o
        de vista Visor de Imágenes según valor.
        """

        if not path:
            return

        if not os.path.exists(path):
            return

        if not os.access(path, os.R_OK):
            return

        if path == os.path.dirname(os.environ["HOME"]):
            return

        ### Quitar Interfaz Anterior.
        for child in self.basebox.get_children():
            self.basebox.remove(child)
            child.destroy()

        if os.path.isdir(path):
            self.__switch_to_preview(path)

        elif os.path.isfile(path):
            self.__switch_to_visor(os.path.dirname(path))

    def __switch_to_editor(self, path):

        pass
        '''
        self.interface = VisorImagenes(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.show_all()
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        #self.interface.connect('ver', self.__switch_to_visor)
        #self.interface.connect('camara', self.__switch_to_camara)
        self.interface.connect('salir', self.__salir)'''

    def __switch_to_camara(self, widget):
        """
        Entra en la vista de Cámara.
        """

        print "Ir al Visor de la Cámara"

    def __switch_to_preview(self, path):
        """
        Entra en la Vista preview.
        """

        self.interface = Previews(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        self.interface.connect('camara', self.__switch_to_camara)
        self.interface.connect('salir', self.__salir)

    def __switch_to_visor(self, path):
        """
        Entra en el Visor de Imágenes.
        """

        self.interface = VisorImagenes(path)

        self.basebox.pack_start(self.interface, True, True, 0)
        self.interface.run()

        self.interface.connect('switch_to', self.switch_to)
        self.interface.connect('salir', self.__salir)

    def __salir(self, widget):

        #self.__rotar(None, 0) Devuelve la pantalla a su estado original.
        self.emit("salir")