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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Widgets.py
# Cristian García <cristian99garcia@gmail.com>
# Ignacio Rodríguez <nachoel01@gmail.com>
from gi.repository import Gtk
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import GObject
import Globales as G
def get_pixbuf(path, x=None, y=None):
if x is None or y is None:
pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
return pixbuf
else:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(path, x, y)
return pixbuf
class LogoJoven(Gtk.Image):
def __init__(self):
super(LogoJoven, self).__init__()
self.set_from_pixbuf(get_pixbuf(G.LOGO_JOVEN))
self.show_all()
class Marcadores(Gtk.TreeView):
def __init__(self):
super(Marcadores, self).__init__()
self.modelo = Gtk.ListStore(str, str, str)
render1 = Gtk.CellRendererPixbuf()
render2 = Gtk.CellRendererText()
render3 = Gtk.CellRendererText()
columna1 = Gtk.TreeViewColumn('', render1, icon_name=0)
columna2 = Gtk.TreeViewColumn('Marcador', render2, text=1)
columna3 = Gtk.TreeViewColumn('', render3, text=2)
columna3.set_property('visible', False)
self.append_column(columna1)
self.append_column(columna2)
self.append_column(columna3)
self.set_model(self.modelo)
self.show_all()
class Toolbar(Gtk.Toolbar):
def __init__(self):
Gtk.Toolbar.__init__(self)
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)
separador = Gtk.SeparatorToolItem()
separador.props.draw = False
separador.set_expand(True)
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(self.arbol, -1)
self.insert(self.icono, -1)
self.insert(Gtk.SeparatorToolItem(), -1)
self.insert(recargar, -1)
self.insert(separador, -1)
self.insert(creditos, -1)
self.insert(Gtk.SeparatorToolItem(), -1)
self.insert(salir, -1)
def __cambiar_vista(self, widget, vista):
pass
def __salir(self, widget):
exit()
def __recargar(self, widget):
pass
def __creditos(self, widget):
pass
|