Mercurial > pyarq-presupuestos
annotate Gtk/gui.py @ 26:16f91684686b default tip
Upgrade to python 3. Keep python 2/3 compatibility
author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
---|---|
date | Tue, 18 Jun 2019 17:50:23 +0200 |
parents | 189f8274aecd |
children |
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 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
49 from builtins import str as text |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
50 from six import text_type |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
51 |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
52 def textinp2(textstring): |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
53 """textinp2(textstring) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
54 |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
55 python2 decode textstring with utf-8 |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
56 python3 raise except and do nothing with textstring |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
57 |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
58 return textstring |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
59 |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
60 All output gtk string must be passed by textinp2 |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
61 """ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
62 try: |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
63 # python2 works, python3 raise except and do nothing with textstring |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
64 textstring = text(textstring, "utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
65 except TypeError: |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
66 pass |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
67 return textstring |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
68 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
69 # Standar Modules |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
70 import sys |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
71 import os |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
72 import time |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
73 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
74 # gui |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
75 import gi |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
76 gi.require_version('Gtk', '3.0') |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
77 from gi.repository import Gtk |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
78 from gi.repository import GdkPixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
79 from gi.repository import Gio |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
80 from gi.repository import GLib |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
81 from gi.repository import Gdk |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
82 from gi.repository import Pango |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
83 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
84 import weakref |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
85 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
86 # pyArq-Presupuestos Modules |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
87 from Gtk import importFiebdc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
88 from Generic import base |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
89 from Generic import fiebdc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
90 from Generic import utils |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
91 from Generic import globalVars |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
92 from Generic import openwith |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
93 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
94 # Load default icon |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
95 _icons = [ "ICON16", "ICON32","ICON64","ICON128"] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
96 _pixbufIcons = [] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
97 for _icon in _icons: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
98 if os.path.exists(globalVars.getAppPath(_icon)): |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
99 _icon_file = globalVars.getAppPath(_icon) |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
100 _pixbufIcon = GdkPixbuf.Pixbuf.new_from_file(_icon_file) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
101 _pixbufIcons.append(_pixbufIcon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
102 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
103 _tuni = _("The icon file does not exist. '$1'") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
104 _uni = utils.mapping(_tuni, (globalVars.getAppPath(_icon),)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
105 print(_uni ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
106 if len(_pixbufIcons) > 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
107 Gtk.Window.set_default_icon_list(_pixbufIcons) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
108 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
109 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
110 _tuni = _("The icon file does not exist. '$1'") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
111 _uni = utils.mapping(_tuni, (globalVars.getAppPath("ICON"),)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
112 print(_uni ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
113 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
114 # Autodetect desktop |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
115 if globalVars.desktop["autodetect"]: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
116 openwith.autodetect_desktop() |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
117 _tuni = _("pyArq-Presupuestos running on $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
118 _uni = utils.mapping(_tuni, (globalVars.desktop["desktop"],)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
119 print(_uni) |
23
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 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
122 class App(Gtk.Application): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
123 """gui.App: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
124 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
125 Description: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
126 This is the Gtk application base class. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
127 Constructor: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
128 App() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
129 Ancestry: |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
130 +-- Gtk.Application |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
131 https://lazka.github.io/pgi-docs/Gtk-3.0/classes/Application.html |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
132 +-- App |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
133 Atributes: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
134 Methods: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
135 do_activate |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
136 do_startup |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
137 do_open |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
138 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
139 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
140 def __init__(self, *args, **kwargs): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
141 """__init__() |
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 Sets the application id and application_name. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
144 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
145 self.filesToOpen = [] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
146 self._application_id = "es.obraencurso.pyarq.presupuestos" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
147 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
|
148 flags=Gio.ApplicationFlags.HANDLES_OPEN, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
149 **kwargs) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
150 GLib.set_prgname(self._application_id) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
151 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
152 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
|
153 """do_open(files, n_files, hint) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
154 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
155 Set the filename list to open. |
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 self.filesToOpen = files |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
158 self.activate() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
159 self.filesToOpen = [] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
160 return 0 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
161 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
162 def do_activate(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
163 """do_activate() |
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 Shows new appplication windows. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
166 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
167 _mainWindow = MainWindow(self, self.filesToOpen ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
168 _mainWindow.window.present_with_time(Gtk.get_current_event_time()) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
169 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
170 def do_startup(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
171 """do_startup() |
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 Sets the app actions. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
174 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
175 Gtk.Application.do_startup(self) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
176 # App Actions |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
177 action = Gio.SimpleAction.new("newWindow", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
178 action.connect("activate", self._on_newWindow) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
179 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
180 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
181 action = Gio.SimpleAction.new("acell_newWindow", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
182 action.connect("activate", self._on_control_n) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
183 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
184 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
185 action = Gio.SimpleAction.new("about", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
186 action.connect("activate", self._on_about) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
187 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
188 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
189 action = Gio.SimpleAction.new("quit", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
190 action.connect("activate", self._on_quit) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
191 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
192 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
193 action = Gio.SimpleAction.new("acell_quit", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
194 action.connect("activate", self._on_control_q) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
195 self.add_action(action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
196 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
197 # App menu |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
198 _app_menu = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
199 _section_window = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
200 _section_window.append(_("_New window"), "app.newWindow") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
201 _section_window.append(_("_Close window"), "win.CloseWindow") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
202 _app_menu.append_section(None,_section_window) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
203 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
|
204 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
|
205 _section_general = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
206 _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
|
207 _app_menu.append_section(None,_section_general) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
208 _section_quit = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
209 _section_quit.append(_("_Quit application"), "app.quit") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
210 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
|
211 _app_menu.append_section(None,_section_quit) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
212 self.set_app_menu(_app_menu) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
213 # TODO : from gui config |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
214 win_menu = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
215 # Win Menu |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
216 if win_menu: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
217 _win_menu = Gio.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
218 _win_submenu_file = Gio.Menu.new() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
219 _import_fiebdc = Gio.MenuItem.new(_("_Import Fiebdc"), |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
220 "win.ImportFiebdc") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
221 _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
|
222 _win_submenu_file.append_item(_import_fiebdc) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
223 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
224 _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
|
225 _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
|
226 _win_submenu_file.append_item(_close_tab) |
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 _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
|
229 _win_submenu_go = Gio.Menu.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
230 _back = Gio.MenuItem.new(_("_Back"), "win.GoPrevious") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
231 _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
|
232 _win_submenu_go.append_item(_back) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
233 _forward = Gio.MenuItem.new(_("_Forward"), "win.GoPosterior") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
234 _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
|
235 _win_submenu_go.append_item(_forward) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
236 _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
|
237 _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
|
238 _win_submenu_go.append_item(_up) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
239 _root = Gio.MenuItem.new(_("_Root"), "win.GoToRoot") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
240 _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
|
241 _win_submenu_go.append_item(_root) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
242 _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
|
243 self.set_menubar(_win_menu) |
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_newWindow(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
246 """on_newWindow(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 Shows new appplication windows. |
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 _mainWindow = MainWindow(self, []) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
251 _mainWindow.window.present_with_time(Gtk.get_current_event_time()) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
252 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
253 def _on_about(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
254 """_on_about(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
255 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
256 Shows About dialog. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
257 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
258 _aboutDialog = Gtk.AboutDialog(modal=False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
259 _aboutDialog.set_program_name(globalVars.name) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
260 _aboutDialog.set_copyright(base.copyright) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
261 _aboutDialog.set_authors(base.authors) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
262 _aboutDialog.set_version(globalVars.version + globalVars.changeset) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
263 _aboutDialog.set_website(base.website) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
264 _aboutDialog.set_website_label(base.website_label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
265 _aboutDialog.set_license_type(Gtk.License(3)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
266 _aboutDialog.set_comments(base.comments) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
267 _aboutDialog.connect("response", self._on_close_aboutdialog) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
268 _aboutDialog.present_with_time(Gtk.get_current_event_time()) |
23
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 def _on_close_aboutdialog(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
271 """on_close_aboutdialog(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
272 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
273 Close About dialog. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
274 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
275 action.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
276 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
277 def _on_control_q(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
278 """on_control_q(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
279 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
280 Quit app. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
281 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
282 print("Control q -> Quit app") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
283 self.quit() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
284 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
285 def _on_quit(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
286 """_on_quit(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
287 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
288 Quit app. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
289 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
290 self.quit() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
291 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
292 def _on_control_n(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
293 """on_control_n(action, param) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
294 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
295 Shows new appplication windows. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
296 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
297 print("Control n -> New window") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
298 self._on_newWindow(action, param) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
299 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
300 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
301 class MainWindow(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
302 """gui.MainWindow: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
303 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
304 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
305 Creates and shows the main window. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
306 This is the interface base class. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
307 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
308 MainWindow(app, files) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
309 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
310 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
311 +-- MainWindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
312 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
313 self.window: Gtk.ApplicationWindow object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
314 Methods: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
315 changeHistorySignal |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
316 changeActiveSignal |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
317 appendEmptyPage |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
318 updatePage |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
319 closePage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
320 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
321 # TODO:* Can choose open budget in new window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
322 # 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
|
323 # 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
|
324 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
325 def __init__(self, app, files): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
326 """__init__(app, files) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
327 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
328 Initialize the atributes self.__page_list without data. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
329 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
|
330 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
331 app: Gtk.Application instance |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
332 files: Gio.file list from command line |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
333 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
334 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
|
335 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
|
336 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
|
337 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
|
338 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
|
339 self.__navigation_is_enabled: True/False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
340 self.__goBack_button |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
341 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
342 self.__page_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
343 # Main window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
344 self.window = Gtk.ApplicationWindow(application=app) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
345 self.window.set_default_size(771, 570) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
346 self.window.set_title("Presupuestos") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
347 self.window.set_border_width(5) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
348 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
|
349 # HeaderBar |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
350 _hb = Gtk.HeaderBar() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
351 _hb.set_show_close_button(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
352 _hb.props.title = "Presupuestos" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
353 self.window.set_titlebar(_hb) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
354 _hb.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
355 # Actions |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
356 # General Actions |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
357 self.__general_action_group = Gio.SimpleActionGroup.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
358 # CloseWindow Action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
359 _action = Gio.SimpleAction.new("CloseWindow", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
360 _action.connect("activate", self._menuitemClose) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
361 self.window.add_action(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
362 self.__general_action_group.insert(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
363 # CloseWindow from acell Action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
364 _action = Gio.SimpleAction.new("acell_close", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
365 _action.connect("activate", self._on_control_x) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
366 self.window.add_action(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
367 self.__general_action_group.insert(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
368 # ImportFiebdc Action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
369 _action = Gio.SimpleAction.new("ImportFiebdc", None) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
370 _action.connect("activate", self._on_menuitemImportFiebdc) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
371 self.window.add_action(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
372 self.__general_action_group.insert(_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
373 # CloseTab action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
374 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
|
375 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
|
376 self.window.add_action(self.__closeTab_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
377 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
|
378 # Navigation Actions |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
379 self.__navigation_is_enabled = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
380 self.__navigation_action_group = Gio.SimpleActionGroup.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
381 # Go Previous action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
382 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
|
383 self.__GoPrevious_action.connect("activate", self._menuitemGoPrevious) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
384 self.window.add_action(self.__GoPrevious_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
385 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
|
386 self.__GoPrevious_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
387 # Go posterior action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
388 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
|
389 self.__GoPosterior_action.connect("activate", self._menuitemGoPosterior) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
390 self.window.add_action(self.__GoPosterior_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
391 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
|
392 self.__GoPosterior_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
393 # Go Up action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
394 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
|
395 self.__GoUp_action.connect("activate", self._menuitemGoUp) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
396 self.window.add_action(self.__GoUp_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
397 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
|
398 self.__GoUp_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
399 # Go to Root action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
400 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
|
401 self.__GoToRoot_action.connect("activate", self._menuitemGoToRoot) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
402 self.window.add_action(self.__GoToRoot_action) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
403 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
|
404 self.__GoToRoot_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
405 # Vertical Grid |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
406 _vbox1 = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
407 _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
|
408 self.window.add(_vbox1) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
409 _vbox1.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
410 # Toolbar |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
411 _toolbar = Gtk.Toolbar() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
412 _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
|
413 # Import Fiebdc |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
414 _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
|
415 _gtk_image.show() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
416 _ImportFiebdc_button = Gtk.ToolButton.new(_gtk_image, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
417 _("Import Fiebdc")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
418 _ImportFiebdc_button.set_tooltip_text(_("Import Fiebdc")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
419 _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
|
420 _toolbar.insert(_ImportFiebdc_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
421 _ImportFiebdc_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
422 _ImportFiebdc_button.set_action_name("win.ImportFiebdc") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
423 # Close tab |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
424 _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
|
425 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
426 _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
|
427 _closeTabButton.set_tooltip_text(_("Close tab")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
428 _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
|
429 _toolbar.insert(_closeTabButton, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
430 _closeTabButton.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
431 _closeTabButton.set_action_name("win.CloseTab") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
432 # Separator item |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
433 _separator = Gtk.SeparatorToolItem() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
434 _separator.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
435 _toolbar.insert(_separator, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
436 # Go Back |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
437 _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
|
438 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
439 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
|
440 self.__goBack_button.set_tooltip_text(_("Back")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
441 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
|
442 _toolbar.insert(self.__goBack_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
443 self.__goBack_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
444 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
|
445 # Go Forward |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
446 _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
|
447 _gtk_image.show() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
448 self.__goForward_button = Gtk.MenuToolButton.new(_gtk_image, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
449 _("Forward")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
450 self.__goForward_button.set_tooltip_text(_("Forward")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
451 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
|
452 _toolbar.insert(self.__goForward_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
453 self.__goForward_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
454 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
|
455 # Go Up Item |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
456 _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
|
457 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
458 _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
|
459 _goUP_button.set_tooltip_text(_("Up Item")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
460 _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
|
461 _toolbar.insert(_goUP_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
462 _goUP_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
463 _goUP_button.set_action_name("win.GoUp") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
464 # Go Root Item |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
465 _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
|
466 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
467 _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
|
468 _goRoot_button.set_tooltip_text(_("Root")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
469 _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
|
470 _toolbar.insert(_goRoot_button, -1) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
471 _goRoot_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
472 _goRoot_button.set_action_name("win.GoToRoot") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
473 # Pack and show |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
474 _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
|
475 _toolbar.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
476 _vbox1.add(_toolbar) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
477 # Notebook |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
478 self.__notebook = Gtk.Notebook() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
479 _vbox1.add(self.__notebook) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
480 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
|
481 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
|
482 self.__notebook.set_show_tabs(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
483 self.__notebook.set_show_border(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
484 self.__notebook.set_scrollable(True) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
485 self.__notebook.connect("switch-page", self._switch_page) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
486 self.__notebook.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
487 self._main() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
488 if len(files) > 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
489 for file in files: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
490 _budget = base.Budget() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
491 _budget_file = fiebdc.Read() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
492 _read_method = _budget_file.readFile |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
493 _filename = file.get_path() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
494 _filetype = "budget" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
495 _exit_method = _budget_file.cancel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
496 _file_window = FileSelectionWindow(self, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
497 _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
|
498 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
499 def changeHistorySignal(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
500 """changeHistorySignal() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
501 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
502 A pane emit the updateHistory signal. |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
503 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
504 Nothing to do now |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
505 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
506 pass |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
507 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
508 def changeActiveSignal(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
509 """changeActiveSignal() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
510 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
511 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
|
512 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
513 Chech buttons sensitive |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
514 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
515 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
|
516 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
517 def _checkButtonsSensitive(self, page_num): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
518 """_checkButtonsSensitive(page_num) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
519 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
520 page_num: page number in notebook |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
521 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
522 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
|
523 buttons. |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
524 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
525 _page = self.__page_list[page_num] |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
526 if isinstance(_page, Page) and \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
527 self.__navigation_is_enabled: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
528 # GoToRoot and GoUp actions |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
529 _goto_root = self.__GoToRoot_action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
530 _go_up = self.__GoUp_action |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
531 if len(_page.activePathRecord) == 1 and \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
532 _goto_root.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
533 _goto_root.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
534 _go_up.set_enabled(False) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
535 elif len(_page.activePathRecord) != 1 and \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
536 not _goto_root.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
537 _goto_root.set_enabled(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
538 _go_up.set_enabled(True) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
539 # GoPrevMenu action |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
540 _go_Previous = self.__GoPrevious_action |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
541 _go_prev = self.__GoPrevious_action |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
542 if _page.previousPathRecord is None: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
543 if _go_prev.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
544 _go_prev.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
545 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
|
546 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
547 if not _go_prev.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
548 _go_prev.set_enabled(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
549 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
|
550 # GoPostMenu action |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
551 _go_Posterior = self.__GoPosterior_action |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
552 if _page.posteriorPathRecord is None: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
553 if _go_Posterior.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
554 _go_Posterior.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
555 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
|
556 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
557 if not _go_Posterior.get_enabled(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
558 _go_Posterior.set_enabled(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
559 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
|
560 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
561 def _disable_navigation(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
562 self.__GoPrevious_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
563 self.__GoPosterior_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
564 self.__GoUp_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
565 self.__GoToRoot_action.set_enabled(False) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
566 self.__navigation_is_enabled = False |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
567 |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
568 def _switch_page(self, notebook, page, page_num): |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
569 """_switch_page(notebook, page, page_num) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
570 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
571 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
|
572 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
573 It shows/hides closeTabButton |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
574 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
|
575 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
576 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
|
577 if _page_num == page_num: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
578 _page.closeTabButton.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
579 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
580 _page.closeTabButton.hide() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
581 _page = self.__page_list[page_num] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
582 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
583 if isinstance(_page, EmptyPage) and \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
584 self.__navigation_is_enabled: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
585 self._disable_navigation() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
586 elif isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
587 if not self.__navigation_is_enabled: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
588 self.__navigation_is_enabled = True |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
589 self.__goBack_button.set_menu(_page.back_menu) |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
590 self.__goForward_button.set_menu(_page.forward_menu) |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
591 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
|
592 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
593 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
|
594 """main() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
595 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
596 Shows window. |
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 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
|
599 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
600 def appendEmptyPage(self, emptyPage): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
601 """appendEmptyPage(emptyPage) |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
602 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
603 Append a empty page to the notebook. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
604 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
605 self.__page_list.append(emptyPage) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
606 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
|
607 # TODO: reordenable and detachable Pages |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
608 #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
|
609 #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
|
610 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
611 def updatePage(self, empty_page, page): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
612 """updatePage(page) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
613 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
614 Update emptyPage to Page. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
615 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
616 _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
|
617 self.__page_list[_page_num] = page |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
618 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
|
619 if not self.__navigation_is_enabled: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
620 self.__navigation_is_enabled = True |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
621 self._checkButtonsSensitive(_page_num) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
622 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
623 def _on_control_x(self, action, param): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
624 print("Control x -> Close window") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
625 self.window.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
626 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
627 def _on_menuitemImportFiebdc(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
628 """_on_menuitemImportFiebdc(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
629 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
630 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
|
631 parameter: None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
632 Callback to open a budget file. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
633 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
634 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
|
635 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
636 _budget = base.Budget() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
637 _budget_file = fiebdc.Read() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
638 _read_method = _budget_file.readFile |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
639 _filename = "" |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
640 _filetype = "budget" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
641 _exit_method = _budget_file.cancel |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
642 _file_window = FileSelectionWindow(self, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
643 _read_method, _budget, _filename, _exit_method, _filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
644 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
645 def _menuitemClose(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
646 """_menuitemClose(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
647 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
648 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
|
649 parameter: None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
650 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
651 Callback to close the main window. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
652 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
653 self.window.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
654 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
655 def _on_CloseTab(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
656 """_on_CloseTab(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
657 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
658 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
|
659 parameter: None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
660 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
661 Callback to close tab. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
662 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
663 _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
|
664 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
|
665 _page = self.__page_list[_page_num] |
16
60bc5117926c
no durus
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
11
diff
changeset
|
666 _page.close() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
667 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
668 def closePage(self, page): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
669 """closePage(page) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
670 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
671 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
|
672 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
673 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
|
674 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
|
675 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
676 if page in self.__page_list: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
677 _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
|
678 self.__page_list.pop(_page_num) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
679 page.clear() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
680 self.__notebook.remove_page(_page_num) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
681 if len(self.__page_list) == 0: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
682 self._disable_navigation() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
683 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
684 _tuni = _("The page is not in the page list") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
685 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
686 raise IndexError(_str) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
687 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
688 def _menuitemGoToRoot(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
689 """_menuitemGoToRoot(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
690 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
691 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
|
692 parameter: None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
693 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
694 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
|
695 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
696 _page_num = self.__notebook.get_current_page() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
697 if _page_num == -1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
698 return |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
699 _page = self.__page_list[_page_num] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
700 if isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
701 # 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
|
702 _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
|
703 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
704 def _menuitemGoUp(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
705 """_menuitemGoUp(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
706 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
707 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
|
708 parameter: None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
709 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
710 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
|
711 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
712 _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
|
713 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
|
714 _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
|
715 if isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
716 # 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
|
717 _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
|
718 if len(_active_path) > 1: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
719 _budget = _page.budget |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
720 _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
|
721 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
|
722 _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
|
723 _up_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
724 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
725 def _menuitemGoPrevious(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
726 """_menuitemGoPrevious(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
727 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
728 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
|
729 parameter: None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
730 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
731 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
|
732 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
733 _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
|
734 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
|
735 _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
|
736 if isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
737 # 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
|
738 _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
|
739 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
|
740 _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
|
741 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
|
742 _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
|
743 _previous_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
744 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
745 def _menuitemGoPosterior(self, action, parameter): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
746 """_menuitemPosterior(action, parameter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
747 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
748 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
|
749 parameter: None |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
750 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
751 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
|
752 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
753 _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
|
754 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
|
755 _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
|
756 if isinstance(_page, Page): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
757 # 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
|
758 _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
|
759 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
|
760 _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
|
761 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
|
762 _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
|
763 _posterior_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
764 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
765 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
|
766 """_delete_event(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
767 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
768 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
|
769 event: the "Gdk.Event" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
770 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
771 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
|
772 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
|
773 It Returns True so the signal "destroy" is emitted. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
774 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
775 for _page in self.__page_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
776 _page.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
777 return False # -> destroy |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
778 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
779 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
780 class FileSelectionWindow(object): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
781 """gui.FileSelectionWindow: |
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 Description: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
784 Class to show the selection file window |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
785 Constructor: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
786 FileSelectionWindow(mainWindow, readFileMethod, budget, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
787 filename, cancelMethod, filetype) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
788 Ancestry: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
789 +-- object |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
790 +-- FileSelectionWindow |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
791 Atributes: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
792 No public Atributes |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
793 Methods: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
794 No public Methods |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
795 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
796 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
797 def __init__(self, mainWindow, readFileMethod, budget, filename, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
798 cancelMethod, filetype): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
799 """__init__(mainWindow, readFileMethod, budget, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
800 filename, cancelMethod, filetype) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
801 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
802 mainWindow: MainWindow object |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
803 readFileMethod: Method to read the selected file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
804 budget: base.Budget object |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
805 filename: "file" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
806 cancelMethod: Method to cancel the read method |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
807 fileytpe: "budget" or "database". |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
808 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
|
809 Connects the events: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
810 * clicked ok button: _openFile |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
811 * clicked cancel button: destroy window |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
812 * destroy event: _destroy |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
813 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
814 # TODO: Add file filter |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
815 self.__mainWindow = mainWindow |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
816 self.__readFileMethod = readFileMethod |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
817 self.__budget = budget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
818 self.__filetype = filetype |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
819 self.__cancelMethod = cancelMethod |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
820 self.__file = None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
821 self.__filename = filename |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
822 if self.__filename == "": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
823 self.__dialog = Gtk.FileChooserNative.new(_("Open File"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
824 mainWindow.window, Gtk.FileChooserAction.OPEN, _("Open File"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
825 _("Cancel") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
826 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
|
827 _response = self.__dialog.run() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
828 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
|
829 Gtk.ResponseType.YES, Gtk.ResponseType.APPLY]: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
830 self._openFile(self.__dialog.get_filename()) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
831 elif _response == Gtk.ResponseType.CANCEL: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
832 self.__dialog.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
833 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
834 self.__dialog = None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
835 self._openFile(self.__filename) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
836 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
837 def _launchProgressWindow(self, file): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
838 """_launchProgressWindow(file) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
839 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
840 Launch the progress window |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
841 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
842 self.__filename = file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
843 _emptyPage = EmptyPage(self.__mainWindow, self.__readFileMethod, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
844 self.__budget, self.__filename, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
845 self.__cancelMethod, self.__filetype) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
846 self.__mainWindow.appendEmptyPage(_emptyPage) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
847 _emptyPage.run() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
848 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
849 def _openFile(self, filename): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
850 """_openFile(filename) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
851 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
852 filename: the filename to open |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
853 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
|
854 _launchProgressWindow is called |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
855 """ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
856 _file = filename # string in python 2, unicode in python 3 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
857 if sys.getfilesystemencoding(): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
858 try: |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
859 # python2 works, python3 raise except and do nothing with _file |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
860 _file = text(filename, sys.getfilesystemencoding()) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
861 except TypeError: |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
862 pass |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
863 self.__file = _file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
864 _filename = os.path.basename(self.__file) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
865 _filename_ext = _filename.split(".")[-1] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
866 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
|
867 _filename_ext != "bc3" and _filename_ext != "BC3": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
868 print(_("The file must have 'bc3' extension") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
869 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
870 if self.__dialog is not None: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
871 self.__dialog.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
872 # 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
|
873 self._launchProgressWindow(self.__file) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
874 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
875 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
876 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
|
877 """gui.EmptyPage: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
878 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
879 Description: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
880 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
|
881 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
|
882 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
883 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
|
884 cancelMethod, filetype): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
885 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
|
886 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
|
887 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
|
888 filename: "file" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
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", "database" |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
891 Ancestry: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
892 +-- object |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
893 +-- EmptyPage |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
894 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
895 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
|
896 title: Read. Page Title |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
897 filetype: Read. budget or basedata |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
898 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
|
899 Methods: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
900 run |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
901 readFile_progress |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
902 readFile_send_message |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
903 readFile_set_statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
904 readFile_end |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
905 readFile_cancel |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
906 stopLoading |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
907 updateGui |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
908 threadFinishedSignal |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
909 threadCanceled |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
910 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
|
911 close |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
912 clear |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
913 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
914 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
915 def __init__(self, mainWindow, readFileMethod, budget, filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
916 cancelMethod, filetype): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
917 """__init__(mainWindow, readFileMethod, budget, filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
918 cancelMethod, filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
919 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
920 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
|
921 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
|
922 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
|
923 filename: "file" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
924 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
|
925 filetype: "budget" or "database" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
926 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
927 self.__mainWindow: Mainwindow object |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
928 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
|
929 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
|
930 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
|
931 self.__filename: "file" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
932 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
|
933 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
|
934 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
|
935 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
|
936 self.__statistics: record statistics |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
937 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
|
938 self.__main_item: None |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
939 self.__throbber: Gtk.Spinner() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
940 self.__budget_icon: Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
941 self.__title: a horizontal Gtk.Grid |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
942 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
|
943 self.__statuscontext: the statusbar context |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
944 self.__progress_bar: a Gtk.ProgressBar |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
945 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
946 self.__mainWindow = mainWindow |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
947 self.endSuccessfully = False |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
948 self.__readFileMethod = readFileMethod |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
949 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
950 self.__filename = filename |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
951 self.__filetype = filetype |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
952 self.__cancelMethod = cancelMethod |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
953 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
954 self.__cancel = [False, False] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
955 self.__progress = 0.0 |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
956 self.__statistics = None |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
957 self.__widget = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
958 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
|
959 self.__main_item = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
960 self.__widget.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
961 # Throbber |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
962 self.__throbber = Gtk.Spinner() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
963 self.__throbber.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
964 self.__budget_icon = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
965 _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
|
966 globalVars.getAppPath("BUDGET-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
967 self.__budget_icon.set_from_pixbuf(_budget_pixbuf) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
968 _filename = os.path.basename(filename) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
969 _rootfilename = os.path.splitext(_filename)[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
970 if not _rootfilename == "": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
971 _filename = _rootfilename |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
972 if len(_filename) > 28: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
973 _titleLabel = Gtk.Label(_filename[:25] + "...") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
974 _titleLabel.set_tooltip_text(_filename) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
975 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
976 _titleLabel = Gtk.Label(_filename) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
977 _titleLabel.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
978 self.__title = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
979 self.__title.set_column_spacing(4) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
980 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
|
981 self.__title.add(self.__budget_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
982 self.__title.add(self.__throbber) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
983 self.__title.add(_titleLabel) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
984 # Close tab |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
985 _gtk_image = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
986 _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
|
987 "window-close-symbolic", 16, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
988 _gtk_image.set_from_pixbuf(_gtk__pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
989 _gtk_image.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
990 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
|
991 self.closeTabButton.set_tooltip_text(_("Close tab")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
992 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
|
993 self.__title.add(self.closeTabButton) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
994 self.closeTabButton.hide() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
995 self.__closeTabId = self.closeTabButton.connect("clicked", |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
996 self.on_close_button) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
997 # Statusbar |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
998 self.__statusbar = Gtk.Statusbar() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
999 self.__statuscontext = self.__statusbar.get_context_id("Statusbar") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1000 self.__statusbar.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1001 _iconVbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1002 _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
|
1003 _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
|
1004 _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
|
1005 _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
|
1006 _pyArqIcon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1007 _pyArqIcon.set_from_file(globalVars.getAppPath("PYARQ-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1008 _pyArqIcon.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1009 _iconVbox.add(_pyArqIcon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1010 _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
|
1011 _iconVbox.add(_link) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1012 _link.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1013 _iconVbox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1014 self.__widget.add(_iconVbox) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1015 self.__progress_bar = Gtk.ProgressBar() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1016 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
|
1017 self.__progress_bar.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1018 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
|
1019 self.__widget.add(self.__statusbar) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1020 self.__main_item = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1021 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1022 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
|
1023 """run() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1024 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1025 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
|
1026 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1027 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
|
1028 self.__throbber.start() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1029 self._launchChildren() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1030 self._launchTimeout() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1031 |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1032 def readFile_progress(self, percent): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1033 """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
|
1034 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1035 percent: Percentage executed. |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1036 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1037 Sets progress |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1038 """ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1039 _progress = text(int(round(100 * percent,0))) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1040 self.__progress = percent |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1041 |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1042 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
|
1043 """readFile_send_message(message) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1044 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1045 message: mesage from readFile method |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1046 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1047 print( message ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1048 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1049 print( message ) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1050 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1051 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
|
1052 """readFile_set_statistics(statistics) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1053 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1054 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
|
1055 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1056 sets record statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1057 """ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1058 self.__statistics = statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1059 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1060 def readFile_end(self): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1061 """readFile_end() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1062 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1063 The readFile method end successfully |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1064 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1065 self.endSuccessfully = True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1066 print( self.__statistics.str() ) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1067 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1068 def readFile_cancel(self): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1069 """readFile_cancel() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1070 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1071 The readFile method is canceled |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1072 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1073 self.endSuccessfully = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1074 print(_("Process terminated") ) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
16
diff
changeset
|
1075 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1076 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
|
1077 """stopLoading() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1078 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1079 Stop progressbar |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1080 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1081 self.__throbber.destroy() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1082 self.__budget_icon.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1083 self.__progress_bar.hide() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1084 self.__statusbar.pop(self.__statuscontext) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1085 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1086 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
|
1087 """_launchChildren() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1088 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1089 Launch the thread to read the file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1090 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1091 if self.__children is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1092 self.__children = importFiebdc.Thread(self, self.__mainWindow, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1093 self.__readFileMethod, self.__budget, self.__filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
1094 self.__cancelMethod, self.__filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1095 self.__children.start() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1096 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1097 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
|
1098 """_launchTimeout() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1099 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1100 Launch the timeouts: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1101 1- update progress bar |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1102 2- update time label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1103 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
|
1104 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1105 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
|
1106 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
|
1107 self.__cancel = [False, False] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1108 GLib.timeout_add(1000, self._autoClose) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1109 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1110 def updateGui(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1111 while Gtk.events_pending(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1112 Gtk.main_iteration() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1113 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1114 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
|
1115 """_updateProgressBar() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1116 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1117 update progress bar in a timeout |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1118 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
|
1119 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1120 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
|
1121 self.__cancel[0] = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1122 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1123 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1124 self.__progress_bar.set_fraction(self.__progress) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1125 _text = "%s%%" %text(int(round(100 * self.__progress,0))) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1126 self.__progress_bar.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1127 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1128 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1129 def _updateLabel(self, _time): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1130 """_updateLabel(_time) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1131 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1132 update time label in a timeout |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1133 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
|
1134 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1135 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
|
1136 self.__cancel[1] = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1137 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1138 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1139 _time = time.time() - _time |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1140 _text = utils.mapping(_("Time: $1"), ("%.0f" %_time,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1141 self.__statusbar.pop(self.__statuscontext) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1142 self.__statusbar.push(self.__statuscontext, _text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1143 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1144 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1145 def _autoClose(self): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1146 """_autoClose() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1147 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1148 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
|
1149 closed and ist tiemeout is stoped |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1150 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1151 #_autoClose timeout do nothig |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1152 if self.__cancel == [ True, True ]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1153 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1154 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1155 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1156 |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1157 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
|
1158 """threadFinishedSignal(budget) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1159 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1160 Sets the self.__children to None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1161 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
|
1162 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
|
1163 """ |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1164 self.__budget = budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1165 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1166 self.stopLoading() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1167 _page = Page(self.__mainWindow, self.__budget, self.closeTabButton) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1168 _children = self.__widget.get_children() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1169 for _child in _children: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1170 self.__widget.remove(_child) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1171 self.__widget.add(_page.widget) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1172 self.closeTabButton.disconnect(self.__closeTabId) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1173 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
|
1174 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
|
1175 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1176 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
|
1177 """threadCanceled() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1178 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1179 Sets the __children atribute to None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1180 This causes that the timeouts is ended. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1181 This method is called from thread when is canceled |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1182 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1183 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1184 self.stopLoading() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1185 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
|
1186 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1187 def on_close_button(self, widget): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1188 """on_close_button() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1189 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1190 Call close |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1191 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1192 self.close() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1193 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1194 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
|
1195 """close() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1196 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1197 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
|
1198 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1199 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
|
1200 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1201 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
|
1202 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1203 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1204 Nothig to do now |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1205 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1206 pass |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1207 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1208 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1209 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1210 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1211 Return de main widget to show in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1212 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1213 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1214 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1215 def _getTitle(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1216 """_getTitle() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1217 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1218 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
|
1219 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1220 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
|
1221 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1222 def _getFiletype(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1223 """_getFiletipe() |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1224 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1225 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
|
1226 """ |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
1227 return self.__filetype |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1228 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1229 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1230 "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
|
1231 title = property(_getTitle, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1232 "Page Title") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1233 filetype = property(_getFiletype, None, None, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1234 "Filetype: budget or basedata") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1235 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1236 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1237 class Page(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1238 """gui.Page: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1239 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1240 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1241 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
|
1242 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
|
1243 according to "panes_list" information. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1244 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1245 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
|
1246 mainwindow: MainWindow object |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1247 budget: base.Budget object |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1248 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
|
1249 active_code: Active record code |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1250 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1251 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1252 +-- Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1253 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1254 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
|
1255 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
|
1256 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
|
1257 ej: [ "v", pane1, pane2 ] , [ "h", pane1, pane2 ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1258 [ "v", [ "h", pane1, pane2 ], [ "h", pane1, pane2 ] ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1259 pane types: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1260 * "DecompositionList": its creates a "DecompositionList" object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1261 * "RecordDescription" : its creates a "Description" objetc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1262 * "Measure": its creates a "Measure" objetc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1263 * "FileView": its creates a "FileView" objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1264 * "CompanyView": its creates a "CompanyView" object |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1265 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
|
1266 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
|
1267 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
|
1268 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
|
1269 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
|
1270 forward_menu: forward menu to show in menutoolbutton |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1271 Methods: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1272 propagateMessageFrom |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1273 sendMessageTo |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1274 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
|
1275 close |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1276 clear |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1277 getItem |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1278 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1279 # 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
|
1280 # TODO: * Panes in windows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1281 # TODO: * pane types |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1282 # TODO: * General budget properties (is better a dialog?) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1283 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1284 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
|
1285 """__init__(mainWindow, budget, closeTabButton, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1286 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1287 mainWindow: MainWindow object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1288 budget: "base.Budget" object |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1289 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
|
1290 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
|
1291 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1292 self.__mainWindow: MainWindow object |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1293 self.__widget: a Gtk.Grid |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1294 self.__panes_list: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1295 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
|
1296 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
|
1297 self.__active_path_record: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1298 self.__history_back: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1299 self.__history_forward: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1300 self.__back_menu: a Gtk.Menu |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1301 self.__forward_menu: a Gtk.Menu |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1302 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1303 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1304 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
|
1305 self.__mainWindow = mainWindow |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1306 self.closeTabButton = closeTabButton |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1307 self.__widget = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1308 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
|
1309 self.__widget.props.margin = 5 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1310 #TODO: __panes_list should come from gui config file... |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1311 # "DecompositionList" "RecordDescription" "Measure" |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1312 # "Sheet of Conditions" "FileView" "CompanyView" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1313 self.__panes_list = [ "v", "DecompositionList", [ "v", "Measure", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1314 "RecordDescription" ]] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1315 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
|
1316 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
|
1317 self.__history_back = [] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1318 self.__history_forward = [] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1319 self.__back_menu = Gtk.Menu() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1320 self.__back_menu.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1321 self.__forward_menu = Gtk.Menu() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1322 self.__forward_menu.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1323 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
|
1324 self._setActivePathRecord(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1325 self.__widget.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1326 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
|
1327 globalVars.getAppPath("BUDGET-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1328 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
|
1329 globalVars.getAppPath("CHAPTER-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1330 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
|
1331 globalVars.getAppPath("UNIT-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1332 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
|
1333 globalVars.getAppPath("MATERIAL-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1334 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
|
1335 globalVars.getAppPath("MACHINERY-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1336 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
|
1337 globalVars.getAppPath("LABOURFORCE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1338 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1339 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
|
1340 """propagateMessageFrom(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1341 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1342 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
|
1343 * "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
|
1344 * "autoclose" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1345 * "split h" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1346 * "split v" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1347 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
|
1348 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1349 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
|
1350 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1351 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
|
1352 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1353 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1354 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
|
1355 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
|
1356 self._setActivePathRecord(arg) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1357 self.__mainWindow.changeActiveSignal() # Check sensitive buttons |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1358 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
|
1359 self._closeItem(pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1360 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
|
1361 self._splitItem(pane_path, "h") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1362 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
|
1363 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
|
1364 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1365 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
|
1366 """sendMessageTo(pane, message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1367 pane: the receiver pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1368 message: string message |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1369 pane_path: tuple that represents the pane pane_path which emits |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1370 the message |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1371 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1372 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1373 Sends a message to a pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1374 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1375 pane.runMessage(message, pane_path, arg) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1376 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1377 def on_close_button(self, widget): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1378 self.close() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1379 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1380 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
|
1381 """close() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1382 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1383 Close Page |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1384 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1385 self.__mainWindow.closePage(self) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1386 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1387 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
|
1388 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1389 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1390 Clear atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1391 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1392 self.propagateMessageFrom("clear", (0,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1393 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1394 del self.__panes_list |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1395 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1396 del self.__title |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1397 del self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1398 del self.__main_item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1399 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1400 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
|
1401 """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
|
1402 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1403 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
|
1404 instance or a View instance |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1405 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1406 _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
|
1407 if len(pane_path) == 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1408 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1409 else: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1410 return _item.getItem(pane_path[1:]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1411 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1412 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
|
1413 """_setMainItem(item) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1414 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1415 Sets a new main item in the page |
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 if not self.__main_item is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1418 _old_main_widget = self.__main_item.widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1419 self.__widget.remove(_old_main_widget) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1420 self.__main_item = item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1421 _main_widget = self.__main_item.widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1422 _main_widget.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1423 self.__widget.add(_main_widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1424 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1425 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
|
1426 """_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
|
1427 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1428 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
|
1429 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1430 _item = self.getItem(pane_path) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1431 _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
|
1432 _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
|
1433 _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
|
1434 _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
|
1435 if len(pane_path) > 1: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1436 _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
|
1437 _parent.setItem(pane_path[-1], [_paned]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1438 else: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1439 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
|
1440 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1441 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
|
1442 """_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
|
1443 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1444 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
|
1445 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1446 _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
|
1447 if len(pane_path) > 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1448 # 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
|
1449 _parent = self.getItem(pane_path[:-1]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1450 _brothers = [ _brother for _brother in _parent] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1451 _brothers.remove(_item) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1452 _brother = _brothers[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1453 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1454 _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
|
1455 _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
|
1456 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
|
1457 _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
|
1458 _grandparent.setItem(pane_path[-2], [_brother]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1459 _parent.widget.destroy() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1460 _parent.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1461 _item.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1462 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1463 _grandparent = self |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1464 _grandparent._setMainItem(_brother) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1465 _parent.widget.destroy() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1466 _parent.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1467 _item.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1468 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1469 # 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
|
1470 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1471 |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1472 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
|
1473 """_itemsFactory(list_paned, pane_path=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1474 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1475 list_paned: list in "__panes_list" format |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1476 [ "v" or "h", panel1_type, panel2_type] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1477 which contains the info for create the widgets. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1478 panel types: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1479 * "DecompositionList" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1480 * "RecordDescription" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1481 * "Measure" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1482 * "Sheet of Conditions" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1483 * "FileView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1484 * "CompanyView" |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1485 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
|
1486 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1487 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
|
1488 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1489 if pane_path is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1490 pane_path = (0,) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1491 if not isinstance(list_paned, list): |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1492 _tuni = _("The value must be a list") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1493 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1494 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1495 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
|
1496 if len(list_paned) != 3: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1497 _tuni = _("Incorrect len") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1498 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1499 raise ValueError(_str) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1500 if not isinstance(list_paned[1], list): |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1501 list_paned[1] = [list_paned[1]] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1502 if not isinstance(list_paned[2], list): |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1503 list_paned[2] = [list_paned[2]] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1504 _item1 = self._itemsFactory(list_paned[1], pane_path + (0,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1505 _item2 = self._itemsFactory(list_paned[2], 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
|
1506 _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
|
1507 elif list_paned[0] == "DecompositionList": |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1508 _item = View("DecompositionList", self.__budget, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1509 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
|
1510 elif list_paned[0] == "RecordDescription": |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1511 _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
|
1512 pane_path, self.__active_path_record, True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1513 elif list_paned[0] == "Measure": |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1514 _item = View("Measure", self.__budget, weakref.ref(self), |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1515 pane_path, self.__active_path_record, True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1516 elif list_paned[0] == "Sheet of Conditions": |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1517 _item = View("Sheet of Conditions", |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1518 self.__budget, weakref.ref(self), pane_path, |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1519 self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1520 elif list_paned[0] == "FileView": |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1521 _item = View("FileView", self.__budget, weakref.ref(self), |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1522 pane_path, self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1523 elif list_paned[0] == "CompanyView": |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1524 _item = View("CompanyView", self.__budget, weakref.ref(self), |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1525 pane_path, self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1526 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1527 _item = None |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1528 _tuni = _("Incorrect item $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1529 _uni = utils.mapping(_tuni, (text(list_paned[0]),)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1530 _str = _uni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1531 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1532 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1533 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1534 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
|
1535 """_setActivePathRecord(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1536 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1537 path_record: the active record path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1538 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1539 Sets the active record path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1540 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1541 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
|
1542 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
|
1543 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
|
1544 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
|
1545 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1546 _tuni = _("The budget does not have the path record: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1547 _uni = utils.mapping(_tuni, (text(path_record),)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1548 _str = _uni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1549 raise ValueError(_str) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1550 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1551 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
|
1552 """_appendHistory(path)) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1553 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1554 path: the new active path record |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1555 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1556 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
|
1557 """ |
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 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
|
1559 # 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
|
1560 # 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
|
1561 _items_num = len(self.__history_back) - \ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1562 self.__history_back.index(path) -1 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1563 for _item in range(_items_num): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1564 _record_path = self.__history_back.pop() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1565 _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
|
1566 self.__back_menu.remove(_first_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1567 self.__history_forward.append(_record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1568 _menuitem = self._menuItemFactory(_record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1569 _menuitem.connect_object("activate", self._menuHistoryForward, |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1570 _record_path, _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1571 self.__forward_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1572 while len(self.__history_forward) > 100: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1573 # list too long |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1574 self.__history_forward.pop(0) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1575 _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
|
1576 self.__forward_menu.remove(_last_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1577 else: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1578 # 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
|
1579 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
|
1580 path in self.__history_forward: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1581 # 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
|
1582 # 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
|
1583 _items_num = len(self.__history_forward) - \ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1584 self.__history_forward.index(path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1585 for _item in range(_items_num): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1586 _record_path = self.__history_forward.pop() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1587 _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
|
1588 self.__forward_menu.remove(_first_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1589 self.__history_back.append(_record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1590 if len(self.__history_back) > 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1591 _menuitem = self._menuItemFactory( |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1592 self.__history_back[-2]) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1593 _menuitem.connect_object("activate", |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1594 self._menuHistoryBack, self.__history_back[-2], |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1595 _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1596 self.__back_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1597 else: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1598 # 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
|
1599 # 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
|
1600 self.__history_forward[:] = [] |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1601 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
|
1602 self.__forward_menu.remove(_child) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1603 self.__history_back.append(path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1604 if len(self.__history_back) > 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1605 _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
|
1606 _menuitem.connect_object("activate", self._menuHistoryBack, |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1607 self.__history_back[-2], _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1608 self.__back_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1609 while len(self.__history_back) > 100: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1610 # list too long |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1611 self.__history_back.pop(0) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1612 _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
|
1613 self.__back_menu.remove(_last_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1614 self.__mainWindow.changeHistorySignal() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1615 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1616 def _getImage(self, record): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1617 """_getImage(record) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1618 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1619 record: record object |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1620 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1621 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
|
1622 """ |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1623 _hierarchy = record.recordType.hierarchy |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1624 _type = record.recordType.type |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1625 _subtype = record.recordType.subtype |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1626 if _hierarchy == 0: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1627 _icon = self.__budget_icon |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1628 elif _hierarchy == 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1629 _icon = self.__chapter_icon |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1630 else: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1631 if _type == 0: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1632 _icon = self.__unit_icon |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1633 elif _type == 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1634 _icon = self.__labourforce_icon |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1635 elif _type == 2: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1636 _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
|
1637 else: |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1638 _icon = self.__material_icon |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1639 _image = Gtk.Image() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1640 _image.set_from_pixbuf(_icon) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1641 return _image |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1642 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1643 def _menuFactory(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1644 """_menuFactory() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1645 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1646 record: record object |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1647 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1648 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
|
1649 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1650 # Back Menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1651 # clear menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1652 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
|
1653 self.__back_menu.remove(_child) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1654 # pupulate menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1655 if len(self.__history_back) > 1: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1656 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
|
1657 _menuitem = self._menuItemFactory(_record_path) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1658 _menuitem.connect("activate", self._menuHistoryBack, |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1659 _record_path, _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1660 self.__back_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1661 # Forward Menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1662 # clear menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1663 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
|
1664 self.__forward_menu.remove(_child) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1665 # pupulate menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1666 if len(self.__history_forward) > 0: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1667 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
|
1668 _menuitem = self._menuItemFactory(_record_path) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1669 _menuitem.connect("activate", self._menuHistoryForward, |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1670 _record_path, _menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1671 self.__forward_menu.prepend(_menuitem) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1672 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1673 def _menuItemFactory(self, record_path): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1674 """_menuItemFactory(record_path): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1675 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1676 record_path: record path |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1677 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1678 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
|
1679 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1680 _code = self.budget.getCode(record_path) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1681 _record = self.budget.getRecord(_code) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1682 _summary = _record.summary |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1683 _text = _code + " " + _summary |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1684 if len(_text) > 30: |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1685 _text = _text[:27] + "..." |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1686 _icon = self._getImage(_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1687 _grid = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1688 _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
|
1689 _grid.set_column_spacing(6) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1690 _label = Gtk.Label(_text) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1691 _menuitem = Gtk.MenuItem.new() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1692 _grid.add(_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1693 _grid.add(_label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1694 _menuitem.add(_grid) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1695 _menuitem.show_all() |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1696 return _menuitem |
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 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
|
1699 """_menuHistoryBack(record_path, menu_item) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1700 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1701 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
|
1702 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1703 if self.budget.hasPath(record_path): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1704 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
|
1705 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1706 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
|
1707 """_menuHistoryForward(record_path, menu_item) |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1708 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1709 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
|
1710 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1711 if self.budget.hasPath(record_path): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1712 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
|
1713 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1714 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1715 """_getActivePathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1716 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1717 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
|
1718 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1719 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
|
1720 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1721 def _getPreviousPathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1722 """_getPreviousPathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1723 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1724 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
|
1725 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1726 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
|
1727 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
|
1728 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1729 return None |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1730 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1731 def _getPosteriorPathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1732 """_getPosteriorPathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1733 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1734 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
|
1735 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1736 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
|
1737 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
|
1738 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1739 return None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1740 |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1741 def _getBackMenu(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1742 """_getBackMenu() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1743 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1744 Return the Back Menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1745 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1746 return self.__back_menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1747 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1748 def _getForwardMenu(self): |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1749 """_getForwardMenu() |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1750 |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1751 Return the Forward Menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1752 """ |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1753 return self.__forward_menu |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1754 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1755 def _getTitle(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1756 """_getTitle() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1757 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1758 Return the page title, a Gtk.Label objetc |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1759 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1760 return self.__title |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1761 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1762 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1763 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1764 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1765 Return de main widget to show in the pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1766 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1767 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1768 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1769 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
|
1770 """_setBudget(budget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1771 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1772 budget: a base.Budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1773 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1774 Sets the budget and the active code atributes, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1775 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
|
1776 shows the main widget. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1777 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1778 if budget is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1779 self.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1780 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1781 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
|
1782 self._setActivePathRecord((0,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1783 # Todo: change page title |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1784 self.__title = Gtk.Label(self.__budget.getCode( |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1785 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1786 _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
|
1787 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
|
1788 _main_widget = self.__main_item.widget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1789 _main_widget.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1790 self.__widget.add(_main_widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1791 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1792 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1793 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1794 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1795 Return de budget, a "base.Budget" object. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1796 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1797 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1798 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1799 def _getPanesList(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1800 """_getPanesList() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1801 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1802 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
|
1803 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1804 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
|
1805 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1806 budget = property(_getBudget, _setBudget, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1807 "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
|
1808 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1809 "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
|
1810 title = property(_getTitle, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1811 "Page Title") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1812 panes_list = property(_getPanesList, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1813 "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
|
1814 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
|
1815 "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
|
1816 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
|
1817 "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
|
1818 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
|
1819 "Posterior Active Path Record") |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1820 back_menu = property(_getBackMenu, None, None, |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1821 "Back Menu") |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1822 forward_menu = property(_getForwardMenu, None, None, |
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
1823 "Forward Menu") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1824 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1825 class View(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1826 """gui.View: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1827 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1828 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1829 It creates a view to show the budget info |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1830 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1831 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
|
1832 connected) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1833 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
|
1834 * DecompositionList |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1835 * Description |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1836 * Measure |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1837 * Sheet |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1838 * FileView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1839 * CompanyView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1840 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
|
1841 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
|
1842 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 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
|
1844 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
|
1845 and receives signals from/to others views. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1846 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1847 +-- object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1848 +-- View |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1849 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
|
1850 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
|
1851 notebook page |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1852 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
|
1853 a Gtk.Grid object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1854 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1855 getItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1856 propagateMessgeFrom |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1857 runMessage |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1858 getClone |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1859 clear |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1860 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1861 |
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
|
1862 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
|
1863 active_path_record, connected=True): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1864 """__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
|
1865 connected ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1866 view_type: the object type to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1867 * DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1868 * Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1869 * Measure |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1870 * Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1871 * FileView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1872 * CompanyView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1873 budget: the budget to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1874 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
|
1875 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
|
1876 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
|
1877 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1878 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
|
1879 * DecompositionList |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1880 * Description |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1881 * Measure |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1882 * Sheet of conditions |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1883 * FileView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1884 * CompanyView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1885 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
|
1886 showed |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1887 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
|
1888 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
|
1889 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
|
1890 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
|
1891 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
|
1892 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
|
1893 * DecompositionList object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1894 * Description object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1895 * Measure object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1896 * Sheet object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1897 * FileView object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1898 * Comapany View |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1899 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
|
1900 False |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1901 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1902 Creates and shows a new view |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1903 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1904 self.__view_type = view_type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1905 self.__wr_page = wr_page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1906 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
|
1907 self.__pane_path = pane_path |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1908 self.__connected = connected |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1909 # view_type liststore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1910 _liststore = Gtk.ListStore(str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1911 _liststore.append([_("Decomposition")]) #0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1912 _liststore.append([_("Description")]) #1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1913 _liststore.append([_("Measure")]) #2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1914 _liststore.append([_("Sheet of Conditions")]) #3 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1915 _liststore.append([_("Files")]) #4 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1916 _liststore.append([_("Companies")]) #5 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1917 _combobox = Gtk.ComboBox.new_with_model(_liststore) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1918 _cell = Gtk.CellRendererText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1919 _combobox.pack_start(_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1920 _combobox.add_attribute(_cell, 'text', 0) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1921 self.__widget = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1922 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
|
1923 _hbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1924 _hbox.set_orientation(Gtk.Orientation(0)) # 0 Horizontal |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1925 if view_type == "DecompositionList": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1926 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
|
1927 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1928 _combobox.set_active(0) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1929 _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
|
1930 _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
|
1931 "DECOMPOSITION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1932 elif view_type == "RecordDescription": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1933 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
|
1934 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1935 _combobox.set_active(1) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1936 _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
|
1937 _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
|
1938 "DESCRIPTION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1939 elif view_type == "Measure": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1940 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
|
1941 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1942 _combobox.set_active(2) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1943 _view_icon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1944 _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
|
1945 elif view_type == "Sheet of Conditions": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1946 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
|
1947 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1948 _combobox.set_active(3) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1949 _view_icon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1950 _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
|
1951 elif view_type == "FileView": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1952 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
|
1953 pane_path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1954 _combobox.set_active(4) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1955 _view_icon = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1956 _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
|
1957 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
|
1958 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
|
1959 active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1960 _combobox.set_active(5) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1961 _view_icon = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1962 _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
|
1963 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1964 _tuni = _("Invalid type of View: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1965 _uni = utils.mapping(_tuni, view_type) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1966 _str = _uni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1967 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1968 _view_icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1969 _combobox.connect("changed", self._change_combo) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1970 _combobox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1971 self.__widget.add(_hbox) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1972 self.__widget.add(self.__view.widget) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1973 _hbox.add(_view_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1974 _hbox.add(_combobox) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1975 _invisible = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1976 _invisible.set_orientation(Gtk.Orientation(0)) # 0 Horizontal |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1977 _invisible.set_property("hexpand", True) # expand horizontal space |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1978 _invisible.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1979 _hbox.add(_invisible) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1980 # TODO : Set thist with config |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1981 add_menu = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1982 if add_menu: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1983 _icon_menu = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1984 _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
|
1985 _icon_menu.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1986 _menu_button = Gtk.ToolButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1987 _menu_button.set_icon_widget(_icon_menu) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1988 _menu_button.connect("clicked", self._menu_view) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1989 _menu_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1990 _hbox.add(_menu_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1991 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1992 _icon_horizontal = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1993 _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
|
1994 _icon_horizontal.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1995 _horizontal_button = Gtk.ToolButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1996 _horizontal_button.set_icon_widget(_icon_horizontal) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
1997 _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
|
1998 _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
|
1999 _horizontal_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2000 _hbox.add(_horizontal_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2001 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2002 _icon_vertical = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2003 _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
|
2004 _icon_vertical.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2005 _vertical_button = Gtk.ToolButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2006 _vertical_button.set_icon_widget(_icon_vertical) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2007 _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
|
2008 _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
|
2009 _vertical_button.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2010 _hbox.add(_vertical_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2011 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2012 self.__connected_button = Gtk.ToolButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2013 _icon_connected = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2014 if self.__connected: |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2015 _icon_path = globalVars.getAppPath("CONNECTED-ICON") |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2016 _icon_connected.set_from_file(_icon_path) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2017 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
|
2018 else: |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2019 _icon_path = globalVars.getAppPath("DISCONNECTED-ICON") |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2020 _icon_connected.set_from_file(_icon_path) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2021 self.__connected_button.set_tooltip_text(_("Connect view")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2022 _icon_connected.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2023 self.__connected_button.set_icon_widget(_icon_connected) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2024 self.__connected_button.connect("clicked", self._connected) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2025 self.__connected_button.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2026 _hbox.add(self.__connected_button) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2027 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2028 _icon_close = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2029 _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
|
2030 _icon_close.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2031 _close_button = Gtk.ToolButton() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2032 _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
|
2033 _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
|
2034 _close_button.set_tooltip_text(_("Close view")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2035 _close_button.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2036 _hbox.add(_close_button) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2037 _hbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2038 self.__widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2039 |
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
|
2040 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
|
2041 """getItem(pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2042 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2043 Return itself. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2044 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2045 return self |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2046 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2047 def _closeItem_from_menu(self, close_menuitem): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2048 """_closeItem_from_menu(close_menuitem) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2049 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2050 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
|
2051 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
|
2052 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2053 self.propagateMessageFrom("autoclose", self.__pane_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2054 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2055 def _closeItem_from_button(self, close_button): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2056 """_closeItem_from_button(close_button) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2057 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2058 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
|
2059 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
|
2060 """ |
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
|
2061 self.propagateMessageFrom("autoclose", self.__pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2062 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2063 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
|
2064 """_change_combo(combobox) |
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 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
|
2067 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
|
2068 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2069 _index = combobox.get_active() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2070 _budget = self.__view.budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2071 _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
|
2072 _pane_path = self.__view.pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2073 _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
|
2074 _hbox = self.__widget.get_children()[1] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2075 _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
|
2076 _hbox.remove(_view_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2077 _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
|
2078 self.__widget.remove(self.__view.widget) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2079 _view_icon = Gtk.Image() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2080 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
|
2081 self.__view = DecompositionList(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2082 _path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2083 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2084 _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
|
2085 "DECOMPOSITION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2086 self.__view_type = "DecompositionList" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2087 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
|
2088 self.__view = Description(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2089 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2090 _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
|
2091 self.__view_type = "RecordDescription" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2092 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
|
2093 self.__view = Measure(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2094 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2095 _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
|
2096 self.__view_type = "Measure" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2097 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
|
2098 self.__view = Sheet(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2099 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2100 _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
|
2101 self.__view_type = "Sheet of Conditions" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2102 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
|
2103 self.__view = FileView(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2104 _path_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2105 _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
|
2106 self.__view_type = "FileView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2107 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
|
2108 self.__view = CompanyView(_budget, _wr_page, _pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2109 _path_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2110 _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
|
2111 self.__view_type = "CompanyView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2112 _view_icon.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2113 _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
|
2114 self.__widget.add(self.__view.widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2115 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2116 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
|
2117 """_menu_view(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2118 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2119 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
|
2120 It shows a popup menu with some options |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2121 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2122 _menu_view = Gtk.Menu() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2123 _item_leftright = Gtk.MenuItem(_("Split view Left/Right")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2124 _menu_view.append(_item_leftright) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2125 _item_leftright.connect("activate", self._split_view, "h") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2126 _item_leftright.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2127 _item_topbottom = Gtk.MenuItem(_("Split view Top/Bottom")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2128 _menu_view.append(_item_topbottom) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2129 _item_topbottom.connect("activate", self._split_view, "v") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2130 _item_topbottom.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2131 _item_close = Gtk.MenuItem(_("Close view")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2132 _menu_view.append(_item_close) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2133 _item_close.connect("activate",self._closeItem_from_menu) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2134 _item_close.show() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2135 _menu_view.popup_at_widget(widget, Gdk.Gravity(7), Gdk.Gravity(1), |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2136 Gtk.get_current_event()) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2137 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2138 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
|
2139 """_menu_view(orientation) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2140 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2141 orientation: orientation split, "h" or "v" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2142 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2143 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
|
2144 _item_topbottom menu items. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2145 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
|
2146 specified orientation |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2147 """ |
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
|
2148 self.propagateMessageFrom( "split " + orientation, self.__pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2149 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2150 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
|
2151 """_connected(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2152 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2153 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
|
2154 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
|
2155 _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
|
2156 to/from others views |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2157 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2158 if self.__connected: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2159 _icon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2160 _icon.set_from_file(globalVars.getAppPath("DISCONNECTED-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2161 _icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2162 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
|
2163 self.__connected_button.set_tooltip_text(_("Connect View")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2164 self.__connected = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2165 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2166 _icon = Gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2167 _icon.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2168 _icon.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2169 self.__connected_button.set_tooltip_text(_("Disconnect View")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2170 self.__connected_button.set_icon_widget(_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2171 self.__connected = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2172 |
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
|
2173 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
|
2174 """propagateMessageFrom(message, pane_path, arg=None) |
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 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
|
2177 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
|
2178 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2179 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
|
2180 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2181 if self.__connected or message == "autoclose" or \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2182 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
|
2183 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
|
2184 |
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
|
2185 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
|
2186 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2187 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2188 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2189 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2190 "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
|
2191 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
|
2192 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2193 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2194 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2195 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
|
2196 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2197 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
|
2198 self.__view.runMessage(message, pane_path, arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2199 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2200 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2201 """_getWidget() |
1
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 Return de pane widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2204 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2205 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2206 |
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
|
2207 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
|
2208 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2209 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2210 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
|
2211 """ |
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
|
2212 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
|
2213 |
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
|
2214 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
|
2215 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2216 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2217 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
|
2218 """ |
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
|
2219 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
|
2220 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
|
2221 |
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
|
2222 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
|
2223 """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
|
2224 |
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
|
2225 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
|
2226 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2227 return a clone of itself |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2228 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2229 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
|
2230 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
|
2231 self.__connected) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2232 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2233 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
|
2234 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2235 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2236 Clear the intance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2237 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2238 del self.__wr_page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2239 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
|
2240 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2241 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2242 del self.__view |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2243 del self.__connected |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2244 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
|
2245 |
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
|
2246 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2247 "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
|
2248 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
|
2249 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2250 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2251 class Paned(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2252 """gui.Paned: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2253 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2254 Description: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2255 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
|
2256 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2257 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
|
2258 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
|
2259 "h" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2260 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
|
2261 widget2: the botton or right pane widget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2262 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2263 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2264 +-- Paned |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2265 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2266 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
|
2267 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
|
2268 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2269 getClone |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2270 getItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2271 setItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2272 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2273 clear(self) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2274 """ |
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
|
2275 # 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
|
2276 # 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
|
2277 # TODO: 0.0 no space for widget1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2278 # TODO: 1.0 all the space for widget1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2279 |
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
|
2280 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
|
2281 """__init__(oritentation, pane_path, item1, item2) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2282 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2283 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
|
2284 pane_path: the paned path in the page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2285 item1: the top or left pane object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2286 item2: the bottom or right pane object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2287 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2288 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
|
2289 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
|
2290 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
|
2291 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
|
2292 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
|
2293 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2294 Creates and shows a new Gtk.Paned |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2295 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2296 self.__orientation = orientation |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2297 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
|
2298 not isinstance(item2.widget, Gtk.Widget): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2299 _tuni = _("The item must be a widget object.") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2300 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2301 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2302 if orientation == "v": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2303 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
|
2304 self.__widget.set_wide_handle(True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2305 elif orientation == "h": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2306 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
|
2307 self.__widget.set_wide_handle(True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2308 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2309 _tuni = _("Invalid orientation.") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2310 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2311 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2312 self.__widget.pack1(item1.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2313 self.__widget.pack2(item2.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2314 self.__widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2315 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
|
2316 self.__pane_path = pane_path |
1
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 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
|
2319 """__getitem__(item) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2320 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2321 Called to implement evaluation of self[key]. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2322 The accepted keys should be integers 0 or 1. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2323 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2324 return self.__items[item] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2325 |
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
|
2326 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
|
2327 """getClone(new_pane_path) |
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 a clone Paned instance with the path new_path |
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 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
|
2332 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
|
2333 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
|
2334 |
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
|
2335 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
|
2336 """getItem(pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2337 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2338 Return the item whith the specified path. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2339 """ |
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
|
2340 _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
|
2341 if len(pane_path) == 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2342 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2343 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
|
2344 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
|
2345 |
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
|
2346 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
|
2347 """setItem(pane_path, item_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2348 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2349 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
|
2350 remove the old item in this position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2351 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2352 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
|
2353 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
|
2354 _old_item = self.__items[pane_path] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2355 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
|
2356 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
|
2357 if pane_path == 0: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2358 self.__widget.pack1(item.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2359 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2360 self.__widget.pack2(item.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2361 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2362 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2363 |
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
|
2364 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
|
2365 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2366 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2367 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2368 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2369 "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
|
2370 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
|
2371 arg: arguments |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2372 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2373 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
|
2374 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2375 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
|
2376 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
|
2377 _item.runMessage(message, pane_path, arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2378 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2379 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2380 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2381 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2382 Return de Gtk.Paned widget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2383 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2384 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2385 |
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
|
2386 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
|
2387 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2388 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2389 Return de Paned path in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2390 """ |
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
|
2391 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
|
2392 |
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
|
2393 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
|
2394 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2395 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2396 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
|
2397 """ |
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
|
2398 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
|
2399 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
|
2400 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
|
2401 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2402 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
|
2403 """clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2404 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2405 Delete atributes |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2406 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2407 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2408 del self.__orientation |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2409 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
|
2410 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2411 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2412 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
|
2413 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
|
2414 "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
|
2415 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2416 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2417 class TreeView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2418 """gui.Treeviev: |
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 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2421 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
|
2422 DescompositionList and Measure classes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2423 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2424 TreView(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2425 args: list of tuples, the tuple items are: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2426 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2427 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2428 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2429 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2430 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2431 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2432 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2433 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2434 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2435 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2436 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2437 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2438 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2439 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2440 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2441 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2442 columns: list of columns (Gtk.TreeViewColumn objects) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2443 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2444 createColumn |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2445 createTextBaseColumn |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2446 createBaseColumn |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2447 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2448 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2449 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
|
2450 """__init__(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2451 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2452 args: list of tuples, the tuple items are: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2453 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2454 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2455 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2456 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2457 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2458 * Calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2459 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2460 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2461 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2462 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2463 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2464 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2465 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2466 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
|
2467 each column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2468 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2469 self.columns = [ self.createColumn(arg) for arg in args ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2470 self.columns.append(self.createColumn(("END",))) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2471 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2472 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
|
2473 """createColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2474 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2475 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2476 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2477 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2478 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2479 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2480 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2481 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2482 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2483 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2484 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2485 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2486 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2487 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2488 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2489 Return a column created whith the arg info |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2490 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2491 if args[0] == "INDEX": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2492 _index_column = self.createBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2493 _text_index_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2494 _text_index_cell.set_property('foreground', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2495 globalVars.color["TEXT"]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2496 _pixbuf_index_cell = Gtk.CellRendererPixbuf() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2497 _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
|
2498 globalVars.getAppPath("ARROW-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2499 _pixbuf_index_cell.set_property("pixbuf", _arrow_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2500 _index_column.pack_start(_text_index_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2501 _index_column.pack_start(_pixbuf_index_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2502 _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
|
2503 self._colorCell, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2504 [globalVars.color["INDEX-UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2505 globalVars.color["INDEX-EVEN"]]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2506 return _index_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2507 elif args[0] == "TEXT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2508 _column, _cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2509 _column.add_attribute(_cell, 'text', args[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2510 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2511 elif args[0] == "FLOAT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2512 _column, _cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2513 _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
|
2514 _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
|
2515 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2516 elif args[0] == "CALCULATED": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2517 _column, cell = self.createTextBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2518 _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
|
2519 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2520 elif args[0] == "CALCULATEDTEXT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2521 _column, cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2522 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2523 elif args[0] == "TYPE": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2524 _column = self.createBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2525 _type_cell1 = Gtk.CellRendererPixbuf() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2526 _type_cell2 = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2527 _type_cell2.set_property('foreground', args[3]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2528 _column.pack_start(_type_cell1, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2529 _column.pack_start(_type_cell2, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2530 _column.add_attribute(_type_cell2, 'text', args[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2531 _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
|
2532 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2533 _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
|
2534 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2535 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2536 elif args[0] == "PIXBUF": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2537 _column = self.createBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2538 _type_cell1 = Gtk.CellRendererPixbuf() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2539 _column.pack_start(_type_cell1, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2540 _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
|
2541 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2542 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2543 elif args[0] == "END": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2544 _end_column = Gtk.TreeViewColumn() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2545 _end_column.set_clickable(False) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2546 _end_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2547 _end_cell.set_property('background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2548 globalVars.color["UNEVEN"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2549 _end_column.pack_start(_end_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2550 return _end_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2551 return None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2552 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2553 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
|
2554 """createTextBaseColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2555 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2556 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2557 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2558 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2559 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2560 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2561 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2562 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2563 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2564 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2565 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2566 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2567 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2568 Return a column and its CellREndererText |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2569 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2570 _column = self.createBaseColumn(args) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2571 _cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2572 _cell.set_property('foreground', args[3]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2573 _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
|
2574 _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
|
2575 return _column, _cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2576 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2577 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
|
2578 """createBaseColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2579 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2580 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2581 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2582 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2583 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2584 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2585 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2586 * calculated text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2587 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2588 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2589 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2590 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2591 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2592 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2593 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2594 Return a column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2595 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2596 _column = Gtk.TreeViewColumn() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2597 _column.set_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2598 _column.connect("clicked", args[1]) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2599 _column.set_sizing(Gtk.TreeViewColumnSizing(2)) # 2 Fixed |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2600 _column.set_fixed_width(args[2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2601 _column.set_resizable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2602 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2603 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2604 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2605 class DecompositionList(TreeView): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2606 """gui.DecompositionList: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2607 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2608 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2609 Class to show a budget Decomposition List |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2610 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2611 DecompositionList(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2612 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2613 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
|
2614 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
|
2615 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
|
2616 Returns the newly created DecompositionList instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2617 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2618 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2619 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2620 +-- DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2621 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2622 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
|
2623 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
|
2624 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
|
2625 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
|
2626 active_path_record: Read. Active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2627 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2628 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2629 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2630 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2631 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
|
2632 """__init__(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2633 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2634 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2635 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
|
2636 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
|
2637 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
|
2638 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2639 self.__budget: budget showed ("base.Budget" object) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2640 self.__wr_page: weak reference from Page instance which creates 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
|
2641 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
|
2642 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
|
2643 (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
|
2644 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
|
2645 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
|
2646 (Gtk.TreeView) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2647 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
|
2648 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
|
2649 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
|
2650 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
|
2651 self.__chapter_background_colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2652 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
|
2653 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
|
2654 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
|
2655 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
|
2656 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
|
2657 (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2658 self.__measure_column: Measure column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2659 self.__price_column: Price column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2660 self.__amount_column: Amount column(Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2661 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
|
2662 self.__chapter_icon: a GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2663 self.__unit_icon: a GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2664 self.__material_icon: a GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2665 self.__machinery_icon: a GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2666 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
|
2667 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
|
2668 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
|
2669 self.__cursor: cursor position in the table |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2670 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2671 Sets the init atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2672 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
|
2673 showing the top record descomposition |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2674 Creates the list in self.__treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2675 * Creates the columns and cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2676 * Sets te the column headers values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2677 * Sets the selection properties |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2678 * Connects the events |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2679 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2680 # TODO: to group all columns in a dicctionary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2681 # Budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2682 if not isinstance(budget, base.Budget): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2683 _tuni = _("Argument must be a Budget object") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2684 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2685 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2686 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2687 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
|
2688 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2689 # ListStore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2690 self.__liststore = Gtk.ListStore(object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2691 #, int, int, str, str, str, str, str,str |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2692 ) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2693 if path_record is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2694 path_record = (0,) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2695 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
|
2696 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2697 # Treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2698 self.__treeview = Gtk.TreeView(self.__liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2699 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2700 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2701 self.__treeview.set_headers_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2702 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2703 # Scrolled_window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2704 self.__scrolled_window = Gtk.ScrolledWindow() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2705 # widget expand all space |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2706 self.__scrolled_window.set_property("expand", True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2707 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
|
2708 Gtk.PolicyType(1)) # 1 Automatic |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2709 self.__scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2710 # colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2711 _text_color = globalVars.color["TEXT"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2712 _background_color = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2713 globalVars.color["UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2714 globalVars.color["EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2715 self.__chapter_background_colors = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2716 globalVars.color["CHAPTER-UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2717 globalVars.color["CHAPTER-EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2718 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
|
2719 [("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
|
2720 ("CALCULATEDTEXT", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2721 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
|
2722 ("PIXBUF", self._showParentRecord, 26, _text_color, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2723 _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2724 ("CALCULATEDTEXT", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2725 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
|
2726 ("CALCULATEDTEXT", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2727 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
|
2728 ("CALCULATED", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2729 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
|
2730 ("CALCULATED", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2731 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
|
2732 ("CALCULATED", self._showParentRecord, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2733 90, globalVars.color["CALCULATED-TEXT"], |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2734 _background_color), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2735 ]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2736 self.__index_column = self.columns[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2737 self.__code_column = self.columns[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2738 self.__type_column = self.columns[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2739 self.__unit_column = self.columns[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2740 self.__description_column = self.columns[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2741 self.__measure_column = self.columns[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2742 self.__price_column = self.columns[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2743 self.__amount_column = self.columns[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2744 self.__end_column = self.columns[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2745 # Index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2746 self.__treeview.append_column(self.__index_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2747 # Code column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2748 self.__treeview.append_column(self.__code_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2749 # Type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2750 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
|
2751 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
|
2752 globalVars.getAppPath("CHAPTER-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2753 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
|
2754 globalVars.getAppPath("UNIT-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2755 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
|
2756 globalVars.getAppPath("MATERIAL-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2757 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
|
2758 globalVars.getAppPath("MACHINERY-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2759 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
|
2760 globalVars.getAppPath("LABOURFORCE-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2761 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
|
2762 self.__labourforce_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2763 # Unit column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2764 self.__treeview.append_column(self.__unit_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2765 # Description column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2766 self.__treeview.append_column(self.__description_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2767 # Measure Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2768 self.__treeview.append_column(self.__measure_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2769 # Price column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2770 self.__treeview.append_column(self.__price_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2771 # Amount column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2772 self.__treeview.append_column(self.__amount_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2773 # End Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2774 self.__treeview.append_column(self.__end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2775 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2776 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
|
2777 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
|
2778 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
|
2779 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
|
2780 self._treeviewClickedEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2781 self.__treeview.connect("cursor-changed", self._treeviewCursorChanged) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2782 # control selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2783 self.__treeselection = self.__treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2784 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
|
2785 self.__treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2786 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2787 if len(self.__liststore) > 0: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2788 _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
|
2789 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
|
2790 self.__unit_column.get_cells()[0],True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2791 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2792 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2793 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2794 self._setColumnsHeaders() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2795 self.__scrolled_window.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2796 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2797 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
|
2798 """_treeviewCursorChanged(treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2799 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2800 treeview: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2801 Method connected to "cursor-changed" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2802 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
|
2803 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
|
2804 unnecessary changes in cursor position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2805 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2806 event = Gtk.get_current_event() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2807 (_cursor_path, _column) = treeview.get_cursor() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2808 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
|
2809 if not _column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2810 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
|
2811 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2812 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
|
2813 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2814 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2815 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2816 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2817 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2818 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
|
2819 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2820 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
|
2821 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2822 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2823 The events in end column are ignored. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2824 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
|
2825 this row but not to the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2826 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2827 if event.button == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2828 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
|
2829 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2830 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2831 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2832 if _column == self.columns[-1]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2833 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2834 if _column is self.columns[0]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2835 self.__cursor[0] == _path_cursor |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2836 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2837 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2838 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
|
2839 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2840 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2841 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2842 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2843 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2844 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
|
2845 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2846 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
|
2847 Returns :FALSE to propagate the event further. |
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 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
|
2850 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
|
2851 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
|
2852 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2853 (_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
|
2854 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
|
2855 Gdk.keyval_from_name("KP_Right")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2856 and _column == self.columns[-2]) \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2857 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
|
2858 Gdk.keyval_from_name("KP_Left")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2859 and _column == self.columns[1]): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2860 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2861 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2862 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2863 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
|
2864 """_moveCursor(treeview, step, count) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2865 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2866 treeview: the treeview that received the signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2867 step: the movement step size |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2868 count: the number of steps to take |
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 Method connected to "move-cursor" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2871 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
|
2872 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
|
2873 Page Down, Home and End keys. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2874 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2875 Returns :TRUE if the signal was handled. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2876 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2877 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2878 |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2879 def _controlSelection(self, selection, model, path, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2880 path_currently_selected, *data): |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2881 """_controlSelection(selection, model, path, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2882 path_currently_selected, *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2883 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2884 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2885 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2886 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2887 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
|
2888 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2889 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2890 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
|
2891 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2892 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2893 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
|
2894 the previous selection is erased. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2895 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2896 _column = self.__treeview.get_cursor()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2897 if _column is self.columns[0] \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2898 or self.__selection_control == False: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2899 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2900 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2901 self.__selection_control = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2902 self.__treeselection.unselect_all() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2903 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2904 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2905 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2906 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
|
2907 """_selectAll(column) |
1
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 column: index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2910 Method connected to "clicked" event in the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2911 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
|
2912 all rows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2913 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2914 (_model, _pathlist) = self.__treeselection.get_selected_rows() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2915 # 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
|
2916 if isinstance(self.__cursor[0],Gtk.TreePath): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2917 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
|
2918 self.__selection_control = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2919 if len(_pathlist) == 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2920 # select all |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2921 self.__treeselection.select_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2922 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2923 # unselect all |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2924 self.__treeselection.unselect_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2925 self.__selection_control = True |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2926 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2927 def _setColumnsHeaders(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2928 """_setColumnsHeaders() |
1
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 Sets the headers column values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2931 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2932 _path_record = self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2933 _number = _path_record[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2934 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2935 _code = _budget.getCode(_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2936 _decomposition = _budget.getDecomposition(_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2937 _stryield = _budget.getStrYield(_decomposition.budgetMeasures[0], |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2938 _budget.getRecord(_code).recordType) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2939 _record = _budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2940 _unit = _record.unit |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2941 _description = _record.summary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2942 _price = _budget.getStrPriceFromRecord(self.budget.getActiveTitle(), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
2943 _record, _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2944 # TODO: round to decimal places in amount |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2945 _amount = float(_stryield) * float(_price) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2946 if len(_path_record) == 1: # root record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2947 _amount = _price |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2948 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2949 _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
|
2950 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2951 _amount = _budget.getStrAmount(self.__active_path_record) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2952 _str = _("Code") + chr(10) + "[" + _code + "]" |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2953 self.__code_column.set_title(_str) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2954 _str = _("Unit") + chr(10) + "[" + _unit + "]" |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2955 self.__unit_column.set_title(_str) |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2956 _str = _("Description") + chr(10) + "[" + \ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2957 _description + "]" |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2958 self.__description_column.set_title(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2959 self.__measure_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2960 _("Measure") + chr(10) + "[" + _stryield + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2961 self.__price_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2962 _("Price") + chr(10) + "[" + _price + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2963 self.__amount_column.set_title( |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2964 _("Amount") + chr(10) + "[" + text(_amount) + "]") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2965 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2966 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
|
2967 """_setListstoreValues(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2968 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2969 path_record: Record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2970 Sets the liststore record values from a path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2971 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2972 self.__liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2973 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2974 if not _budget.hasPath(path_record): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2975 _tuni = _("Invalid path") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2976 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2977 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2978 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2979 _parent_code = _budget.getCode(path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2980 for N,_code in enumerate(_budget.getchildren(_parent_code)): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2981 _decomposition = _budget.getNDecomposition(_parent_code, N) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2982 _record = _budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2983 _values = [_record, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2984 #_record.hierarchy, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2985 #_record.type, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2986 #_record.subtype, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2987 #_code, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2988 #_record.unit, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2989 #_record.summary, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2990 #_decomposition.yield_, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2991 #_decomposition.budget[0].yield_, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2992 #_record.prices[_budget.getActiveTitle()].prices] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2993 #_record.getPrice(_budget.getActiveTitle()) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2994 ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2995 _treeiter = self.__liststore.append(_values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2996 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2997 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
|
2998 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2999 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3000 column: the Gtk.TreeViewColumn in the treeview |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3001 cell_renderer: a Gtk.CellRenderer |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3002 tree_model: the Gtk.TreeModel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3003 iter: Gtk.TreeIter pointing at the row |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3004 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
|
3005 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3006 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
|
3007 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
|
3008 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
|
3009 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
|
3010 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
|
3011 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
|
3012 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
|
3013 -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
|
3014 -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
|
3015 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
|
3016 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
|
3017 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
|
3018 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3019 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
|
3020 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3021 _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
|
3022 _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
|
3023 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3024 _record = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3025 if column is self.__index_column: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3026 cell_renderer.set_property('text', text(_number + 1)) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3027 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
|
3028 'cell-background', lcolor[_number % 2]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3029 elif column is self.__code_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3030 # if the record is a chapter |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3031 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
|
3032 lcolor = self.__chapter_background_colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3033 _code = _record.code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3034 cell_renderer.set_property('text', _code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3035 elif column is self.__unit_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3036 _unit = _record.unit |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3037 cell_renderer.set_property('text', _unit) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3038 elif column is self.__description_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3039 _summary = _record.summary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3040 cell_renderer.set_property('text', _summary) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3041 elif column is self.__measure_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3042 _parent_code = self.budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3043 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3044 _decomposition = _parent_record.children[_number] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3045 _stryield = self.__budget.getStrYield( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3046 _decomposition.budgetMeasures[0], _parent_record.recordType) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3047 cell_renderer.set_property('text', _stryield) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3048 elif column is self.__price_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3049 _price = self.budget.getStrPriceFromRecord( |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3050 self.budget.getActiveTitle(), _record, _global_row_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3051 cell_renderer.set_property('text', _price) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3052 elif column is self.__amount_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3053 _parent_code = self.budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3054 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3055 _amount = self.budget.getStrAmount( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3056 self.__active_path_record + (_number,)) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3057 cell_renderer.set_property('text', text(_amount)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3058 elif column is self.__type_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3059 _hierarchy = tree_model[_row_path][0].recordType.hierarchy |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3060 _type = tree_model[_row_path][0].recordType.type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3061 _subtype = tree_model[_row_path][0].recordType.subtype |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3062 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
|
3063 cell_renderer.set_property("pixbuf",self.__chapter_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3064 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3065 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
|
3066 cell_renderer.set_property("pixbuf",self.__unit_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3067 elif _type == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3068 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
|
3069 self.__labourforce_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3070 elif _type == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3071 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
|
3072 self.__machinery_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3073 else: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3074 cell_renderer.set_property("pixbuf",self.__material_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3075 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
|
3076 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3077 globalVars.color["ACTIVE"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3078 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3079 cell_renderer.set_property('cell-background', |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3080 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3081 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3082 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
|
3083 """_showParentRecord(column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3084 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3085 column: the column that is clicked |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3086 Method connected to "clicked" event of many columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3087 Show the parent record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3088 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3089 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3090 if len(self.__active_path_record) == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3091 # The active record is the root record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3092 # 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
|
3093 if isinstance(self.__cursor[0],Gtk.TreePath): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3094 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
|
3095 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3096 _path_record = self.__active_path_record[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3097 _parent = self.__active_path_record[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3098 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
|
3099 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3100 self._setListstoreValues(self.__active_path_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3101 arg = _path_record |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3102 _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
|
3103 _page.propagateMessageFrom("change_active", self.__pane_path, arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3104 self.__treeview.set_cursor(_parent, self.__cursor[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3105 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3106 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3107 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
|
3108 """_showMessageRecord(record_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3109 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3110 record_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3111 Method connected to "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3112 Show the record especified in the "change_active" message |
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 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3115 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
|
3116 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3117 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3118 self.__treeview.set_cursor((0,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3119 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3120 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
|
3121 """_showRowRecord(treeview, treeview_path, column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3122 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3123 treeview: treview to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3124 treeview_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3125 code: the code of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3126 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3127 Method connected to "row-activated" event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3128 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
|
3129 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
|
3130 "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
|
3131 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
|
3132 Show the especified record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3133 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3134 if not (column is self.__end_column) and \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3135 not (column is self.__index_column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3136 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3137 _model = treeview.get_model() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3138 _iter = _model.get_iter(treeview_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3139 _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
|
3140 _path_record = self.__active_path_record |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3141 for _indice in treeview_path.get_indices(): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3142 _path_record = _path_record + (_indice,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3143 if self.__budget.hasPath(_path_record): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3144 # if this record path is valid |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3145 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
|
3146 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3147 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3148 self.__treeview.set_cursor((0,)) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3149 _arg = _path_record |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3150 _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
|
3151 _page.propagateMessageFrom("change_active", self.__pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3152 _arg ) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3153 |
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
|
3154 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
|
3155 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3156 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3157 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3158 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3159 "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
|
3160 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
|
3161 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3162 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3163 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3164 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
|
3165 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3166 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3167 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3168 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3169 _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
|
3170 self._showMessageRecord( _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3171 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3172 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3173 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3174 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
|
3175 """_clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3176 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3177 it deletes the __budget reference |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3178 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3179 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3180 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3181 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3182 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3183 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3184 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3185 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3186 return self.__scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3187 |
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
|
3188 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
|
3189 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3190 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3191 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
|
3192 """ |
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
|
3193 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
|
3194 |
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 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
|
3196 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3197 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3198 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
|
3199 """ |
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
|
3200 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3201 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3202 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
|
3203 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3204 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3205 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3206 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3207 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3208 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3209 def _setWrPage(self,wr_page): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3210 """_setWrPage() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3211 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3212 set the wr_Page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3213 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3214 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3215 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3216 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3217 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3218 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3219 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3220 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3221 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3222 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3223 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3224 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3225 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3226 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3227 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3228 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3229 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3230 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3231 "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
|
3232 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3233 "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
|
3234 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3235 "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
|
3236 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3237 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3238 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3239 "Active path record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3240 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3241 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3242 class Measure(TreeView): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3243 """gui.Measure: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3244 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3245 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3246 Class to show a Measure List |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3247 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3248 Measure(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3249 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3250 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
|
3251 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
|
3252 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
|
3253 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3254 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3255 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3256 +-- DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3257 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3258 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
|
3259 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
|
3260 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
|
3261 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
|
3262 this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3263 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
|
3264 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3265 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3266 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3267 |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3268 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
|
3269 """__init__(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3270 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3271 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
|
3272 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
|
3273 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
|
3274 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
|
3275 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3276 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
|
3277 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
|
3278 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
|
3279 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
|
3280 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
|
3281 (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
|
3282 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
|
3283 (Gtk.TreeView) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3284 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
|
3285 Gtk.ScrolledWindow() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3286 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
|
3287 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
|
3288 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
|
3289 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
|
3290 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
|
3291 self.__comment_column: Comment column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3292 self.__unit_column: Unit column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3293 self.__length_column: Legth column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3294 self.__width_column: With column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3295 self.__height_column: Height column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3296 self.__formula_column: Formula column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3297 self.__parcial_column: Parcial column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3298 self.__subtotal_column: Subtotal column (Gtk.TreeViewColumn) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3299 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
|
3300 self.__calculatedline_icon: GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3301 self.__normalline_icon: GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3302 self.__parcialline_icon: GdkPixbuf.Pixbuf |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3303 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
|
3304 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
|
3305 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
|
3306 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
|
3307 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3308 Sets the init atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3309 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
|
3310 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
|
3311 Creates the list in self.__treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3312 * Creates the columns and cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3313 * Sets te the column headers values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3314 * Sets the selection properties |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3315 * Connects the events |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3316 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3317 # Seting init args |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3318 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3319 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3320 if not isinstance(budget, base.Budget): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3321 _tuni = _("Argument must be a Budget object") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3322 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3323 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3324 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3325 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
|
3326 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3327 if not isinstance(path_record, tuple): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3328 print(_("Record path must be a tuple") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3329 path_record = (0,) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3330 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3331 # ListStore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3332 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
|
3333 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3334 # Treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3335 self.__treeview = Gtk.TreeView(self.__liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3336 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3337 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3338 self.__treeview.set_headers_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3339 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3340 # Scrolled_window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3341 self.__scrolled_window = Gtk.ScrolledWindow() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
3342 # widget expand all space |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
3343 self.__scrolled_window.set_property("expand", True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3344 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
|
3345 Gtk.PolicyType(1)) # 1 Automatic |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3346 self.__scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3347 # colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3348 _text_color = globalVars.color["TEXT"] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3349 _calculated_text = globalVars.color["CALCULATED-TEXT"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3350 _background_color = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3351 globalVars.color["UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3352 globalVars.color["EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3353 self.__chapter_background_colors = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3354 globalVars.color["CHAPTER-UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3355 globalVars.color["CHAPTER-EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3356 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
|
3357 [("INDEX",self._selectAll,42), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3358 ("PIXBUF", self._passMethod, 40, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3359 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3360 ("CALCULATEDTEXT", self._passMethod, 128, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3361 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3362 ("CALCULATED", self._passMethod, 55, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3363 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3364 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3365 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3366 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3367 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3368 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3369 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3370 ("CALCULATEDTEXT", self._passMethod, 120, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3371 _text_color, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3372 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3373 _calculated_text, _background_color), |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3374 ("CALCULATED", self._passMethod, 70, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3375 _calculated_text, _background_color), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3376 ]) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3377 # Colums |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3378 self.__index_column = self.columns[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3379 self.__linetype_column = self.columns[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3380 self.__comment_column = self.columns[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3381 self.__units_column = self.columns[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3382 self.__length_column = self.columns[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3383 self.__width_column = self.columns[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3384 self.__height_column = self.columns[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3385 self.__formula_column = self.columns[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3386 self.__parcial_column = self.columns[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3387 self.__subtotal_column = self.columns[9] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3388 self.__end_column = self.columns[10] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3389 # Index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3390 self.__treeview.append_column(self.__index_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3391 # Linetype column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3392 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
|
3393 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
|
3394 globalVars.getAppPath("CALCULATEDLINE-ICON")) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3395 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
|
3396 globalVars.getAppPath("NORMALLINE-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3397 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
|
3398 globalVars.getAppPath("PARCIALLINE-ICON") ) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3399 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
|
3400 globalVars.getAppPath("ACUMULATEDLINE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3401 # Comment column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3402 self.__treeview.append_column(self.__comment_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3403 # Units column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3404 self.__treeview.append_column(self.__units_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3405 # Length column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3406 self.__treeview.append_column(self.__length_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3407 # Width_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3408 self.__treeview.append_column(self.__width_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3409 # Height column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3410 self.__treeview.append_column(self.__height_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3411 # Formula column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3412 self.__treeview.append_column(self.__formula_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3413 # Parcial column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3414 self.__treeview.append_column(self.__parcial_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3415 # Subtotal column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3416 self.__treeview.append_column(self.__subtotal_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3417 # End Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3418 self.__treeview.append_column(self.__end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3419 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3420 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
|
3421 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
|
3422 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
|
3423 self._treeviewClickedEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3424 self.__treeview.connect("cursor-changed", self._treeviewCursorChanged) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3425 # control selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3426 self.__treeselection = self.__treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3427 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
|
3428 self.__treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3429 self.__selection_control = True |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3430 if len(self.__liststore) > 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3431 _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
|
3432 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
|
3433 self.columns[1].get_cells()[0],True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3434 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3435 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3436 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3437 self._setColumnsHeaders() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3438 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
|
3439 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3440 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
|
3441 """_treeviewCursorChanged(treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3442 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3443 treeview: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3444 Method connected to "cursor-changed" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3445 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
|
3446 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
|
3447 unnecessary changes in cursor position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3448 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3449 event = Gtk.get_current_event() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3450 (_cursor_path, _column) = treeview.get_cursor() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3451 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
|
3452 if not _column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3453 self.__cursor = treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3454 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3455 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
|
3456 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3457 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3458 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3459 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3460 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3461 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
|
3462 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3463 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
|
3464 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3465 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3466 The events in end column are ignored. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3467 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
|
3468 this row but not to the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3469 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3470 if event.button == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3471 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
|
3472 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3473 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3474 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3475 if _column == self.columns[-1]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3476 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3477 if _column is self.columns[0]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3478 self.__cursor[0] == _path_cursor |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3479 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3480 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3481 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
|
3482 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3483 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3484 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3485 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3486 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3487 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
|
3488 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3489 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
|
3490 Returns :FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3491 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3492 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
|
3493 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
|
3494 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
|
3495 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3496 (_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
|
3497 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
|
3498 Gdk.keyval_from_name("KP_Right")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3499 and _column == self.columns[-2]) \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3500 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
|
3501 Gdk.keyval_from_name("KP_Left")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3502 and _column == self.columns[1]): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3503 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3504 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3505 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3506 def _moveCursor(self, treeview, step, count): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3507 """moveCursor(treeview, step, count) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3508 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3509 treeview: the treeview that received the signal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3510 step: the movement step size |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3511 count: the number of steps to take |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3512 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3513 Method connected to "move-cursor" signal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3514 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
|
3515 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
|
3516 Page Down, Home and End keys. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3517 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3518 Returns :TRUE if the signal was handled. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3519 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3520 return False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3521 |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
3522 def _controlSelection(self, selection, model, path, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
3523 path_currently_selected, *data): |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
3524 """_controlSelection(selection, model, path, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
3525 path_currently_selected, *data) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3526 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3527 selection: treeselection |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3528 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3529 Method connected to set_selection_function() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3530 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
|
3531 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
|
3532 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
|
3533 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
|
3534 be left unchanged. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3535 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3536 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
|
3537 the previous selection is erased. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3538 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3539 _column = self.__treeview.get_cursor()[1] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3540 if _column is self.columns[0] \ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3541 or self.__selection_control == False: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3542 return True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3543 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3544 self.__selection_control = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3545 self.__treeselection.unselect_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3546 self.__selection_control = True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3547 return False |
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 def _selectAll(self, column): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3550 """_selectAll(column) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3551 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3552 column: index column |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3553 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
|
3554 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
|
3555 all rows |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3556 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3557 (_model, _pathlist) = self.__treeselection.get_selected_rows() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3558 # 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
|
3559 if isinstance(self.__cursor[0],Gtk.TreePath): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3560 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
|
3561 self.__selection_control = False |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3562 if len(_pathlist) == 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3563 # select all |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3564 self.__treeselection.select_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3565 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3566 # unselect all |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3567 self.__treeselection.unselect_all() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3568 self.__selection_control = True |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3569 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3570 def _setColumnsHeaders(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3571 """_setColumnsHeaders() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3572 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3573 Sets the headers column values |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3574 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3575 _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
|
3576 _DS = self.__budget.getDecimals("DS") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3577 _total = _measure.measure |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3578 _total_str = ("%." + text(abs(_DS)) + "f" ) % _total |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3579 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
|
3580 self.columns[2].set_title(_("Comment")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3581 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
|
3582 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
|
3583 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
|
3584 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
|
3585 self.columns[7].set_title(_("Formula")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3586 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
|
3587 self.columns[9].set_title(_("Subtotal")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3588 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3589 def _setListstoreValues(self, path_record): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3590 """_setListstoreValues(path_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3591 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3592 path_record: Record path in the budget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3593 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
|
3594 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3595 self.__liststore.clear() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3596 _budget = self.__budget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3597 if not _budget.hasPath(path_record): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3598 _tuni = _("Invalid path") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3599 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3600 raise ValueError(_str) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3601 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3602 _measure = _budget.getMeasure(path_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3603 if isinstance(_measure, base.Measure): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3604 _lines = _measure.lines |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3605 for _line in _lines: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3606 _values = [ _line ] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3607 _treeiter = self.__liststore.append(_values) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3608 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3609 _tuni = _("measure must be a Measure object. Type: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3610 _uni = utils.mapping(_tuni, (text(type(_measure)),)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3611 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3612 raise ValueError(_str) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3613 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3614 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
|
3615 """_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
|
3616 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3617 column: the Gtk.TreeViewColumn in the treeview |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3618 cell_renderer: a Gtk.CellRenderer |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3619 tree_model: the Gtk.TreeModel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3620 iter: Gtk.TreeIter pointing at the row |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3621 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
|
3622 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3623 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
|
3624 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
|
3625 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
|
3626 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
|
3627 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
|
3628 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
|
3629 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
|
3630 -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
|
3631 -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
|
3632 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
|
3633 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
|
3634 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
|
3635 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3636 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
|
3637 and text for index and amount columns. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3638 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3639 _row_path = tree_model.get_path(iter) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3640 _number = _row_path[-1] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3641 if column is self.__index_column: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3642 cell_renderer.set_property('text', text(_number + 1)) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3643 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
|
3644 'cell-background', lcolor[_number % 2]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3645 elif column is self.__linetype_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3646 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3647 _type = _measure.lineType |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3648 if _type == 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3649 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
|
3650 elif _type == 1: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3651 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
|
3652 elif _type == 2: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3653 cell_renderer.set_property("pixbuf", |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3654 self.__acumulatedline_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3655 else: #elif _type == 3: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3656 cell_renderer.set_property("pixbuf", |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3657 self.__calculatedline_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3658 elif column is self.__comment_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3659 _measure = tree_model[_row_path][0] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3660 _comment = text(_measure.comment) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3661 cell_renderer.set_property('text', _comment) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3662 elif column is self.__units_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3663 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3664 _units = _measure.units |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3665 if isinstance(_units, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3666 _DN = self.__budget.getDecimals("DN") |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3667 _units = ("%." + text(abs(_DN)) + "f" ) % _units |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3668 cell_renderer.set_property('text', _units) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3669 elif column is self.__length_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3670 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3671 _length = _measure.length |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3672 if isinstance(_length, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3673 _DD = self.__budget.getDecimals("DD") |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3674 _length = ("%." + text(abs(_DD)) + "f" ) % _length |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3675 cell_renderer.set_property('text', _length) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3676 elif column is self.__width_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3677 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3678 _width = _measure.width |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3679 if isinstance(_width, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3680 _DD = self.__budget.getDecimals("DD") |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3681 _width = ("%." + text(abs(_DD)) + "f" ) % _width |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3682 cell_renderer.set_property('text', _width) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3683 elif column is self.__height_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3684 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3685 _height = _measure.height |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3686 if isinstance(_height, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3687 _DD = self.__budget.getDecimals("DD") |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3688 _height = ("%." + text(abs(_DD)) + "f" ) % _height |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3689 cell_renderer.set_property('text', _height) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3690 elif column is self.__formula_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3691 _measure = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3692 _formula = _measure.formula |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3693 cell_renderer.set_property('text', _formula) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3694 elif column is self.__parcial_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3695 _measure_line = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3696 _parcial = _measure_line.parcial |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3697 _type = _measure_line.lineType |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3698 if _type == 1 or _type == 2: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3699 _parcial = "" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3700 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3701 if isinstance(_parcial, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3702 _DS = self.__budget.getDecimals("DS") |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3703 _parcial = ("%." + text(abs(_DS)) + "f" ) % _parcial |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3704 cell_renderer.set_property('text', _parcial) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3705 elif column is self.__subtotal_column: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3706 _measure_line = tree_model[_row_path][0] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3707 _type = _measure_line.lineType |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3708 if _type == 1 or _type == 2: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3709 if _type == 1: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3710 _color = globalVars.color["SUBTOTAL-PARCIAL"] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3711 _subtotal = _measure_line.parcial_subtotal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3712 else: #elif _type == 2: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3713 _color = globalVars.color["SUBTOTAL"] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3714 _subtotal = _measure_line.acumulated_subtotal |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3715 lcolor = [_color, _color] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3716 if isinstance(_subtotal, float): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3717 _DS = self.__budget.getDecimals("DS") |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3718 _subtotal= ("%." + text(abs(_DS)) + "f" ) % _subtotal |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3719 cell_renderer.set_property('text', _subtotal) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3720 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3721 cell_renderer.set_property('text', "") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3722 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3723 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
|
3724 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3725 globalVars.color["ACTIVE"]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3726 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3727 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3728 lcolor[_number % 2]) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3729 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3730 def _passMethod(self, column): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3731 """_passMethod(column) |
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 column: the column that is clicked |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3734 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
|
3735 Do nothing |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3736 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3737 pass |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3738 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3739 def _showMessageRecord(self, record_path): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3740 """_showMessageRecord(record_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3741 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3742 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
|
3743 Method connected to "change_active" message |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3744 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
|
3745 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3746 _budget = self.__budget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3747 self.__active_path_record = record_path |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3748 self._setColumnsHeaders() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3749 self._setListstoreValues(self.__active_path_record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3750 self.__treeview.set_cursor((0,)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3751 |
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
|
3752 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
|
3753 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3754 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3755 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3756 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3757 "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
|
3758 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
|
3759 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3760 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3761 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3762 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
|
3763 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3764 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3765 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3766 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3767 _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
|
3768 self._showMessageRecord( _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3769 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3770 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3771 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3772 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
|
3773 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3774 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3775 it deletes the __budget value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3776 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3777 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3778 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3779 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3780 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3781 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3782 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3783 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3784 return self.__scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3785 |
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
|
3786 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
|
3787 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3788 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3789 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
|
3790 """ |
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
|
3791 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
|
3792 |
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
|
3793 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
|
3794 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3795 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3796 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
|
3797 """ |
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
|
3798 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
|
3799 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3800 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
|
3801 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3802 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3803 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3804 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3805 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3806 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3807 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
|
3808 """_setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3809 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3810 set the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3811 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3812 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3813 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3814 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3815 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3816 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3817 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3818 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3819 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3820 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3821 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3822 """getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3823 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3824 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3825 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3826 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3827 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3828 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3829 "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
|
3830 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3831 "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
|
3832 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3833 "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
|
3834 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3835 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3836 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3837 "Active Code") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3838 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3839 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3840 class Description(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3841 """gui.Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3842 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3843 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3844 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
|
3845 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3846 budget: budget showed ("base.Budget" object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3847 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
|
3848 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
|
3849 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
|
3850 Returns the newly created DecompositionList instance |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3851 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3852 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3853 +-- Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3854 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3855 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
|
3856 widget: the main widget (Gtk.ScrolledWindow object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3857 pane_path: Read-Write. Pane page identifier |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3858 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
|
3859 active_path_record: Read. Active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3860 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3861 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3862 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3863 # TODO: make standard: "DecompositonList and Description" |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3864 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3865 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
|
3866 """__init__(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3867 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3868 budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3869 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
|
3870 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
|
3871 path_record: the path of the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3872 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3873 self.__budget: the budget (base.obra object) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
3874 self.__wr_page: weak reference from Page instance which creates 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
|
3875 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
|
3876 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
|
3877 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3878 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
|
3879 the record text. |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3880 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
|
3881 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
|
3882 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3883 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
|
3884 of the record to be showed in a pane. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3885 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3886 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
3887 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3888 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3889 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
|
3890 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3891 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3892 _budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3893 _text = _budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3894 self.__active_path_record)).text |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3895 _scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3896 _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
|
3897 _scrollwindow.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3898 Gtk.PolicyType(1)) # 1 Automatic |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
3899 _scrollwindow.set_shadow_type(1) # IN 1 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3900 _textview = Gtk.TextView() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3901 _textview.set_wrap_mode(2) # 2 Word |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3902 _textview.set_hexpand(True) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3903 _textview.set_vexpand(True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3904 self.__textbuffer = _textview.get_buffer() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3905 self.__textbuffer.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3906 _textview.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3907 _vbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3908 _vbox.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3909 _tuni = _("Description text of the record $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3910 _ucode = self.__budget.getCode(self.__active_path_record) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3911 _uni = utils.mapping(_tuni, (_ucode,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3912 self.__label = Gtk.Label(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3913 self.__label.set_alignment(0, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3914 self.__label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3915 _vbox.add(self.__label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3916 _vbox.add(_textview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3917 _vbox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3918 _scrollwindow.add(_vbox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3919 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3920 self.__widget = _scrollwindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3921 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3922 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
|
3923 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3924 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3925 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3926 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
|
3927 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3928 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3929 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3930 _code = _budget.getCode(self.__active_path_record) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3931 _tuni = _("Description text of the record $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3932 _uni = utils.mapping(_tuni, (_code,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
3933 self.__label.set_text(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3934 _text = _budget.getRecord(_code).text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3935 self.__textbuffer.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3936 |
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
|
3937 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
|
3938 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3939 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3940 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3941 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3942 "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
|
3943 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
|
3944 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3945 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3946 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3947 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
|
3948 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3949 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3950 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3951 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
|
3952 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3953 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3954 self._clear() |
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 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
|
3957 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3958 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3959 Delete all instance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3960 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3961 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
|
3962 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3963 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3964 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3965 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3966 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3967 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3968 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3969 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3970 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3971 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3972 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3973 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3974 |
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
|
3975 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
|
3976 """_getPanePath() |
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 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
|
3979 """ |
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 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
|
3981 |
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
|
3982 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
|
3983 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3984 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3985 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
|
3986 """ |
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
|
3987 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3988 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3989 def _getWrPage(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3990 """_getWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3991 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3992 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3993 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3994 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3995 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3996 def _setWrPage(self, wr_page): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
3997 """_setWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3998 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3999 set the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4000 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4001 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4002 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4003 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4004 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4005 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4006 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4007 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4008 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4009 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4010 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4011 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4012 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4013 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4014 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4015 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4016 |
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
|
4017 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4018 "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
|
4019 widget = property(_getWidget, None, None, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4020 "The main widget (Gtk.ScrolledWindow)") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4021 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4022 "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
|
4023 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4024 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4025 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4026 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4027 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4028 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4029 class Sheet(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4030 """gui.Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4031 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4032 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4033 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
|
4034 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4035 Sheet(budget, code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4036 budget: budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4037 code: code record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4038 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4039 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4040 +-- Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4041 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4042 budget: The budget (base.obra objetc) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4043 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
|
4044 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
|
4045 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
|
4046 active_path_record: The active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4047 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4048 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4049 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4050 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4051 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
|
4052 """__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
|
4053 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4054 budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4055 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
|
4056 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
|
4057 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
|
4058 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4059 self.__budget: the budget (base.obra object) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4060 self.__wr_page: weak reference from Page instance which creates 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
|
4061 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
|
4062 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
|
4063 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
|
4064 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
|
4065 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
|
4066 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
|
4067 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
|
4068 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
|
4069 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
|
4070 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
|
4071 the record text. |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4072 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
|
4073 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4074 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
|
4075 of the record to be showed in a pane. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4076 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4077 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4078 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4079 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4080 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
|
4081 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4082 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4083 _budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4084 _main_box = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4085 _main_box.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4086 _tuni = _("Sheet of Conditions of the record $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4087 _ucode = self.__budget.getCode(self.__active_path_record) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4088 _uni = utils.mapping(_tuni, (_ucode,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4089 self.__label = Gtk.Label(_uni) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4090 self.__label.set_xalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4091 self.__label.set_yalign(0) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4092 self.__label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4093 _frame = Gtk.Frame() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4094 _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
|
4095 _frame_box = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4096 _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
|
4097 _list_box = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4098 _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
|
4099 self.__field_liststore = Gtk.ListStore(str, str) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4100 self.__field_treeview = Gtk.TreeView(self.__field_liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4101 _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
|
4102 _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
|
4103 self.__field_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4104 _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
|
4105 self._field_controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4106 self.__field_treeview.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4107 _fieldcode_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4108 _field_column = Gtk.TreeViewColumn(_("Field")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4109 _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
|
4110 _field_cell = Gtk.CellRendererText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4111 _field_column.pack_end(_field_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4112 _field_column.add_attribute(_fieldcode_cell, "text", 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4113 _field_column.add_attribute(_field_cell, "text", 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4114 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
|
4115 _field_scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4116 _field_scrollwindow.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4117 Gtk.PolicyType(1)) # 1 Automatic |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4118 # widget expand all space |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4119 _field_scrollwindow.set_property("hexpand", True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4120 _field_scrollwindow.add(self.__field_treeview) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4121 _field_scrollwindow.set_size_request(-1, 80) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4122 _field_scrollwindow.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4123 self.__section_liststore = Gtk.ListStore(str, str) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4124 self.__section_treeview = Gtk.TreeView(self.__section_liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4125 _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
|
4126 _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
|
4127 self.__section_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4128 _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
|
4129 self._section_controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4130 self.__section_treeview.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4131 _sectioncode_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4132 _section_column = Gtk.TreeViewColumn(_("Section")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4133 _section_column.pack_start(_sectioncode_cell, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4134 _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
|
4135 _section_cell = Gtk.CellRendererText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4136 _section_column.pack_end(_section_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4137 _section_column.add_attribute(_section_cell, "text", 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4138 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
|
4139 _section_scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4140 _section_scrollwindow.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4141 Gtk.PolicyType(1)) # 1 Automatic |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4142 # widget expand all space |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4143 _section_scrollwindow.set_property("hexpand", True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4144 _section_scrollwindow.set_size_request(-1, 90) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4145 _section_scrollwindow.add(self.__section_treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4146 _section_scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4147 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4148 _list_box.add(_field_scrollwindow) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4149 _list_box.add(_section_scrollwindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4150 _list_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4151 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4152 _scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4153 _scrollwindow.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4154 Gtk.PolicyType(1)) # 1 Automatic |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4155 _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
|
4156 _textview = Gtk.TextView() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4157 _textview.set_wrap_mode(2) # 2 Word |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4158 _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
|
4159 self.__textbuffer = _textview.get_buffer() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4160 _textview.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4161 _hbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4162 _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
|
4163 _hbox.add(_textview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4164 _hbox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4165 _frame_box.add(self.__label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4166 _frame_box.add(_list_box) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4167 _frame_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4168 _frame.add(_frame_box) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4169 _frame.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4170 _main_box.add(_frame) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4171 _vbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4172 _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
|
4173 _vbox.add(_hbox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4174 _vbox.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4175 _main_box.add(_scrollwindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4176 _main_box.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4177 _scrollwindow.add(_vbox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4178 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4179 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
|
4180 self._setFields() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4181 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4182 def _setFields(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4183 """_setFields() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4184 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4185 Set the fields items in the field treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4186 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4187 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4188 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4189 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4190 _field_list = _sheet.getFields() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4191 self.__field_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4192 for _field in _field_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4193 _field_text = self.__budget.getSheetField(_field) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4194 _iter = self.__field_liststore.append([_field, _field_text]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4195 _treeselection = self.__field_treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4196 _treeselection.select_path(0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4197 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4198 def _setSection(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4199 """_setSection() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4200 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4201 Set the section items in the section treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4202 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4203 self.__section_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4204 if not self.__field_selection is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4205 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4206 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4207 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4208 _section_list = _sheet.getSections(self.__field_selection) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4209 for _section in _section_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4210 _section_text = self.__budget.getSheetSection(_section) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4211 _iter = self.__section_liststore.append([_section, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4212 _section_text]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4213 _treeselection = self.__section_treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4214 _treeselection.select_path(0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4215 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4216 def _setText(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4217 """_setText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4218 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4219 Set the text in the textview |
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 if not self.__section_selection is None and\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4222 not self.__field_selection is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4223 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4224 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4225 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4226 _paragraph_code = _sheet.getParagraph(self.__field_selection, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4227 self.__section_selection) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4228 _paragraph = self.__budget.getSheetParagraph(_paragraph_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4229 self.__textbuffer.set_text(_paragraph) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4230 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4231 self.__textbuffer.set_text("") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4232 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4233 def _field_controlSelection(self, selection, model, path, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4234 path_currently_selected, *data): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4235 """_controlSelection(selection, model, path, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4236 path_currently_selected, *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4237 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4238 selection: treeselection |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4239 path: selected path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4240 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4241 Method connected to set_selection_function() in field treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4242 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
|
4243 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4244 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4245 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
|
4246 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4247 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4248 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
|
4249 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
|
4250 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4251 _treeiter = self.__field_liststore.get_iter(path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4252 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
|
4253 self._setSection() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4254 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4255 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4256 def _section_controlSelection(self, selection, model, path, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4257 path_currently_selected, *data): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4258 """_section_controlSelection(selection, model, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4259 path, path_currently_selected, *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4260 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4261 selection: treeselection |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4262 path: selected path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4263 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4264 Method connected to set_selection_function() in sector treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4265 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
|
4266 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4267 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4268 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
|
4269 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4270 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4271 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
|
4272 section in showed |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4273 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4274 _treeiter = self.__section_liststore.get_iter(path) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4275 self.__section_selection = self.__section_liststore.get_value(_treeiter, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4276 0) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4277 self._setText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4278 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4279 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4280 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
|
4281 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4282 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4283 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4284 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4285 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
|
4286 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4287 self.__field_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4288 self.__field_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4289 self.__section_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4290 self.__section_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4291 self.__textbuffer.set_text("") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4292 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4293 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4294 _code = _budget.getCode(self.__active_path_record) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4295 _tuni = _("Sheet2 of Conditions of the record $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4296 _uni = utils.mapping(_tuni, (_code,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4297 self.__label.set_text(_uni) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4298 self._setFields() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4299 |
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
|
4300 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
|
4301 """runMessage(message, pane_path, arg=None) |
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 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4304 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4305 "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
|
4306 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
|
4307 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4308 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4309 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4310 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
|
4311 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4312 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4313 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4314 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
|
4315 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4316 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4317 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4318 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4319 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
|
4320 """_clear() |
1
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 Deletes all the instance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4323 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4324 del self.__wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4325 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
|
4326 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4327 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4328 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4329 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4330 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4331 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4332 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4333 del self.__field_liststore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4334 del self.__field_treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4335 del self.__field_selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4336 del self.__section_liststore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4337 del self.__section_treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4338 del self.__section_selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4339 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4340 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4341 """_getWidget() |
1
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 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4344 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4345 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4346 |
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
|
4347 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
|
4348 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4349 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4350 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
|
4351 """ |
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
|
4352 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
|
4353 |
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
|
4354 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
|
4355 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4356 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4357 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
|
4358 """ |
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
|
4359 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4360 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4361 def _getWrPage(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4362 """_getWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4363 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4364 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4365 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4366 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4367 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4368 def _setWrPage(self, wr_page): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4369 """_setWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4370 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4371 set the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4372 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4373 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4374 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4375 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4376 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4377 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4378 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4379 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4380 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4381 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4382 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4383 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4384 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4385 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4386 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4387 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4388 |
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
|
4389 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4390 "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
|
4391 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4392 "Lista de configuracion de vistas") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4393 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4394 "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
|
4395 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4396 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4397 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4398 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4399 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4400 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4401 class FileView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4402 """gui.FileView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4403 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4404 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4405 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
|
4406 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4407 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
|
4408 budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4409 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
|
4410 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
|
4411 path_record: the path of the active record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4412 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4413 +-- object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4414 +-- FileView |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4415 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4416 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
|
4417 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
|
4418 budget: The budget (base.obra object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4419 active_path_record: Read. |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4420 wr_page: Read-Write. weak reference from Page instance |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4421 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4422 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4423 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4424 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4425 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
|
4426 """__init__(budget, page, pane_path, path_record=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4427 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4428 budget: the budget (base.obra object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4429 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
|
4430 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
|
4431 path_record: the path of the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4432 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4433 self.__budget: the budget (base.obra object) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4434 self.__wr_page: weak reference from Page instance which creates 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
|
4435 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
|
4436 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
|
4437 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
|
4438 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
|
4439 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
|
4440 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4441 Creates an shows the scroledwindow that contain icon files |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4442 of the record to be showed in a pane. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4443 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4444 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4445 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4446 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4447 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
|
4448 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4449 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4450 self.__active_code = budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4451 _budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4452 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4453 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4454 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4455 self.__icon_box = self._getIconBox(_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4456 _scrollwindow = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4457 _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
|
4458 self.__icon_box.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4459 _scrollwindow.add(self.__icon_box) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4460 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4461 self.__widget = _scrollwindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4462 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4463 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
|
4464 """_getIconBox(record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4465 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4466 record: the active record object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4467 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4468 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
|
4469 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4470 _files = record.getFiles() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4471 _flowbox = Gtk.FlowBox() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4472 _flowbox.set_valign(Gtk.Align.START) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4473 _flowbox.set_max_children_per_line(30) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4474 _flowbox.set_selection_mode(Gtk.SelectionMode.NONE) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4475 _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
|
4476 for _file in _files: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4477 _path = os.path.dirname(self.__budget.filename) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4478 _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
|
4479 _box = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4480 _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
|
4481 if os.path.exists(_file_path): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4482 _filetype = utils.getFiletype(_file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4483 _event_box = Gtk.LinkButton() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4484 _file_icon = Gtk.Image() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4485 # "image", "wmf", "dxf", "pdf" , "video", |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4486 # "office-document", "office-presentation", |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4487 # "office-spreadsheet", "html", "rtf", "txt", "" |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4488 # icon |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4489 if _filetype in ["image", "wmf"]: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4490 try: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4491 _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
|
4492 _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
|
4493 GdkPixbuf.InterpType(2)) # 2 BILINEAR |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4494 except: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4495 _image_pixbuf = GdkPixbuf.Pixbuf.new_from_file( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4496 globalVars.getAppPath("IMAGE-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4497 _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
|
4498 GdkPixbuf.InterpType(2)) # 2 BILINEAR |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4499 _file_icon.set_from_pixbuf(_image_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4500 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4501 _filetype, _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4502 elif _filetype == "dxf": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4503 _dxf_pixbuf = GdkPixbuf.Pixbuf.new_from_file( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4504 globalVars.getAppPath("DXF-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4505 _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
|
4506 GdkPixbuf.InterpType(2)) # 2 BILINEAR |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4507 _file_icon.set_from_pixbuf(_dxf_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4508 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4509 "dxf", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4510 elif _filetype == "pdf": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4511 _pdf_pixbuf = GdkPixbuf.Pixbuf.new_from_file( |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4512 globalVars.getAppPath("PDF-ICON")) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4513 _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
|
4514 GdkPixbuf.InterpType(2)) # 2 BILINEAR |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4515 _file_icon.set_from_pixbuf(_pdf_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4516 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4517 "pdf", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4518 elif _filetype == "video": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4519 _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
|
4520 "video-x-generic", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4521 _file_icon.set_from_pixbuf(_video_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4522 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4523 "video", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4524 elif _filetype == "office-document": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4525 _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
|
4526 "x-office-document", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4527 _file_icon.set_from_pixbuf(_document_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4528 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4529 "office-document", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4530 elif _filetype == "office-presentation": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4531 _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
|
4532 "x-office-presentation", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4533 _file_icon.set_from_pixbuf(_presentation_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4534 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4535 "office-presentation", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4536 elif _filetype == "office-spreadsheet": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4537 _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
|
4538 "x-office-spreadsheet", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4539 _file_icon.set_from_pixbuf(_spreadsheet_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4540 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4541 "office-spreadsheet", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4542 elif _filetype == "html": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4543 _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
|
4544 "text-html", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4545 _file_icon.set_from_pixbuf(_html_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4546 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4547 "html", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4548 elif _filetype == "rtf": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4549 _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
|
4550 "text-x-generic", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4551 _file_icon.set_from_pixbuf(_rtf_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4552 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4553 "rtf", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4554 elif _filetype == "txt": |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4555 _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
|
4556 "text-x-generic", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4557 _file_icon.set_from_pixbuf(_txt_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4558 _event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4559 "txt", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4560 else: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4561 _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
|
4562 "image-missing", 64, 0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4563 _file_icon.set_from_pixbuf(_missing_pixbuf) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4564 # Is secure open no detected filetype? |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4565 #_event_box.connect("activate-link", self._launchFile, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4566 # "", _file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4567 _event_box = Gtk.EventBox() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4568 _event_box.add(_file_icon) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4569 _event_box.props.margin = 5 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4570 _box.add(_event_box) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4571 _file_icon.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4572 _event_box.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4573 # label |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4574 _label_event_box = Gtk.EventBox() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4575 _label = Gtk.Label(_file.name) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4576 _label_event_box.add(_label) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4577 _label_event_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4578 _label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4579 _label_event_box.props.margin = 5 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4580 _box.add(_label_event_box) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4581 _box.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4582 _box.props.margin = 5 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4583 _flowbox.add(_box) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4584 _flowbox.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4585 #_scrolled.show() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4586 return _flowbox |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4587 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4588 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
|
4589 """_launchFile(widget, event, kind, file_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4590 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4591 widget: the widget that emit the signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4592 king: kind of file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4593 file_path: the path file to be launch |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4594 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4595 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
|
4596 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
|
4597 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
|
4598 when opening an empty uri. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4599 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4600 openwith.launch_file(kind, file_path) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4601 return True |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4602 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4603 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
|
4604 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4605 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4606 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4607 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
|
4608 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4609 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4610 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4611 _code = _budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4612 _record = self.__budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4613 self.__icon_box.destroy() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4614 self.__icon_box = self._getIconBox(_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4615 self.__icon_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4616 self.__widget.add_with_viewport(self.__icon_box) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4617 |
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
|
4618 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
|
4619 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4620 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4621 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4622 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4623 "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
|
4624 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
|
4625 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4626 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4627 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4628 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
|
4629 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4630 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4631 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4632 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
|
4633 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4634 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4635 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4636 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4637 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
|
4638 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4639 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4640 Delete all instance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4641 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4642 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
|
4643 del self.__pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4644 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4645 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4646 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4647 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4648 """_getWidget() |
1
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 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4651 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4652 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4653 |
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
|
4654 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
|
4655 """_getPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4656 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4657 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
|
4658 """ |
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
|
4659 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
|
4660 |
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 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
|
4662 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4663 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4664 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
|
4665 """ |
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
|
4666 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4667 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4668 def _getWrPage(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4669 """_getWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4670 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4671 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4672 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4673 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4674 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4675 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
|
4676 """setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4677 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4678 set the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4679 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4680 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4681 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4682 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4683 """getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4684 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4685 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4686 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4687 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4688 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4689 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4690 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4691 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4692 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4693 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4694 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4695 |
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
|
4696 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4697 "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
|
4698 widget = property(_getWidget, None, None, |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4699 "The main widget (Gtk.ScrolledWindow)") |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4700 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4701 "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
|
4702 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4703 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4704 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4705 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4706 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4707 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4708 class CompanyView(object): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4709 """gui:CompanyView: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4710 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4711 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4712 Class to show the company records of a budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4713 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4714 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
|
4715 budget: budget showed ("base.Budget" object) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4716 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
|
4717 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
|
4718 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
|
4719 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4720 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4721 +-- CompanyView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4722 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4723 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
|
4724 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
|
4725 pane_path: Read-Write. Pane page identifier |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4726 wr_page: Read-Write. weak reference from Page instance |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4727 budget: Read. Budget to show, base.budget instance. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4728 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4729 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4730 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4731 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4732 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
|
4733 """__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
|
4734 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4735 budget: budget showed ("base.Budget" object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4736 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
|
4737 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
|
4738 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
|
4739 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4740 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
|
4741 self.__budget: budget: budget showed ("base.Budget" object) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4742 self.__wr_page: weak reference from Page 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
|
4743 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
|
4744 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
|
4745 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
|
4746 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
|
4747 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
|
4748 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4749 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
|
4750 """ |
22
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4751 if path_record is None: |
7bd4ca56607d
bug fix: Mutable default arguments
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
4752 path_record = (0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4753 self.__selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4754 # Seting init args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4755 if not isinstance(budget, base.Budget): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4756 _tuni = _("Argument must be a Budget object") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4757 _str = _tuni.encode("utf-8") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4758 raise ValueError(_str) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4759 self.__budget = budget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4760 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
|
4761 self.__pane_path = pane_path |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4762 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
|
4763 # main widget |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4764 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
|
4765 self.__widget.set_position(230) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4766 # TreeStore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4767 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
|
4768 self._setTreeStoreValues() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4769 # Select Treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4770 _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
|
4771 _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
|
4772 _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
|
4773 _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
|
4774 _select_treeview.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4775 # Scrolled_window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4776 _scrolled_window = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4777 _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
|
4778 _scrolled_window.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4779 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
|
4780 _scrolled_window.add(_select_treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4781 # colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4782 _text_color = globalVars.color["TEXT"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4783 _background_color = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4784 globalVars.color["UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4785 globalVars.color["EVEN"]] |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4786 _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
|
4787 _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
|
4788 _code_column.set_fixed_width(200) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4789 _code_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4790 _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
|
4791 _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
|
4792 _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
|
4793 _summary_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4794 _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
|
4795 _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
|
4796 _code_column.add_attribute(_summary_cell, 'text', 1) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4797 # Index column |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4798 _select_treeview.append_column(_code_column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4799 # control selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4800 _treeselection = _select_treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4801 _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
|
4802 _treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4803 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4804 _scrolled_window.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4805 # Option View |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4806 self.__option_View = OptionView() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4807 # Add to main widget |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4808 self.__widget.add1(_scrolled_window) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4809 self.__widget.add2(self.__option_View.widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4810 # Selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4811 _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
|
4812 _select_treeview.grab_focus() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4813 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4814 self.__widget.show() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4815 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4816 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
|
4817 """_setOptions(type) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4818 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4819 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
|
4820 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
|
4821 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4822 if type == "company": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4823 _options = [("code", _("Code"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4824 _("""Code that define the company""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4825 ("summary", _("Summary"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4826 _("""Summary of the company name""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4827 ("name", _("Name"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4828 _("""Complete name""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4829 ("cif", _("CIF"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4830 _("""Fiscal identifier number""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4831 ("web", _("Web"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4832 _("""Company web page""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4833 ("email", _("Email"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4834 _("""Company email""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4835 ] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4836 self.__option_View.options = _options |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4837 elif type == "office": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4838 _options = [("officeType", _("Type"), "string", |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4839 _("""Type of Office: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4840 C: Central office |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4841 D: Local office |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4842 R: Performer""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4843 ("subname", _("Name"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4844 _("Office name")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4845 ("address", _("Address"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4846 ("postal code", _("Postal code"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4847 ("town", _("Town"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4848 ("province", _("Province"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4849 ("country", _("Country"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4850 ("phone", _("Phone"), "list", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4851 _("Phone numbers of the office")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4852 ("fax", _("Fax"), "list", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4853 _("Fax numbers of the office")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4854 ("contact person", _("Contact person"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4855 _("Contact persons in the office")), |
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 self.__option_View.options = _options |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4858 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4859 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
|
4860 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4861 def _setTreeStoreValues(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4862 """_setTreeStoreValues() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4863 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4864 Sets the treestore values from the budget |
1
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 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4867 _company_keys = _budget.getCompanyKeys() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4868 for _company_key in _company_keys: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4869 _company = _budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4870 _values = [_company_key, _company.summary] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4871 _treeiter = self.__treestore.append(None, _values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4872 _offices = _company.offices |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4873 for _office in _offices: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4874 # TODO: Test offices |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4875 _values = [_office.officeType, _office.subname] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4876 self.__treestore.append(_treeiter, _values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4877 |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4878 def _controlSelection(self, selection, model, path, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4879 path_currently_selected, *data): |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4880 """_controlSelection(selection, model, path, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
4881 path_currently_selected, *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4882 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4883 selection: selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4884 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4885 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4886 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
|
4887 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4888 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4889 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
|
4890 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4891 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4892 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
|
4893 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4894 if len(path) == 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4895 # The selection is a company |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4896 _company_key = self.__treestore[path][0] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4897 _company_key = textinp2(_company_key) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4898 _company = self.__budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4899 _selection = "company" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4900 _values = _company.values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4901 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4902 # The selection is a office |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4903 _company_key = self.__treestore[path[:1]][0] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4904 _company_key = textinp2(_company_key) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4905 _company = self.__budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4906 _selection = "office" |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4907 _office = _company.offices[path[1]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4908 _values = _office.values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4909 if not self.__selection == _selection: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4910 self.__selection = _selection |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4911 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
|
4912 self.__option_View.values = _values |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4913 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4914 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4915 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
|
4916 """_showMessageRecord(record_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4917 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4918 record_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4919 Method connected to "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4920 Show the record especified in the "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4921 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4922 self.__active_path_record = record_path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4923 |
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
|
4924 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
|
4925 """runMessage(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4926 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4927 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4928 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4929 "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
|
4930 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
|
4931 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4932 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4933 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4934 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
|
4935 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4936 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4937 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4938 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4939 _path_record = arg |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4940 self._showMessageRecord(_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4941 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4942 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4943 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4944 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4945 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
|
4946 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4947 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4948 column: the Gtk.TreeViewColumn in the treeview |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4949 cell_renderer: a Gtk.CellRenderer |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4950 tree_model: the Gtk.TreeModel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4951 iter: Gtk.TreeIter pointing at the row |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4952 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
|
4953 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4954 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
|
4955 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
|
4956 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
|
4957 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
|
4958 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
|
4959 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
|
4960 current data function. The signature of func is: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4961 -def celldatafunction(column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4962 -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
|
4963 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
|
4964 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
|
4965 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
|
4966 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4967 The method sets cell background color for all columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4968 and text for index and amount columns. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4969 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4970 _row_path = tree_model.get_path(iter) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4971 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4972 if column is self.__index_column: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
4973 cell_renderer.set_property('text', text(_number + 1)) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4974 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
|
4975 'cell-background', lcolor[_number % 2]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4976 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
|
4977 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4978 globalVars.color["ACTIVE"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4979 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4980 cell_renderer.set_property('cell-background', |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4981 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4982 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4983 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
|
4984 """_clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4985 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4986 it deletes the self.__budget value |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4987 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4988 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4989 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4990 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4991 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4992 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
4993 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4994 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4995 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4996 |
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
|
4997 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
|
4998 """_getPanePath() |
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 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
|
5001 """ |
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
|
5002 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
|
5003 |
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
|
5004 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
|
5005 """_setPanePath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5006 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5007 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
|
5008 """ |
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
|
5009 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
|
5010 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5011 def _getWrPage(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5012 """_getWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5013 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5014 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5015 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5016 return self.__wr_page |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5017 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5018 def _setWrPage(self,wr_page): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5019 """_setWrPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5020 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5021 set the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5022 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5023 self.__wr_page = wr_page |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5024 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5025 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5026 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5027 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5028 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5029 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5030 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5031 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5032 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5033 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5034 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5035 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5036 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5037 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5038 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5039 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5040 "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
|
5041 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5042 "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
|
5043 pane_path = property(_getPanePath, _setPanePath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5044 "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
|
5045 wr_page = property(_getWrPage, _setWrPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5046 "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
|
5047 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5048 "Budget object") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5049 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5050 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5051 class OptionView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5052 """gui.OptionView: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5053 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5054 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5055 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
|
5056 and "Type" to show and edit Options |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5057 Constructor: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5058 OptionView() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5059 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5060 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5061 +-- OptionView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5062 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5063 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
|
5064 options: Write |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5065 values: Write |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5066 Methods: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5067 No public Methods |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5068 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5069 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5070 def __init__(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5071 """__init__() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5072 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5073 self.__option_dict: |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5074 {"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
|
5075 "option_description"]} |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5076 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
|
5077 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
|
5078 self.__liststore: Gtk.ListStore |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5079 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
|
5080 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
|
5081 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
|
5082 self.__type_column: type column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5083 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
|
5084 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
|
5085 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5086 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
|
5087 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5088 self.__option_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5089 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
|
5090 self.__option_types = {"boolean" : _("Boolean"), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5091 "integer": _("Integer"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5092 "string": _("Text"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5093 "color" : _("Color"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5094 "list" : _("List")} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5095 # ListStore |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5096 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
|
5097 # Treeview |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5098 self.__treeview = Gtk.TreeView(self.__liststore) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5099 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5100 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5101 self.__treeview.set_headers_clickable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5102 # vbox |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5103 _vbox = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5104 _vbox.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5105 # Scrolled_window |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5106 _scrolled_window = Gtk.ScrolledWindow() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5107 _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
|
5108 _scrolled_window.set_policy(Gtk.PolicyType(1), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5109 Gtk.PolicyType(1)) # 1 Automatic |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5110 _scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5111 _scrolled_window.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5112 _vbox.add(_scrolled_window) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5113 # colors |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5114 _text_color = globalVars.color["TEXT"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5115 _background_color = [ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5116 globalVars.color["UNEVEN"], |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5117 globalVars.color["EVEN"]] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5118 # Option Column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5119 self.__option_column = Gtk.TreeViewColumn() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5120 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
|
5121 self.__option_column.set_fixed_width(150) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5122 self.__option_column.set_resizable(True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5123 _option_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5124 _option_cell.set_property('foreground', _text_color) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5125 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
|
5126 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
|
5127 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5128 self.__option_column.set_title(_("Option name")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5129 self.__option_column.add_attribute(_option_cell, 'text', 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5130 self.__treeview.append_column(self.__option_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5131 # Value Column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5132 self.__value_column = Gtk.TreeViewColumn() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5133 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
|
5134 self.__value_column.set_fixed_width(275) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5135 self.__value_column.set_resizable(True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5136 _value_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5137 _value_cell.set_property('foreground', _text_color) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5138 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
|
5139 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
|
5140 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5141 self.__value_column.set_title(_("Value")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5142 self.__value_column.add_attribute(_value_cell, 'text', 2) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5143 self.__treeview.append_column(self.__value_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5144 # Type Column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5145 self.__type_column = Gtk.TreeViewColumn() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5146 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
|
5147 self.__type_column.set_fixed_width(70) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5148 self.__type_column.set_resizable(True) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5149 _type_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5150 _type_cell.set_property('foreground', _text_color) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5151 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
|
5152 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
|
5153 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5154 self.__type_column.set_title(_("Type")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5155 self.__treeview.append_column(self.__type_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5156 # End Column |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5157 _end_column = Gtk.TreeViewColumn() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5158 _end_column.set_clickable(False) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5159 _end_cell = Gtk.CellRendererText() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5160 _end_cell.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5161 globalVars.color["UNEVEN"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5162 _end_column.pack_start(_end_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5163 self.__treeview.append_column(_end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5164 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5165 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
|
5166 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
|
5167 self._treeviewClickedEvent) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5168 # control selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5169 _treeselection = self.__treeview.get_selection() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5170 _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
|
5171 _treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5172 # labels |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5173 _frame = Gtk.Frame() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
5174 _frame.set_shadow_type(2) # OUT 2 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5175 _vbox2 = Gtk.Grid() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5176 _vbox2.set_orientation(Gtk.Orientation(1)) # 1 Vertical |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5177 _frame.add(_vbox2) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5178 _label = Gtk.Label() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5179 _label.set_xalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5180 _label.set_yalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5181 _label.set_margin_start(12) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5182 _label.set_markup("<b>" + _("Description:") + "</b>") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5183 _label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5184 self.__description_label = Gtk.Label() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5185 self.__description_label.set_xalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5186 self.__description_label.set_yalign(0) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5187 self.__description_label.set_margin_start(24) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5188 self.__description_label.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5189 _vbox2.add(_label) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5190 _vbox2.add(self.__description_label) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5191 _vbox2.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5192 _frame.show() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5193 _vbox.add(_frame) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5194 # Show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5195 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5196 _vbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5197 self.__widget = _vbox |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5198 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5199 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
|
5200 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5201 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5202 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5203 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5204 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5205 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
|
5206 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5207 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
|
5208 Returns :FALSE to propagate the event further. |
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 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
|
5211 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
|
5212 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
|
5213 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5214 (_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
|
5215 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
|
5216 Gdk.keyval_from_name("KP_Right")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5217 and _column == self.__value_column) \ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5218 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
|
5219 Gdk.keyval_from_name("KP_Left")] \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5220 and _column == self.__value_column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5221 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5222 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5223 _description = self.__liststore[_cursor_path][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5224 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5225 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5226 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5227 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
|
5228 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5229 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5230 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5231 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5232 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5233 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
|
5234 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5235 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
|
5236 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5237 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5238 The cursos is moved to value column. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5239 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5240 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
|
5241 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5242 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5243 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5244 _description = self.__liststore[_path_cursor][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5245 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5246 if _column == self.__value_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5247 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5248 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5249 self.__treeview.set_cursor(_path_cursor,self.__value_column, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5250 True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5251 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5252 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5253 return True |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5254 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5255 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
|
5256 *data): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5257 """_controlSelection(selection, model, path, path_currently_selected, |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5258 *data) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5259 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5260 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5261 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5262 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5263 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
|
5264 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5265 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5266 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
|
5267 be left unchanged. |
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 Return False so none row is selected |
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 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5272 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5273 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
|
5274 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5275 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5276 column: the Gtk.TreeViewColumn in the treeview |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5277 cell_renderer: a Gtk.CellRenderer |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5278 tree_model: the Gtk.TreeModel |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5279 iter: Gtk.TreeIter pointing at the row |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5280 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
|
5281 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5282 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
|
5283 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
|
5284 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
|
5285 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
|
5286 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
|
5287 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
|
5288 current data function. The signature of func is: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5289 -def celldatafunction(column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5290 -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
|
5291 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
|
5292 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
|
5293 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
|
5294 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5295 The method sets cell background color for all columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5296 and text for type column. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5297 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5298 _row_path = tree_model.get_path(iter) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5299 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5300 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
|
5301 cell_renderer.set_property('cell-background', |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5302 globalVars.color["ACTIVE"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5303 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5304 cell_renderer.set_property('cell-background', |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5305 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5306 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
|
5307 _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
|
5308 cell_renderer.set_property('text', _type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5309 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5310 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
|
5311 """_setOptions(option_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5312 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5313 option_list: list of tuples |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5314 (option, option name, type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5315 option: option identifier |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5316 option name: a string with the option name |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5317 Description: a string with the option description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5318 type: can be "boolean" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5319 "integer" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5320 "string" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5321 "color" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5322 Sets the Options in the treeview rows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5323 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5324 self.__option_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5325 self.__option_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5326 self.__liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5327 if isinstance(option_list, list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5328 for _option in option_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5329 if isinstance(_option, tuple) and len(_option) == 4: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5330 _option_key = _option[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5331 _option_name = _option[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5332 _option_type = _option[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5333 _option_description = _option[3] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
5334 if isinstance(_option_key, text_type) and \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
5335 isinstance(_option_name, text_type) and \ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5336 _option_type in self.__option_types.keys(): |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5337 self.__liststore.append([_option_key, _option_name, "", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5338 _option_type, _option_description]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5339 self.__option_dict[_option_key] = [_option_name, "", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5340 _option_type, _option_description] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5341 self.__option_list.append(_option_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5342 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5343 print(_("Option values must be strings") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5344 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5345 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
|
5346 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5347 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
|
5348 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5349 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
|
5350 """_setValues(values) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5351 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5352 values: dictionary {option : value} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5353 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5354 Sets the Options values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5355 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5356 if isinstance(values, dict): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
5357 for (_option, _value) in values.items(): |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5358 if _option in self.__option_dict: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5359 _type = self.__option_dict[_option][2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5360 if _type == "boolean": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5361 if isinstance(_value, bool): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5362 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5363 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5364 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5365 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5366 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5367 print(_("Icorrect type, must be boolean") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5368 elif _type == "integer": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5369 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5370 _value = int(_value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5371 except ValueError: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5372 print(_("Icorrect type, must be integer") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5373 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5374 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5375 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5376 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5377 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5378 elif _type == "string": |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
5379 if isinstance(_value, text_type): |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5380 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5381 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5382 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5383 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5384 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5385 print(_("Icorrect type, must be string") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5386 elif _type == "list": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5387 if isinstance(_value, list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5388 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5389 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5390 _str_value = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5391 for _item_value in _value: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5392 _str_value = _str_value + _item_value + "," |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5393 if _str_value[-1] == ",": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5394 _str_value = _str_value[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5395 self.__liststore.set_value(_iter, 2, _str_value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5396 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5397 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5398 print(_("Icorrect type, must be list") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5399 elif _type == "color": |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
5400 if isinstance(_value, text_type): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5401 if Gdk.RGBA().parse(_value): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5402 print(_("Icorrect type, must be a parseable " \ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5403 "color") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5404 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5405 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5406 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5407 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5408 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5409 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5410 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
|
5411 "color") ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5412 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5413 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
|
5414 print(_option, _value) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5415 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5416 print( _("Values must be a dict") ) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5417 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
|
5418 self.__value_column, False) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5419 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5420 (_cursor_path, _column) = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5421 _description = self.__liststore[_cursor_path][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5422 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5423 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5424 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5425 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5426 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5427 return the main widget (Gtk.ScrolledWindow) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5428 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
5429 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
|
5430 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5431 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
|
5432 "main widget") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5433 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
|
5434 "values") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
5435 options = property(None, _setOptions, None, |
11
fe9c55f86698
Improvements in navigation buttons
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
10
diff
changeset
|
5436 "options") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
22
diff
changeset
|
5437 |