Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Box2.py
blob: c9d90b9426a47152bffee9fd3fbf2daa6a89fdca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# IconView.py by:
# Cristian García <cristian99garcia@gmail.com>
# Ignacio Rodríguez <nachoel01@gmail.com>
# Python Joven - CeibalJAM! Uruguay

from IconView import IconView
from ListView import ListView

from gi.repository import Gtk

import Globales as G

class Box2(Gtk.Box):

    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()

        self.scrolled.add(self.view)

        self.pack_start(self.scrolled, True, True, 4)
        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:
            self.view = self.listview

        self.scrolled.remove(self.scrolled.get_children()[0])
        self.scrolled.add(self.view)
        
        self.show_all()