Mercurial > pyarq-presupuestos
annotate Gtk/gui.py @ 24:2b393934f1db
more icons
author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
---|---|
date | Fri, 03 May 2019 11:11:00 +0200 |
parents | 65e7ae0d0e63 |
children | 189f8274aecd |
rev | line source |
---|---|
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1 # -*- coding: utf-8 -*- |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2 ## File gui.py |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3 ## This file is part of pyArq-Presupuestos. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4 ## |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5 ## Copyright (C) 2010-2019 Miguel Ángel Bárcena Rodríguez |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
6 ## <miguelangel@obraencurso.es> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
7 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
8 ## pyArq-Presupuestos is free software: you can redistribute it and/or modify |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
9 ## it under the terms of the GNU General Public License as published by |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
10 ## the Free Software Foundation, either version 3 of the License, or |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
11 ## (at your option) any later version. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
12 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
13 ## pyArq-Presupuestos is distributed in the hope that it will be useful, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
14 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
15 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
16 ## GNU General Public License for more details. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
17 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
18 ## You should have received a copy of the GNU General Public License |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
19 ## along with this program. If not, see <http://www.gnu.org/licenses/>. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
20 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
21 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
22 """Gui module |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
23 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
24 The MainWindow class contain the toplevel WINDOW, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
25 this window have a notebook with a page for each budget. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
26 Each budget or notebook page is showed by the Page class, this class contain |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
27 the main widget showed in a page notebook. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
28 The main widget can show the budget information in several panes. |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
29 This panes are ordened in Gtk.Paned represented for the class Paned which can |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
30 have 2 viewes represented for the View class or other Gtk.Paned that have other |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
31 viewes or more Gtk.Paned. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
32 The view can have diferente type of widgets to show the budget information. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
33 The DecompositionList class show the decompositon list information of a record |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
34 The Measure class show the measure information of a record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
35 The Sheet class class show the sheet of condition information of a record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
36 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
37 The views can send signal to the others. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
38 All the viewes ordered in panes can be or not be connected to the others, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
39 if there are connecteded to the others when the user change the active code in |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
40 one of the panes the active code change in the others. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
41 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
42 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
43 # TODO: Config file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
44 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
45 # Modules |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
46 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
47 # python 2/3 compatibility |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
48 from __future__ import absolute_import, division, print_function, unicode_literals |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
49 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
50 # Standar Modules |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
51 import sys |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
52 import os |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
53 import time |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
54 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
55 # gui |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
56 import gi |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
57 gi.require_version('Gtk', '3.0') |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
58 from gi.repository import Gtk |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
59 from gi.repository import GdkPixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
60 from gi.repository import Gio |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
61 from gi.repository import GLib |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
62 from gi.repository import Gdk |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
63 from gi.repository import Pango |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
64 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
65 import weakref |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
66 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
67 # pyArq-Presupuestos Modules |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
68 from Gtk import importFiebdc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
69 from Generic import base |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
70 from Generic import fiebdc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
71 from Generic import utils |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
72 from Generic import globalVars |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
73 from Generic import openwith |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
74 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
75 # Load default icon |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
76 _icons = [ "ICON16", "ICON32","ICON64","ICON128"] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
77 _pixbufIcons = [] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
78 for _icon in _icons: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
79 if os.path.exists(globalVars.getAppPath(_icon)): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
80 _pixbufIcon = GdkPixbuf.Pixbuf.new_from_file(globalVars.getAppPath(_icon)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
81 _pixbufIcons.append(_pixbufIcon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
82 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
83 print(utils.mapping(_("The icon file does not exist. '$1'"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
84 (str(globalVars.getAppPath(_icon)),)) ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
85 if len(_pixbufIcons) > 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
86 Gtk.Window.set_default_icon_list(_pixbufIcons) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
87 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
88 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
89 print(utils.mapping(_("The icon file does not exist. '$1'"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
90 (str(globalVars.getAppPath("ICON")),)) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
91 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
92 # Autodetect desktop |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
93 if globalVars.desktop["autodetect"]: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
94 openwith.autodetect_desktop() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
95 print(utils.mapping(_("pyArq-Presupuestos running on $1"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
96 (globalVars.desktop["desktop"],))) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
97 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
98 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
99 class App(Gtk.Application): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
100 """gui.App: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
101 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
102 Description: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
103 This is the Gtk application base class. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
104 Constructor: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
105 App() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
106 Ancestry: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
107 +-- Gtk.Application https://lazka.github.io/pgi-docs/Gtk-3.0/classes/Application.html |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
108 +-- App |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
109 Atributes: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
110 Methods: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
111 do_activate |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
112 do_startup |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
113 do_open |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
114 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
115 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
116 def __init__(self, *args, **kwargs): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
117 """__init__() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
118 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
119 Sets the application id and application_name. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
120 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
121 self.filesToOpen = [] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
122 self._application_id = "es.obraencurso.pyarq.presupuestos" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
123 super(App, self).__init__(application_id=self._application_id, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
124 flags=Gio.ApplicationFlags.HANDLES_OPEN, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
125 **kwargs) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
126 GLib.set_prgname(self._application_id) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
127 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
128 def do_open(self, files, n_files, hint): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
129 """do_open(files, n_files, hint) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
130 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
131 Set the filename list to open. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
132 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
133 self.filesToOpen = files |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
134 self.activate() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
135 self.filesToOpen = [] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
136 return 0 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
137 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
138 def do_activate(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
139 """do_activate() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
140 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
141 Shows new appplication windows. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
142 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
143 _mainWindow = MainWindow(self, self.filesToOpen ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
144 _mainWindow.window.present_with_time(GLib.get_monotonic_time() / 1000) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
145 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
146 def do_startup(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
147 """do_startup() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
148 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
149 Sets the app actions. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
150 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
151 Gtk.Application.do_startup(self) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
152 # App Actions |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
153 action = Gio.SimpleAction.new("newWindow", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
154 action.connect("activate", self._on_newWindow) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
155 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
156 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
157 action = Gio.SimpleAction.new("acell_newWindow", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
158 action.connect("activate", self._on_control_n) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
159 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
160 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
161 action = Gio.SimpleAction.new("about", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
162 action.connect("activate", self._on_about) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
163 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
164 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
165 action = Gio.SimpleAction.new("quit", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
166 action.connect("activate", self._on_quit) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
167 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
168 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
169 action = Gio.SimpleAction.new("acell_quit", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
170 action.connect("activate", self._on_control_q) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
171 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
172 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
173 # App menu |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
174 _app_menu = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
175 _section_window = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
176 _section_window.append(_("_New window"), "app.newWindow") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
177 _section_window.append(_("_Close window"), "win.CloseWindow") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
178 _app_menu.append_section(None,_section_window) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
179 self.set_accels_for_action('win.acell_close', ["<Primary>x"]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
180 self.set_accels_for_action('app.acell_newWindow', ["<Primary>n"]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
181 _section_general = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
182 _section_general.append(_("About") + " " + globalVars.name, "app.about") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
183 _app_menu.append_section(None,_section_general) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
184 _section_quit = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
185 _section_quit.append(_("_Quit application"), "app.quit") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
186 self.set_accels_for_action('app.acell_quit', ["<Primary>q"]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
187 _app_menu.append_section(None,_section_quit) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
188 self.set_app_menu(_app_menu) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
189 # TODO : from gui config |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
190 win_menu = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
191 # Win Menu |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
192 if win_menu: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
193 _win_menu = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
194 _win_submenu_file = Gio.Menu.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
195 _import_fiebdc = Gio.MenuItem.new(_("_Import Fiebdc"), "win.ImportFiebdc") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
196 _import_fiebdc.set_icon(Gio.Icon.new_for_string("document-open")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
197 _win_submenu_file.append_item(_import_fiebdc) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
198 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
199 _close_tab = Gio.MenuItem.new(_("_Close tab"), "win.CloseTab") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
200 _close_tab.set_icon(Gio.Icon.new_for_string("window-close")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
201 _win_submenu_file.append_item(_close_tab) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
202 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
203 _win_menu.append_submenu(_("_File"), _win_submenu_file) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
204 _win_submenu_go = Gio.Menu.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
205 _back = Gio.MenuItem.new(_("_Back"), "win.GoPrevious") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
206 _back.set_icon(Gio.Icon.new_for_string("go-previous")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
207 _win_submenu_go.append_item(_back) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
208 _forward = Gio.MenuItem.new(_("_Forward"), "win.GoPosterior") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
209 _forward.set_icon(Gio.Icon.new_for_string("go-next")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
210 _win_submenu_go.append_item(_forward) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
211 _up = Gio.MenuItem.new(_("_Up Item"), "win.GoUp") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
212 _up.set_icon(Gio.Icon.new_for_string("go-up")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
213 _win_submenu_go.append_item(_up) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
214 _root = Gio.MenuItem.new(_("_Root"), "win.GoToRoot") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
215 _root.set_icon(Gio.Icon.new_for_string("go-top")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
216 _win_submenu_go.append_item(_root) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
217 _win_menu.append_submenu(_("_Go"), _win_submenu_go) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
218 self.set_menubar(_win_menu) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
219 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
220 def _on_newWindow(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
221 """on_newWindow(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
222 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
223 Shows new appplication windows. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
224 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
225 _mainWindow = MainWindow(self, []) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
226 _mainWindow.window.present_with_time(GLib.get_monotonic_time() / 1000) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
227 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
228 def _on_about(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
229 """_on_about(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
230 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
231 Shows About dialog. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
232 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
233 _aboutDialog = Gtk.AboutDialog(modal=False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
234 _aboutDialog.set_program_name(globalVars.name) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
235 _aboutDialog.set_copyright(base.copyright) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
236 _aboutDialog.set_authors(base.authors) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
237 _aboutDialog.set_version(globalVars.version + globalVars.changeset) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
238 _aboutDialog.set_website(base.website) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
239 _aboutDialog.set_website_label(base.website_label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
240 _aboutDialog.set_license_type(Gtk.License(3)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
241 _aboutDialog.set_comments(base.comments) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
242 _aboutDialog.connect("response", self._on_close_aboutdialog) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
243 _aboutDialog.present_with_time(GLib.get_monotonic_time() / 1000) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
244 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
245 def _on_close_aboutdialog(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
246 """on_close_aboutdialog(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
247 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
248 Close About dialog. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
249 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
250 action.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
251 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
252 def _on_control_q(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
253 """on_control_q(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
254 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
255 Quit app. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
256 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
257 print("Control q -> Quit app") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
258 self.quit() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
259 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
260 def _on_quit(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
261 """_on_quit(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
262 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
263 Quit app. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
264 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
265 self.quit() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
266 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
267 def _on_control_n(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
268 """on_control_n(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
269 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
270 Shows new appplication windows. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
271 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
272 print("Control n -> New window") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
273 self._on_newWindow(action, param) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
274 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
275 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
276 class MainWindow(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
277 """gui.MainWindow: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
278 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
279 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
280 Creates and shows the main window. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
281 This is the interface base class. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
282 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
283 MainWindow(app, files) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
284 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
285 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
286 +-- MainWindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
287 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
288 self.window: Gtk.ApplicationWindow object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
289 Methods: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
290 changeHistorySignal |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
291 changeActiveSignal |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
292 appendEmptyPage |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
293 updatePage |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
294 closePage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
295 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
296 # TODO:* Can choose open budget in new window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
297 # TODO:* Can choose show more than one notebook in the same window or |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
298 # TODO: can show basedata notebook in a side pane |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
299 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
300 def __init__(self, app, files): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
301 """__init__(app, files) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
302 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
303 Initialize the atributes self.__page_list without data. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
304 Creates the widgets "window" and "__notebook". |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
305 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
306 app: Gtk.Application instance |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
307 files: Gio.file list from command line |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
308 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
309 self.window: Gtk.ApplicationWindow object |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
310 self.__page_list: List of pages ("Page" object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
311 self.__notebook: Notebook widget ("Gtk.Notebook" object) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
312 self.__general_action_group: "General" action group |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
313 self.__navigation_action_group: "Navigation" action group |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
314 self.__navigation_is_enabled: True/False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
315 self.__goBack_button |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
316 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
317 self.__page_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
318 # Main window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
319 self.window = Gtk.ApplicationWindow(application=app) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
320 self.window.set_default_size(771, 570) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
321 self.window.set_title("Presupuestos") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
322 self.window.set_border_width(5) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
323 self.window.connect("delete_event", self._delete_event) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
324 # HeaderBar |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
325 _hb = Gtk.HeaderBar() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
326 _hb.set_show_close_button(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
327 _hb.props.title = "Presupuestos" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
328 self.window.set_titlebar(_hb) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
329 _hb.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
330 # Actions |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
331 # General Actions |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
332 self.__general_action_group = Gio.SimpleActionGroup.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
333 # CloseWindow Action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
334 _action = Gio.SimpleAction.new("CloseWindow", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
335 _action.connect("activate", self._menuitemClose) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
336 self.window.add_action(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
337 self.__general_action_group.insert(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
338 # CloseWindow from acell Action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
339 _action = Gio.SimpleAction.new("acell_close", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
340 _action.connect("activate", self._on_control_x) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
341 self.window.add_action(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
342 self.__general_action_group.insert(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
343 # ImportFiebdc Action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
344 _action = Gio.SimpleAction.new("ImportFiebdc", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
345 _action.connect("activate", self._on_menuitemImportFiebdc) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
346 self.window.add_action(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
347 self.__general_action_group.insert(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
348 # CloseTab action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
349 self.__closeTab_action = Gio.SimpleAction.new("CloseTab", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
350 self.__closeTab_action.connect("activate", self._on_CloseTab) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
351 self.window.add_action(self.__closeTab_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
352 self.__general_action_group.insert(self.__closeTab_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
353 # Navigation Actions |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
354 self.__navigation_is_enabled = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
355 self.__navigation_action_group = Gio.SimpleActionGroup.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
356 # Go Previous action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
357 self.__GoPrevious_action = Gio.SimpleAction.new("GoPrevious", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
358 self.__GoPrevious_action.connect("activate", self._menuitemGoPrevious) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
359 self.window.add_action(self.__GoPrevious_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
360 self.__general_action_group.insert(self.__GoPrevious_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
361 self.__GoPrevious_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
362 # Go posterior action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
363 self.__GoPosterior_action = Gio.SimpleAction.new("GoPosterior", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
364 self.__GoPosterior_action.connect("activate", self._menuitemGoPosterior) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
365 self.window.add_action(self.__GoPosterior_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
366 self.__general_action_group.insert(self.__GoPosterior_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
367 self.__GoPosterior_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
368 # Go Up action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
369 self.__GoUp_action = Gio.SimpleAction.new("GoUp", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
370 self.__GoUp_action.connect("activate", self._menuitemGoUp) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
371 self.window.add_action(self.__GoUp_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
372 self.__general_action_group.insert(self.__GoUp_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
373 self.__GoUp_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
374 # Go to Root action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
375 self.__GoToRoot_action = Gio.SimpleAction.new("GoToRoot", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
376 self.__GoToRoot_action.connect("activate", self._menuitemGoToRoot) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
377 self.window.add_action(self.__GoToRoot_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
378 self.__general_action_group.insert(self.__GoToRoot_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
379 self.__GoToRoot_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
380 # Vertical Grid |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
381 _vbox1 = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
382 _vbox1.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
383 self.window.add(_vbox1) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
384 _vbox1.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
385 # Toolbar |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
386 _toolbar = Gtk.Toolbar() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
387 _toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_PRIMARY_TOOLBAR) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
388 # Import Fiebdc |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
389 _gtk_image = Gtk.Image.new_from_icon_name("document-open",1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
390 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
391 _ImportFiebdc_button = Gtk.ToolButton.new(_gtk_image , _("Import Fiebdc")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
392 _ImportFiebdc_button.set_tooltip_text(_("Import Fiebdc")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
393 _ImportFiebdc_button.set_is_important(False) # label not shown |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
394 _toolbar.insert(_ImportFiebdc_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
395 _ImportFiebdc_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
396 _ImportFiebdc_button.set_action_name("win.ImportFiebdc") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
397 # Close tab |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
398 _gtk_image = Gtk.Image.new_from_icon_name("window-close",1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
399 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
400 _closeTabButton = Gtk.ToolButton.new(_gtk_image , _("_Close tab")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
401 _closeTabButton.set_tooltip_text(_("Close tab")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
402 _closeTabButton.set_is_important(False) # label not shown |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
403 _toolbar.insert(_closeTabButton, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
404 _closeTabButton.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
405 _closeTabButton.set_action_name("win.CloseTab") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
406 # Separator item |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
407 _separator = Gtk.SeparatorToolItem() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
408 _separator.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
409 _toolbar.insert(_separator, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
410 # Go Back |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
411 _gtk_image = Gtk.Image.new_from_icon_name("go-previous",1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
412 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
413 self.__goBack_button = Gtk.MenuToolButton.new(_gtk_image ,_("Back")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
414 self.__goBack_button.set_tooltip_text(_("Back")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
415 self.__goBack_button.set_is_important(False) # label not shown |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
416 _toolbar.insert(self.__goBack_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
417 self.__goBack_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
418 self.__goBack_button.set_action_name("win.GoPrevious") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
419 # Go Forward |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
420 _gtk_image = Gtk.Image.new_from_icon_name("go-next",1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
421 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
422 self.__goForward_button = Gtk.MenuToolButton.new(_gtk_image ,_("Forward")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
423 self.__goForward_button.set_tooltip_text(_("Forward")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
424 self.__goForward_button.set_is_important(False) # label not shown |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
425 _toolbar.insert(self.__goForward_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
426 self.__goForward_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
427 self.__goForward_button.set_action_name("win.GoPosterior") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
428 # Go Up Item |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
429 _gtk_image = Gtk.Image.new_from_icon_name("go-up",1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
430 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
431 _goUP_button = Gtk.ToolButton.new(_gtk_image ,_("Up Item")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
432 _goUP_button.set_tooltip_text(_("Up Item")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
433 _goUP_button.set_is_important(False) # label not shown |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
434 _toolbar.insert(_goUP_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
435 _goUP_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
436 _goUP_button.set_action_name("win.GoUp") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
437 # Go Root Item |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
438 _gtk_image = Gtk.Image.new_from_icon_name("go-top",1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
439 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
440 _goRoot_button = Gtk.ToolButton.new(_gtk_image ,_("Root")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
441 _goRoot_button.set_tooltip_text(_("Root")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
442 _goRoot_button.set_is_important(False) # label not shown |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
443 _toolbar.insert(_goRoot_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
444 _goRoot_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
445 _goRoot_button.set_action_name("win.GoToRoot") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
446 # Pack and show |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
447 _toolbar.set_hexpand(True) # with extra horizontal space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
448 _toolbar.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
449 _vbox1.add(_toolbar) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
450 # Notebook |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
451 self.__notebook = Gtk.Notebook() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
452 _vbox1.add(self.__notebook) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
453 self.__notebook.set_tab_pos(Gtk.PositionType(2)) # Up |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
454 self.__notebook.set_property("expand", True) # widget expand all space |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
455 self.__notebook.set_show_tabs(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
456 self.__notebook.set_show_border(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
457 self.__notebook.set_scrollable(True) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
458 self.__notebook.connect("switch-page", self._switch_page) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
459 self.__notebook.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
460 self._main() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
461 if len(files) > 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
462 for file in files: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
463 _budget = base.Budget() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
464 _budget_file = fiebdc.Read() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
465 _read_method = _budget_file.readFile |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
466 _filename = file.get_path() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
467 _filetype = "budget" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
468 _exit_method = _budget_file.cancel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
469 _file_window = FileSelectionWindow(self, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
470 _read_method, _budget, _filename, _exit_method, _filetype) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
471 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
472 def changeHistorySignal(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
473 """changeHistorySignal() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
474 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
475 A pane emit the updateHistory signal. |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
476 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
477 Nothing to do now |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
478 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
479 pass |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
480 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
481 def changeActiveSignal(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
482 """changeActiveSignal() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
483 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
484 A pane emit the change-active signal. |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
485 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
486 Chech buttons sensitive |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
487 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
488 self._checkButtonsSensitive(self.__notebook.get_current_page()) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
489 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
490 def _checkButtonsSensitive(self, page_num): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
491 """_checkButtonsSensitive(page_num) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
492 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
493 page_num: page number in notebook |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
494 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
495 Check and if necessary update the enabled state of the navigation |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
496 buttons. |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
497 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
498 _page = self.__page_list[page_num] |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
499 if isinstance(_page, Page) and \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
500 self.__navigation_is_enabled: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
501 # GoToRoot and GoUp actions |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
502 _goto_root = self.__GoToRoot_action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
503 _go_up = self.__GoUp_action |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
504 if len(_page.activePathRecord) == 1 and \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
505 _goto_root.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
506 _goto_root.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
507 _go_up.set_enabled(False) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
508 elif len(_page.activePathRecord) != 1 and \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
509 not _goto_root.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
510 _goto_root.set_enabled(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
511 _go_up.set_enabled(True) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
512 # GoPrevMenu action |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
513 _go_Previous = self.__GoPrevious_action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
514 _go_prev = self.__GoPrevious_action |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
515 if _page.previousPathRecord is None: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
516 if _go_prev.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
517 _go_prev.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
518 self.__goBack_button.props.menu = None |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
519 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
520 if not _go_prev.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
521 _go_prev.set_enabled(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
522 self.__goBack_button.set_menu(_page.back_menu) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
523 # GoPostMenu action |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
524 _go_Posterior = self.__GoPosterior_action |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
525 if _page.posteriorPathRecord is None: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
526 if _go_Posterior.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
527 _go_Posterior.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
528 self.__goForward_button.props.menu = None |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
529 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
530 if not _go_Posterior.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
531 _go_Posterior.set_enabled(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
532 self.__goForward_button.set_menu(_page.forward_menu) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
533 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
534 def _disable_navigation(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
535 self.__GoPrevious_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
536 self.__GoPosterior_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
537 self.__GoUp_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
538 self.__GoToRoot_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
539 self.__navigation_is_enabled = False |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
540 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
541 def _switch_page(self, notebook, page, page_num,): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
542 """_switch_page(notebook, page, page_num) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
543 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
544 Method connected to the "switch-page" signal of the notebook widget |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
545 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
546 It shows/hides closeTabButton |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
547 and changes the sensitive state of the navigation action group |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
548 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
549 for _page_num, _page in enumerate(self.__page_list): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
550 if _page_num == page_num: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
551 _page.closeTabButton.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
552 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
553 _page.closeTabButton.hide() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
554 _page = self.__page_list[page_num] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
555 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
556 if isinstance(_page, EmptyPage) and \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
557 self.__navigation_is_enabled: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
558 self._disable_navigation() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
559 elif isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
560 if not self.__navigation_is_enabled: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
561 self.__navigation_is_enabled = True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
562 self._checkButtonsSensitive(page_num) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
563 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
564 def _main(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
565 """main() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
566 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
567 Shows window. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
568 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
569 self.window.show() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
570 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
571 def appendEmptyPage(self, emptyPage): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
572 """appendEmptyPage(emptyPage) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
573 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
574 Append a empty page to the notebook. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
575 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
576 self.__page_list.append(emptyPage) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
577 self.__notebook.append_page(emptyPage.widget, emptyPage.title) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
578 # TODO: reordenable and detachable Pages |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
579 #self.__notebook.set_tab_reorderable(emptyPage.widget, True) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
580 #self.__notebook.set_tab_detachable(emptyPage.widget, True) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
581 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
582 def updatePage(self, empty_page, page): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
583 """updatePage(page) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
584 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
585 Update emptyPage to Page. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
586 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
587 _page_num = self.__notebook.page_num(empty_page.widget) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
588 self.__page_list[_page_num] = page |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
589 if self.__notebook.get_current_page() == _page_num: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
590 if not self.__navigation_is_enabled: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
591 self.__navigation_is_enabled = True |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
592 self._checkButtonsSensitive(_page_num) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
593 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
594 def _on_control_x(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
595 print("Control x -> Close window") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
596 self.window.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
597 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
598 def _on_menuitemImportFiebdc(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
599 """_on_menuitemImportFiebdc(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
600 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
601 action: the action where the event is emitted from |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
602 parameter: None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
603 Callback to open a budget file. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
604 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
605 Creates and shows a file selection window to open a budget file. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
606 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
607 _budget = base.Budget() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
608 _budget_file = fiebdc.Read() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
609 _read_method = _budget_file.readFile |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
610 _filename = "" |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
611 _filetype = "budget" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
612 _exit_method = _budget_file.cancel |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
613 _file_window = FileSelectionWindow(self, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
614 _read_method, _budget, _filename, _exit_method, _filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
615 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
616 def _menuitemClose(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
617 """_menuitemClose(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
618 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
619 action: the action where the event is emitted from |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
620 parameter: None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
621 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
622 Callback to close the main window. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
623 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
624 self.window.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
625 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
626 def _on_CloseTab(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
627 """_on_CloseTab(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
628 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
629 action: the action where the event is emitted from |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
630 parameter: None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
631 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
632 Callback to close tab. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
633 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
634 _page_num = self.__notebook.get_current_page() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
635 if _page_num != -1: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
636 _page = self.__page_list[_page_num] |
16
60bc5117926c
no durus
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
637 _page.close() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
638 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
639 def closePage(self, page): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
640 """closePage(page) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
641 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
642 page: EmptyPage or Page object |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
643 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
644 Removes a page from notebook and page_list. |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
645 Hide navigation action group if necessary |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
646 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
647 if page in self.__page_list: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
648 _page_num = self.__page_list.index(page) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
649 self.__page_list.pop(_page_num) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
650 page.clear() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
651 self.__notebook.remove_page(_page_num) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
652 if len(self.__page_list) == 0: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
653 self._disable_navigation() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
654 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
655 raise IndexError( _("The page is not in the page list") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
656 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
657 def _menuitemGoToRoot(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
658 """_menuitemGoToRoot(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
659 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
660 action: the action where the event is emitted from |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
661 parameter: None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
662 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
663 Callback to go to root record. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
664 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
665 _page_num = self.__notebook.get_current_page() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
666 if _page_num == -1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
667 return |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
668 _page = self.__page_list[_page_num] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
669 if isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
670 # not loading budget |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
671 _page.propagateMessageFrom("change_active", (-1,), (0,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
672 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
673 def _menuitemGoUp(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
674 """_menuitemGoUp(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
675 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
676 action: the action where the event is emitted from |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
677 parameter: None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
678 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
679 Callback to go to up record. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
680 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
681 _page_num = self.__notebook.get_current_page() |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
682 if _page_num != -1: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
683 _page = self.__page_list[_page_num] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
684 if isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
685 # not loading budget |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
686 _active_path = _page.activePathRecord |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
687 if len(_active_path) > 1: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
688 _budget = _page.budget |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
689 _up_path = _active_path[:-1] |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
690 if _budget.hasPath(_up_path): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
691 _page.propagateMessageFrom("change_active", (-1,), |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
692 _up_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
693 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
694 def _menuitemGoPrevious(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
695 """_menuitemGoPrevious(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
696 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
697 action: the action where the event is emitted from |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
698 parameter: None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
699 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
700 Callback to go to previous record. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
701 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
702 _page_num = self.__notebook.get_current_page() |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
703 if _page_num != -1: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
704 _page = self.__page_list[_page_num] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
705 if isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
706 # not loading budget |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
707 _previous_path = _page.previousPathRecord |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
708 if _previous_path is not None: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
709 _budget = _page.budget |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
710 if _budget.hasPath(_previous_path): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
711 _page.propagateMessageFrom("change_active", (-1,), |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
712 _previous_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
713 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
714 def _menuitemGoPosterior(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
715 """_menuitemPosterior(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
716 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
717 action: the action where the event is emitted from |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
718 parameter: None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
719 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
720 Callback to go to posterior record. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
721 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
722 _page_num = self.__notebook.get_current_page() |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
723 if _page_num != -1: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
724 _page = self.__page_list[_page_num] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
725 if isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
726 # not loading budget |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
727 _posterior_path = _page.posteriorPathRecord |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
728 if _posterior_path is not None: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
729 _budget = _page.budget |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
730 if _budget.hasPath(_posterior_path): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
731 _page.propagateMessageFrom("change_active", (-1,), |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
732 _posterior_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
733 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
734 def _delete_event(self, widget, event): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
735 """_delete_event(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
736 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
737 widget: the widget where the event is emitted from |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
738 event: the "Gdk.Event" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
739 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
740 Method connected to "delete_event" signal of main window widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
741 This signal is emitted when a user press the close titlebar button. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
742 It Returns True so the signal "destroy" is emitted. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
743 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
744 for _page in self.__page_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
745 _page.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
746 return False # -> destroy |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
747 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
748 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
749 class FileSelectionWindow(object): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
750 """gui.FileSelectionWindow: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
751 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
752 Description: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
753 Class to show the selection file window |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
754 Constructor: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
755 FileSelectionWindow(mainWindow, readFileMethod, budget, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
756 filename, cancelMethod, filetype) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
757 Ancestry: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
758 +-- object |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
759 +-- FileSelectionWindow |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
760 Atributes: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
761 No public Atributes |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
762 Methods: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
763 No public Methods |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
764 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
765 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
766 def __init__(self, mainWindow, readFileMethod, budget, filename, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
767 cancelMethod, filetype): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
768 """__init__(mainWindow, readFileMethod, budget, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
769 filename, cancelMethod, filetype) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
770 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
771 mainWindow: MainWindow object |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
772 readFileMethod: Method to read the selected file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
773 budget: base.Budget object |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
774 filename: "file" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
775 cancelMethod: Method to cancel the read method |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
776 fileytpe: "budget" or "database". |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
777 Sets the init atributes, creates the file selection window |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
778 Connects the events: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
779 * clicked ok button: _openFile |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
780 * clicked cancel button: destroy window |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
781 * destroy event: _destroy |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
782 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
783 # TODO: Add file filter |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
784 self.__mainWindow = mainWindow |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
785 self.__readFileMethod = readFileMethod |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
786 self.__budget = budget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
787 self.__filetype = filetype |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
788 self.__cancelMethod = cancelMethod |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
789 self.__file = None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
790 self.__filename = filename |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
791 if self.__filename == "": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
792 self.__dialog = Gtk.FileChooserNative.new(_("Open File"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
793 mainWindow.window, Gtk.FileChooserAction.OPEN, _("Open File"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
794 _("Cancel") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
795 self.__dialog.set_current_folder(globalVars.getHomePath("BUDGET")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
796 _response = self.__dialog.run() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
797 if _response in [ Gtk.ResponseType.OK, Gtk.ResponseType.ACCEPT, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
798 Gtk.ResponseType.YES, Gtk.ResponseType.APPLY]: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
799 self._openFile(self.__dialog.get_filename()) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
800 elif _response == Gtk.ResponseType.CANCEL: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
801 self.__dialog.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
802 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
803 self.__dialog = None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
804 self._openFile(self.__filename) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
805 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
806 def _launchProgressWindow(self, file): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
807 """_launchProgressWindow(file) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
808 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
809 Launch the progress window |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
810 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
811 self.__filename = file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
812 _emptyPage = EmptyPage(self.__mainWindow, self.__readFileMethod, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
813 self.__budget, self.__filename, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
814 self.__cancelMethod, self.__filetype) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
815 self.__mainWindow.appendEmptyPage(_emptyPage) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
816 _emptyPage.run() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
817 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
818 def _openFile(self, filename): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
819 """_openFile(filename) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
820 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
821 filename: the filename to open |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
822 If the selected file has a bc3 extension |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
823 _launchProgressWindow is called |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
824 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
825 _file = filename |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
826 if sys.getfilesystemencoding(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
827 _file = _file.decode(sys.getfilesystemencoding()) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
828 self.__file = _file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
829 _filename = os.path.basename(self.__file) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
830 _filename_ext = _filename.split(".")[-1] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
831 if (self.__filetype == "budget" or self.__filetype == "database") and \ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
832 _filename_ext != "bc3" and _filename_ext != "BC3": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
833 print(_("The file must have 'bc3' extension") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
834 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
835 if self.__dialog is not None: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
836 self.__dialog.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
837 # TODO: the file exits? is it not binary?, can it be readed? |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
838 self._launchProgressWindow(self.__file) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
839 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
840 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
841 class EmptyPage(object): |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
842 """gui.EmptyPage: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
843 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
844 Description: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
845 It creates and shows a page in the notebook while a budget is loaded. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
846 The page show the pyarq logo, loading time and a progress bar. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
847 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
848 EmptyPage(mainWindow, readFileMethod, budget, filename, |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
849 cancelMethod, filetype): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
850 mainWindow: Mainwindow object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
851 readFileMethod: Method to read the selected file |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
852 budget: base.Budget object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
853 filename: "file" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
854 cancelMethod: Method to cancel the read method |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
855 filetype: "budget", "database" |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
856 Ancestry: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
857 +-- object |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
858 +-- EmptyPage |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
859 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
860 widget: Read. Main widget showed in the pane |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
861 title: Read. Page Title |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
862 filetype: Read. budget or basedata |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
863 endSuccessfully: Read-Write. False/True |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
864 Methods: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
865 run |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
866 readFile_progress |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
867 readFile_send_message |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
868 readFile_set_statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
869 readFile_end |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
870 readFile_cancel |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
871 stopLoading |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
872 updateGui |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
873 threadFinishedSignal |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
874 threadCanceled |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
875 on_close_button |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
876 close |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
877 clear |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
878 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
879 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
880 def __init__(self, mainWindow, readFileMethod, budget, filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
881 cancelMethod, filetype): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
882 """__init__(mainWindow, readFileMethod, budget, filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
883 cancelMethod, filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
884 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
885 mainWindow: Mainwindow object |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
886 readFileMethod: Method to read the selected file |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
887 budget: base.Budget object |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
888 filename: "file" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
889 cancelMethod: Method to cancel the read method |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
890 filetype: "budget" or "database" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
891 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
892 self.__mainWindow: Mainwindow object |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
893 self.endSuccessfully False/True |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
894 self.__readFileMethod: Method to read the selected file |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
895 self.__budget: base.Budget object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
896 self.__filename: "file" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
897 self.__cancelMethod: Method to cancel the read method |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
898 self.__filetype: "budget" or "database" |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
899 self.__children: the read thread |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
900 self.__progress: 0 to 1 progress |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
901 self.__statistics: record statistics |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
902 self.__widget: main widget, a vertial Gtk.Grid object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
903 self.__main_item: None |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
904 self.__throbber: Gtk.Spinner() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
905 self.__budget_icon: Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
906 self.__title: a horizontal Gtk.Grid |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
907 self.__statusbar: a Gtk.Statusbar |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
908 self.__statuscontext: the statusbar context |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
909 self.__progress_bar: a Gtk.ProgressBar |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
910 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
911 self.__mainWindow = mainWindow |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
912 self.endSuccessfully = False |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
913 self.__readFileMethod = readFileMethod |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
914 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
915 self.__filename = filename |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
916 self.__filetype = filetype |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
917 self.__cancelMethod = cancelMethod |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
918 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
919 self.__cancel = [False, False] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
920 self.__progress = 0.0 |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
921 self.__statistics = None |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
922 self.__widget = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
923 self.__widget.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
924 self.__main_item = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
925 self.__widget.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
926 # Throbber |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
927 self.__throbber = Gtk.Spinner() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
928 self.__throbber.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
929 self.__budget_icon = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
930 _budget_pixbuf = GdkPixbuf.Pixbuf.new_from_file( |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
931 globalVars.getAppPath("BUDGET-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
932 self.__budget_icon.set_from_pixbuf(_budget_pixbuf) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
933 _filename = os.path.basename(filename) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
934 _rootfilename = os.path.splitext(_filename)[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
935 if not _rootfilename == "": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
936 _filename = _rootfilename |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
937 if len(_filename) > 28: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
938 _titleLabel = Gtk.Label(_filename[:25] + "...") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
939 _titleLabel.set_tooltip_text(_filename) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
940 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
941 _titleLabel = Gtk.Label(_filename) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
942 _titleLabel.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
943 self.__title = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
944 self.__title.set_column_spacing(4) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
945 self.__title.set_orientation(Gtk.Orientation(0)) # 0 Horizontal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
946 self.__title.add(self.__budget_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
947 self.__title.add(self.__throbber) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
948 self.__title.add(_titleLabel) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
949 # Close tab |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
950 _gtk_image = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
951 _gtk__pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
952 "window-close-symbolic", 16, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
953 _gtk_image.set_from_pixbuf(_gtk__pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
954 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
955 self.closeTabButton = Gtk.ToolButton.new(_gtk_image , _("_Close tab")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
956 self.closeTabButton.set_tooltip_text(_("Close tab")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
957 self.closeTabButton.set_is_important(False) # label not shown |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
958 self.__title.add(self.closeTabButton) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
959 self.closeTabButton.hide() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
960 self.__closeTabId = self.closeTabButton.connect("clicked", self.on_close_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
961 # Statusbar |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
962 self.__statusbar = Gtk.Statusbar() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
963 self.__statuscontext = self.__statusbar.get_context_id("Statusbar") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
964 self.__statusbar.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
965 _iconVbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
966 _iconVbox.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
967 _iconVbox.props.halign = Gtk.Align(3) # 3 Center |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
968 _iconVbox.props.valign = Gtk.Align(3) # 3 Center |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
969 _iconVbox.set_property("expand", True) # widget expand all space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
970 _pyArqIcon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
971 _pyArqIcon.set_from_file(globalVars.getAppPath("PYARQ-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
972 _pyArqIcon.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
973 _iconVbox.add(_pyArqIcon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
974 _link = Gtk.LinkButton.new("http://pyarq.obraencurso.es") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
975 _iconVbox.add(_link) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
976 _link.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
977 _iconVbox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
978 self.__widget.add(_iconVbox) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
979 self.__progress_bar = Gtk.ProgressBar() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
980 self.__progress_bar.set_show_text(True) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
981 self.__progress_bar.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
982 self.__statusbar.pack_start(self.__progress_bar, False, False, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
983 self.__widget.add(self.__statusbar) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
984 self.__main_item = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
985 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
986 def run(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
987 """run() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
988 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
989 Launch clildren and timeouts |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
990 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
991 self.__statusbar.push(self.__statuscontext, _("Time: 0s")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
992 self.__throbber.start() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
993 self._launchChildren() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
994 self._launchTimeout() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
995 |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
996 def readFile_progress(self, percent): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
997 """readFile_progress(percent) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
998 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
999 percent: Percentage executed. |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1000 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1001 Sets progress |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1002 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1003 _progress = str(int(round(100 * percent,0))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1004 self.__progress = percent |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1005 |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1006 def readFile_send_message(self, message): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1007 """readFile_send_message(message) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1008 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1009 message: mesage from readFile method |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1010 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1011 print( message ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1012 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1013 print( message ) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1014 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1015 def readFile_set_statistics(self, statistics): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1016 """readFile_set_statistics(statistics) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1017 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1018 statistics: record statistics from readFile method |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1019 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1020 sets record statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1021 """ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1022 self.__statistics = statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1023 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1024 def readFile_end(self): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1025 """readFile_end() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1026 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1027 The readFile method end successfully |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1028 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1029 self.endSuccessfully = True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1030 print( self.__statistics.str() ) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1031 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1032 def readFile_cancel(self): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1033 """readFile_cancel() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1034 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1035 The readFile method is canceled |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1036 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1037 self.endSuccessfully = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1038 print(_("Process terminated") ) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1039 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1040 def stopLoading(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1041 """stopLoading() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1042 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1043 Stop progressbar |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1044 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1045 self.__throbber.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1046 self.__budget_icon.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1047 self.__progress_bar.hide() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1048 self.__statusbar.pop(self.__statuscontext) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1049 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1050 def _launchChildren(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1051 """_launchChildren() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1052 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1053 Launch the thread to read the file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1054 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1055 if self.__children is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1056 self.__children = importFiebdc.Thread(self, self.__mainWindow, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1057 self.__readFileMethod, self.__budget, self.__filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
1058 self.__cancelMethod, self.__filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1059 self.__children.start() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1060 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1061 def _launchTimeout(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1062 """_launchTimeout() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1063 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1064 Launch the timeouts: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1065 1- update progress bar |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1066 2- update time label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1067 3- If the other timetouts are stoped the window is closed |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1068 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1069 GLib.timeout_add(1000, self._updateLabel, time.time()) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1070 GLib.timeout_add(500, self._updateProgressBar) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1071 self.__cancel = [False, False] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1072 GLib.timeout_add(1000, self._autoClose) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1073 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1074 def updateGui(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1075 while Gtk.events_pending(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1076 Gtk.main_iteration() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1077 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1078 def _updateProgressBar(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1079 """_updateProgressBar() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1080 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1081 update progress bar in a timeout |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1082 If the thread end or is canceled the timeout is stoped |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1083 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1084 if self.__children is None or self.__children.isCanceled() == True: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1085 self.__cancel[0] = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1086 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1087 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1088 self.__progress_bar.set_fraction(self.__progress) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1089 _text = "%s%%" %str(int(round(100 * self.__progress,0))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1090 self.__progress_bar.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1091 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1092 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1093 def _updateLabel(self, _time): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1094 """_updateLabel(_time) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1095 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1096 update time label in a timeout |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1097 If the thread end or is canceled the timeout is stoped |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1098 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1099 if self.__children is None or self.__children.isCanceled() == True: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1100 self.__cancel[1] = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1101 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1102 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1103 _time = time.time() - _time |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1104 _text = utils.mapping(_("Time: $1"), ("%.0f" %_time,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1105 self.__statusbar.pop(self.__statuscontext) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1106 self.__statusbar.push(self.__statuscontext, _text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1107 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1108 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1109 def _autoClose(self): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1110 """_autoClose() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1111 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1112 If the time label and progress bar timeouts are stoped the window is |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1113 closed and ist tiemeout is stoped |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1114 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1115 #_autoClose timeout do nothig |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1116 if self.__cancel == [ True, True ]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1117 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1118 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1119 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1120 |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1121 def threadFinishedSignal(self, budget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1122 """threadFinishedSignal(budget) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1123 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1124 Sets the self.__children to None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1125 This causes that the timeouts is ended. |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1126 This method is called from thread when it finish |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1127 """ |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1128 self.__budget = budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1129 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1130 self.stopLoading() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1131 _page = Page(self.__mainWindow, self.__budget, self.closeTabButton) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1132 _children = self.__widget.get_children() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1133 for _child in _children: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1134 self.__widget.remove(_child) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1135 self.__widget.add(_page.widget) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1136 self.closeTabButton.disconnect(self.__closeTabId) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1137 self.closeTabButton.connect("clicked", _page.on_close_button) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1138 self.__mainWindow.updatePage(self, _page) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1139 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1140 def threadCanceled(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1141 """threadCanceled() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1142 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1143 Sets the __children atribute to None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1144 This causes that the timeouts is ended. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1145 This method is called from thread when is canceled |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1146 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1147 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1148 self.stopLoading() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1149 self.__mainWindow.closePage(self) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1150 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1151 def on_close_button(self, widget): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1152 """on_close_button() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1153 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1154 Call close |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1155 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1156 self.close() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1157 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1158 def close(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1159 """close() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1160 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1161 Close page canceling children |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1162 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1163 self.__children.cancel() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1164 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1165 def clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1166 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1167 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1168 Nothig to do now |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1169 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1170 pass |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1171 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1172 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1173 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1174 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1175 Return de main widget to show in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1176 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1177 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1178 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1179 def _getTitle(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1180 """_getTitle() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1181 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1182 Return the title of the page, a Gtk.Label objetc |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1183 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1184 return self.__title |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1185 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1186 def _getFiletype(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1187 """_getFiletipe() |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1188 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1189 Return the title of the page, a Gtk.Label objetc |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1190 """ |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1191 return self.__filetype |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1192 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1193 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1194 "Main widget showed in the pane") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1195 title = property(_getTitle, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1196 "Page Title") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1197 filetype = property(_getFiletype, None, None, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1198 "Filetype: budget or basedata") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1199 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1200 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1201 class Page(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1202 """gui.Page: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1203 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1204 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1205 It creates and shows a page in the notebook from a budget object. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1206 The page can show the budget information in several panes ordered |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1207 according to "panes_list" information. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1208 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1209 Page(mainWindow, budget, closeTabButton, active_code=None) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1210 mainwindow: MainWindow object |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1211 budget: base.Budget object |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1212 closeTabButton. button winget to close tab |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1213 active_code: Active record code |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1214 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1215 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1216 +-- Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1217 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1218 widget: Read. Notebook page Widget. (a vertical Gtk.Grid instance) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1219 budget: Read-Write. Budget to show in the page. (base.obra object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1220 panes_list: Read. info list for create the panes |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1221 ej: [ "v", pane1, pane2 ] , [ "h", pane1, pane2 ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1222 [ "v", [ "h", pane1, pane2 ], [ "h", pane1, pane2 ] ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1223 pane types: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1224 * "DecompositionList": its creates a "DecompositionList" object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1225 * "RecordDescription" : its creates a "Description" objetc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1226 * "Measure": its creates a "Measure" objetc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1227 * "FileView": its creates a "FileView" objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1228 * "CompanyView": its creates a "CompanyView" object |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1229 title: Read. Notebook page title (Gtk.Label object) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1230 activePathRecord: Read. The active path record |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1231 previousPathRecord: Read. The previous path record |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1232 posteriorPathRecord Read. The posterior path record |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1233 back_menu: back menu to show in menutoolbutton |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1234 forward_menu: forward menu to show in menutoolbutton |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1235 Methods: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1236 propagateMessageFrom |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1237 sendMessageTo |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1238 on_close_button |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1239 close |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1240 clear |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1241 getItem |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1242 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1243 # TODO: * The panes can be ordered as the user wishes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1244 # TODO: * Panes in windows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1245 # TODO: * pane types |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1246 # TODO: * General budget properties (is better a dialog?) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1247 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1248 def __init__(self, mainWindow, budget, closeTabButton, path_record=None): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1249 """__init__(mainWindow, budget, closeTabButton, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1250 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1251 mainWindow: MainWindow object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1252 budget: "base.Budget" object |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1253 closeTabButton: Button widget to close tab |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1254 path_record: the active path record |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1255 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1256 self.__mainWindow: MainWindow object |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1257 self.__widget: a Gtk.Grid |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1258 self.__panes_list: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1259 self.__main_item: Main item in Page. (Paned object or View object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1260 self.closeTabButton: : Button widget to close tab |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1261 self.__active_path_record: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1262 self.__history_back: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1263 self.__history_forward: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1264 self.__back_menu: a Gtk.Menu |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1265 self.__forward_menu: a Gtk.Menu |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1266 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1267 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1268 path_record = (0,) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1269 self.__mainWindow = mainWindow |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1270 self.closeTabButton = closeTabButton |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1271 self.__widget = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1272 self.__widget.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1273 self.__widget.props.margin = 5 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1274 #TODO: __panes_list should come from gui config file... |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1275 # "DecompositionList" "RecordDescription" "Measure" "Sheet of Conditions" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1276 # "FileView" "CompanyView" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1277 self.__panes_list = [ "v", "DecompositionList", [ "v", "Measure", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1278 "RecordDescription" ]] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1279 self.__main_item = None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1280 self.__active_path_record = () |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1281 self.__history_back = [] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1282 self.__history_forward = [] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1283 self.__back_menu = Gtk.Menu() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1284 self.__back_menu.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1285 self.__forward_menu = Gtk.Menu() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1286 self.__forward_menu.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1287 self.budget = budget # Create all items and widgets |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1288 self._setActivePathRecord(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1289 self.__widget.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1290 self.__budget_icon = GdkPixbuf.Pixbuf.new_from_file( |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1291 globalVars.getAppPath("BUDGET-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1292 self.__chapter_icon = GdkPixbuf.Pixbuf.new_from_file( |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1293 globalVars.getAppPath("CHAPTER-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1294 self.__unit_icon = GdkPixbuf.Pixbuf.new_from_file( |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1295 globalVars.getAppPath("UNIT-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1296 self.__material_icon = GdkPixbuf.Pixbuf.new_from_file( |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1297 globalVars.getAppPath("MATERIAL-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1298 self.__machinery_icon = GdkPixbuf.Pixbuf.new_from_file( |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1299 globalVars.getAppPath("MACHINERY-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1300 self.__labourforce_icon = GdkPixbuf.Pixbuf.new_from_file( |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1301 globalVars.getAppPath("LABOURFORCE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1302 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1303 def propagateMessageFrom(self, message, pane_path, arg=None): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1304 """propagateMessageFrom(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1305 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1306 message: string message |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1307 * "change_active": change active code |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1308 * "autoclose" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1309 * "split h" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1310 * "split v" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1311 pane_path: tuple that represents the pane path which emits the message |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1312 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1313 if message is "change_active" arg is the path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1314 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1315 The panes are connectted to this method to send messages to other panes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1316 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1317 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1318 if message == "change_active" and _budget.hasPath(arg): |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1319 self.sendMessageTo(self.__main_item, message, pane_path, arg) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1320 self._setActivePathRecord(arg) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1321 self.__mainWindow.changeActiveSignal() # Check sensitive buttons |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1322 elif message == "autoclose": |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1323 self._closeItem(pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1324 elif message == "split h": |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1325 self._splitItem(pane_path, "h") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1326 elif message == "split v": |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1327 self._splitItem(pane_path, "v") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1328 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1329 def sendMessageTo(self, pane, message, pane_path, arg=None): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1330 """sendMessageTo(pane, message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1331 pane: the receiver pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1332 message: string message |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1333 pane_path: tuple that represents the pane pane_path which emits the message |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1334 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1335 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1336 Sends a message to a pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1337 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1338 pane.runMessage(message, pane_path, arg) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1339 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1340 def on_close_button(self, widget): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1341 self.close() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1342 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1343 def close(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1344 """close() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1345 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1346 Close Page |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1347 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1348 self.__mainWindow.closePage(self) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1349 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1350 def clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1351 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1352 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1353 Clear atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1354 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1355 self.propagateMessageFrom("clear", (0,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1356 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1357 del self.__panes_list |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1358 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1359 del self.__title |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1360 del self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1361 del self.__main_item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1362 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1363 def getItem(self, pane_path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1364 """getItem(pane_path) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1365 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1366 Return the item whith the path "pane_path", it can return a Paned |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1367 instance or a View instance |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1368 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1369 _item = self.__main_item |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1370 if len(pane_path) == 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1371 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1372 else: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1373 return _item.getItem(pane_path[1:]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1374 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1375 def _setMainItem(self, item): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1376 """_setMainItem(item) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1377 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1378 Sets a new main item in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1379 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1380 if not self.__main_item is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1381 _old_main_widget = self.__main_item.widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1382 self.__widget.remove(_old_main_widget) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1383 self.__main_item = item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1384 _main_widget = self.__main_item.widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1385 _main_widget.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1386 self.__widget.add(_main_widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1387 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1388 def _splitItem(self, pane_path, orientation): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1389 """_splitItem(pane_path, orientation) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1390 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1391 Splits the item that is identifies by the pane_path and the orientation |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1392 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1393 _item = self.getItem(pane_path) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1394 _item.pane_path = pane_path + (0,) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1395 _item_clone0 = _item.getClone(pane_path + (0,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1396 _item_clone1 = _item.getClone(pane_path + (1,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1397 _paned = Paned(orientation, pane_path, _item_clone0, _item_clone1) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1398 if len(pane_path) > 1: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1399 _parent = self.getItem(pane_path[:-1]) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1400 _parent.setItem(pane_path[-1], [_paned]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1401 else: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1402 self._setMainItem(_paned) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1403 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1404 def _closeItem(self, pane_path): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1405 """_closeItem(pane_path) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1406 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1407 Closes the item that is identifies by the pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1408 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1409 _item = self.getItem(pane_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1410 if len(pane_path) > 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1411 # There are more than one item |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1412 _parent = self.getItem(pane_path[:-1]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1413 _brothers = [ _brother for _brother in _parent] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1414 _brothers.remove(_item) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1415 _brother = _brothers[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1416 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1417 _parent.widget.remove(_brother.widget) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1418 _brother.pane_path = pane_path[:-1] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1419 if len(pane_path) > 2: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1420 _grandparent = self.getItem(pane_path[:-2]) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1421 _grandparent.setItem(pane_path[-2], [_brother]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1422 _parent.widget.destroy() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1423 _parent.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1424 _item.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1425 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1426 _grandparent = self |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1427 _grandparent._setMainItem(_brother) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1428 _parent.widget.destroy() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1429 _parent.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1430 _item.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1431 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1432 # Thre is only one item in the page, it can not be closed |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1433 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1434 |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1435 def _itemsFactory(self, list_paned, pane_path=None): |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1436 """_itemsFactory(list_paned, pane_path=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1437 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1438 list_paned: list in "__panes_list" format |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1439 [ "v" or "h", panel1_type, panel2_type] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1440 which contains the info for create the widgets. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1441 panel types: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1442 * "DecompositionList" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1443 * "RecordDescription" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1444 * "Measure" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1445 * "Sheet of Conditions" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1446 * "FileView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1447 * "CompanyView" |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1448 pane_path: tuple that represents the item path in the page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1449 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1450 Creates the items and widgets and returns the main item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1451 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1452 if pane_path is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1453 pane_path = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1454 if not isinstance(list_paned , list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1455 raise ValueError( _("The value must be a list") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1456 if list_paned[0] == "v" or list_paned[0] == "h": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1457 if len(list_paned) != 3: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1458 raise ValueError( _("Incorrect len") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1459 if not isinstance(list_paned[1],list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1460 list_paned[1] = [list_paned[1]] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1461 if not isinstance(list_paned[2],list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1462 list_paned[2] = [list_paned[2]] |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1463 _item1 = self._itemsFactory(list_paned[1],pane_path + (0,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1464 _item2 = self._itemsFactory(list_paned[2],pane_path + (1,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1465 _item = Paned(list_paned[0], pane_path, _item1, _item2) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1466 elif list_paned[0] == "DecompositionList": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1467 _item = View( "DecompositionList", self.__budget, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1468 weakref.ref(self), pane_path, self.__active_path_record, True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1469 elif list_paned[0] == "RecordDescription": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1470 _item = View( "RecordDescription", self.__budget,weakref.ref(self), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1471 pane_path, self.__active_path_record, True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1472 elif list_paned[0] == "Measure": |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1473 _item = View( "Measure", self.__budget, weakref.ref(self), pane_path, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1474 self.__active_path_record, True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1475 elif list_paned[0] == "Sheet of Conditions": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1476 _item = View("Sheet of Conditions", self.__budget, weakref.ref(self), pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1477 self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1478 elif list_paned[0] == "FileView": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1479 _item = View("FileView", self.__budget, weakref.ref(self), pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1480 self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1481 elif list_paned[0] == "CompanyView": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1482 _item = View("CompanyView", self.__budget, weakref.ref(self), pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1483 self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1484 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1485 _item = None |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1486 raise ValueError( utils.mapping(_("Incorrect item $1"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1487 (str(list_paned[0]),)) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1488 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1489 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1490 def _setActivePathRecord(self, path_record): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1491 """_setActivePathRecord(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1492 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1493 path_record: the active record path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1494 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1495 Sets the active record path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1496 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1497 if path_record != self.__active_path_record: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1498 if self.__budget.hasPath(path_record): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1499 self.__active_path_record = path_record |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1500 self._appendHistory(path_record) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1501 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1502 raise ValueError( utils.mapping(_("The budget does not have "\ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1503 "the path record: $1"), (str(path_record),)) ) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1504 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1505 def _appendHistory(self, path): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1506 """_appendHistory(path)) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1507 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1508 path: the new active path record |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1509 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1510 Append the new active path record to history lists and update menus |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1511 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1512 if len(self.__history_back) > 1 and path in self.__history_back[:-1]: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1513 # the new active record is in back history list |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1514 # then append forward history and pop back history |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1515 _items_num = len(self.__history_back) - \ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1516 self.__history_back.index(path) -1 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1517 for _item in range(_items_num): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1518 _record_path = self.__history_back.pop() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1519 _first_menuitem = self.__back_menu.get_children()[0] |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1520 self.__back_menu.remove(_first_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1521 self.__history_forward.append(_record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1522 _menuitem = self._menuItemFactory(_record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1523 _menuitem.connect_object("activate", self._menuHistoryForward, |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1524 _record_path, _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1525 self.__forward_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1526 while len(self.__history_forward) > 100: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1527 # list too long |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1528 self.__history_forward.pop(0) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1529 _last_menuitem = self.__forward_menu.get_children()[-1] |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1530 self.__forward_menu.remove(_last_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1531 else: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1532 # the new active record not is in back history list |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1533 if len(self.__history_forward) > 1 and \ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1534 path in self.__history_forward: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1535 # the new active record is in history forward list |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1536 # then append back history and pop forward history |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1537 _items_num = len(self.__history_forward) - \ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1538 self.__history_forward.index(path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1539 for _item in range(_items_num): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1540 _record_path = self.__history_forward.pop() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1541 _first_menuitem = self.__forward_menu.get_children()[0] |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1542 self.__forward_menu.remove(_first_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1543 self.__history_back.append(_record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1544 if len(self.__history_back) > 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1545 _menuitem = self._menuItemFactory( |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1546 self.__history_back[-2]) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1547 _menuitem.connect_object("activate", |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1548 self._menuHistoryBack, self.__history_back[-2], |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1549 _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1550 self.__back_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1551 else: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1552 # the new active record not is in history forward list |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1553 # then append back history and clear forward history |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1554 self.__history_forward[:] = [] |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1555 for _child in self.__forward_menu.get_children(): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1556 self.__forward_menu.remove(_child) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1557 self.__history_back.append(path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1558 if len(self.__history_back) > 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1559 _menuitem = self._menuItemFactory(self.__history_back[-2]) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1560 _menuitem.connect_object("activate", self._menuHistoryBack, |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1561 self.__history_back[-2], _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1562 self.__back_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1563 while len(self.__history_back) > 100: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1564 # list too long |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1565 self.__history_back.pop(0) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1566 _last_menuitem = self.__back_menu.get_children()[-1] |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1567 self.__back_menu.remove(_last_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1568 self.__mainWindow.changeHistorySignal() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1569 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1570 def _getImage(self, record): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1571 """_getImage(record) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1572 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1573 record: record object |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1574 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1575 Returns an image depending on the type of record |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1576 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1577 _hierarchy = record.recordType.hierarchy |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1578 _type = record.recordType.type |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1579 _subtype = record.recordType.subtype |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1580 if _hierarchy == 0: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1581 _icon = self.__budget_icon |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1582 elif _hierarchy == 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1583 _icon = self.__chapter_icon |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1584 else: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1585 if _type == 0: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1586 _icon = self.__unit_icon |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1587 elif _type == 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1588 _icon = self.__labourforce_icon |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1589 elif _type == 2: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1590 _icon = self.__machinery_icon |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1591 else: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1592 _icon = self.__material_icon |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1593 _image = Gtk.Image() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1594 _image.set_from_pixbuf(_icon) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1595 return _image |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1596 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1597 def _menuFactory(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1598 """_menuFactory() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1599 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1600 record: record object |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1601 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1602 Creates menus for history back an history forward tool buttons |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1603 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1604 # Back Menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1605 # clear menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1606 for _child in self.__back_menu.get_children(): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1607 self.__back_menu.remove(_child) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1608 # pupulate menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1609 if len(self.__history_back) > 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1610 for _record_path in self.__history_back[:-1]: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1611 _menuitem = self._menuItemFactory(_record_path) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1612 _menuitem.connect("activate", self._menuHistoryBack, |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1613 _record_path, _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1614 self.__back_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1615 # Forward Menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1616 # clear menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1617 for _child in self.__forward_menu.get_children(): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1618 self.__forward_menu.remove(_child) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1619 # pupulate menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1620 if len(self.__history_forward) > 0: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1621 for _record_path in self.__history_forward[:]: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1622 _menuitem = self._menuItemFactory(_record_path) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1623 _menuitem.connect("activate", self._menuHistoryForward, |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1624 _record_path, _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1625 self.__forward_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1626 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1627 def _menuItemFactory(self, record_path): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1628 """_menuItemFactory(record_path): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1629 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1630 record_path: record path |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1631 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1632 Creates and return a menuItem to go to the record |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1633 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1634 _code = self.budget.getCode(record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1635 _record = self.budget.getRecord(_code) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1636 _summary = _record.summary |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1637 _text = _code.decode("utf8") + " " + _summary.decode("utf8") |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1638 if len(_text) > 30: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1639 _text = _text[:27] + "..." |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1640 _icon = self._getImage(_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1641 _grid = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1642 _grid.set_orientation(Gtk.Orientation(0)) # 0 Horizontal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1643 _grid.set_column_spacing(6) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1644 _label = Gtk.Label(_text) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1645 _menuitem = Gtk.MenuItem.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1646 _grid.add(_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1647 _grid.add(_label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1648 _menuitem.add(_grid) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1649 _menuitem.show_all() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1650 return _menuitem |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1651 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1652 def _menuHistoryBack(self, record_path, menu_item): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1653 """_menuHistoryBack(record_path, menu_item) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1654 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1655 Go to the record selected in History Back menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1656 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1657 if self.budget.hasPath(record_path): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1658 self.propagateMessageFrom("change_active", (-1,), record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1659 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1660 def _menuHistoryForward(self, record_path, menu_item): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1661 """_menuHistoryForward(record_path, menu_item) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1662 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1663 Go to the record selected in History Forward menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1664 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1665 if self.budget.hasPath(record_path): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1666 self.propagateMessageFrom("change_active", (-1,), record_path) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1667 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1668 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1669 """_getActivePathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1670 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1671 Return the Active Path Record |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1672 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1673 return self.__active_path_record |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1674 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1675 def _getPreviousPathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1676 """_getPreviousPathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1677 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1678 Return the Previous Path Record |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1679 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1680 if len(self.__history_back) > 1: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1681 return self.__history_back[-2] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1682 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1683 return None |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1684 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1685 def _getPosteriorPathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1686 """_getPosteriorPathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1687 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1688 Return the Posterior Path Record |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1689 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1690 if len(self.__history_forward) > 0: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1691 return self.__history_forward[-1] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1692 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1693 return None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1694 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1695 def _getBackMenu(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1696 """_getBackMenu() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1697 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1698 Return the Back Menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1699 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1700 return self.__back_menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1701 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1702 def _getForwardMenu(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1703 """_getForwardMenu() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1704 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1705 Return the Forward Menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1706 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1707 return self.__forward_menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1708 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1709 def _getTitle(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1710 """_getTitle() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1711 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1712 Return the page title, a Gtk.Label objetc |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1713 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1714 return self.__title |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1715 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1716 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1717 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1718 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1719 Return de main widget to show in the pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1720 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1721 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1722 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1723 def _setBudget(self, budget): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1724 """_setBudget(budget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1725 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1726 budget: a base.Budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1727 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1728 Sets the budget and the active code atributes, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1729 creates the page title and the widgets in the pane and |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1730 shows the main widget. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1731 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1732 if budget is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1733 self.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1734 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1735 self.__budget = budget |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1736 self._setActivePathRecord((0,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1737 # Todo: change page title |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1738 self.__title = Gtk.Label(self.__budget.getCode( |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1739 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1740 _panes_list = self.__panes_list |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1741 self.__main_item = self._itemsFactory(_panes_list) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1742 _main_widget = self.__main_item.widget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1743 _main_widget.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1744 self.__widget.add(_main_widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1745 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1746 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1747 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1748 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1749 Return de budget, a "base.Budget" object. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1750 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1751 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1752 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1753 def _getPanesList(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1754 """_getPanesList() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1755 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1756 Return the panes list, info list for create the panes. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1757 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1758 return self.__panes_list |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1759 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1760 budget = property(_getBudget, _setBudget, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1761 "Budget to show, base.Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1762 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1763 "Main widget showed in the pane") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1764 title = property(_getTitle, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1765 "Page Title") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1766 panes_list = property(_getPanesList, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1767 "Info list for create the panes") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1768 activePathRecord = property(_getActivePathRecord, None, None, |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1769 "Active Path Record") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1770 previousPathRecord = property(_getPreviousPathRecord, None, None, |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1771 "Previous Active Path Record") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1772 posteriorPathRecord = property(_getPosteriorPathRecord, None, None, |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1773 "Posterior Active Path Record") |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1774 back_menu = property(_getBackMenu, None, None, |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1775 "Back Menu") |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1776 forward_menu = property(_getForwardMenu, None, None, |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1777 "Forward Menu") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1778 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1779 class View(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1780 """gui.View: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1781 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1782 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1783 It creates a view to show the budget info |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1784 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1785 View(view_type, budget, wr_page, pane_path, active_path_record, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1786 connected) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1787 view_type: the object type to show |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1788 * DecompositionList |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1789 * Description |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1790 * Measure |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1791 * Sheet |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1792 * FileView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1793 * CompanyView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1794 budget: the budget to show |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1795 wr_page: weak reference to the page where the view must be showed |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1796 pane_path: the position or path of the view in the page notebook |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1797 active_path_record: the record path that must be showed |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1798 connected: boolean value, True means that the View object sends |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1799 and receives signals from/to others views. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1800 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1801 +-- object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1802 +-- View |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1803 Atributes: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1804 pane_path: Read-Write. The tuple that identifies the view in the main |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1805 notebook page |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1806 widget: Read. the main Gtk widget to show in a view object, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1807 a Gtk.Grid object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1808 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1809 getItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1810 propagateMessgeFrom |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1811 runMessage |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1812 getClone |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1813 clear |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1814 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1815 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1816 def __init__(self, view_type, budget, wr_page, pane_path, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1817 active_path_record, connected=True): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1818 """__init__(view_type, budget, wr_page, pane_path, active_path_record, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1819 connected ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1820 view_type: the object type to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1821 * DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1822 * Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1823 * Measure |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1824 * Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1825 * FileView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1826 * CompanyView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1827 budget: the budget to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1828 wr_page: weak reference to the page where the view must be showed |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1829 pane_path: the position or path of the view in the page notebook |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1830 active_path_record: the record path that must be showed |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1831 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1832 self.__view_type: the object type to show |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1833 * DecompositionList |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1834 * Description |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1835 * Measure |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1836 * Sheet of conditions |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1837 * FileView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1838 * CompanyView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1839 self.__wr_page: weak reference to the page where the view must be |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1840 showed |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1841 self.__budget: the budget to show |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1842 self.__pane_path: the position or path of the view in the page notebook |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1843 self.__connected: boolean value, True means that the View object sends |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1844 and receives signals from/to others views |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1845 self.__widget: main widget. a Gtk.Grid |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1846 self.__view: the object to show: |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1847 * DecompositionList object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1848 * Description object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1849 * Measure object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1850 * Sheet object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1851 * FileView object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1852 * Comapany View |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1853 self.__connected_button: a button to switch self.__connected True or |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1854 False |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1855 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1856 Creates and shows a new view |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1857 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1858 self.__view_type = view_type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1859 self.__wr_page = wr_page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1860 self.__budget = budget |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1861 self.__pane_path = pane_path |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1862 self.__connected = connected |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1863 # view_type liststore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1864 _liststore = Gtk.ListStore(str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1865 _liststore.append([_("Decomposition")]) #0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1866 _liststore.append([_("Description")]) #1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1867 _liststore.append([_("Measure")]) #2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1868 _liststore.append([_("Sheet of Conditions")]) #3 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1869 _liststore.append([_("Files")]) #4 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1870 _liststore.append([_("Companies")]) #5 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1871 _combobox = Gtk.ComboBox.new_with_model(_liststore) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1872 _cell = Gtk.CellRendererText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1873 _combobox.pack_start(_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1874 _combobox.add_attribute(_cell, 'text', 0) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1875 self.__widget = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1876 self.__widget.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1877 _hbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1878 _hbox.set_orientation(Gtk.Orientation(0)) # 0 Horizontal |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1879 if view_type == "DecompositionList": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1880 self.__view = DecompositionList(budget, weakref.ref(self), |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1881 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1882 _combobox.set_active(0) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1883 _view_icon = Gtk.Image() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1884 _view_icon.set_from_file(globalVars.getAppPath( |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1885 "DECOMPOSITION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1886 elif view_type == "RecordDescription": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1887 self.__view = Description(budget, weakref.ref(self), |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1888 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1889 _combobox.set_active(1) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1890 _view_icon = Gtk.Image() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1891 _view_icon.set_from_file(globalVars.getAppPath( |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1892 "DESCRIPTION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1893 elif view_type == "Measure": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1894 self.__view = Measure(budget, weakref.ref(self), |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1895 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1896 _combobox.set_active(2) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1897 _view_icon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1898 _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1899 elif view_type == "Sheet of Conditions": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1900 self.__view = Sheet(budget, weakref.ref(self), |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1901 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1902 _combobox.set_active(3) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1903 _view_icon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1904 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1905 elif view_type == "FileView": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1906 self.__view = FileView(budget, weakref.ref(self), |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1907 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1908 _combobox.set_active(4) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1909 _view_icon = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1910 _view_icon.set_from_file(globalVars.getAppPath("FILEVIEW-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1911 elif view_type == "CompanyView": |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1912 self.__view = CompanyView(budget, weakref.ref(self), pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1913 active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1914 _combobox.set_active(5) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1915 _view_icon = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1916 _view_icon.set_from_file(globalVars.getAppPath("COMPANY-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1917 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1918 raise ValueError( _(utils.mapping("Invalid type of View: $1", |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1919 view_type)) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1920 _view_icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1921 _combobox.connect("changed", self._change_combo) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1922 _combobox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1923 self.__widget.add(_hbox) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1924 self.__widget.add(self.__view.widget) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1925 _hbox.add(_view_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1926 _hbox.add(_combobox) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1927 _invisible = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1928 _invisible.set_orientation(Gtk.Orientation(0)) # 0 Horizontal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1929 _invisible.set_property("hexpand", True) # widget expand horizontal space |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1930 _invisible.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1931 _hbox.add(_invisible) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1932 # TODO : Set thist with config |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1933 add_menu = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1934 if add_menu: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1935 _icon_menu = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1936 _icon_menu.set_from_file(globalVars.getAppPath("MENU-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1937 _icon_menu.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1938 _menu_button = Gtk.ToolButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1939 _menu_button.set_icon_widget(_icon_menu) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1940 _menu_button.connect("clicked", self._menu_view) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1941 _menu_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1942 _hbox.add(_menu_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1943 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1944 _icon_horizontal = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1945 _icon_horizontal.set_from_file(globalVars.getAppPath("HORIZONTAL")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1946 _icon_horizontal.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1947 _horizontal_button = Gtk.ToolButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1948 _horizontal_button.set_icon_widget(_icon_horizontal) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1949 _horizontal_button.connect("clicked", self._split_view, "h") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1950 _horizontal_button.set_tooltip_text(_("Split View Left/Right")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1951 _horizontal_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1952 _hbox.add(_horizontal_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1953 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1954 _icon_vertical = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1955 _icon_vertical.set_from_file(globalVars.getAppPath("VERTICAL")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1956 _icon_vertical.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1957 _vertical_button = Gtk.ToolButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1958 _vertical_button.set_icon_widget(_icon_vertical) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1959 _vertical_button.connect("clicked", self._split_view, "v") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1960 _vertical_button.set_tooltip_text(_("Split View Top/Bottom")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1961 _vertical_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1962 _hbox.add(_vertical_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1963 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1964 self.__connected_button = Gtk.ToolButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1965 _icon_connected = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1966 if self.__connected: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1967 _icon_connected.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1968 self.__connected_button.set_tooltip_text(_("Disconnect view")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1969 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1970 _icon_connected.set_from_file(globalVars.getAppPath("DISCONNECTED-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1971 self.__connected_button.set_tooltip_text(_("Connect view")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1972 _icon_connected.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1973 self.__connected_button.set_icon_widget(_icon_connected) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1974 self.__connected_button.connect("clicked", self._connected) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1975 self.__connected_button.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1976 _hbox.add(self.__connected_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1977 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1978 _icon_close = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1979 _icon_close.set_from_file(globalVars.getAppPath("CLOSE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1980 _icon_close.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1981 _close_button = Gtk.ToolButton() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1982 _close_button.set_icon_widget(_icon_close) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1983 _close_button.connect("clicked", self._closeItem_from_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1984 _close_button.set_tooltip_text(_("Close view")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1985 _close_button.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1986 _hbox.add(_close_button) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1987 _hbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1988 self.__widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1989 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1990 def getItem(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
1991 """getItem(pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1992 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1993 Return itself. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1994 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1995 return self |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1996 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1997 def _closeItem_from_menu(self, close_menuitem): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1998 """_closeItem_from_menu(close_menuitem) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1999 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2000 Method connected to the "clicked" signal of the _close_button widget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2001 Send the "autoclose" message to the page to close this view |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2002 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2003 self.propagateMessageFrom("autoclose", self.__pane_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2004 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2005 def _closeItem_from_button(self, close_button): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2006 """_closeItem_from_button(close_button) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2007 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2008 Method connected to the "clicked" signal of the _close_button widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2009 Send the "autoclose" message to the page to close this view |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2010 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2011 self.propagateMessageFrom("autoclose", self.__pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2012 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2013 def _change_combo(self, combobox): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2014 """_change_combo(combobox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2015 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2016 Method connected to the "changed" signal of the _combobox widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2017 It changes the view type to the type selected in the combobox |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2018 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2019 _index = combobox.get_active() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2020 _budget = self.__view.budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2021 _wr_page = self.__view.wr_page |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2022 _pane_path = self.__view.pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2023 _path_record = self.__view.active_path_record |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2024 _hbox = self.__widget.get_children()[1] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2025 _view_icon = _hbox.get_child_at(0, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2026 _hbox.remove(_view_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2027 _view_icon.destroy() |
9
229986217a3d
bug fix: view is not displayed when it splits the view Left/Right
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
8
diff
changeset
|
2028 self.__widget.remove(self.__view.widget) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2029 _view_icon = Gtk.Image() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2030 if _index == 0: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2031 self.__view = DecompositionList(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2032 _path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2033 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2034 _view_icon.set_from_file(globalVars.getAppPath( |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2035 "DECOMPOSITION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2036 self.__view_type = "DecompositionList" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2037 elif _index == 1: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2038 self.__view = Description(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2039 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2040 _view_icon.set_from_file(globalVars.getAppPath("DESCRIPTION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2041 self.__view_type = "RecordDescription" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2042 elif _index == 2: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2043 self.__view = Measure(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2044 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2045 _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2046 self.__view_type = "Measure" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2047 elif _index == 3: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2048 self.__view = Sheet(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2049 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2050 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2051 self.__view_type = "Sheet of Conditions" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2052 elif _index == 4: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2053 self.__view = FileView(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2054 _path_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2055 _view_icon.set_from_file(globalVars.getAppPath("FILEVIEW-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2056 self.__view_type = "FileView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2057 elif _index == 5: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2058 self.__view = CompanyView(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2059 _path_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2060 _view_icon.set_from_file(globalVars.getAppPath("COMPANY-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2061 self.__view_type = "CompanyView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2062 _view_icon.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2063 _hbox.attach(_view_icon, 0, 0, 1, 1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2064 self.__widget.add(self.__view.widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2065 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2066 def _menu_view(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2067 """_menu_view(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2068 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2069 Method connected to the "clicked" signal of the __connected_button |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2070 It shows a popup menu with some options |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2071 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2072 _menu_view = Gtk.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2073 _item_leftright = Gtk.MenuItem(_("Split view Left/Right")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2074 _menu_view.append(_item_leftright) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2075 _item_leftright.connect("activate", self._split_view, "h") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2076 _item_leftright.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2077 _item_topbottom = Gtk.MenuItem(_("Split view Top/Bottom")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2078 _menu_view.append(_item_topbottom) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2079 _item_topbottom.connect("activate", self._split_view, "v") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2080 _item_topbottom.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2081 _item_close = Gtk.MenuItem(_("Close view")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2082 _menu_view.append(_item_close) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2083 _item_close.connect("activate",self._closeItem_from_menu) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2084 _item_close.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2085 _menu_view.popup_at_widget(widget, Gdk.Gravity(7), Gdk.Gravity(1), Gtk.get_current_event()) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2086 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2087 def _split_view(self, widget, orientation): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2088 """_menu_view(orientation) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2089 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2090 orientation: orientation split, "h" or "v" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2091 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2092 Method connected to the "activate" signal of the _item_leftright and |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2093 _item_topbottom menu items. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2094 It sends the "split" message to the page to splits the view in the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2095 specified orientation |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2096 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2097 self.propagateMessageFrom( "split " + orientation, self.__pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2098 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2099 def _connected(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2100 """_connected(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2101 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2102 Method connected to the "clicked" signal of the _menu_button |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2103 It changes the __connected atribute to True or False, if the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2104 _connected atribute is False the view do not send and receive messages |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2105 to/from others views |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2106 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2107 if self.__connected: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2108 _icon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2109 _icon.set_from_file(globalVars.getAppPath("DISCONNECTED-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2110 _icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2111 self.__connected_button.set_icon_widget(_icon) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2112 self.__connected_button.set_tooltip_text(_("Connect View")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2113 self.__connected = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2114 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2115 _icon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2116 _icon.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2117 _icon.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2118 self.__connected_button.set_tooltip_text(_("Disconnect View")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2119 self.__connected_button.set_icon_widget(_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2120 self.__connected = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2121 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2122 def propagateMessageFrom(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2123 """propagateMessageFrom(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2124 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2125 message: string message |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2126 pane_path: tuple that represents the pane path which emits the message |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2127 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2128 The panes are connectted to this method to send messages to other panes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2129 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2130 if self.__connected or message == "autoclose" or \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2131 message == "split h" or message == "split v": |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2132 self.__wr_page().propagateMessageFrom(message, pane_path, arg) |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2133 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2134 def runMessage(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2135 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2136 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2137 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2138 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2139 "clear": clear instance |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2140 pane_path: tuple that identifies the pane in the notebook page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2141 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2142 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2143 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2144 This method receives a message and executes its corresponding action |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2145 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2146 if self.__connected: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2147 self.__view.runMessage(message, pane_path, arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2148 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2149 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2150 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2151 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2152 Return de pane widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2153 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2154 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2155 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2156 def _getPanePath(self): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2157 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2158 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2159 return the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2160 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2161 return self.__view.pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2162 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2163 def _setPanePath(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2164 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2165 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2166 set the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2167 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2168 self.__pane_path = pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2169 self.__view.pane_path = pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2170 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2171 def getClone(self, new_pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2172 """getClone(new_pane_path) |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2173 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2174 new_pane_path: the path that identifies the clone view in the page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2175 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2176 return a clone of itself |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2177 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2178 return View(self.__view_type, self.__budget, self.__wr_page, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2179 new_pane_path, self.__view.active_path_record, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2180 self.__connected) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2181 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2182 def clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2183 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2184 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2185 Clear the intance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2186 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2187 del self.__wr_page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2188 del self.__budget |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2189 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2190 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2191 del self.__view |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2192 del self.__connected |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2193 del self.__connected_button |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2194 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2195 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2196 "path that identifies the item in the notebook page") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2197 widget = property(_getWidget, None, None, "View widget") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2198 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2199 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2200 class Paned(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2201 """gui.Paned: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2202 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2203 Description: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2204 It creates and shows Gtk.Paned to show in page budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2205 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2206 Paned(orientation, widget1, widget2) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2207 orientation: The orientation of the pane separator, can be "v" or |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2208 "h" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2209 widget1: the top or left pane widget |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2210 widget2: the botton or right pane widget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2211 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2212 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2213 +-- Paned |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2214 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2215 widget: Read. Pane widget("Gtk.Paned" object) |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2216 pane_path: Read-Write. The paned path in the page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2217 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2218 getClone |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2219 getItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2220 setItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2221 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2222 clear(self) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2223 """ |
9
229986217a3d
bug fix: view is not displayed when it splits the view Left/Right
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
8
diff
changeset
|
2224 # TODO: *control the position paned separator. Now is always in the middle |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2225 # TODO: can be with a float(0.0-1.0) aspect ratio |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2226 # TODO: 0.0 no space for widget1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2227 # TODO: 1.0 all the space for widget1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2228 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2229 def __init__(self, orientation, pane_path, item1, item2): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2230 """__init__(oritentation, pane_path, item1, item2) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2231 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2232 orientation: The orientation of de Gtk.Paned, can be "v" or "h" |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2233 pane_path: the paned path in the page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2234 item1: the top or left pane object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2235 item2: the bottom or right pane object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2236 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2237 self.__orientation: The orientation of de Gtk.Paned, can be "v" or "h" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2238 self.__widget: Main widget, a Gtk.Paned |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2239 self.__items: list of items showed in the paned, its can be View or |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2240 Paned instances |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2241 self.__pane_path: the paned path in the page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2242 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2243 Creates and shows a new Gtk.Paned |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2244 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2245 self.__orientation = orientation |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2246 if not isinstance(item1.widget, Gtk.Widget) or \ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2247 not isinstance(item2.widget, Gtk.Widget): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2248 raise ValueError( _("The item must be a widget object.") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2249 if orientation == "v": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2250 self.__widget = Gtk.Paned.new(Gtk.Orientation(1)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2251 self.__widget.set_wide_handle(True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2252 elif orientation == "h": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2253 self.__widget = Gtk.Paned.new(Gtk.Orientation(0)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2254 self.__widget.set_wide_handle(True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2255 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2256 raise ValueError( _("Invalid orientation.") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2257 self.__widget.pack1(item1.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2258 self.__widget.pack2(item2.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2259 self.__widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2260 self.__items = [item1, item2] |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2261 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2262 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2263 def __getitem__(self, item): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2264 """__getitem__(item) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2265 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2266 Called to implement evaluation of self[key]. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2267 The accepted keys should be integers 0 or 1. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2268 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2269 return self.__items[item] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2270 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2271 def getClone(self, new_pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2272 """getClone(new_pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2273 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2274 Return a clone Paned instance with the path new_path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2275 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2276 return Paned(self.__orientation, new_pane_path, |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2277 self.__items[0].getClone(new_pane_path + (0,)), |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2278 self.__items[1].getClone(new_pane_path + (1,))) |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2279 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2280 def getItem(self,pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2281 """getItem(pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2282 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2283 Return the item whith the specified path. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2284 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2285 _item = self.__items[pane_path[0]] |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2286 if len(pane_path) == 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2287 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2288 else: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2289 return _item.getItem(pane_path[1:]) |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2290 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2291 def setItem(self, pane_path, item_list): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2292 """setItem(pane_path, item_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2293 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2294 Sets the first item in the item_list whith the especified path and |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2295 remove the old item in this position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2296 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2297 item = item_list[0] |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2298 if pane_path == 0 or pane_path == 1: |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2299 _old_item = self.__items[pane_path] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2300 self.__widget.remove(_old_item.widget) |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2301 self.__items[pane_path] = item |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2302 if pane_path == 0: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2303 self.__widget.pack1(item.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2304 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2305 self.__widget.pack2(item.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2306 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2307 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2308 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2309 def runMessage(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2310 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2311 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2312 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2313 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2314 "clear": clear instance |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2315 pane_path: tuple that identifies the pane in the notebook page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2316 arg: arguments |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2317 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2318 This method receives a message and send this to the items of the paned |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2319 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2320 for _item in self.__items: |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2321 if not _item.pane_path == pane_path: |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2322 _item.runMessage(message, pane_path, arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2323 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2324 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2325 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2326 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2327 Return de Gtk.Paned widget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2328 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2329 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2330 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2331 def _getPanePath(self): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2332 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2333 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2334 Return de Paned path in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2335 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2336 return self.__pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2337 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2338 def _setPanePath(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2339 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2340 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2341 sets the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2342 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2343 self.__pane_path = pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2344 self.__items[0].pane_path = pane_path + (0,) |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2345 self.__items[1].pane_path = pane_path + (1,) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2346 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2347 def clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2348 """clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2349 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2350 Delete atributes |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2351 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2352 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2353 del self.__orientation |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2354 del self.__items |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2355 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2356 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2357 widget = property(_getWidget, None, None, "Gtk.Paned widget") |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2358 pane_path = property(_getPanePath, _setPanePath, None, |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2359 "Pane path in the notebook page") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2360 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2361 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2362 class TreeView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2363 """gui.Treeviev: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2364 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2365 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2366 It creates the columns in a treeview, is the base class for |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2367 DescompositionList and Measure classes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2368 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2369 TreView(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2370 args: list of tuples, the tuple items are: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2371 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2372 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2373 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2374 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2375 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2376 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2377 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2378 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2379 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2380 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2381 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2382 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2383 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2384 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2385 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2386 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2387 columns: list of columns (Gtk.TreeViewColumn objects) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2388 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2389 createColumn |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2390 createTextBaseColumn |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2391 createBaseColumn |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2392 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2393 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2394 def __init__(self, args): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2395 """__init__(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2396 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2397 args: list of tuples, the tuple items are: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2398 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2399 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2400 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2401 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2402 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2403 * Calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2404 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2405 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2406 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2407 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2408 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2409 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2410 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2411 Create the columns form the args info calling creatheColumn to create |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2412 each column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2413 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2414 self.columns = [ self.createColumn(arg) for arg in args ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2415 self.columns.append(self.createColumn(("END",))) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2416 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2417 def createColumn(self, args): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2418 """createColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2419 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2420 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2421 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2422 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2423 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2424 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2425 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2426 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2427 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2428 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2429 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2430 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2431 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2432 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2433 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2434 Return a column created whith the arg info |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2435 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2436 if args[0] == "INDEX": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2437 _index_column = self.createBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2438 _text_index_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2439 _text_index_cell.set_property('foreground', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2440 globalVars.color["TEXT"]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2441 _pixbuf_index_cell = Gtk.CellRendererPixbuf() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2442 _arrow_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2443 globalVars.getAppPath("ARROW-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2444 _pixbuf_index_cell.set_property("pixbuf", _arrow_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2445 _index_column.pack_start(_text_index_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2446 _index_column.pack_start(_pixbuf_index_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2447 _index_column.set_cell_data_func(_text_index_cell, |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2448 self._colorCell, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2449 [globalVars.color["INDEX-UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2450 globalVars.color["INDEX-EVEN"]]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2451 return _index_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2452 elif args[0] == "TEXT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2453 _column, _cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2454 _column.add_attribute(_cell, 'text', args[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2455 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2456 elif args[0] == "FLOAT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2457 _column, _cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2458 _column.add_attribute(_cell, 'text', args[5]) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2459 _column.get_cells()[0].set_property('xalign', 1.0) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2460 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2461 elif args[0] == "CALCULATED": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2462 _column, cell = self.createTextBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2463 _column.get_cells()[0].set_property('xalign', 1.0) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2464 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2465 elif args[0] == "CALCULATEDTEXT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2466 _column, cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2467 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2468 elif args[0] == "TYPE": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2469 _column = self.createBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2470 _type_cell1 = Gtk.CellRendererPixbuf() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2471 _type_cell2 = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2472 _type_cell2.set_property('foreground', args[3]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2473 _column.pack_start(_type_cell1, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2474 _column.pack_start(_type_cell2, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2475 _column.add_attribute(_type_cell2, 'text', args[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2476 _column.set_cell_data_func(_type_cell1, |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2477 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2478 _column.set_cell_data_func(_type_cell2, |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2479 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2480 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2481 elif args[0] == "PIXBUF": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2482 _column = self.createBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2483 _type_cell1 = Gtk.CellRendererPixbuf() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2484 _column.pack_start(_type_cell1, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2485 _column.set_cell_data_func(_type_cell1, |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2486 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2487 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2488 elif args[0] == "END": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2489 _end_column = Gtk.TreeViewColumn() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2490 _end_column.set_clickable(False) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2491 _end_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2492 _end_cell.set_property('background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2493 globalVars.color["UNEVEN"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2494 _end_column.pack_start(_end_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2495 return _end_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2496 return None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2497 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2498 def createTextBaseColumn(self, args): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2499 """createTextBaseColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2500 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2501 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2502 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2503 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2504 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2505 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2506 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2507 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2508 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2509 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2510 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2511 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2512 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2513 Return a column and its CellREndererText |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2514 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2515 _column = self.createBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2516 _cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2517 _cell.set_property('foreground', args[3]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2518 _column.pack_start(_cell, True) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2519 _column.set_cell_data_func(_cell, self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2520 return _column, _cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2521 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2522 def createBaseColumn(self, args): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2523 """createBaseColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2524 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2525 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2526 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2527 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2528 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2529 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2530 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2531 * calculated text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2532 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2533 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2534 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2535 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2536 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2537 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2538 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2539 Return a column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2540 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2541 _column = Gtk.TreeViewColumn() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2542 _column.set_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2543 _column.connect("clicked", args[1]) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2544 _column.set_sizing(Gtk.TreeViewColumnSizing(2)) # 2 Fixed |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2545 _column.set_fixed_width(args[2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2546 _column.set_resizable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2547 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2548 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2549 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2550 class DecompositionList(TreeView): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2551 """gui.DecompositionList: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2552 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2553 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2554 Class to show a budget Decomposition List |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2555 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2556 DecompositionList(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2557 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2558 page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2559 pane_path: tuple that represents the view path in the Page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2560 path_record: the record path that must be showed |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2561 Returns the newly created DecompositionList instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2562 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2563 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2564 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2565 +-- DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2566 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2567 budget: Read. Budget to show, base.obra object. |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2568 widget: Read. Window that contains the table, Gtk.ScrolledWindow |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2569 pane_path: Read-Write. Pane page identifier |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2570 wr_page: Read-Write. weak ref from Page object which creates this class |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2571 active_path_record: Read. Active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2572 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2573 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2574 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2575 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2576 def __init__(self, budget, wr_page, pane_path, path_record=None): |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2577 """__init__(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2578 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2579 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2580 page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2581 pane_path: tuple that represents the path of the List in the Page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2582 path_record: the record path that must be showed |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2583 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2584 self.__budget: budget showed ("base.Budget" object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2585 self.__wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2586 self.__pane_path: tuple that represents the path of the List in the Page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2587 self.__liststore: list model which store the list data |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2588 (Gtk.ListStore object) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2589 self.__active_path_record: the record path that must be showed |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2590 self.__treeview: widget for displaying decomposition lists |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2591 (Gtk.TreeView) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2592 self.__scrolled_window: widget to contain the treeview object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2593 self.__chapter_background_colors: background colors of the Code |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2594 column cells when there is a chapter record, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2595 list of color [even cell, uneven cell] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2596 self.__chapter_background_colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2597 self.__index_column: Index column (Gtk.TreeViewColumn object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2598 self.__code_column: Record code column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2599 self.__type_column: Record Type column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2600 self.__unit_column: Unit of measure column (Gtk.TreeViewColumn) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2601 self.__description_column: record's short description column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2602 (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2603 self.__measure_column: Measure column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2604 self.__price_column: Price column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2605 self.__amount_column: Amount column(Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2606 self.__end_column: End empty column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2607 self.__chapter_icon: a GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2608 self.__unit_icon: a GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2609 self.__material_icon: a GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2610 self.__machinery_icon: a GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2611 self.__labourforce_icon: a GdkPixbuf.Pixbuf |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2612 self.__treeselection: active selection |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2613 self.__selection_control: state of the selection control (True/False) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2614 self.__cursor: cursor position in the table |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2615 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2616 Sets the init atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2617 Creates the init list values in self.__liststore from the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2618 showing the top record descomposition |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2619 Creates the list in self.__treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2620 * Creates the columns and cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2621 * Sets te the column headers values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2622 * Sets the selection properties |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2623 * Connects the events |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2624 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2625 # TODO: to group all columns in a dicctionary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2626 # Budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2627 if not isinstance(budget, base.Budget): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2628 raise ValueError( _("Argument must be a Budget object") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2629 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2630 self.__wr_page = wr_page |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
2631 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2632 # ListStore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2633 self.__liststore = Gtk.ListStore(object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2634 #, int, int, str, str, str, str, str,str |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2635 ) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2636 if path_record is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2637 path_record = (0,) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2638 self.__active_path_record = path_record |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2639 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2640 # Treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2641 self.__treeview = Gtk.TreeView(self.__liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2642 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2643 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2644 self.__treeview.set_headers_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2645 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2646 # Scrolled_window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2647 self.__scrolled_window = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2648 self.__scrolled_window.set_property("expand", True) # widget expand all space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2649 self.__scrolled_window.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2650 Gtk.PolicyType(1)) # 1 Automatic |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2651 self.__scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2652 # colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2653 _text_color = globalVars.color["TEXT"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2654 _background_color = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2655 globalVars.color["UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2656 globalVars.color["EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2657 self.__chapter_background_colors = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2658 globalVars.color["CHAPTER-UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2659 globalVars.color["CHAPTER-EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2660 super(DecompositionList,self).__init__( |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2661 [("INDEX",self._selectAll,42), |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2662 ("CALCULATEDTEXT", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2663 100, _text_color, _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2664 ("PIXBUF", self._showParentRecord, 26, _text_color, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2665 _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2666 ("CALCULATEDTEXT", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2667 52, _text_color, _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2668 ("CALCULATEDTEXT", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2669 245, _text_color, _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2670 ("CALCULATED", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2671 90, _text_color, _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2672 ("CALCULATED", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2673 90, _text_color, _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2674 ("CALCULATED", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2675 90, globalVars.color["CALCULATED-TEXT"], |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2676 _background_color), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2677 ]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2678 self.__index_column = self.columns[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2679 self.__code_column = self.columns[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2680 self.__type_column = self.columns[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2681 self.__unit_column = self.columns[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2682 self.__description_column = self.columns[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2683 self.__measure_column = self.columns[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2684 self.__price_column = self.columns[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2685 self.__amount_column = self.columns[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2686 self.__end_column = self.columns[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2687 # Index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2688 self.__treeview.append_column(self.__index_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2689 # Code column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2690 self.__treeview.append_column(self.__code_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2691 # Type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2692 self.__treeview.append_column(self.__type_column) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2693 self.__chapter_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2694 globalVars.getAppPath("CHAPTER-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2695 self.__unit_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2696 globalVars.getAppPath("UNIT-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2697 self.__material_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2698 globalVars.getAppPath("MATERIAL-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2699 self.__machinery_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2700 globalVars.getAppPath("MACHINERY-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2701 self.__labourforce_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2702 globalVars.getAppPath("LABOURFORCE-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2703 self.__type_column.get_cells()[0].set_property("pixbuf", |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2704 self.__labourforce_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2705 # Unit column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2706 self.__treeview.append_column(self.__unit_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2707 # Description column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2708 self.__treeview.append_column(self.__description_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2709 # Measure Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2710 self.__treeview.append_column(self.__measure_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2711 # Price column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2712 self.__treeview.append_column(self.__price_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2713 # Amount column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2714 self.__treeview.append_column(self.__amount_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2715 # End Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2716 self.__treeview.append_column(self.__end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2717 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2718 self.__treeview.connect("row-activated", self._showRowRecord) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2719 self.__treeview.connect("move-cursor", self._moveCursor) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2720 self.__treeview.connect("key-press-event", self._treeviewKeyPressEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2721 self.__treeview.connect("button-press-event", |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2722 self._treeviewClickedEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2723 self.__treeview.connect("cursor-changed", self._treeviewCursorChanged) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2724 # control selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2725 self.__treeselection = self.__treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2726 self.__treeselection.set_mode(Gtk.SelectionMode(3)) # 3 MULTIPLE |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2727 self.__treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2728 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2729 if len(self.__liststore) > 0: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2730 _tree_path = Gtk.TreePath.new_from_indices((0,)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2731 self.__treeview.set_cursor_on_cell(_tree_path ,self.__unit_column, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2732 self.__unit_column.get_cells()[0],True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2733 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2734 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2735 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2736 self._setColumnsHeaders() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2737 self.__scrolled_window.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2738 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2739 def _treeviewCursorChanged(self, treeview): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2740 """_treeviewCursorChanged(treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2741 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2742 treeview: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2743 Method connected to "cursor-changed" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2744 The "cursor-changed" signal is emitted when the cursor moves or is set |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2745 Sets the new cursor position in self.__cursor, it is used to avoid |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2746 unnecessary changes in cursor position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2747 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2748 event = Gtk.get_current_event() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2749 (_cursor_path, _column) = treeview.get_cursor() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2750 if event is None or event.type != Gdk.EventType(7): # 7 BUTTON_RELEASE |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2751 if not _column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2752 self.__cursor = treeview.get_cursor() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2753 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2754 def _treeviewClickedEvent(self, widget, event): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2755 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2756 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2757 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2758 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2759 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2760 The "button-press-event" signal is emitted when a mouse button is |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2761 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2762 Returns TRUE to stop other handlers from being invoked for the event. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2763 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2764 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2765 The events in end column are ignored. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2766 If the user click in a row of the index column the cursor is moved to |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2767 this row but not to the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2768 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2769 if event.button == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2770 path_at_pos = self.__treeview.get_path_at_pos(int(event.x), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2771 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2772 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2773 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2774 if _column == self.columns[-1]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2775 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2776 if _column is self.columns[0]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2777 self.__cursor[0] == _path_cursor |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2778 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2779 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2780 def _treeviewKeyPressEvent(self, widget, event): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2781 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2782 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2783 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2784 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2785 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2786 The "key-press-event" signal is emitted when the user presses a key |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2787 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2788 Returns :TRUE to stop other handlers from being invoked for the event. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2789 Returns :FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2790 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2791 If the user press the right cursor button and the cursor is in the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2792 amount column or pres the left cursor button and the cursor is |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2793 in the code column the event is estoped, else the event is propagated. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2794 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2795 (_cursor_path, _column) = self.__treeview.get_cursor() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2796 if (event.keyval in [Gdk.keyval_from_name("Right"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2797 Gdk.keyval_from_name("KP_Right")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2798 and _column == self.columns[-2]) \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2799 or (event.keyval in [Gdk.keyval_from_name("Left"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2800 Gdk.keyval_from_name("KP_Left")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2801 and _column == self.columns[1]): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2802 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2803 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2804 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2805 def _moveCursor(self, treeview, step, count): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2806 """_moveCursor(treeview, step, count) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2807 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2808 treeview: the treeview that received the signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2809 step: the movement step size |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2810 count: the number of steps to take |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2811 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2812 Method connected to "move-cursor" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2813 The "move-cursor" signal is emitted when the user moves the cursor |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2814 using the Right, Left, Up or Down arrow keys or the Page Up, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2815 Page Down, Home and End keys. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2816 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2817 Returns :TRUE if the signal was handled. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2818 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2819 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2820 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2821 def _controlSelection(self, selection, model, path, path_currently_selected, *data): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2822 """_controlSelection(selection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2823 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2824 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2825 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2826 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2827 This method is called before any node is selected or unselected, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2828 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2829 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2830 of the node may be toggled, and FALSE if the state of the node should |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2831 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2832 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2833 The selection only run if the user click in the index column, else |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2834 the previous selection is erased. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2835 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2836 _column = self.__treeview.get_cursor()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2837 if _column is self.columns[0] \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2838 or self.__selection_control == False: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2839 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2840 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2841 self.__selection_control = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2842 self.__treeselection.unselect_all() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2843 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2844 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2845 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2846 def _selectAll(self, column): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2847 """_selectAll(column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2848 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2849 column: index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2850 Method connected to "clicked" event in the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2851 If the user clickes in the index column header selecs or deselects |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2852 all rows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2853 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2854 (_model, _pathlist) = self.__treeselection.get_selected_rows() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2855 # it avoid to set cursor in the index column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2856 if isinstance(self.__cursor[0],Gtk.TreePath): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2857 self.__treeview.set_cursor(self.__cursor[0], self.__cursor[1]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2858 self.__selection_control = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2859 if len(_pathlist) == 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2860 # select all |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2861 self.__treeselection.select_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2862 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2863 # unselect all |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2864 self.__treeselection.unselect_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2865 self.__selection_control = True |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2866 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2867 def _setColumnsHeaders(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2868 """_setColumnsHeaders() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2869 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2870 Sets the headers column values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2871 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2872 _path_record = self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2873 _number = _path_record[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2874 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2875 _code = _budget.getCode(_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2876 _decomposition = _budget.getDecomposition(_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2877 _stryield = _budget.getStrYield(_decomposition.budgetMeasures[0], |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2878 _budget.getRecord(_code).recordType) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2879 _record = _budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2880 _unit = _record.unit |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2881 _description = _record.summary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2882 _price = _budget.getStrPriceFromRecord(self.budget.getActiveTitle(), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2883 _record, _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2884 # TODO: round to decimal places in amount |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2885 _amount = float(_stryield) * float(_price) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2886 if len(_path_record) == 1: # root record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2887 _amount = _price |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2888 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2889 _parent_code = self.budget.getCode(self.__active_path_record[:-1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2890 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2891 _amount = _budget.getStrAmount(self.__active_path_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2892 self.__code_column.set_title(_("Code") + chr(10) + "[" + _code.decode("utf8") + "]") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2893 self.__unit_column.set_title(_("Unit") + chr(10) + "[" + _unit.decode("utf8") + "]") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2894 self.__description_column.set_title( |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2895 _("Description") + chr(10) + "[" + _description.decode("utf8") + "]") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2896 self.__measure_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2897 _("Measure") + chr(10) + "[" + _stryield + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2898 self.__price_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2899 _("Price") + chr(10) + "[" + _price + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2900 self.__amount_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2901 _("Amount") + chr(10) + "[" + str(_amount) + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2902 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2903 def _setListstoreValues(self, path_record): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2904 """_setListstoreValues(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2905 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2906 path_record: Record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2907 Sets the liststore record values from a path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2908 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2909 self.__liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2910 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2911 if not _budget.hasPath(path_record): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2912 raise ValueError( _("Invalid path") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2913 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2914 _parent_code = _budget.getCode(path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2915 for N,_code in enumerate(_budget.getchildren(_parent_code)): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2916 _decomposition = _budget.getNDecomposition(_parent_code, N) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2917 _record = _budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2918 _values = [_record, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2919 #_record.hierarchy, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2920 #_record.type, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2921 #_record.subtype, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2922 #_code, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2923 #_record.unit, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2924 #_record.summary, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2925 #_decomposition.yield_, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2926 #_decomposition.budget[0].yield_, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2927 #_record.prices[_budget.getActiveTitle()].prices] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2928 #_record.getPrice(_budget.getActiveTitle()) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2929 ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2930 _treeiter = self.__liststore.append(_values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2931 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2932 def _colorCell(self, column, cell_renderer, tree_model, iter, lcolor): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2933 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2934 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2935 column: the Gtk.TreeViewColumn in the treeview |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2936 cell_renderer: a Gtk.CellRenderer |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2937 tree_model: the Gtk.TreeModel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2938 iter: Gtk.TreeIter pointing at the row |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2939 lcolor: list with 2 Gtk colors for even and uneven record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2940 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2941 Method connected to "set_cell_data_func" of many column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2942 The set_cell_data_func() method sets the data function (or method) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2943 to use for the column Gtk.CellRenderer specified by cell_renderer. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2944 This function (or method) is used instead of the standard attribute |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2945 mappings for setting the column values, and should set the attributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2946 of the cell renderer as appropriate. func may be None to remove the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2947 current data function. The signature of func is: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2948 -def celldatafunction(column, cell_renderer, tree_model, iter, lcolor) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2949 -def celldatamethod(self,column,cell_renderer,tree_model, iter, lcolor) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2950 where column is the Gtk.TreeViewColumn in the treeview, cell is the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2951 Gtk.CellRenderer for column, model is the Gtk.TreeModel for the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2952 treeview and iter is the Gtk.TreeIter pointing at the row. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2953 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2954 The method sets cell background color and text for all columns. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2955 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2956 _row_path = tree_model.get_path(iter) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2957 _global_row_path = self.__active_path_record + (_row_path[0],) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2958 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2959 _record = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2960 if column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2961 cell_renderer.set_property('text', str(_number + 1)) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2962 self.__index_column.get_cells()[1].set_property( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2963 'cell-background', lcolor[_number % 2]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2964 elif column is self.__code_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2965 # if the record is a chapter |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2966 if tree_model.get_value(iter, 0).recordType.hierarchy == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2967 lcolor = self.__chapter_background_colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2968 _code = _record.code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2969 cell_renderer.set_property('text', _code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2970 elif column is self.__unit_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2971 _unit = _record.unit |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2972 cell_renderer.set_property('text', _unit) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2973 elif column is self.__description_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2974 _summary = _record.summary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2975 cell_renderer.set_property('text', _summary) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2976 elif column is self.__measure_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2977 _parent_code = self.budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2978 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2979 _decomposition = _parent_record.children[_number] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2980 _stryield = self.__budget.getStrYield( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2981 _decomposition.budgetMeasures[0], _parent_record.recordType) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2982 cell_renderer.set_property('text', _stryield) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2983 elif column is self.__price_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2984 _price = self.budget.getStrPriceFromRecord( |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2985 self.budget.getActiveTitle(), _record, _global_row_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2986 cell_renderer.set_property('text', _price) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2987 elif column is self.__amount_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2988 _parent_code = self.budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2989 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2990 _amount = self.budget.getStrAmount( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2991 self.__active_path_record + (_number,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2992 cell_renderer.set_property('text', str(_amount)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2993 elif column is self.__type_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2994 _hierarchy = tree_model[_row_path][0].recordType.hierarchy |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2995 _type = tree_model[_row_path][0].recordType.type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2996 _subtype = tree_model[_row_path][0].recordType.subtype |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2997 if _hierarchy == 1: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2998 cell_renderer.set_property("pixbuf",self.__chapter_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2999 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3000 if _type == 0: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3001 cell_renderer.set_property("pixbuf",self.__unit_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3002 elif _type == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3003 cell_renderer.set_property("pixbuf", |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3004 self.__labourforce_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3005 elif _type == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3006 cell_renderer.set_property("pixbuf", |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3007 self.__machinery_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3008 else: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3009 cell_renderer.set_property("pixbuf",self.__material_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3010 if self.__treeview.get_cursor() == (_row_path,column): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3011 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3012 globalVars.color["ACTIVE"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3013 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3014 cell_renderer.set_property('cell-background', |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3015 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3016 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3017 def _showParentRecord(self, column): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3018 """_showParentRecord(column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3019 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3020 column: the column that is clicked |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3021 Method connected to "clicked" event of many columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3022 Show the parent record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3023 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3024 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3025 if len(self.__active_path_record) == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3026 # The active record is the root record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3027 # This avoid to move the cursor to the clicked column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3028 if isinstance(self.__cursor[0],Gtk.TreePath): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3029 self.__treeview.set_cursor(self.__cursor[0], self.__cursor[1]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3030 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3031 _path_record = self.__active_path_record[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3032 _parent = self.__active_path_record[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3033 self.__active_path_record = _path_record |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3034 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3035 self._setListstoreValues(self.__active_path_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3036 arg = _path_record |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3037 _page = self.__wr_page() |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3038 _page.propagateMessageFrom("change_active", self.__pane_path, arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3039 self.__treeview.set_cursor(_parent, self.__cursor[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3040 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3041 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3042 def _showMessageRecord(self, record_path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3043 """_showMessageRecord(record_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3044 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3045 record_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3046 Method connected to "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3047 Show the record especified in the "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3048 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3049 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3050 self.__active_path_record = record_path |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3051 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3052 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3053 self.__treeview.set_cursor((0,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3054 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3055 def _showRowRecord(self, treeview, treeview_path, column): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3056 """_showRowRecord(treeview, treeview_path, column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3057 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3058 treeview: treview to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3059 treeview_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3060 code: the code of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3061 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3062 Method connected to "row-activated" event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3063 The "row-activated" signal is emitted when the row_activated() method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3064 is called or the user double clicks a treeview row. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3065 "row-activated" is also emitted when a non-editable row is selected |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3066 and one of the keys: Space, Shift+Space, Return or Enter is pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3067 Show the especified record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3068 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3069 if not (column is self.__end_column) and \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3070 not (column is self.__index_column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3071 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3072 _model = treeview.get_model() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3073 _iter = _model.get_iter(treeview_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3074 _code = _model.get_value(_iter, 0).code |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3075 _path_record = self.__active_path_record |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3076 for _indice in treeview_path.get_indices(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3077 _path_record = _path_record + (_indice,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3078 if self.__budget.hasPath(_path_record): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3079 # if this record path is valid |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3080 self.__active_path_record = _path_record |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3081 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3082 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3083 self.__treeview.set_cursor((0,)) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3084 _arg = _path_record |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3085 _page = self.__wr_page() |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3086 _page.propagateMessageFrom("change_active", self.__pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3087 _arg ) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3088 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3089 def runMessage(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3090 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3091 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3092 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3093 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3094 "clear": clear instance |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3095 pane_path: tuple that identifies the pane in the notebook page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3096 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3097 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3098 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3099 This method receives a message and executes its corresponding action |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3100 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3101 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3102 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3103 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3104 _path_record = arg |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3105 self._showMessageRecord( _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3106 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3107 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3108 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3109 def _clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3110 """_clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3111 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3112 it deletes the __budget reference |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3113 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3114 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3115 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3116 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3117 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3118 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3119 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3120 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3121 return self.__scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3122 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3123 def _getPanePath(self): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3124 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3125 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3126 return the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3127 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3128 return self.__pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3129 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3130 def _setPanePath(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3131 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3132 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3133 sets the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3134 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3135 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3136 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3137 def _getWrPage(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3138 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3139 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3140 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3141 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3142 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3143 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3144 def _setWrPage(self,wr_page): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3145 """_setWrPage() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3146 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3147 set the wr_Page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3148 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3149 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3150 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3151 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3152 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3153 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3154 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3155 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3156 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3157 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3158 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3159 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3160 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3161 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3162 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3163 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3164 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3165 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3166 "Pane configuration list") |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3167 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3168 "path that identifie the item in the page notebook") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3169 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3170 "weak reference from Page instance which creates this class") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3171 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3172 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3173 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3174 "Active path record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3175 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3176 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3177 class Measure(TreeView): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3178 """gui.Measure: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3179 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3180 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3181 Class to show a Measure List |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3182 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3183 Measure(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3184 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3185 page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3186 pane_path: tuple that represents the path of the List in the Page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3187 path_record: path of the active record in the budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3188 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3189 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3190 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3191 +-- DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3192 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3193 budget: Read. Budget to show, base.obra instance. |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3194 widget: Read. Window that contains the table, Gtk.ScrolledWindow |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3195 pane_path: Read-Write. Pane page identifier |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3196 wr_page: Read-Write. weak reference from Page instance which creates |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3197 this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3198 active_path_record: Read. Path of the active record in the budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3199 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3200 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3201 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3202 |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3203 def __init__(self, budget, page, pane_path, path_record=None): |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3204 """__init__(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3205 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3206 budget: budget: budget showed ("base.Budget" object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3207 wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3208 pane_path: tuple that represents the path of the List in the Page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3209 path_record: path of the active record in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3210 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3211 self.__budget: budget showed ("base.Budget" object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3212 self.__page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3213 self.__pane_path: tuple that represents the path of the List in the Page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3214 self.__active_path_record: path of the active record in the budget |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3215 self.__liststore: list model which store the list data |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3216 (Gtk.ListStore object) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3217 self.__treeview: widget to display decomposition lists |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3218 (Gtk.TreeView) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3219 self.__scrolled_window: widget to scroll the treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3220 Gtk.ScrolledWindow() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3221 self.__chapter_background_colors: The background colors of the Code |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3222 column cells when there is a chapter record |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3223 as a list of color [even cell, uneven cell] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3224 self.__index_column: Index column (Gtk.TreeViewColumn object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3225 self.__linetype_column: Linetype column (Gtk.TreeViewColumn object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3226 self.__comment_column: Comment column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3227 self.__unit_column: Unit column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3228 self.__length_column: Legth column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3229 self.__width_column: With column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3230 self.__height_column: Height column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3231 self.__formula_column: Formula column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3232 self.__parcial_column: Parcial column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3233 self.__subtotal_column: Subtotal column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3234 self.__end_column: End empty column (Gtk.TreeViewColumn |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3235 self.__calculatedline_icon: GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3236 self.__normalline_icon: GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3237 self.__parcialline_icon: GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3238 self.__acumulatedline_icon: GdkPixbuf.Pixbuf |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3239 self.__treeselection: active selection |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3240 self.__selection_control: state of the selection control (True/False) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3241 self.__cursor: Situation of the cursor in the table |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3242 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3243 Sets the init atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3244 Creates the init list values in self.__liststore from the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3245 showing the top record from the record with path path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3246 Creates the list in self.__treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3247 * Creates the columns and cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3248 * Sets te the column headers values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3249 * Sets the selection properties |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3250 * Connects the events |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3251 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3252 # Seting init args |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3253 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3254 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3255 if not isinstance(budget, base.Budget): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3256 raise ValueError( _("Argument must be a Budget object") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3257 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3258 self.__wr_page = page |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3259 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3260 if not isinstance(path_record, tuple): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3261 print(_("Record path must be a tuple") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3262 path_record = (0,) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3263 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3264 # ListStore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3265 self.__liststore = Gtk.ListStore(object) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3266 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3267 # Treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3268 self.__treeview = Gtk.TreeView(self.__liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3269 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3270 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3271 self.__treeview.set_headers_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3272 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3273 # Scrolled_window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3274 self.__scrolled_window = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3275 self.__scrolled_window.set_property("expand", True) # widget expand all space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3276 self.__scrolled_window.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3277 Gtk.PolicyType(1)) # 1 Automatic |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3278 self.__scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3279 # colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3280 _text_color = globalVars.color["TEXT"] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3281 _calculated_text = globalVars.color["CALCULATED-TEXT"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3282 _background_color = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3283 globalVars.color["UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3284 globalVars.color["EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3285 self.__chapter_background_colors = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3286 globalVars.color["CHAPTER-UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3287 globalVars.color["CHAPTER-EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3288 super(Measure,self).__init__( |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3289 [("INDEX",self._selectAll,42), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3290 ("PIXBUF", self._passMethod, 40, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3291 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3292 ("CALCULATEDTEXT", self._passMethod, 128, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3293 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3294 ("CALCULATED", self._passMethod, 55, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3295 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3296 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3297 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3298 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3299 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3300 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3301 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3302 ("CALCULATEDTEXT", self._passMethod, 120, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3303 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3304 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3305 _calculated_text, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3306 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3307 _calculated_text, _background_color), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3308 ]) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3309 # Colums |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3310 self.__index_column = self.columns[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3311 self.__linetype_column = self.columns[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3312 self.__comment_column = self.columns[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3313 self.__units_column = self.columns[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3314 self.__length_column = self.columns[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3315 self.__width_column = self.columns[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3316 self.__height_column = self.columns[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3317 self.__formula_column = self.columns[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3318 self.__parcial_column = self.columns[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3319 self.__subtotal_column = self.columns[9] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3320 self.__end_column = self.columns[10] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3321 # Index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3322 self.__treeview.append_column(self.__index_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3323 # Linetype column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3324 self.__treeview.append_column(self.__linetype_column) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3325 self.__calculatedline_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3326 globalVars.getAppPath("CALCULATEDLINE-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3327 self.__normalline_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3328 globalVars.getAppPath("NORMALLINE-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3329 self.__parcialline_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3330 globalVars.getAppPath("PARCIALLINE-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3331 self.__acumulatedline_icon = GdkPixbuf.Pixbuf.new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3332 globalVars.getAppPath("ACUMULATEDLINE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3333 # Comment column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3334 self.__treeview.append_column(self.__comment_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3335 # Units column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3336 self.__treeview.append_column(self.__units_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3337 # Length column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3338 self.__treeview.append_column(self.__length_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3339 # Width_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3340 self.__treeview.append_column(self.__width_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3341 # Height column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3342 self.__treeview.append_column(self.__height_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3343 # Formula column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3344 self.__treeview.append_column(self.__formula_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3345 # Parcial column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3346 self.__treeview.append_column(self.__parcial_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3347 # Subtotal column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3348 self.__treeview.append_column(self.__subtotal_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3349 # End Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3350 self.__treeview.append_column(self.__end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3351 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3352 self.__treeview.connect("move-cursor", self._moveCursor) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3353 self.__treeview.connect("key-press-event", self._treeviewKeyPressEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3354 self.__treeview.connect("button-press-event", |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3355 self._treeviewClickedEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3356 self.__treeview.connect("cursor-changed", self._treeviewCursorChanged) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3357 # control selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3358 self.__treeselection = self.__treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3359 self.__treeselection.set_mode(Gtk.SelectionMode(3)) # 3 MULTIPLE |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3360 self.__treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3361 self.__selection_control = True |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3362 if len(self.__liststore) > 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3363 _tree_path = Gtk.TreePath.new_from_indices((1,)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3364 self.__treeview.set_cursor_on_cell(_tree_path, self.columns[1], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3365 self.columns[1].get_cells()[0],True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3366 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3367 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3368 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3369 self._setColumnsHeaders() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3370 self.__scrolled_window.show() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3371 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3372 def _treeviewCursorChanged(self, treeview): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3373 """_treeviewCursorChanged(treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3374 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3375 treeview: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3376 Method connected to "cursor-changed" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3377 The "cursor-changed" signal is emitted when the cursor moves or is set |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3378 Sets the new cursor position in self.__cursor, it is used to avoid |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3379 unnecessary changes in cursor position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3380 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3381 event = Gtk.get_current_event() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3382 (_cursor_path, _column) = treeview.get_cursor() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3383 if event is None or event.type != Gdk.EventType(7): # 7 BUTTON_RELEASE |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3384 if not _column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3385 self.__cursor = treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3386 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3387 def _treeviewClickedEvent(self, widget, event): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3388 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3389 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3390 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3391 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3392 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3393 The "button-press-event" signal is emitted when a mouse button is |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3394 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3395 Returns TRUE to stop other handlers from being invoked for the event. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3396 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3397 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3398 The events in end column are ignored. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3399 If the user click in a row of the index column the cursor is moved to |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3400 this row but not to the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3401 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3402 if event.button == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3403 path_at_pos = self.__treeview.get_path_at_pos(int(event.x), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3404 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3405 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3406 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3407 if _column == self.columns[-1]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3408 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3409 if _column is self.columns[0]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3410 self.__cursor[0] == _path_cursor |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3411 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3412 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3413 def _treeviewKeyPressEvent(self, widget, event): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3414 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3415 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3416 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3417 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3418 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3419 The "key-press-event" signal is emitted when the user presses a key |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3420 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3421 Returns :TRUE to stop other handlers from being invoked for the event. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3422 Returns :FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3423 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3424 If the user press the right cursor button and the cursor is in the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3425 amount column or pres the left cursor button and the cursor is |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3426 in the code column the event is estoped, else the event is propagated. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3427 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3428 (_cursor_path, _column) = self.__treeview.get_cursor() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3429 if (event.keyval in [Gdk.keyval_from_name("Right"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3430 Gdk.keyval_from_name("KP_Right")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3431 and _column == self.columns[-2]) \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3432 or (event.keyval in [Gdk.keyval_from_name("Left"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3433 Gdk.keyval_from_name("KP_Left")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3434 and _column == self.columns[1]): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3435 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3436 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3437 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3438 def _moveCursor(self, treeview, step, count): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3439 """moveCursor(treeview, step, count) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3440 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3441 treeview: the treeview that received the signal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3442 step: the movement step size |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3443 count: the number of steps to take |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3444 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3445 Method connected to "move-cursor" signal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3446 The "move-cursor" signal is emitted when the user moves the cursor |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3447 using the Right, Left, Up or Down arrow keys or the Page Up, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3448 Page Down, Home and End keys. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3449 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3450 Returns :TRUE if the signal was handled. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3451 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3452 return False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3453 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3454 def _controlSelection(self, selection, model, path, path_currently_selected, *data): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3455 """_controlSelection(selection) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3456 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3457 selection: treeselection |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3458 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3459 Method connected to set_selection_function() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3460 This method is called before any node is selected or unselected, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3461 giving some control over which nodes are selected. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3462 The selection function should return TRUE if the state |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3463 of the node may be toggled, and FALSE if the state of the node should |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3464 be left unchanged. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3465 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3466 The selection only run if the user click in the index column, else |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3467 the previous selection is erased. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3468 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3469 _column = self.__treeview.get_cursor()[1] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3470 if _column is self.columns[0] \ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3471 or self.__selection_control == False: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3472 return True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3473 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3474 self.__selection_control = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3475 self.__treeselection.unselect_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3476 self.__selection_control = True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3477 return False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3478 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3479 def _selectAll(self, column): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3480 """_selectAll(column) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3481 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3482 column: index column |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3483 Method connected to "clicked" event in the index column |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3484 If the user clickes in the index column header selecs or deselects |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3485 all rows |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3486 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3487 (_model, _pathlist) = self.__treeselection.get_selected_rows() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3488 # it avoid to set cursor in the index column |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3489 if isinstance(self.__cursor[0],Gtk.TreePath): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3490 self.__treeview.set_cursor(self.__cursor[0], self.__cursor[1]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3491 self.__selection_control = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3492 if len(_pathlist) == 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3493 # select all |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3494 self.__treeselection.select_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3495 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3496 # unselect all |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3497 self.__treeselection.unselect_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3498 self.__selection_control = True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3499 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3500 def _setColumnsHeaders(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3501 """_setColumnsHeaders() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3502 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3503 Sets the headers column values |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3504 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3505 _measure = self.__budget.getMeasure(self.__active_path_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3506 _DS = self.__budget.getDecimals("DS") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3507 _total = _measure.measure |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3508 _total_str = ("%." + str(abs(_DS)) + "f" ) % _total |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3509 self.columns[1].set_title(_("Type")) # Σ parcial Σ total |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3510 self.columns[2].set_title(_("Comment")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3511 self.columns[3].set_title(_("N\n(a)")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3512 self.columns[4].set_title(_("Length\n(b)")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3513 self.columns[5].set_title(_("Width\n(c)")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3514 self.columns[6].set_title(_("Height\n(d)")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3515 self.columns[7].set_title(_("Formula")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3516 self.columns[8].set_title(_("Parcial\n[%s]" % _total_str)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3517 self.columns[9].set_title(_("Subtotal")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3518 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3519 def _setListstoreValues(self, path_record): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3520 """_setListstoreValues(path_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3521 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3522 path_record: Record path in the budget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3523 Sets the liststore record values from a path record |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3524 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3525 self.__liststore.clear() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3526 _budget = self.__budget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3527 if not _budget.hasPath(path_record): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3528 raise ValueError( _("Invalid path") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3529 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3530 _measure = _budget.getMeasure(path_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3531 if isinstance(_measure, base.Measure): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3532 _lines = _measure.lines |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3533 for _line in _lines: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3534 _values = [ _line ] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3535 _treeiter = self.__liststore.append(_values) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3536 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3537 raise ValueError( utils.mapping(_("measure must be a Measure "\ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3538 "object. Type: $1"), (str(type(_measure)),)) ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3539 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3540 def _colorCell(self, column, cell_renderer, tree_model, iter, lcolor): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3541 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3542 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3543 column: the Gtk.TreeViewColumn in the treeview |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3544 cell_renderer: a Gtk.CellRenderer |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3545 tree_model: the Gtk.TreeModel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3546 iter: Gtk.TreeIter pointing at the row |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3547 lcolor: list with 2 colors for even and uneven record |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3548 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3549 Method connected to "set_cell_data_func" of many column |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3550 The set_cell_data_func() method sets the data function (or method) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3551 to use for the column Gtk.CellRenderer specified by cell_renderer. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3552 This function (or method) is used instead of the standard attribute |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3553 mappings for setting the column values, and should set the attributes |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3554 of the cell renderer as appropriate. func may be None to remove the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3555 current data function. The signature of func is: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3556 -def celldatafunction(column, cell, model, iter, user_data) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3557 -def celldatamethod(self, column, cell, model, iter, user_data) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3558 where column is the Gtk.TreeViewColumn in the treeview, cell is the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3559 Gtk.CellRenderer for column, model is the Gtk.TreeModel for the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3560 treeview and iter is the Gtk.TreeIter pointing at the row. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3561 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3562 The method sets cell background color for all columns |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3563 and text for index and amount columns. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3564 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3565 _row_path = tree_model.get_path(iter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3566 _number = _row_path[-1] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3567 if column is self.__index_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3568 cell_renderer.set_property('text', str(_number + 1)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3569 self.__index_column.get_cells()[1].set_property( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3570 'cell-background', lcolor[_number % 2]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3571 elif column is self.__linetype_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3572 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3573 _type = _measure.lineType |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3574 if _type == 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3575 cell_renderer.set_property("pixbuf",self.__normalline_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3576 elif _type == 1: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3577 cell_renderer.set_property("pixbuf",self.__parcialline_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3578 elif _type == 2: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3579 cell_renderer.set_property("pixbuf", |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3580 self.__acumulatedline_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3581 else: #elif _type == 3: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3582 cell_renderer.set_property("pixbuf", |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3583 self.__calculatedline_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3584 elif column is self.__comment_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3585 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3586 _comment = str(_measure.comment) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3587 cell_renderer.set_property('text', _comment) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3588 elif column is self.__units_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3589 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3590 _units = _measure.units |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3591 if isinstance(_units, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3592 _DN = self.__budget.getDecimals("DN") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3593 _units = ("%." + str(abs(_DN)) + "f" ) % _units |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3594 cell_renderer.set_property('text', _units) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3595 elif column is self.__length_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3596 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3597 _length = _measure.length |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3598 if isinstance(_length, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3599 _DD = self.__budget.getDecimals("DD") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3600 _length = ("%." + str(abs(_DD)) + "f" ) % _length |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3601 cell_renderer.set_property('text', _length) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3602 elif column is self.__width_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3603 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3604 _width = _measure.width |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3605 if isinstance(_width, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3606 _DD = self.__budget.getDecimals("DD") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3607 _width = ("%." + str(abs(_DD)) + "f" ) % _width |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3608 cell_renderer.set_property('text', _width) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3609 elif column is self.__height_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3610 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3611 _height = _measure.height |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3612 if isinstance(_height, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3613 _DD = self.__budget.getDecimals("DD") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3614 _height = ("%." + str(abs(_DD)) + "f" ) % _height |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3615 cell_renderer.set_property('text', _height) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3616 elif column is self.__formula_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3617 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3618 _formula = _measure.formula |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3619 cell_renderer.set_property('text', _formula) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3620 elif column is self.__parcial_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3621 _measure_line = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3622 _parcial = _measure_line.parcial |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3623 _type = _measure_line.lineType |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3624 if _type == 1 or _type == 2: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3625 _parcial = "" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3626 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3627 if isinstance(_parcial, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3628 _DS = self.__budget.getDecimals("DS") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3629 _parcial = ("%." + str(abs(_DS)) + "f" ) % _parcial |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3630 cell_renderer.set_property('text', _parcial) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3631 elif column is self.__subtotal_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3632 _measure_line = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3633 _type = _measure_line.lineType |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3634 if _type == 1 or _type == 2: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3635 if _type == 1: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3636 _color = globalVars.color["SUBTOTAL-PARCIAL"] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3637 _subtotal = _measure_line.parcial_subtotal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3638 else: #elif _type == 2: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3639 _color = globalVars.color["SUBTOTAL"] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3640 _subtotal = _measure_line.acumulated_subtotal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3641 lcolor = [_color, _color] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3642 if isinstance(_subtotal, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3643 _DS = self.__budget.getDecimals("DS") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3644 _subtotal= ("%." + str(abs(_DS)) + "f" ) % _subtotal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3645 cell_renderer.set_property('text', _subtotal) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3646 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3647 cell_renderer.set_property('text', "") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3648 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3649 if self.__treeview.get_cursor() == (_row_path,column): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3650 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3651 globalVars.color["ACTIVE"]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3652 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3653 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3654 lcolor[_number % 2]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3655 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3656 def _passMethod(self, column): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3657 """_passMethod(column) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3658 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3659 column: the column that is clicked |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3660 Method connected to "clicked" event of many columns |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3661 Do nothing |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3662 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3663 pass |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3664 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3665 def _showMessageRecord(self, record_path): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3666 """_showMessageRecord(record_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3667 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3668 record_path: the path of the record to show |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3669 Method connected to "change_active" message |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3670 Show the record especified in the "change_active" message |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3671 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3672 _budget = self.__budget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3673 self.__active_path_record = record_path |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3674 self._setColumnsHeaders() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3675 self._setListstoreValues(self.__active_path_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3676 self.__treeview.set_cursor((0,)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3677 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3678 def runMessage(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3679 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3680 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3681 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3682 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3683 "clear": clear instance |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3684 pane_path: tuple that identifies the pane in the notebook page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3685 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3686 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3687 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3688 This method receives a message and executes its corresponding action |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3689 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3690 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3691 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3692 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3693 _path_record = arg |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3694 self._showMessageRecord( _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3695 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3696 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3697 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3698 def _clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3699 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3700 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3701 it deletes the __budget value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3702 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3703 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3704 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3705 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3706 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3707 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3708 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3709 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3710 return self.__scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3711 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3712 def _getPanePath(self): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3713 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3714 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3715 return the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3716 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3717 return self.__pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3718 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3719 def _setPanePath(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3720 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3721 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3722 sets the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3723 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3724 self.__pane_path = pane_path |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3725 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3726 def _getWrPage(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3727 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3728 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3729 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3730 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3731 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3732 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3733 def _setWrPage(self,wr_page): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3734 """_setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3735 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3736 set the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3737 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3738 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3739 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3740 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3741 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3742 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3743 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3744 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3745 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3746 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3747 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3748 """getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3749 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3750 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3751 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3752 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3753 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3754 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3755 "Pane configuration list") |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3756 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3757 "Path that identifies the item in the page notebook") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3758 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3759 "Weak reference from Page instance which creates this class") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3760 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3761 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3762 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3763 "Active Code") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3764 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3765 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3766 class Description(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3767 """gui.Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3768 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3769 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3770 Class to show a description text of a record in a pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3771 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3772 budget: budget showed ("base.Budget" object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3773 page: weak reference from Page instance which creates this class |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3774 pane_path: tuple that represents the view path in the Page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3775 path_record: the record path that must be showed |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3776 Returns the newly created DecompositionList instance |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3777 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3778 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3779 +-- Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3780 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3781 budget: Read. Budget to show, base.obra object. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3782 widget: the main widget (Gtk.ScrolledWindow object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3783 pane_path: Read-Write. Pane page identifier |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3784 wr_page: Read-Write. weak ref from Page object which creates this class |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3785 active_path_record: Read. Active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3786 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3787 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3788 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3789 # TODO: make standard: "DecompositonList and Description" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3790 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3791 def __init__(self, budget, wr_page, pane_path, path_record=None): |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3792 """__init__(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3793 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3794 budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3795 wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3796 pane_path: the path position of the description in the page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3797 path_record: the path of the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3798 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3799 self.__budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3800 self.__wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3801 self.__pane_path: the path position of the description in the page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3802 self.__active_path_recordthe path of the active record |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3803 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3804 self.__textbuffer: The textbuffer of the textview that contain |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3805 the record text. |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3806 self.__label: The Gtk.label with the title of the pane |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3807 self.__widget: the main pane widget, a Gtk.ScrolledWindow() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3808 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3809 Creates an shows the scroledwindow that contain the description text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3810 of the record to be showed in a pane. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3811 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3812 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3813 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3814 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3815 self.__wr_page = wr_page |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3816 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3817 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3818 _budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3819 _text = _budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3820 self.__active_path_record)).text |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3821 _scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3822 _scrollwindow.set_property("expand", True) # widget expand all space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3823 _scrollwindow.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3824 Gtk.PolicyType(1)) # 1 Automatic |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3825 _scrollwindow.set_shadow_type(1) # NONE 0, IN 1, OUT 2, ETCHED_IN 3,ETCHED_OUT 4 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3826 _textview = Gtk.TextView() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3827 _textview.set_wrap_mode(2) # 2 Word |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3828 _textview.set_hexpand(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3829 _textview.set_vexpand(True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3830 self.__textbuffer = _textview.get_buffer() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3831 self.__textbuffer.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3832 _textview.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3833 _vbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3834 _vbox.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3835 self.__label = Gtk.Label(utils.mapping(_("Description text of the "\ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3836 "record $1"), (str(self.__budget.getCode( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3837 self.__active_path_record)),))) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3838 self.__label.set_alignment(0, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3839 self.__label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3840 _vbox.add(self.__label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3841 _vbox.add(_textview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3842 _vbox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3843 _scrollwindow.add(_vbox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3844 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3845 self.__widget = _scrollwindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3846 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3847 def _setActivePathRecord(self, path_record): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3848 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3849 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3850 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3851 Set the new path code to show its description text. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3852 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3853 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3854 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3855 _code = _budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3856 self.__label.set_text(utils.mapping(_("Description text of the record "\ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3857 "$1"), (_code.decode("utf8"),))) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3858 _text = _budget.getRecord(_code).text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3859 self.__textbuffer.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3860 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3861 def runMessage(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3862 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3863 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3864 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3865 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3866 "clear": clear instance |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3867 pane_path: tuple that identifies the pane in the notebook page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3868 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3869 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3870 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3871 This method receives a message and executes its corresponding action |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3872 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3873 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3874 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3875 if _budget.hasPath(arg): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3876 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3877 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3878 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3879 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3880 def _clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3881 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3882 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3883 Delete all instance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3884 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3885 del self.__widget |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3886 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3887 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3888 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3889 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3890 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3891 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3892 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3893 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3894 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3895 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3896 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3897 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3898 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3899 def _getPanePath(self): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3900 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3901 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3902 return the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3903 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3904 return self.__pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3905 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3906 def _setPanePath(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3907 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3908 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3909 sets the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3910 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3911 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3912 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3913 def _getWrPage(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3914 """_getWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3915 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3916 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3917 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3918 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3919 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3920 def _setWrPage(self, wr_page): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3921 """_setWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3922 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3923 set the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3924 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3925 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3926 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3927 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3928 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3929 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3930 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3931 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3932 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3933 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3934 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3935 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3936 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3937 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3938 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3939 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3940 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3941 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3942 "Path that identifie the item in the page notebook") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3943 widget = property(_getWidget, None, None, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3944 "The main widget (Gtk.ScrolledWindow)") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3945 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3946 "Weak reference from Page instance which creates this class") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3947 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3948 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3949 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3950 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3951 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3952 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3953 class Sheet(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3954 """gui.Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3955 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3956 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3957 Class to show a sheeet of conditions text of a record in a pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3958 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3959 Sheet(budget, code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3960 budget: budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3961 code: code record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3962 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3963 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3964 +-- Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3965 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3966 budget: The budget (base.obra objetc) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3967 widget: the main widget (Gtk.Grid object) |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3968 pane_path: the tuple that identifies the pane in the notebook page |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3969 wr_page: weak reference from Page instance which creates this class |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3970 active_path_record: The active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3971 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3972 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3973 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3974 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3975 def __init__(self, budget, wr_page, pane_path, path_record=None): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3976 """__init__(budget, wr_page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3977 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3978 budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3979 wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3980 pane_path: the path position of the description in the page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3981 path_record: the path of the active record |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3982 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3983 self.__budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3984 self.__wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
3985 self.__pane_path: the path position of the description in the page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3986 self.__active_path_record: the path of the active record |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3987 self.__label: The Gtk.label with the title of the pane |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3988 self.__field_liststore: the field liststore |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3989 self.__field_treeview: the field treeview |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3990 self.__field_selection: the field selected in field treview |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3991 self.__section_liststore: the section liststore |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3992 self.__section_treeview: the section treeview |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3993 self.__section_selection: the section selected in the section treeview |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3994 self.__textbuffer: The textbuffer of the textview that contain |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3995 the record text. |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3996 self.__widget: main widget, a Gtk.Grid() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3997 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3998 Creates an shows the scroledwindow that contain the description text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3999 of the record to be showed in a pane. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4000 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4001 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4002 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4003 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4004 self.__wr_page = wr_page |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4005 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4006 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4007 _budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4008 _main_box = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4009 _main_box.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4010 self.__label = Gtk.Label(utils.mapping(_("Sheet of Conditions of the "\ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4011 "record $1"), (self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4012 self.__active_path_record),))) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4013 self.__label.set_xalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4014 self.__label.set_yalign(0) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4015 self.__label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4016 _frame = Gtk.Frame() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4017 _frame.set_shadow_type(Gtk.ShadowType(1)) # 1 In |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4018 _frame_box = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4019 _frame_box.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4020 _list_box = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4021 _list_box.set_orientation(Gtk.Orientation(0)) # 0 Horizontal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4022 self.__field_liststore = Gtk.ListStore(str, str) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4023 self.__field_treeview = Gtk.TreeView(self.__field_liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4024 _field_treeselection = self.__field_treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4025 _field_treeselection.set_mode(Gtk.SelectionMode(1)) # 1 SINGLE |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4026 self.__field_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4027 _field_treeselection.set_select_function( |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4028 self._field_controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4029 self.__field_treeview.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4030 _fieldcode_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4031 _field_column = Gtk.TreeViewColumn(_("Field")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4032 _field_column.pack_start(_fieldcode_cell, False) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4033 _field_cell = Gtk.CellRendererText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4034 _field_column.pack_end(_field_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4035 _field_column.add_attribute(_fieldcode_cell, "text", 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4036 _field_column.add_attribute(_field_cell, "text", 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4037 self.__field_treeview.append_column(_field_column) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4038 _field_scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4039 _field_scrollwindow.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4040 Gtk.PolicyType(1)) # 1 Automatic |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4041 _field_scrollwindow.set_property("hexpand", True) # widget expand all space |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4042 _field_scrollwindow.add(self.__field_treeview) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4043 _field_scrollwindow.set_size_request(-1, 80) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4044 _field_scrollwindow.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4045 self.__section_liststore = Gtk.ListStore(str, str) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4046 self.__section_treeview = Gtk.TreeView(self.__section_liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4047 _section_treeselection = self.__section_treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4048 _section_treeselection.set_mode(Gtk.SelectionMode(1)) # 1 SINGLE |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4049 self.__section_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4050 _section_treeselection.set_select_function( |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4051 self._section_controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4052 self.__section_treeview.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4053 _sectioncode_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4054 _section_column = Gtk.TreeViewColumn(_("Section")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4055 _section_column.pack_start(_sectioncode_cell, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4056 _section_column.add_attribute(_sectioncode_cell, "text", 0) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4057 _section_cell = Gtk.CellRendererText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4058 _section_column.pack_end(_section_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4059 _section_column.add_attribute(_section_cell, "text", 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4060 self.__section_treeview.append_column(_section_column) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4061 _section_scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4062 _section_scrollwindow.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4063 Gtk.PolicyType(1)) # 1 Automatic |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4064 _section_scrollwindow.set_property("hexpand", True) # widget expand all space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4065 _section_scrollwindow.set_size_request(-1, 90) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4066 _section_scrollwindow.add(self.__section_treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4067 _section_scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4068 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4069 _list_box.add(_field_scrollwindow) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4070 _list_box.add(_section_scrollwindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4071 _list_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4072 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4073 _scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4074 _scrollwindow.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4075 Gtk.PolicyType(1)) # 1 Automatic |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4076 _scrollwindow.set_property("expand", True) # widget expand all space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4077 _textview = Gtk.TextView() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4078 _textview.set_wrap_mode(2) # 2 Word |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4079 _textview.set_property("expand", True) # widget expand all space |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4080 self.__textbuffer = _textview.get_buffer() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4081 _textview.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4082 _hbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4083 _hbox.set_orientation(Gtk.Orientation(0)) # 0 Horizontal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4084 _hbox.add(_textview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4085 _hbox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4086 _frame_box.add(self.__label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4087 _frame_box.add(_list_box) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4088 _frame_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4089 _frame.add(_frame_box) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4090 _frame.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4091 _main_box.add(_frame) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4092 _vbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4093 _vbox.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4094 _vbox.add(_hbox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4095 _vbox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4096 _main_box.add(_scrollwindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4097 _main_box.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4098 _scrollwindow.add(_vbox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4099 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4100 self.__widget = _main_box |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4101 self._setFields() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4102 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4103 def _setFields(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4104 """_setFields() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4105 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4106 Set the fields items in the field treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4107 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4108 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4109 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4110 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4111 _field_list = _sheet.getFields() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4112 self.__field_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4113 for _field in _field_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4114 _field_text = self.__budget.getSheetField(_field) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4115 _iter = self.__field_liststore.append([_field, _field_text]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4116 _treeselection = self.__field_treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4117 _treeselection.select_path(0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4118 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4119 def _setSection(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4120 """_setSection() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4121 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4122 Set the section items in the section treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4123 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4124 self.__section_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4125 if not self.__field_selection is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4126 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4127 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4128 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4129 _section_list = _sheet.getSections(self.__field_selection) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4130 for _section in _section_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4131 _section_text = self.__budget.getSheetSection(_section) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4132 _iter = self.__section_liststore.append([_section, _section_text]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4133 _treeselection = self.__section_treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4134 _treeselection.select_path(0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4135 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4136 def _setText(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4137 """_setText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4138 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4139 Set the text in the textview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4140 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4141 if not self.__section_selection is None and\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4142 not self.__field_selection is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4143 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4144 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4145 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4146 _paragraph_code = _sheet.getParagraph(self.__field_selection, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4147 self.__section_selection) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4148 _paragraph = self.__budget.getSheetParagraph(_paragraph_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4149 self.__textbuffer.set_text(_paragraph) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4150 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4151 self.__textbuffer.set_text("") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4152 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4153 def _field_controlSelection(self, selection, model, path, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4154 path_currently_selected, *data): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4155 """_controlSelection(selection, model, path, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4156 path_currently_selected, *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4157 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4158 selection: treeselection |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4159 path: selected path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4160 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4161 Method connected to set_selection_function() in field treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4162 This method is called before any node is selected or unselected, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4163 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4164 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4165 of the node may be toggled, and FALSE if the state of the node should |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4166 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4167 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4168 When a user select a row in the field treeview the section treeview is |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4169 reloaded to show the sections of this field and already the text sheet. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4170 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4171 _treeiter = self.__field_liststore.get_iter(path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4172 self.__field_selection = self.__field_liststore.get_value(_treeiter, 0) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4173 self._setSection() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4174 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4175 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4176 def _section_controlSelection(self, selection, model, path, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4177 path_currently_selected, *data): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4178 """_section_controlSelection(selection, model, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4179 path, path_currently_selected, *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4180 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4181 selection: treeselection |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4182 path: selected path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4183 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4184 Method connected to set_selection_function() in sector treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4185 This method is called before any node is selected or unselected, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4186 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4187 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4188 of the node may be toggled, and FALSE if the state of the node should |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4189 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4190 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4191 When a user select a row in the field treeview the text sheet for this |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4192 section in showed |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4193 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4194 _treeiter = self.__section_liststore.get_iter(path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4195 self.__section_selection = self.__section_liststore.get_value(_treeiter, 0) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4196 self._setText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4197 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4198 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4199 def _setActivePathRecord(self, path_record): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4200 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4201 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4202 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4203 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4204 Set the new path code to show its sheet of condition text. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4205 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4206 self.__field_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4207 self.__field_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4208 self.__section_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4209 self.__section_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4210 self.__textbuffer.set_text("") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4211 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4212 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4213 _code = _budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4214 self.__label.set_text(utils.mapping(_("Sheet2 of Conditions of the "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4215 "record $1"), (_code,))) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4216 self._setFields() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4217 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4218 def runMessage(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4219 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4220 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4221 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4222 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4223 "clear": clear instance |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4224 pane_path: tuple that identifies the pane in the notebook page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4225 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4226 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4227 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4228 This method receives a message and executes its corresponding action |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4229 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4230 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4231 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4232 if _budget.hasPath(arg): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4233 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4234 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4235 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4236 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4237 def _clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4238 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4239 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4240 Deletes all the instance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4241 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4242 del self.__wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4243 del self.__widget |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4244 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4245 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4246 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4247 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4248 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4249 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4250 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4251 del self.__field_liststore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4252 del self.__field_treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4253 del self.__field_selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4254 del self.__section_liststore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4255 del self.__section_treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4256 del self.__section_selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4257 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4258 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4259 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4260 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4261 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4262 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4263 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4264 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4265 def _getPanePath(self): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4266 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4267 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4268 return the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4269 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4270 return self.__pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4271 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4272 def _setPanePath(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4273 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4274 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4275 sets the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4276 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4277 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4278 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4279 def _getWrPage(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4280 """_getWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4281 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4282 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4283 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4284 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4285 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4286 def _setWrPage(self, wr_page): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4287 """_setWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4288 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4289 set the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4290 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4291 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4292 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4293 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4294 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4295 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4296 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4297 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4298 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4299 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4300 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4301 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4302 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4303 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4304 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4305 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4306 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4307 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4308 "Path that identifie the item in the page notebook") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4309 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4310 "Lista de configuracion de vistas") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4311 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4312 "Weak reference from Page instance which creates this class") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4313 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4314 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4315 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4316 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4317 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4318 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4319 class FileView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4320 """gui.FileView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4321 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4322 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4323 Class to show the file icons of a record in a pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4324 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4325 Description(budget, page, pane_path, path_record=None) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4326 budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4327 wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4328 pane_path: the path position of the description in the page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4329 path_record: the path of the active record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4330 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4331 +-- object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4332 +-- FileView |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4333 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4334 widget: the main widget (Gtk.ScrolledWindow object) |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4335 pane_path: the tuple that identifies the pane in the notebook page |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4336 budget: The budget (base.obra object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4337 active_path_record: Read. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4338 wr_page: Read-Write. weak reference from Page instance which creates this class |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4339 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4340 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4341 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4342 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4343 def __init__(self, budget, wr_page, pane_path, path_record=None): |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4344 """__init__(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4345 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4346 budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4347 wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4348 pane_path: the path position of the description in the page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4349 path_record: the path of the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4350 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4351 self.__budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4352 self.__wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4353 self.__pane_path: the path position of the description in the page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4354 self.__active_path_record: the path of the active record |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4355 self.__active_code: the code of the active record |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4356 self.__icon_box: the box that contains the icon |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4357 self.__widget: main widget, a Gtk.ScrolledWindow |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4358 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4359 Creates an shows the scroledwindow that contain icon files |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4360 of the record to be showed in a pane. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4361 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4362 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4363 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4364 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4365 self.__wr_page = wr_page |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4366 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4367 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4368 self.__active_code = budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4369 _budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4370 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4371 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4372 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4373 self.__icon_box = self._getIconBox(_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4374 _scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4375 _scrollwindow.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4376 self.__icon_box.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4377 _scrollwindow.add(self.__icon_box) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4378 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4379 self.__widget = _scrollwindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4380 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4381 def _getIconBox(self, record): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4382 """_getIconBox(record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4383 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4384 record: the active record object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4385 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4386 Creates and returns the box whith te icon files of the active record. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4387 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4388 _files = record.getFiles() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4389 _flowbox = Gtk.FlowBox() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4390 _flowbox.set_valign(Gtk.Align.START) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4391 _flowbox.set_max_children_per_line(30) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4392 _flowbox.set_selection_mode(Gtk.SelectionMode.NONE) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4393 _flowbox.set_property("expand", True) # widget expand all space |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4394 for _file in _files: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4395 _path = os.path.dirname(self.__budget.filename) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4396 _file_path = os.path.join(_path, _file.name) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4397 _box = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4398 _box.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4399 if os.path.exists(_file_path): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4400 _filetype = utils.getFiletype(_file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4401 _event_box = Gtk.LinkButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4402 _file_icon = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4403 # "image", "wmf", "dxf", "pdf" , "video", |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4404 # "office-document", "office-presentation", "office-spreadsheet", |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4405 # "html", "rtf", "txt", "" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4406 # icon |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4407 if _filetype in ["image", "wmf"]: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4408 try: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4409 _image_pixbuf = GdkPixbuf.Pixbuf.new_from_file(_file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4410 _image_pixbuf = _image_pixbuf.scale_simple(64, 64, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4411 GdkPixbuf.InterpType(2)) # 2 BILINEAR |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4412 except: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4413 _image_pixbuf = GdkPixbuf.Pixbuf.new_from_file( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4414 globalVars.getAppPath("IMAGE-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4415 _image_pixbuf = _image_pixbuf.scale_simple(64, 64, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4416 GdkPixbuf.InterpType(2)) # 2 BILINEAR |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4417 _file_icon.set_from_pixbuf(_image_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4418 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4419 _filetype, _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4420 elif _filetype == "dxf": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4421 _dxf_pixbuf = GdkPixbuf.Pixbuf.new_from_file( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4422 globalVars.getAppPath("DXF-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4423 _dxf_pixbuf = _dxf_pixbuf.scale_simple(64, 64, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4424 GdkPixbuf.InterpType(2)) # 2 BILINEAR |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4425 _file_icon.set_from_pixbuf(_dxf_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4426 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4427 "dxf", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4428 elif _filetype == "pdf": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4429 _pdf_pixbuf = GdkPixbuf.Pixbuf.new_from_file( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4430 globalVars.getAppPath("PDF-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4431 _pdf_pixbuf = _pdf_pixbuf.scale_simple(64, 64, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4432 GdkPixbuf.InterpType(2)) # 2 BILINEAR |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4433 _file_icon.set_from_pixbuf(_pdf_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4434 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4435 "pdf", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4436 elif _filetype == "video": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4437 _video_pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4438 "video-x-generic", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4439 _file_icon.set_from_pixbuf(_video_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4440 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4441 "video", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4442 elif _filetype == "office-document": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4443 _document_pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4444 "x-office-document", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4445 _file_icon.set_from_pixbuf(_document_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4446 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4447 "office-document", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4448 elif _filetype == "office-presentation": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4449 _presentation_pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4450 "x-office-presentation", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4451 _file_icon.set_from_pixbuf(_presentation_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4452 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4453 "office-presentation", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4454 elif _filetype == "office-spreadsheet": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4455 _spreadsheet_pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4456 "x-office-spreadsheet", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4457 _file_icon.set_from_pixbuf(_spreadsheet_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4458 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4459 "office-spreadsheet", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4460 elif _filetype == "html": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4461 _html_pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4462 "text-html", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4463 _file_icon.set_from_pixbuf(_html_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4464 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4465 "html", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4466 elif _filetype == "rtf": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4467 _rtf_pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4468 "text-x-generic", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4469 _file_icon.set_from_pixbuf(_rtf_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4470 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4471 "rtf", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4472 elif _filetype == "txt": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4473 _txt_pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4474 "text-x-generic", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4475 _file_icon.set_from_pixbuf(_txt_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4476 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4477 "txt", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4478 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4479 _missing_pixbuf = Gtk.IconTheme.get_default().load_icon( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4480 "image-missing", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4481 _file_icon.set_from_pixbuf(_missing_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4482 # Is secure open no detected filetype? |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4483 #_event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4484 # "", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4485 _event_box = Gtk.EventBox() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4486 _event_box.add(_file_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4487 _event_box.props.margin = 5 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4488 _box.add(_event_box) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4489 _file_icon.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4490 _event_box.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4491 # label |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4492 _label_event_box = Gtk.EventBox() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4493 _label = Gtk.Label(_file.name) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4494 _label_event_box.add(_label) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4495 _label_event_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4496 _label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4497 _label_event_box.props.margin = 5 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4498 _box.add(_label_event_box) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4499 _box.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4500 _box.props.margin = 5 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4501 _flowbox.add(_box) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4502 _flowbox.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4503 #_scrolled.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4504 return _flowbox |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4505 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4506 def _launchFile(self, widget, kind, file_path): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4507 """_launchFile(widget, event, kind, file_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4508 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4509 widget: the widget that emit the signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4510 king: kind of file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4511 file_path: the path file to be launch |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4512 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4513 Launch the file if a click emit the signal. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4514 Method connected to "activate-link" signal in images botton link |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4515 Return True: stops propagate event and avoids to raise an error |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4516 when opening an empty uri. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4517 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4518 openwith.launch_file(kind, file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4519 return True |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4520 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4521 def _setActivePathRecord(self, path_record): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4522 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4523 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4524 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4525 Set the new path code to show its description text. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4526 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4527 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4528 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4529 _code = _budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4530 _record = self.__budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4531 self.__icon_box.destroy() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4532 self.__icon_box = self._getIconBox(_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4533 self.__icon_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4534 self.__widget.add_with_viewport(self.__icon_box) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4535 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4536 def runMessage(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4537 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4538 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4539 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4540 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4541 "clear": clear instance |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4542 pane_path: tuple that identifies the pane in the notebook page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4543 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4544 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4545 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4546 This method receives a message and executes its corresponding action |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4547 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4548 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4549 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4550 if _budget.hasPath(arg): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4551 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4552 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4553 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4554 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4555 def _clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4556 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4557 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4558 Delete all instance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4559 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4560 del self.__widget |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4561 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4562 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4563 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4564 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4565 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4566 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4567 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4568 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4569 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4570 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4571 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4572 def _getPanePath(self): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4573 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4574 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4575 return the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4576 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4577 return self.__pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4578 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4579 def _setPanePath(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4580 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4581 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4582 sets the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4583 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4584 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4585 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4586 def _getWrPage(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4587 """_getWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4588 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4589 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4590 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4591 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4592 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4593 def _setWrPage(self, wr_page): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4594 """setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4595 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4596 set the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4597 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4598 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4599 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4600 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4601 """getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4602 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4603 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4604 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4605 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4606 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4607 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4608 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4609 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4610 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4611 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4612 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4613 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4614 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4615 "Path that identifie the item in the page notebook") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4616 widget = property(_getWidget, None, None, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4617 "The main widget (Gtk.ScrolledWindow)") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4618 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4619 "Weak reference from Page instance which creates this class") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4620 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4621 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4622 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4623 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4624 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4625 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4626 class CompanyView(object): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4627 """gui:CompanyView: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4628 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4629 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4630 Class to show the company records of a budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4631 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4632 CompanyView(budget, wr_page, pane_path, path_record=(None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4633 budget: budget showed ("base.Budget" object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4634 wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4635 pane_path: tuple that represents the path of the List in the Page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4636 path_record: path of the active record in the budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4637 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4638 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4639 +-- CompanyView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4640 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4641 active_path_record: Read. Path of the active record in the budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4642 widget: Read. Window that contains the main widget, a Gtk.Paned |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4643 pane_path: Read-Write. Pane page identifier |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4644 wr_page: Read-Write. weak reference from Page instance which creates this class |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4645 budget: Read. Budget to show, base.budget instance. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4646 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4647 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4648 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4649 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4650 def __init__(self, budget, wr_page, pane_path, path_record=None): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4651 """__init__(budget, wr_page, pane_path, path_record=None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4652 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4653 budget: budget showed ("base.Budget" object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4654 wr_page: weak reference from Page instance which creates this class |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4655 pane_path: tuple that represents the path of the pane in the Page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4656 path_record: path of the active record in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4657 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4658 self.__selection: "company" or "office" selected treeview |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4659 self.__budget: budget: budget showed ("base.Budget" object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4660 self.__wr_page: weak reference from Page instance which creates this class |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4661 self.__pane_path: tuple that represents the path of the List in the Page |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4662 self.__active_path_record: path of the active record in the budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4663 self.__widget: main widget, a Gtk.Paned |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4664 self.__treestore: to store companys data |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4665 self.__option_View: OptionView object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4666 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4667 Creates an shows the widgets with the company data. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4668 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4669 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4670 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4671 self.__selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4672 # Seting init args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4673 if not isinstance(budget, base.Budget): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4674 raise ValueError( _("Argument must be a Budget object") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4675 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4676 self.__wr_page = wr_page |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4677 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4678 self.__active_path_record = path_record |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4679 # main widget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4680 self.__widget = Gtk.Paned.new(Gtk.Orientation(0)) # 0 Horizontal |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4681 self.__widget.set_position(230) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4682 # TreeStore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4683 self.__treestore = Gtk.TreeStore(str, str) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4684 self._setTreeStoreValues() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4685 # Select Treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4686 _select_treeview = Gtk.TreeView(self.__treestore) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4687 _select_treeview.set_enable_search(False) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4688 _select_treeview.set_reorderable(False) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4689 _select_treeview.set_headers_visible(False) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4690 _select_treeview.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4691 # Scrolled_window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4692 _scrolled_window = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4693 _scrolled_window.set_property("expand", True) # widget expand all space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4694 _scrolled_window.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4695 Gtk.PolicyType(1)) # 1 Automatic |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4696 _scrolled_window.add(_select_treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4697 # colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4698 _text_color = globalVars.color["TEXT"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4699 _background_color = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4700 globalVars.color["UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4701 globalVars.color["EVEN"]] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4702 _code_column = Gtk.TreeViewColumn() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4703 _code_column.set_clickable(True) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4704 _code_column.set_fixed_width(200) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4705 _code_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4706 _code_cell.set_property('foreground', _text_color) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4707 _code_column.pack_start(_code_cell, True) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4708 _code_column.add_attribute(_code_cell, 'text', 0) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4709 _summary_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4710 _summary_cell.set_property('foreground', _text_color) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4711 _code_column.pack_start(_summary_cell, True) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4712 _code_column.add_attribute(_summary_cell, 'text', 1) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4713 # Index column |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4714 _select_treeview.append_column(_code_column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4715 # control selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4716 _treeselection = _select_treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4717 _treeselection.set_mode(Gtk.SelectionMode(1)) # 1 SINGLE |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4718 _treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4719 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4720 _scrolled_window.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4721 # Option View |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4722 self.__option_View = OptionView() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4723 # Add to main widget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4724 self.__widget.add1(_scrolled_window) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4725 self.__widget.add2(self.__option_View.widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4726 # Selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4727 _select_treeview.set_cursor((0,), None, False) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4728 _select_treeview.grab_focus() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4729 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4730 self.__widget.show() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4731 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4732 def _setOptions(self, type): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4733 """_setOptions(type) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4734 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4735 type: "company" or "office" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4736 Sets the Options in the OptionView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4737 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4738 if type == "company": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4739 _options = [("code", _("Code"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4740 _("""Code that define the company""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4741 ("summary", _("Summary"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4742 _("""Summary of the company name""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4743 ("name", _("Name"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4744 _("""Complete name""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4745 ("cif", _("CIF"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4746 _("""Fiscal identifier number""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4747 ("web", _("Web"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4748 _("""Company web page""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4749 ("email", _("Email"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4750 _("""Company email""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4751 ] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4752 self.__option_View.options = _options |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4753 elif type == "office": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4754 _options = [("officeType", _("Type"), "string", |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4755 _("""Type of Office: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4756 C: Central office |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4757 D: Local office |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4758 R: Performer""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4759 ("subname", _("Name"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4760 _("Office name")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4761 ("address", _("Address"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4762 ("postal code", _("Postal code"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4763 ("town", _("Town"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4764 ("province", _("Province"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4765 ("country", _("Country"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4766 ("phone", _("Phone"), "list", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4767 _("Phone numbers of the office")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4768 ("fax", _("Fax"), "list", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4769 _("Fax numbers of the office")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4770 ("contact person", _("Contact person"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4771 _("Contact persons in the office")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4772 ] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4773 self.__option_View.options = _options |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4774 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4775 print(_("Unknow Option Type") ) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4776 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4777 def _setTreeStoreValues(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4778 """_setTreeStoreValues() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4779 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4780 Sets the treestore values from the budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4781 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4782 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4783 _company_keys = _budget.getCompanyKeys() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4784 for _company_key in _company_keys: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4785 _company = _budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4786 _values = [_company_key, _company.summary] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4787 _treeiter = self.__treestore.append(None, _values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4788 _offices = _company.offices |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4789 for _office in _offices: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4790 # TODO: Test offices |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4791 _values = [_office.officeType, _office.subname] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4792 self.__treestore.append(_treeiter, _values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4793 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4794 def _controlSelection(self, selection, model, path, path_currently_selected, *data): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4795 """_controlSelection(selection, model, path, path_currently_selected, *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4796 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4797 selection: selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4798 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4799 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4800 This method is called before any node is selected or unselected, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4801 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4802 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4803 of the node may be toggled, and FALSE if the state of the node should |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4804 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4805 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4806 The selection changes the company/office in the option treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4807 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4808 if len(path) == 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4809 # The selection is a company |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4810 _company_key = self.__treestore[path][0] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4811 _company = self.__budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4812 _selection = "company" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4813 _values = _company.values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4814 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4815 # The selection is a office |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4816 _company_key = self.__treestore[path[:1]][0] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4817 _company = self.__budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4818 _selection = "office" |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4819 _office = _company.offices[path[1]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4820 _values = _office.values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4821 if not self.__selection == _selection: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4822 self.__selection = _selection |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4823 self._setOptions(_selection) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4824 self.__option_View.values = _values |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4825 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4826 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4827 def _showMessageRecord(self, record_path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4828 """_showMessageRecord(record_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4829 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4830 record_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4831 Method connected to "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4832 Show the record especified in the "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4833 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4834 self.__active_path_record = record_path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4835 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4836 def runMessage(self, message, pane_path, arg=None): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4837 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4838 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4839 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4840 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4841 "clear": clear instance |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4842 pane_path: tuple that identifies the pane in the notebook page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4843 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4844 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4845 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4846 This method receives a message and executes its corresponding action |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4847 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4848 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4849 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4850 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4851 _path_record = arg |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4852 self._showMessageRecord( _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4853 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4854 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4855 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4856 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4857 def _colorCell(self, column, cell_renderer, tree_model, iter, lcolor): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4858 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4859 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4860 column: the Gtk.TreeViewColumn in the treeview |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4861 cell_renderer: a Gtk.CellRenderer |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4862 tree_model: the Gtk.TreeModel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4863 iter: Gtk.TreeIter pointing at the row |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4864 lcolor: list with 2 gtk colors for even and uneven record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4865 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4866 Method connected to "set_cell_data_func" of many column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4867 The set_cell_data_func() method sets the data function (or method) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4868 to use for the column Gtk.CellRenderer specified by cell_renderer. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4869 This function (or method) is used instead of the standard attribute |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4870 mappings for setting the column values, and should set the attributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4871 of the cell renderer as appropriate. func may be None to remove the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4872 current data function. The signature of func is: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4873 -def celldatafunction(column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4874 -def celldatamethod(self, column, cell, model, iter, user_data) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4875 where column is the Gtk.TreeViewColumn in the treeview, cell is the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4876 Gtk.CellRenderer for column, model is the Gtk.TreeModel for the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4877 treeview and iter is the Gtk.TreeIter pointing at the row. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4878 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4879 The method sets cell background color for all columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4880 and text for index and amount columns. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4881 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4882 _row_path = tree_model.get_path(iter) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4883 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4884 if column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4885 cell_renderer.set_property('text', str(_number + 1)) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4886 self.__index_column.get_cells()[1].set_property( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4887 'cell-background', lcolor[_number % 2]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4888 if self.__treeview.get_cursor() == (_row_path,column): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4889 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4890 globalVars.color["ACTIVE"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4891 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4892 cell_renderer.set_property('cell-background', |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4893 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4894 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4895 def _clear(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4896 """_clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4897 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4898 it deletes the self.__budget value |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4899 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4900 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4901 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4902 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4903 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4904 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4905 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4906 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4907 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4908 |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4909 def _getPanePath(self): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4910 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4911 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4912 return the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4913 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4914 return self.__pane_path |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4915 |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4916 def _setPanePath(self, pane_path): |
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4917 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4918 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4919 sets the tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4920 """ |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4921 self.__pane_path = pane_path |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4922 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4923 def _getWrPage(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4924 """_getWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4925 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4926 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4927 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4928 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4929 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4930 def _setWrPage(self,wr_page): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4931 """_setWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4932 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4933 set the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4934 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4935 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4936 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4937 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4938 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4939 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4940 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4941 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4942 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4943 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4944 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4945 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4946 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4947 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4948 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4949 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4950 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4951 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4952 "Active path record") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4953 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4954 "main widget") |
10
d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
9
diff
changeset
|
4955 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4956 "Path that identifies the item in the page notebook") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4957 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4958 "Weak reference from Page instance which creates this class") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4959 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4960 "Budget object") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4961 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4962 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4963 class OptionView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4964 """gui.OptionView: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4965 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4966 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4967 It creates a treeview whith the column "Option Name" "Value" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4968 and "Type" to show and edit Options |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4969 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4970 OptionView() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4971 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4972 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4973 +-- OptionView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4974 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4975 widget: Read. Main widget |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4976 options: Write |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4977 values: Write |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4978 Methods: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4979 No public Methods |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4980 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4981 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4982 def __init__(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4983 """__init__() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4984 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4985 self.__option_dict: |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4986 {"option key" : ["option name", "value", "option type", |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4987 "option_description"]} |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4988 self.__option_list: option keys list |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4989 self.__option_types: valid option types list |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4990 self.__liststore: Gtk.ListStore |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4991 self.__treeview: Gtk.TreeView |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4992 self.__option_column: option column |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4993 self.__value_column: value column |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4994 self.__type_column: type column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4995 self.__description_label: Gtk.Label |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4996 self.__widget: Main widget |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4997 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4998 Creates an shows the widget that contain the option data. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4999 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5000 self.__option_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5001 self.__option_list = [] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5002 self.__option_types = {"boolean" : _("Boolean"), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5003 "integer": _("Integer"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5004 "string": _("Text"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5005 "color" : _("Color"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5006 "list" : _("List")} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5007 # ListStore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5008 self.__liststore = Gtk.ListStore(str, str, str, str, str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5009 # Treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5010 self.__treeview = Gtk.TreeView(self.__liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5011 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5012 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5013 self.__treeview.set_headers_clickable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5014 # vbox |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5015 _vbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5016 _vbox.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5017 # Scrolled_window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5018 _scrolled_window = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5019 _scrolled_window.set_property("expand", True) # widget expand all space |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5020 _scrolled_window.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5021 Gtk.PolicyType(1)) # 1 Automatic |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5022 _scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5023 _scrolled_window.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5024 _vbox.add(_scrolled_window) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5025 # colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5026 _text_color = globalVars.color["TEXT"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5027 _background_color = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5028 globalVars.color["UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5029 globalVars.color["EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5030 # Option Column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5031 self.__option_column = Gtk.TreeViewColumn() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5032 self.__option_column.set_sizing(Gtk.TreeViewColumnSizing(2)) # 2 Fixed |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5033 self.__option_column.set_fixed_width(150) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5034 self.__option_column.set_resizable(True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5035 _option_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5036 _option_cell.set_property('foreground', _text_color) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5037 self.__option_column.pack_start(_option_cell, True) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5038 self.__option_column.set_cell_data_func(_option_cell, self._colorCell, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5039 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5040 self.__option_column.set_title(_("Option name")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5041 self.__option_column.add_attribute(_option_cell, 'text', 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5042 self.__treeview.append_column(self.__option_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5043 # Value Column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5044 self.__value_column = Gtk.TreeViewColumn() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5045 self.__value_column.set_sizing(Gtk.TreeViewColumnSizing(2)) # 2 Fixed |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5046 self.__value_column.set_fixed_width(275) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5047 self.__value_column.set_resizable(True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5048 _value_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5049 _value_cell.set_property('foreground', _text_color) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5050 self.__value_column.pack_start(_value_cell, True) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5051 self.__value_column.set_cell_data_func(_value_cell, self._colorCell, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5052 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5053 self.__value_column.set_title(_("Value")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5054 self.__value_column.add_attribute(_value_cell, 'text', 2) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5055 self.__treeview.append_column(self.__value_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5056 # Type Column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5057 self.__type_column = Gtk.TreeViewColumn() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5058 self.__type_column.set_sizing(Gtk.TreeViewColumnSizing(2)) # 2 Fixed |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5059 self.__type_column.set_fixed_width(70) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5060 self.__type_column.set_resizable(True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5061 _type_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5062 _type_cell.set_property('foreground', _text_color) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5063 self.__type_column.pack_start(_type_cell, True) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5064 self.__type_column.set_cell_data_func(_type_cell, self._colorCell, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5065 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5066 self.__type_column.set_title(_("Type")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5067 self.__treeview.append_column(self.__type_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5068 # End Column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5069 _end_column = Gtk.TreeViewColumn() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5070 _end_column.set_clickable(False) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5071 _end_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5072 _end_cell.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5073 globalVars.color["UNEVEN"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5074 _end_column.pack_start(_end_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5075 self.__treeview.append_column(_end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5076 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5077 self.__treeview.connect("key-press-event", self._treeviewKeyPressEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5078 self.__treeview.connect("button-press-event", |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5079 self._treeviewClickedEvent) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5080 # control selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5081 _treeselection = self.__treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5082 _treeselection.set_mode(Gtk.SelectionMode(3)) # 3 MULTIPLE |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5083 _treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5084 # labels |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5085 _frame = Gtk.Frame() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5086 _frame.set_shadow_type(2) # NONE 0, IN 1, OUT 2, ETCHED_IN 3,ETCHED_OUT 4 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5087 _vbox2 = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5088 _vbox2.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5089 _frame.add(_vbox2) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5090 _label = Gtk.Label() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5091 _label.set_xalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5092 _label.set_yalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5093 _label.set_margin_start(12) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5094 _label.set_markup("<b>" + _("Description:") + "</b>") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5095 _label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5096 self.__description_label = Gtk.Label() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5097 self.__description_label.set_xalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5098 self.__description_label.set_yalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5099 self.__description_label.set_margin_start(24) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5100 self.__description_label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5101 _vbox2.add(_label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5102 _vbox2.add(self.__description_label) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5103 _vbox2.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5104 _frame.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5105 _vbox.add(_frame) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5106 # Show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5107 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5108 _vbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5109 self.__widget = _vbox |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5110 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5111 def _treeviewKeyPressEvent(self, widget, event): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5112 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5113 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5114 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5115 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5116 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5117 The "key-press-event" signal is emitted when the user presses a key |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5118 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5119 Returns :TRUE to stop other handlers from being invoked for the event. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5120 Returns :FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5121 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5122 If the user press the right cursor button and the cursor is in the |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5123 value column or press the left cursor button and the cursor is |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5124 in the value column the event is estoped, else the event is propagated. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5125 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5126 (_cursor_path, _column) = self.__treeview.get_cursor() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5127 if (event.keyval in [Gdk.keyval_from_name("Right"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5128 Gdk.keyval_from_name("KP_Right")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5129 and _column == self.__value_column) \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5130 or (event.keyval in [Gdk.keyval_from_name("Left"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5131 Gdk.keyval_from_name("KP_Left")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5132 and _column == self.__value_column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5133 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5134 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5135 _description = self.__liststore[_cursor_path][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5136 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5137 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5138 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5139 def _treeviewClickedEvent(self, widget, event): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5140 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5141 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5142 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5143 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5144 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5145 The "button-press-event" signal is emitted when a mouse button is |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5146 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5147 Returns TRUE to stop other handlers from being invoked for the event. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5148 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5149 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5150 The cursos is moved to value column. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5151 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5152 path_at_pos = self.__treeview.get_path_at_pos(int(event.x), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5153 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5154 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5155 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5156 _description = self.__liststore[_path_cursor][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5157 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5158 if _column == self.__value_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5159 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5160 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5161 self.__treeview.set_cursor(_path_cursor,self.__value_column, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5162 True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5163 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5164 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5165 return True |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5166 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5167 def _controlSelection(self, selection, model, path, path_currently_selected, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5168 *data): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5169 """_controlSelection(selection, model, path, path_currently_selected, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5170 *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5171 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5172 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5173 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5174 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5175 This method is called before any node is selected or unselected, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5176 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5177 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5178 of the node may be toggled, and FALSE if the state of the node should |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5179 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5180 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5181 Return False so none row is selected |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5182 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5183 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5184 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5185 def _colorCell(self, column, cell_renderer, tree_model, iter, lcolor): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5186 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5187 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5188 column: the Gtk.TreeViewColumn in the treeview |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5189 cell_renderer: a Gtk.CellRenderer |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5190 tree_model: the Gtk.TreeModel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5191 iter: Gtk.TreeIter pointing at the row |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5192 lcolor: list with 2 colors for even and uneven record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5193 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5194 Method connected to "set_cell_data_func" of the column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5195 The set_cell_data_func() method sets the data function (or method) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5196 to use for the column Gtk.CellRenderer specified by cell_renderer. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5197 This function (or method) is used instead of the standard attribute |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5198 mappings for setting the column values, and should set the attributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5199 of the cell renderer as appropriate. func may be None to remove the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5200 current data function. The signature of func is: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5201 -def celldatafunction(column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5202 -def celldatamethod(self, column, cell, model, iter, user_data) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5203 where column is the Gtk.TreeViewColumn in the treeview, cell is the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5204 Gtk.CellRenderer for column, model is the Gtk.TreeModel for the |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5205 treeview and iter is the Gtk.TreeIter pointing at the row. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5206 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5207 The method sets cell background color for all columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5208 and text for type column. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5209 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5210 _row_path = tree_model.get_path(iter) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5211 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5212 if self.__treeview.get_cursor() == (_row_path,column): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5213 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5214 globalVars.color["ACTIVE"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5215 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5216 cell_renderer.set_property('cell-background', |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5217 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5218 if column is self.__type_column: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5219 _type = self.__option_types[tree_model[_row_path][3]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5220 cell_renderer.set_property('text', _type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5221 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5222 def _setOptions(self, option_list): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5223 """_setOptions(option_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5224 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5225 option_list: list of tuples |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5226 (option, option name, type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5227 option: option identifier |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5228 option name: a string with the option name |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5229 Description: a string with the option description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5230 type: can be "boolean" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5231 "integer" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5232 "string" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5233 "color" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5234 Sets the Options in the treeview rows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5235 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5236 self.__option_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5237 self.__option_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5238 self.__liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5239 if isinstance(option_list, list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5240 for _option in option_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5241 if isinstance(_option, tuple) and len(_option) == 4: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5242 _option_key = _option[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5243 _option_name = _option[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5244 _option_type = _option[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5245 _option_description = _option[3] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5246 #-# str and unicode |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5247 if (isinstance(_option_key, str) or \ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5248 isinstance(_option_key, unicode)) and \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5249 (isinstance(_option_name, str) or\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5250 isinstance(_option_name, unicode))and \ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5251 _option_type in self.__option_types.keys(): |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5252 self.__liststore.append([_option_key, _option_name, "", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5253 _option_type, _option_description]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5254 self.__option_dict[_option_key] = [_option_name, "", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5255 _option_type, _option_description] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5256 self.__option_list.append(_option_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5257 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5258 print(_("Option values must be strings") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5259 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5260 print(_("Option must be a tuple with 4 items") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5261 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5262 print(_("Option list must be a list") ) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5263 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5264 def _setValues(self, values): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5265 """_setValues(values) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5266 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5267 values: dictionary {option : value} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5268 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5269 Sets the Options values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5270 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5271 if isinstance(values, dict): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5272 for _option, _value in values.iteritems(): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5273 if _option in self.__option_dict: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5274 _type = self.__option_dict[_option][2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5275 if _type == "boolean": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5276 if isinstance(_value, bool): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5277 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5278 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5279 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5280 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5281 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5282 print(_("Icorrect type, must be boolean") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5283 elif _type == "integer": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5284 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5285 _value = int(_value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5286 except ValueError: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5287 print(_("Icorrect type, must be integer") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5288 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5289 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5290 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5291 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5292 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5293 elif _type == "string": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5294 if isinstance(_value, str): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5295 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5296 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5297 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5298 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5299 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5300 print(_("Icorrect type, must be string") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5301 elif _type == "list": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5302 if isinstance(_value, list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5303 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5304 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5305 _str_value = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5306 for _item_value in _value: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5307 _str_value = _str_value + _item_value + "," |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5308 if _str_value[-1] == ",": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5309 _str_value = _str_value[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5310 self.__liststore.set_value(_iter, 2, _str_value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5311 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5312 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5313 print(_("Icorrect type, must be list") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5314 elif _type == "color": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5315 if isinstance(_value, str): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5316 if Gdk.RGBA().parse(_value): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5317 print(_("Icorrect type, must be a parseable " \ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5318 "color") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5319 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5320 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5321 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5322 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5323 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5324 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5325 print(_("Type must be boolean, integer, string or "\ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5326 "color") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5327 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5328 print( _("Value must be in the option dict") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5329 print(_option, _value) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5330 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5331 print( _("Values must be a dict") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5332 self.__treeview.set_cursor(Gtk.TreePath.new_from_indices((0,)), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5333 self.__value_column, False) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5334 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5335 (_cursor_path, _column) = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5336 _description = self.__liststore[_cursor_path][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5337 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5338 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5339 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5340 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5341 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5342 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5343 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
5344 return self.__widget |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5345 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5346 widget = property(_getWidget, None, None, |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5347 "main widget") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5348 values = property(None, _setValues, None, |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5349 "values") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5350 options = property(None, _setOptions, None, |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
5351 "options") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5352 |