Beispiel #1
0
class JAMediaPyGiHack(Gtk.EventBox):

    __gtype_name__ = 'JAMediaPyGiHack'

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

    def __init__(self):

        Gtk.EventBox.__init__(self)

        vbox = Gtk.VBox()

        self.toolbar = Toolbar()
        vbox.pack_start(self.toolbar, False, False, 0)

        self.base_panel = BasePanel()
        vbox.pack_start(self.base_panel, True, True, 0)

        self.add(vbox)
        self.show_all()

        self.toolbar.connect("import", self.__import)
        self.toolbar.connect("accion-menu", self.__set_accion)
        self.toolbar.connect("salir", self.__emit_salir)
        self.base_panel.connect("update", self.__update)

    def __emit_salir(self, widget):

        self.emit('salir')

    def __update(self, widget, view):

        if view == "Terminal":
            pass

        elif view == "Gstreamer - Inspect 1.0" or \
            view == "Apis PyGiHack":
            self.toolbar.update(view)

    def __set_accion(self, widget, menu, wid_lab, valor):

        self.base_panel.set_accion(menu, wid_lab, valor)

    def __import(self, widget, paquete, modulo):

        self.base_panel.import_modulo(paquete, modulo)
class JAMediaPyGiHack(Gtk.EventBox):

    __gtype_name__ = 'JAMediaPyGiHack'

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

    def __init__(self):

        Gtk.EventBox.__init__(self)

        vbox = Gtk.VBox()

        self.toolbar = Toolbar()
        vbox.pack_start(self.toolbar, False, False, 0)

        self.base_panel = BasePanel()
        vbox.pack_start(self.base_panel, True, True, 0)

        self.add(vbox)
        self.show_all()

        self.toolbar.connect("import", self.__import)
        self.toolbar.connect("accion-menu", self.__set_accion)
        self.toolbar.connect("salir", self.__emit_salir)
        self.base_panel.connect("update", self.__update)

    def __emit_salir(self, widget):
        self.emit('salir')

    def __update(self, widget, view):
        if view == "Terminal":
            pass
        elif view == "Gstreamer - Inspect 1.0" or view == "Apis PyGiHack":
            self.toolbar.update(view)

    def __set_accion(self, widget, menu, wid_lab, valor):
        self.base_panel.set_accion(menu, wid_lab, valor)

    def __import(self, widget, paquete, modulo):
        self.base_panel.import_modulo(paquete, modulo)
class JAMediaPyGiHack(Gtk.Box):

    __gtype_name__ = 'JAMediaPyGiHack'

    __gsignals__ = {
        'salir': (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, []),
        "abrir":
        (GObject.SIGNAL_RUN_LAST, GObject.TYPE_NONE, (GObject.TYPE_STRING, ))
    }

    def __init__(self):

        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        self.toolbar = Toolbar()
        self.pack_start(self.toolbar, False, False, 0)

        self.basebox = BaseBox()
        self.pack_start(self.basebox, True, True, 0)

        self.informewidget = False

        # FIXME: Activar para obtener informe de módulos
        #self.connect("realize", self.__realize)
        self.show_all()

        self.toolbar.connect("import", self.__import)
        self.toolbar.connect("accion-menu", self.__set_accion)
        self.toolbar.connect("salir", self.__emit_salir)
        self.toolbar.connect("zoom", self.__zoom)
        self.toolbar.connect("accion", self.__buscar_mas)
        self.toolbar.connect("informe", self.__informar)

        self.basebox.connect("update", self.__update)
        self.basebox.connect('abrir', self.__open_file)
        self.basebox.connect("nobusquedas", self.__desactivar_busquedas)

    """
    def __realize(self, widget):
        GLib.timeout_add(1000, self.__informe_pygihack)

    def __informe_pygihack(self):
        self.get_toplevel().set_sensitive(False)
        dialog = Gtk.Dialog(parent=self.get_toplevel(),
        flags=Gtk.DialogFlags.MODAL,
        buttons=["Aceptar", Gtk.ResponseType.ACCEPT])
        dialog.set_border_width(15)
        dialog.set_size_request(250, 400)
        textview = Gtk.TextView()
        textview.set_editable(False)
        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scroll.add(textview)
        textview.get_buffer().set_text(self.toolbar.menu.informe)
        dialog.vbox.pack_start(scroll, True, True, 0)
        dialog.vbox.show_all()
        dialog.run()
        dialog.destroy()
        self.get_toplevel().set_sensitive(True)
        return False
    """

    def __open_file(self, widget, modulo_path):
        self.emit("abrir", modulo_path)

    def __zoom(self, widget, zoom):
        self.basebox.zoom(zoom)

    def __informar(self, widget):
        """
        Abre nueva lengueta en Workpanel con la información de Introspección
        del archivo seleccionado.
        """
        if self.informewidget:
            self.informewidget.destroy()
        self.informewidget = InformeWidget(self.get_toplevel())
        text = self.basebox.get_estructura()
        self.informewidget.setting(text)

    def __buscar_mas(self, widget, accion, text):
        self.basebox.buscar_mas(accion, text)

    def __emit_salir(self, widget):
        self.emit('salir')

    def __update(self, widget, view):
        self.toolbar.update(view)
        self.toolbar.activar_busquedas(self.basebox.check_busquedas())

    def __desactivar_busquedas(self, widget):
        self.toolbar.activar_busquedas(False)

    def __set_accion(self, widget, menu, wid_lab, valor):
        self.basebox.set_accion(menu, wid_lab, valor)

    def __import(self, widget, paquete, modulo):
        self.basebox.import_modulo(paquete, modulo)
