From 5f2803f55b7af62b2652bc0802e641d3fa5e18f5 Mon Sep 17 00:00:00 2001 From: Ignacio Rodríguez Date: Tue, 07 May 2013 19:09:24 +0000 Subject: Grandes cambios. --- diff --git a/Box1.py b/Box1.py index ead5cb4..9134903 100644 --- a/Box1.py +++ b/Box1.py @@ -18,10 +18,3 @@ class Box1(Gtk.Box): self.set_size_request(x, -1) self.show_all() - -if __name__ == "__main__": - Ventana = Gtk.Window() - Ventana.add(Box1()) - Ventana.connect("delete-event", lambda x,i: exit()) - Ventana.show_all() - Gtk.main() diff --git a/Box2.py b/Box2.py index cf0d62c..c9d90b9 100644 --- a/Box2.py +++ b/Box2.py @@ -10,13 +10,16 @@ from ListView import ListView from gi.repository import Gtk +import Globales as G + class Box2(Gtk.Box): - def __init__(self): + def __init__(self, toolbar): Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL) self.iconview = IconView() self.listview = ListView() + self.listview.set_path(G.USUARIO) self.view = self.iconview self.scrolled = Gtk.ScrolledWindow() @@ -24,9 +27,18 @@ class Box2(Gtk.Box): self.scrolled.add(self.view) self.pack_start(self.scrolled, True, True, 4) - - def cambiar_view(self, view): - if view == 'iconos': + self.toolbar = toolbar + + self.actual = self.toolbar.icono + self.toolbar.icono.set_sensitive(False) + self.toolbar.icono.connect("clicked", self.cambiar_view, 'Iconos') + self.toolbar.arbol.connect("clicked", self.cambiar_view, "Arbol") + + def cambiar_view(self, widget, view): + self.actual.set_sensitive(True) + self.actual = widget + widget.set_sensitive(False) + if view == 'Iconos': self.view = self.iconview else: @@ -36,10 +48,3 @@ class Box2(Gtk.Box): self.scrolled.add(self.view) self.show_all() - -if __name__ == '__main__': - Ventana = Gtk.Window() - Ventana.connect("delete-event", lambda x, i: exit()) - Ventana.add(Box2()) - Ventana.show_all() - Gtk.main() diff --git a/GnomExplorer.py b/GnomExplorer.py index 50b10e0..aac84a2 100644 --- a/GnomExplorer.py +++ b/GnomExplorer.py @@ -18,7 +18,7 @@ class GnomExplorer(Gtk.Window): self.box_principal = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) toolbar = Toolbar() - paned = MainPaned() + paned = MainPaned(toolbar) self.box_principal.pack_start(toolbar, False, False, 0) self.box_principal.pack_start(paned, True, True, 6) diff --git a/ListView.py b/ListView.py index 426a353..43906ea 100644 --- a/ListView.py +++ b/ListView.py @@ -18,7 +18,7 @@ class ListView(Gtk.TreeView): self.set_model(self.modelo) self.__construir_columnas() - self.__setear_path("/") + self.set_path("/") self.connect("row-expanded", self.__expandir) self.connect("row-collapsed", self.__colapsar) @@ -37,7 +37,7 @@ class ListView(Gtk.TreeView): self.append_column(columna1) self.append_column(columna2) - def __setear_path(self, path): + def set_path(self, path): self.modelo.clear() dir = os.path.basename(path) iter = self.modelo.append(self.modelo.get_iter_first(), diff --git a/MainPaned.py b/MainPaned.py index e73ff32..5cddc0a 100644 --- a/MainPaned.py +++ b/MainPaned.py @@ -9,10 +9,10 @@ from Box1 import Box1 from Box2 import Box2 class MainPaned(Gtk.HPaned): - def __init__(self): + def __init__(self, toolbar): super(MainPaned, self).__init__() self.pack1(Box1()) - self.pack2(Box2()) + self.pack2(Box2(toolbar)) self.show_all() diff --git a/Widgets.py b/Widgets.py index 73b0f8a..0dcfe7e 100644 --- a/Widgets.py +++ b/Widgets.py @@ -56,8 +56,8 @@ class Toolbar(Gtk.Toolbar): Gtk.Toolbar.__init__(self) - arbol = Gtk.ToolButton(Gtk.STOCK_JUSTIFY_FILL) - icono = Gtk.ToolButton(Gtk.STOCK_MISSING_IMAGE) + self.arbol = Gtk.ToolButton(Gtk.STOCK_JUSTIFY_FILL) + self.icono = Gtk.ToolButton(Gtk.STOCK_MISSING_IMAGE) salir = Gtk.ToolButton(Gtk.STOCK_QUIT) recargar = Gtk.ToolButton(Gtk.STOCK_REFRESH) creditos = Gtk.ToolButton(Gtk.STOCK_ABOUT) @@ -66,14 +66,14 @@ class Toolbar(Gtk.Toolbar): separador.props.draw = False separador.set_expand(True) - arbol.connect('clicked', self.__cambiar_vista, 'arbol') - icono.connect('clicked', self.__cambiar_vista, 'icono') + self.arbol.connect('clicked', self.__cambiar_vista, 'arbol') + self.icono.connect('clicked', self.__cambiar_vista, 'icono') salir.connect('clicked', self.__salir) recargar.connect('clicked', self.__recargar) creditos.connect('clicked', self.__creditos) - self.insert(arbol, -1) - self.insert(icono, -1) + self.insert(self.arbol, -1) + self.insert(self.icono, -1) self.insert(Gtk.SeparatorToolItem(), -1) self.insert(recargar, -1) self.insert(separador, -1) -- cgit v0.9.1