class JAMediaPyGiHack(Gtk.Box):

    __gtype_name__ = 'JAMediaPyGiHack'

    __gsignals__ = {
    'salir': (GObject.SIGNAL_RUN_LAST,
        GObject.TYPE_NONE, []),
    "abrir": (GObject.SIGNAL_RUN_LAST,
        GObject.TYPE_NONE, (GObject.TYPE_STRING,))}

    def __init__(self):

        Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)

        self.toolbar = Toolbar()
        self.pack_start(self.toolbar, False, False, 0)

        self.basebox = BaseBox()
        self.pack_start(self.basebox, True, True, 0)

        self.informewidget = False

        # FIXME: Activar para obtener informe de módulos
        #self.connect("realize", self.__realize)
        self.show_all()

        self.toolbar.connect("import", self.__import)
        self.toolbar.connect("accion-menu", self.__set_accion)
        self.toolbar.connect("salir", self.__emit_salir)
        self.toolbar.connect("zoom", self.__zoom)
        self.toolbar.connect("accion", self.__buscar_mas)
        self.toolbar.connect("informe", self.__informar)

        self.basebox.connect("update", self.__update)
        self.basebox.connect('abrir', self.__open_file)
        self.basebox.connect("nobusquedas", self.__desactivar_busquedas)
        
    """
    def __realize(self, widget):
        GLib.timeout_add(1000, self.__informe_pygihack)

    def __informe_pygihack(self):
        self.get_toplevel().set_sensitive(False)
        dialog = Gtk.Dialog(parent=self.get_toplevel(),
        flags=Gtk.DialogFlags.MODAL,
        buttons=["Aceptar", Gtk.ResponseType.ACCEPT])
        dialog.set_border_width(15)
        dialog.set_size_request(250, 400)
        textview = Gtk.TextView()
        textview.set_editable(False)
        scroll = Gtk.ScrolledWindow()
        scroll.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        scroll.add(textview)
        textview.get_buffer().set_text(self.toolbar.menu.informe)
        dialog.vbox.pack_start(scroll, True, True, 0)
        dialog.vbox.show_all()
        dialog.run()
        dialog.destroy()
        self.get_toplevel().set_sensitive(True)
        return False
    """
    
    def __open_file(self, widget, modulo_path):
        self.emit("abrir", modulo_path)

    def __zoom(self, widget, zoom):
        self.basebox.zoom(zoom)

    def __informar(self, widget):
        """
        Abre nueva lengueta en Workpanel con la información de Introspección
        del archivo seleccionado.
        """
        if self.informewidget:
            self.informewidget.destroy()
        self.informewidget = InformeWidget(self.get_toplevel())
        text = self.basebox.get_estructura()
        self.informewidget.setting(text)

    def __buscar_mas(self, widget, accion, text):
        self.basebox.buscar_mas(accion, text)

    def __emit_salir(self, widget):
        self.emit('salir')

    def __update(self, widget, view):
        self.toolbar.update(view)
        self.toolbar.activar_busquedas(self.basebox.check_busquedas())

    def __desactivar_busquedas(self, widget):
        self.toolbar.activar_busquedas(False)

    def __set_accion(self, widget, menu, wid_lab, valor):
        self.basebox.set_accion(menu, wid_lab, valor)

    def __import(self, widget, paquete, modulo):
        self.basebox.import_modulo(paquete, modulo)