Mercurial > pyarq-presupuestos
annotate Gtk/gui.py @ 9:229986217a3d
bug fix: view is not displayed when it splits the view Left/Right
author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
---|---|
date | Wed, 17 Nov 2010 23:59:48 +0100 |
parents | 55df0b15706b |
children | d2cbc0278b30 |
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 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5 ## Copyright (C) 2010 Miguel Ángel Bárcena Rodríguez |
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. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
29 This panes are ordened in gtk.Paned represented for the class Paned which can |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
30 have 2 viewes represented for the View class or other gtk.Paned that have other |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
31 viewes or more gtk.Paned. |
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 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
45 # Standar Modules |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
46 import os |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
47 import time |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
48 import pygtk |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
49 pygtk.require('2.0') |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
50 import gtk |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
51 import gobject |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
52 import weakref |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
53 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
54 # pyArq-Presupuestos Modules |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
55 from Gtk import importFiebdc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
56 from Generic import base |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
57 from Generic import fiebdc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
58 from Generic import durusdatabase |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
59 from Generic import utils |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
60 from Generic import globalVars |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
61 from Generic import openwith |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
62 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
63 # Load default icon |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
64 if os.path.exists(globalVars.getAppPath("ICON")): |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
65 icon = gtk.gdk.pixbuf_new_from_file(globalVars.getAppPath("ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
66 gtk.window_set_default_icon_list(icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
67 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
68 print utils.mapping(_("The icon file does not exist. '$1'"), |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
69 (globalVars.getAppPath("ICON"),)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
70 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
71 # Autodetect desktop |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
72 if globalVars.desktop["autodetect"]: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
73 openwith.autodetect_desktop() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
74 print utils.mapping(_("pyArq-Presupuestos running on $1"), |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
75 (globalVars.desktop["desktop"],)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
76 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
77 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
78 class MainWindow(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
79 """gui.MainWindow: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
80 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
81 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
82 Creates and shows the main window. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
83 This is the interface base class. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
84 Constructor: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
85 gui.MainWindow() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
86 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
87 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
88 +-- MainWindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
89 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
90 notebook: Read. notebook widget |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
91 pageList: Read. page list |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
92 budgetList: Read. budget list |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
93 Methods: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
94 removePage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
95 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
96 # TODO:* Can choose open budget in new window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
97 # TODO:* gtk.Action for menu and toolbar |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
98 # 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
|
99 # TODO: can show basedata notebook in a side pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
100 __ui = '''<ui> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
101 <menubar name="MenuBar"> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
102 <menu action="File"> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
103 <menuitem action="ImportFiebdc"/> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
104 <menuitem action="Close"/> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
105 </menu> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
106 <menu action="View"> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
107 </menu> |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
108 <menu action="Go"> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
109 <menuitem action="GoUp"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
110 <menuitem action="GoDown"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
111 <menuitem action="GoPrevious"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
112 <menuitem action="GoPosterior"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
113 <menuitem action="GoToRoot"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
114 </menu> |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
115 <menu action="Test"> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
116 <menuitem action="ImportFiebdcPriceDatabase"/> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
117 <menuitem action="OpenPriceDatabase"/> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
118 </menu> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
119 </menubar> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
120 <toolbar name="ToolBar"> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
121 <toolitem action="ImportFiebdc"/> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
122 <toolitem action="Close"/> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
123 <separator name="sep1"/> |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
124 <toolitem action="GoUp"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
125 <toolitem action="GoDown"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
126 <toolitem action="GoPrevious"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
127 <toolitem action="GoPosterior"/> |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
128 <toolitem action="GoToRoot"/> |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
129 </toolbar> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
130 </ui>''' |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
131 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
132 def __init__(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
133 """__init__() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
134 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
135 Initialize the atributes "__budget_list" and "__page_list" without data. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
136 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
|
137 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
138 self.__window: gtk.Window object |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
139 self.__budget_temp_list: Temporal list of budgets |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
140 self.__budget_list: List of budgets ("base.Budget" objects) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
141 self.__page_list: List of pages ("Page" object) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
142 self.__notebook: Notebook widget ("gtk.Notebook" object) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
143 self.__general_action_group: "General" action group |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
144 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
145 #TODO: action group for Navigation buttons |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
146 self.__budget_temp_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
147 self.__budget_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
148 self.__page_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
149 # Main window |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
150 self.__window = gtk.Window(gtk.WINDOW_TOPLEVEL) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
151 self.__window.set_default_size(771, 570) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
152 self.__window.set_title("Presupuestos") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
153 self.__window.set_border_width(0) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
154 self.__window.connect("destroy", self._destroy) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
155 self.__window.connect("delete_event", self._delete_event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
156 # Vertical box |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
157 _vbox1 = gtk.VBox(False, 0) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
158 self.__window.add(_vbox1) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
159 _vbox1.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
160 #Uimanager |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
161 _uimanager = gtk.UIManager() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
162 _accelgroup = _uimanager.get_accel_group() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
163 self.__window.add_accel_group(_accelgroup) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
164 _general_action_group = gtk.ActionGroup("General") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
165 self.__general_action_group = _general_action_group |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
166 _general_action_group.add_actions( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
167 [("File", None, _("_File"), None), |
3
a221c14c3c31
translate and clean gui
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
168 ("ImportFiebdc", gtk.STOCK_OPEN, _('_Import Fiebdc'), "", |
a221c14c3c31
translate and clean gui
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
169 _('Import FIEBDC'), self._menuitemImportFiebdc), |
a221c14c3c31
translate and clean gui
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
170 ("Close", gtk.STOCK_CLOSE, _("_Close"), None, _('Close'), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
171 self._menuitemClose), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
172 ("View", None, _("_View")), |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
173 ("Go", None, _("_Go")), |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
174 ("GoUp", gtk.STOCK_GO_UP, _("_Up Record"),"", |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
175 _("Go up record"), self._menuitemGoUp), |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
176 ("GoDown", gtk.STOCK_GO_DOWN, _("_Down Record"),"", |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
177 _("Go down record"), self._menuitemGoDown), |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
178 ("GoPrevious", gtk.STOCK_GO_BACK, _("_Previous Record"),"", |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
179 _("Go Previous record"), self._menuitemGoPrevious), |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
180 ("GoPosterior", gtk.STOCK_GO_FORWARD, _("_Posterior Record"),"", |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
181 _("Go posterior record"), self._menuitemGoPosterior), |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
182 ("GoToRoot", gtk.STOCK_GOTO_TOP, _("_Root"),"", |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
183 _("Go to root"), self._menuitemGoToRoot), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
184 ("Test", None, _("_Test")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
185 ('ImportFiebdcPriceDatabase', gtk.STOCK_OPEN, |
3
a221c14c3c31
translate and clean gui
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
186 _("Import Fiebdc _price database"), "", _("Import database"), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
187 self._menuitemImportPriceDatabase ), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
188 ("OpenPriceDatabase", gtk.STOCK_OPEN, _('_Open price database'), |
3
a221c14c3c31
translate and clean gui
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
189 "", _('Open Database'), self._menuitemOpenPriceDatabase), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
190 ]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
191 _uimanager.insert_action_group(_general_action_group, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
192 _uimanager.add_ui_from_string(self.__ui) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
193 _menu_bar = _uimanager.get_widget("/MenuBar") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
194 _vbox1.pack_start(_menu_bar, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
195 _toolbar = _uimanager.get_widget("/ToolBar") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
196 _toolbar.get_settings().set_long_property("gtk-toolbar-icon-size", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
197 gtk.ICON_SIZE_SMALL_TOOLBAR, "pyArq-Presupuestos:toolbar") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
198 _vbox1.pack_start(_toolbar, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
199 # Notebook |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
200 self.__notebook = gtk.Notebook() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
201 _vbox1.pack_start(self.__notebook, True, True, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
202 self.__notebook.set_tab_pos(gtk.POS_TOP) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
203 self.__notebook.set_show_tabs(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
204 self.__notebook.set_show_border(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
205 self.__notebook.set_scrollable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
206 self.__notebook.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
207 self._main() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
208 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
209 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
|
210 """main() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
211 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
212 Shows window and starts the GTK+ event processing loop. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
213 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
214 self.__window.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
215 gtk.main() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
216 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
217 def _addBudget(self, budget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
218 """_addBudget(budget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
219 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
220 budget: "base.Budget" object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
221 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
222 Appends a budget in the "__budget_list" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
223 """ |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
224 if not budget is None: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
225 _budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
226 if _budget in self.__budget_temp_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
227 self.__budget_temp_list.remove(_budget) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
228 self.__budget_list.append(_budget) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
229 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
230 def _appendPage(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
231 """_appendPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
232 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
233 Creates a new page (instance of "Page class") from the last budget in |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
234 __budget_list, appends this page in the "__page_list" and shows the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
235 page widget in the notebook widget. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
236 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
237 _last_budget = self.__budget_list[-1] |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
238 _page = Page(self, _last_budget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
239 self.__notebook.append_page(_page.widget, _page.title) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
240 self.__page_list.append(_page) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
241 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
242 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
243 def _menuitemImportFiebdc(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
244 """_menuitemImportFiebdc(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
245 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
246 widget: the widget where the event is emitted from |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
247 Callback to open a budget file. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
248 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
249 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
|
250 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
251 _budget = base.Budget() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
252 self.__budget_temp_list.append(_budget) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
253 _budget_file = fiebdc.Read() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
254 _read_method = _budget_file.readFile |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
255 _filename = "file" |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
256 _filetype = "budget" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
257 _exit_method = _budget_file.cancel |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
258 _file_window = importFiebdc.FileSelectionWindow(self, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
259 _read_method, _budget, _filename, _exit_method, _filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
260 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
261 def _menuitemImportPriceDatabase(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
262 """_menuitemImportPriceDatabase(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
263 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
264 widget: the widget where the event is emitted from |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
265 Callback to open a price database file. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
266 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
267 Creates and shows a file selection window to open a price database file. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
268 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
269 _budget = base.Budget() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
270 self.__budget_temp_list.append(_budget) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
271 _budget_file = fiebdc.Read() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
272 _read_method = _budget_file.readFile |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
273 _filename = "file" |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
274 _filetype = "database" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
275 _exit_method = _budget_file.cancel |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
276 _file_window = importFiebdc.FileSelectionWindow(self, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
277 _read_method, _budget, _filename, _exit_method, _filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
278 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
279 def _menuitemOpenPriceDatabase(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
280 """_menuitemOpenPriceDatabase(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
281 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
282 widget: the widget where the event is emitted from |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
283 Callback to open a price database from a durus file. |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
284 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
285 Creates and shows a file selection window to open a durus database |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
286 """ |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
287 _budget = None |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
288 self.__budget_temp_list.append(_budget) |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
289 _budget_file = durusdatabase.Read() |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
290 _read_method = _budget_file.readFile |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
291 _filename = "file" |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
292 _filetype = "durus" |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
293 _exit_method = _budget_file.cancel |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
294 _file_window = importFiebdc.FileSelectionWindow(self, |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
295 _read_method, _budget, _filename, _exit_method, _filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
296 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
297 def _menuitemClose(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
298 """_menuitemClose(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
299 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
300 widget: the widget where the event is emitted from |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
301 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
302 Callback to close a budget file. |
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 _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
|
305 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
|
306 _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
|
307 if isinstance(_page, EmptyPage) and _page.filetype == "durus": |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
308 print _("Cancel reading Durus database has not been implemented.") |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
309 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
310 _page.close() |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
311 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
312 def removePage(self, page_num): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
313 """removePage(page_num) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
314 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
315 page_num: The number Page to be removed |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
316 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
317 Removes a page from notebook and page_list. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
318 Removes the budget from the budget_list if necessary. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
319 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
320 _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
|
321 if isinstance(_page, Page): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
322 #not loading budget |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
323 self.__budget_list.pop(page_num) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
324 self.__page_list.pop(page_num) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
325 _page.clear() |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
326 self.__notebook.remove_page(page_num) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
327 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
328 def _menuitemGoToRoot(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
329 """_menuitemGoToRoot(widget) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
330 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
331 widget: the widget where the event is emitted from |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
332 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
333 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
|
334 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
335 _page_num = self.__notebook.get_current_page() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
336 if _page_num == -1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
337 return |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
338 _page = self.__page_list[_page_num] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
339 if isinstance(_page, Page): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
340 #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
|
341 _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
|
342 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
343 def _menuitemGoUp(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
344 """_menuitemGoUp(widget) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
345 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
346 widget: the widget where the event is emitted from |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
347 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
348 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
|
349 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
350 _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
|
351 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
|
352 _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
|
353 if isinstance(_page, Page): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
354 #not loading budget |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
355 _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
|
356 if len(_active_path) > 1 and _active_path[-1] > 0: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
357 _budget = self.__budget_list[_page_num] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
358 _up_path = _active_path[:-1] + (_active_path[-1] - 1,) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
359 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
|
360 _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
|
361 _up_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
362 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
363 def _menuitemGoDown(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
364 """_menuitemGoToDown(widget) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
365 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
366 widget: the widget where the event is emitted from |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
367 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
368 Callback to go to down record. |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
369 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
370 _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
|
371 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
|
372 _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
|
373 if isinstance(_page, Page): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
374 #not loading budget |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
375 _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
|
376 if len(_active_path) > 1: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
377 _budget = self.__budget_list[_page_num] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
378 _up_path = _active_path[:-1] + (_active_path[-1] + 1,) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
379 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
|
380 _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
|
381 _up_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
382 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
383 def _menuitemGoPrevious(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
384 """_menuitemGoPrevious(widget) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
385 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
386 widget: the widget where the event is emitted from |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
387 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
388 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
|
389 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
390 _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
|
391 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
|
392 _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
|
393 if isinstance(_page, Page): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
394 #not loading budget |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
395 _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
|
396 if _previous_path is not None: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
397 _budget = self.__budget_list[_page_num] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
398 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
|
399 _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
|
400 _previous_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
401 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
402 def _menuitemGoPosterior(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
403 """_menuitemPosterior(widget) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
404 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
405 widget: the widget where the event is emitted from |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
406 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
407 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
|
408 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
409 _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
|
410 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
|
411 _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
|
412 if isinstance(_page, Page): |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
413 #not loading budget |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
414 _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
|
415 if _posterior_path is not None: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
416 _budget = self.__budget_list[_page_num] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
417 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
|
418 _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
|
419 _posterior_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
420 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
421 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
|
422 """_delete_event(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
423 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
424 widget: the widget where the event is emitted from |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
425 event: the "gtk.gdk.Event" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
426 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
427 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
|
428 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
|
429 It Returns True so the signal "destroy" is emitted. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
430 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
431 for _page in self.__page_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
432 _page.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
433 return False # -> destroy |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
434 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
435 def _destroy(self, widget): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
436 """_destroy(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
437 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
438 widget: the widget where the event is emitted from |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
439 Method connected to "destroy" signal of main window widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
440 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
441 This signal is emited when the method connected to "delete_event" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
442 signal returns True or when the program call the destroy() method of |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
443 the gtk.Window widget. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
444 The window is closed and the GTK+ event processing loop is ended. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
445 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
446 gtk.main_quit() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
447 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
448 def _getNotebook(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
449 """_getNotebook() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
450 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
451 Return the notebook widget |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
452 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
453 return self.__notebook |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
454 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
455 def _getPageList(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
456 """_getPageList() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
457 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
458 Return the page list |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
459 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
460 return self.__page_list |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
461 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
462 def _getBudgetList(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
463 """_getBudgetList() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
464 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
465 Return the budget list |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
466 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
467 return self.__budget_list |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
468 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
469 notebook = property(_getNotebook, None, None, |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
470 "notebook object") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
471 pageList = property(_getPageList, None, None, |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
472 "Page list") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
473 budgetList = property(_getBudgetList, None, None, |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
474 "Budget list") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
475 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
476 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
477 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
|
478 """gui.EmptyPage: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
479 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
480 Description: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
481 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
|
482 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
|
483 Constructor: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
484 gui.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
|
485 cancelMethod, filetype): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
486 mainWindow: gui.Mainwindow object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
487 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
|
488 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
|
489 filename: "file" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
490 cancelMethod: Method to cancel the read method |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
491 filetype: "budget", "database" or "durus" |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
492 Ancestry: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
493 +-- object |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
494 +-- EmptyPage |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
495 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
496 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
|
497 title: Read. Page Title |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
498 filetype: Read. budget, basedata or durus |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
499 Methods: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
500 run |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
501 progress |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
502 stopLoading |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
503 threadFinishedSignal |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
504 threadCanceled |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
505 close |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
506 clear |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
507 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
508 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
509 def __init__(self, mainWindow, readFileMethod, budget, filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
510 cancelMethod, filetype): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
511 """__init__(mainWindow, readFileMethod, budget, filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
512 cancelMethod, filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
513 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
514 mainWindow: gui.Mainwindow object |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
515 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
|
516 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
|
517 filename: "file" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
518 cancelMethod: Method to cancel the read method |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
519 filetype: "budget", "database" or "durus" |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
520 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
521 self.__mainWindow: gui.Mainwindow object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
522 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
|
523 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
|
524 self.__filename: "file" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
525 self.__cancelMethod: Method to cancel the read method |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
526 self.__filetype: "budget", "database" or "durus" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
527 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
|
528 self.__progress: 0 to 1 progress |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
529 self.__widget: main widget, a gtk.VBox object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
530 self.__main_item: None |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
531 self.__throbber: a gtk.Image |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
532 self.__animationThobber: a gtk.gdk.PixbufAnimation |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
533 self.__quietThobber: a pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
534 self.__budget_icon: a gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
535 self.__title: a gtk.HBox |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
536 self.__statusbar: a gtk.Statusbar |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
537 self.__statuscontext: the statusbar context |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
538 self.__progress_bar: a gtk.ProgressBar |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
539 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
540 self.__mainWindow = mainWindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
541 self.__readFileMethod = readFileMethod |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
542 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
543 self.__filename = filename |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
544 self.__filetype = filetype |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
545 self.__cancelMethod = cancelMethod |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
546 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
547 self.__cancel = [False, False] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
548 self.__progress = 0.0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
549 self.__widget = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
550 self.__main_item = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
551 self.__widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
552 self.__throbber = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
553 self.__throbber.set_from_file(globalVars.getAppPath("THROBBER-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
554 self.__throbber.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
555 self.__animationThobber = gtk.gdk.PixbufAnimation( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
556 globalVars.getAppPath("THROBBER-GIF")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
557 self.__quietThobber = self.__throbber.get_pixbuf() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
558 self.__budget_icon = gtk.gdk.pixbuf_new_from_file_at_size( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
559 globalVars.getAppPath("BUDGET-ICON"), 16, 16) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
560 _filename = os.path.basename(filename) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
561 _rootfilename = os.path.splitext(_filename)[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
562 if not _rootfilename == "": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
563 _filename = _rootfilename |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
564 _titleLabel = gtk.Label(_filename) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
565 _titleLabel.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
566 self.__title = gtk.HBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
567 self.__title.add(self.__throbber) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
568 self.__title.add(_titleLabel) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
569 self.__statusbar = gtk.Statusbar() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
570 self.__statuscontext = self.__statusbar.get_context_id("Statusbar") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
571 self.__statusbar.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
572 _align = gtk.Alignment(0.5, 0.5, 0, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
573 _iconVbox = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
574 _pyArqIcon = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
575 _pyArqIcon.set_from_file(globalVars.getAppPath("PYARQ-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
576 _pyArqIcon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
577 _iconVbox.pack_start(_pyArqIcon, True, True, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
578 _link = gtk.LinkButton("http://pyarq.obraencurso.es", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
579 "http://pyarq.obraencurso.es") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
580 _iconVbox.pack_start(_link, True, True, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
581 _link.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
582 _iconVbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
583 _align.add(_iconVbox) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
584 _align.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
585 self.__widget.pack_start(_align, True, True, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
586 _progressframe = gtk.Frame() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
587 _progressframe.set_shadow_type(gtk.SHADOW_IN) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
588 _progressframe.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
589 self.__progress_bar = gtk.ProgressBar() |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
590 if self.__filetype != "durus": |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
591 self.__progress_bar.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
592 _progressframe.add(self.__progress_bar) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
593 self.__statusbar.pack_start(_progressframe, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
594 self.__widget.pack_end(self.__statusbar, False, True, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
595 self.__main_item = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
596 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
597 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
|
598 """run() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
599 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
600 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
|
601 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
602 self.__statusbar.push(self.__statuscontext, _("Time: 0s")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
603 self.__throbber.set_from_animation(self.__animationThobber) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
604 self._launchChildren() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
605 self._launchTimeout() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
606 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
607 def progress(self, percent): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
608 """progress(percent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
609 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
610 percent: Percentage executed. |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
611 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
612 Sets progress |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
613 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
614 _progress = str(int(round(100 * percent,0))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
615 self.__progress = percent |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
616 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
617 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
|
618 """stopLoading() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
619 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
620 Stop progressbar |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
621 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
622 self.__throbber.set_from_pixbuf(self.__budget_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
623 self.__progress_bar.hide() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
624 self.__statusbar.pop(self.__statuscontext) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
625 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
626 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
|
627 """_launchChildren() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
628 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
629 Launch the thread to read the file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
630 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
631 if self.__children is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
632 self.__children = importFiebdc.Thread(self, self.__mainWindow, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
633 self.__readFileMethod, self.__budget, self.__filename, |
4
4e976a99efb9
update ImportPriceDatabase
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
3
diff
changeset
|
634 self.__cancelMethod, self.__filetype) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
635 self.__children.start() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
636 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
637 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
|
638 """_launchTimeout() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
639 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
640 Launch the timeouts: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
641 1- update progress bar |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
642 2- update time label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
643 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
|
644 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
645 gobject.timeout_add(1000, self._updateLabel, time.time()) |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
646 if self.__filetype != "durus": |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
647 gobject.timeout_add(500, self._updateProgressBar) |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
648 self.__cancel = [False, False] |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
649 else: |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
650 self.__cancel = [True, False] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
651 gobject.timeout_add(1000, self._autoClose) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
652 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
653 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
|
654 """_updateProgressBar() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
655 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
656 update progress bar in a timeout |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
657 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
|
658 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
659 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
|
660 self.__cancel[0] = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
661 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
662 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
663 self.__progress_bar.set_fraction(self.__progress) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
664 _text = "%s%%" %str(int(round(100 * self.__progress,0))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
665 self.__progress_bar.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
666 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
667 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
668 def _updateLabel(self, _time): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
669 """_updateProgressBar(_time) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
670 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
671 update time label in a timeout |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
672 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
|
673 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
674 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
|
675 self.__cancel[1] = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
676 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
677 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
678 _time = time.time() - _time |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
679 _text = utils.mapping(_("Time: $1"), ("%.0f" %_time,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
680 self.__statusbar.pop(self.__statuscontext) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
681 self.__statusbar.push(self.__statuscontext, _text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
682 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
683 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
684 def _autoClose(self): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
685 """_updateProgressBar() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
686 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
687 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
|
688 closed and ist tiemeout is stoped |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
689 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
690 if self.__cancel == [ True, True ]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
691 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
692 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
693 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
694 |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
695 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
|
696 """threadFinishedSignal(budget) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
697 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
698 Sets the self.__children to None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
699 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
|
700 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
|
701 """ |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
702 self.__budget = budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
703 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
704 self.stopLoading() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
705 _page = Page(self.__mainWindow, self.__budget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
706 _children = self.__widget.get_children() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
707 for _child in _children: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
708 self.__widget.remove(_child) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
709 self.__widget.pack_start(_page.widget, True, True, 0) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
710 _noteBook = self.__mainWindow.notebook |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
711 _pageIndex = _noteBook.page_num(self.__widget) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
712 self.__mainWindow.pageList[_pageIndex] = _page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
713 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
714 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
|
715 """threadCanceled() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
716 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
717 Sets the __children atribute to None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
718 This causes that the timeouts is ended. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
719 This method is called from thread when is canceled |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
720 TODO: it must called threadFinished or somethig |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
721 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
722 self.__children = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
723 self.stopLoading() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
724 _page_num = self.__mainWindow.notebook.page_num(self.widget) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
725 self.__mainWindow.removePage(_page_num) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
726 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
727 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
|
728 """close() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
729 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
730 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
|
731 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
732 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
|
733 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
734 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
|
735 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
736 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
737 clear vars |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
738 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
739 pass |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
740 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
741 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
742 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
743 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
744 Return de main widget to show in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
745 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
746 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
747 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
748 def _getTitle(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
749 """_getTitle() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
750 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
751 Return the title of the page, a gtk.Label objetc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
752 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
753 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
|
754 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
755 def _getFiletype(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
756 """_getFiletipe() |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
757 |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
758 Return the title of the page, a gtk.Label objetc |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
759 """ |
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
760 return self.__filetype |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
761 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
762 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
763 "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
|
764 title = property(_getTitle, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
765 "Page Title") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
766 filetype = property(_getFiletype, None, None, |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
4
diff
changeset
|
767 "Filetype: budget, basedata or durus") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
768 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
769 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
770 class Page(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
771 """gui.Page: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
772 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
773 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
774 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
|
775 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
|
776 according to "panes_list" information. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
777 Constructor: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
778 gui.Page(mainWindow, budget, active_code=None) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
779 mainwindow: MainWindow object |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
780 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
|
781 active_code: Active record code |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
782 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
783 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
784 +-- Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
785 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
786 widget: Read. Notebook page Widget. (a gtk.VBox instance) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
787 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
|
788 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
|
789 ej: [ "v", pane1, pane2 ] , [ "h", pane1, pane2 ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
790 [ "v", [ "h", pane1, pane2 ], [ "h", pane1, pane2 ] ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
791 pane types: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
792 * "DecompositionList": its creates a "DecompositionList" object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
793 * "RecordDescription" : its creates a "Description" objetc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
794 * "Measure": its creates a "Measure" objetc |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
795 * "FileView": its creates a "FileView" objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
796 * "CompanyView": its creates a "CompanyView" object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
797 title: Read. Notebook page title (gtk.Label object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
798 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
|
799 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
|
800 posteriorPathRecord Read. The posterior path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
801 Methods: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
802 propagateMessageFrom |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
803 sendMessageTo |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
804 close |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
805 clear |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
806 getItem |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
807 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
808 # 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
|
809 # TODO: * Panes in windows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
810 # TODO: * pane types |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
811 # TODO: * General budget properties (is better a dialog?) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
812 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
813 def __init__(self, mainWindow, budget, path_record=(0,)): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
814 """__init__(mainWindow, budget, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
815 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
816 mainWindow: MainWindow object |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
817 budget: "base.Budget" object |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
818 path_record: the active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
819 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
820 #TODO: __panes_list should come from config file... |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
821 self.__mainWindow = mainWindow |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
822 self.__widget = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
823 self.__panes_list = [ "v", "DecompositionList", [ "v", "Measure", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
824 "RecordDescription" ]] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
825 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
|
826 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
|
827 self.__history_back = [] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
828 self.__history_forward = [] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
829 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
|
830 self._setActivePathRecord(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
831 self.__widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
832 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
833 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
|
834 """propagateMessageFrom(message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
835 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
836 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
|
837 * "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
|
838 * "autoclose" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
839 * "split h" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
840 * "split v" |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
841 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
|
842 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
843 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
|
844 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
845 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
|
846 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
847 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
848 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
|
849 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
|
850 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
851 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
|
852 self._closeItem(pane_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
853 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
|
854 self._splitItem(pane_path, "h") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
855 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
|
856 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
|
857 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
858 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
|
859 """sendMessageTo(pane, message, pane_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
860 pane: the receiver pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
861 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
|
862 pane_path: tuple that represents the pane pane_path which emits the message |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
863 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
864 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
865 Sends a message to a pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
866 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
867 if not pane.path == pane_path: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
868 pane.runMessage(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
|
869 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
870 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
|
871 """close() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
872 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
873 Close Page |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
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 _page_list = self.__mainWindow.pageList |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
876 if self in _page_list: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
877 _page_num = _page_list.index(self) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
878 self.__mainWindow.removePage(_page_num) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
879 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
880 raise IndexError, _("The page is not in the page list") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
881 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
882 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
|
883 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
884 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
885 Clear atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
886 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
887 self.propagateMessageFrom("clear", (0,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
888 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
889 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
890 del self.__panes_list |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
891 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
892 del self.__title |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
893 del self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
894 del self.__main_item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
895 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
896 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
|
897 """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
|
898 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
899 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
|
900 instance or a View instance |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
901 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
902 _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
|
903 if len(pane_path) == 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
904 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
905 else: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
906 return _item.getItem(pane_path[1:]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
907 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
908 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
|
909 """_setMainItem(item) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
910 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
911 Sets a new main item in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
912 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
913 if not self.__main_item is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
914 _old_main_widget = self.__main_item.widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
915 self.__widget.remove(_old_main_widget) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
916 self.__main_item = item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
917 _main_widget = self.__main_item.widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
918 _main_widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
919 self.__widget.pack_start(_main_widget, True, True, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
920 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
921 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
|
922 """_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
|
923 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
924 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
|
925 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
926 _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
|
927 _parent = self.getItem(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
|
928 _item.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
|
929 _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
|
930 _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
|
931 _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
|
932 if len(pane_path) > 1: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
933 _parent.setItem(pane_path[-1], [_paned]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
934 else: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
935 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
|
936 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
937 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
|
938 """_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
|
939 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
940 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
|
941 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
942 _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
|
943 if len(pane_path) > 1: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
944 # 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
|
945 _parent = self.getItem(pane_path[:-1]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
946 _brothers = [ _brother for _brother in _parent] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
947 _brothers.remove(_item) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
948 _brother = _brothers[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
949 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
950 _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
|
951 _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
|
952 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
|
953 _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
|
954 _grandparent.setItem(pane_path[-2], [_brother]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
955 _parent.widget.destroy() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
956 _parent.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
957 _item.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
958 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
959 _grandparent = self |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
960 _grandparent._setMainItem(_brother) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
961 _parent.widget.destroy() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
962 _parent.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
963 _item.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
964 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
965 # 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
|
966 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
967 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
968 def _itemsFactory(self, list_paned, pane_path=(0,)): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
969 """_itemsFactory(list_paned, pane_path(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
970 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
971 list_paned: list in "__panes_list" format |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
972 [ "v" or "h", panel1_type, panel2_type] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
973 which contains the info for create the widgets. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
974 panel types: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
975 * "DecompositionList" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
976 * "RecordDescription" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
977 * "Measure" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
978 * "Sheet of Conditions" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
979 * "FileView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
980 * "CompanyView" |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
981 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
|
982 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
983 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
|
984 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
985 if not isinstance(list_paned , list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
986 raise ValueError, _("The value must be a list") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
987 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
|
988 if len(list_paned) != 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
989 raise ValueError, _("Incorrect len") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
990 if not isinstance(list_paned[1],list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
991 list_paned[1] = [list_paned[1]] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
992 if not isinstance(list_paned[2],list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
993 list_paned[2] = [list_paned[2]] |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
994 _item1 = self._itemsFactory(list_paned[1],pane_path + (0,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
995 _item2 = self._itemsFactory(list_paned[2],pane_path + (1,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
996 _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
|
997 elif list_paned[0] == "DecompositionList": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
998 _item = View( "DecompositionList", self.__budget, |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
999 weakref.ref(self), pane_path, self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1000 elif list_paned[0] == "RecordDescription": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1001 _item = View( "RecordDescription", self.__budget,weakref.ref(self), |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1002 pane_path, self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1003 elif list_paned[0] == "Measure": |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1004 _item = View( "Measure", self.__budget, weakref.ref(self), pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1005 self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1006 elif list_paned[0] == "Sheet of Conditions": |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1007 _item = Sheet(sef.__budget, weakref.ref(self), pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1008 self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1009 elif list_paned[0] == "FileView": |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1010 _item = FileView(sef.__budget, weakref.ref(self), pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1011 self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1012 elif list_paned[0] == "CompanyView": |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1013 _item = CompanyView(sef.__budget, weakref.ref(self), pane_path, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1014 self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1015 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1016 _item = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1017 raise ValueError, utils.mapping(_("Incorrect item $1"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1018 (str(list_paned[0]),)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1019 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1020 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1021 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
|
1022 """_setActivePathRecord(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1023 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1024 path_record: the active record path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1025 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1026 Sets the active record path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1027 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1028 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
|
1029 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
|
1030 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
|
1031 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
|
1032 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1033 raise ValueError, utils.mapping(_("The budget does not have "\ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1034 "the path record: $1"), (str(path_record),)) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1035 |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1036 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
|
1037 """_appendHistory(path)) |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1038 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1039 path: the old active path record |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1040 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1041 Sets the old active path record |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1042 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1043 if len(self.__history_back) > 1 and self.__history_back[-2] == path: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1044 # append forward history and pop back history |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1045 _path = self.__history_back.pop() |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1046 self.__history_forward.append(_path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1047 if len(self.__history_forward) > 1000: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1048 self.__history_forward.pop(0) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1049 else: |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1050 # append back history and pop or delete forward history |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1051 if len(self.__history_forward) > 1 and \ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1052 self.__history_forward[-1] == path: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1053 self.__history_forward.pop() |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1054 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1055 self.__history_forward[:] = [] |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1056 self.__history_back.append(path) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1057 if len(self.__history_back) > 1000: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1058 self.__history_back.pop(0) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1059 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1060 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1061 """_getActivePathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1062 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1063 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
|
1064 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1065 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
|
1066 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1067 def _getPreviousPathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1068 """_getPreviousPathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1069 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1070 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
|
1071 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1072 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
|
1073 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
|
1074 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1075 return None |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1076 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1077 def _getPosteriorPathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1078 """_getPosteriorPathRecord() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1079 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1080 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
|
1081 """ |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1082 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
|
1083 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
|
1084 else: |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1085 return None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1086 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1087 def _getTitle(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1088 """_getTitle() |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1089 |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1090 Return the page title, a gtk.Label objetc |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1091 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1092 return self.__title |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1093 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1094 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1095 """_getWidget() |
1
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 Return de main widget to show in the pane |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1098 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1099 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1100 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1101 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
|
1102 """_setBudget(budget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1103 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1104 budget: a base.Budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1105 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1106 Sets the budget and the active code atributes, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1107 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
|
1108 shows the main widget. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1109 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1110 if budget is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1111 self.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1112 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1113 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
|
1114 self._setActivePathRecord((0,)) |
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
1115 # Todo: change page title |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1116 self.__title = gtk.Label(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1117 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1118 _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
|
1119 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
|
1120 _main_widget = self.__main_item.widget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1121 _main_widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1122 self.__widget.pack_start(_main_widget, True, True, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1123 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1124 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1125 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1126 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1127 Return de budget, a "base.Budget" object. |
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 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1130 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1131 def _getPanesList(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1132 """_getPanesList() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1133 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1134 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
|
1135 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1136 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
|
1137 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1138 budget = property(_getBudget, _setBudget, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1139 "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
|
1140 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1141 "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
|
1142 title = property(_getTitle, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1143 "Page Title") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1144 panes_list = property(_getPanesList, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1145 "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
|
1146 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
|
1147 "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
|
1148 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
|
1149 "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
|
1150 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
|
1151 "Posterior Active Path Record") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1152 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1153 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1154 class View(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1155 """gui.View: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1156 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1157 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1158 It creates a view to show the budget info |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1159 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1160 View(view_type, budget, wr_page, path, 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
|
1161 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
|
1162 * DecompositionList |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1163 * Description |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1164 * Measure |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1165 * Sheet |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1166 * FileView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1167 * CompanyView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1168 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
|
1169 wr_page: weak reference to the page where the view must be showed |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1170 path: the position or path of the view in the page notebook |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1171 active_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
|
1172 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1173 +-- object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1174 +-- View |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1175 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1176 path: Read-Write. The tuple that identifies the view in the main |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1177 notebook page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1178 widget: Read. the main gtk widget to show in a view object, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1179 a gtk.VBox object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1180 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1181 getItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1182 propagateMessgeFrom |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1183 runMessage |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1184 getClone |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1185 clear |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1186 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1187 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1188 def __init__(self, view_type, budget, wr_page, path, 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
|
1189 """__init__(view_type, budget, wr_page, path, active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1190 view_type: the object type to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1191 * DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1192 * Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1193 * Measure |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1194 * Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1195 * FileView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1196 * CompanyView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1197 budget: the budget to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1198 wr_page: weak reference to the page where the view must be showed |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1199 path: the position or path of the view in the page notebook |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1200 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
|
1201 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1202 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
|
1203 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
|
1204 * DecompositionList |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1205 * Description |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1206 * Measure |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1207 * Sheet of conditions |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1208 * FileView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1209 * CompanyView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1210 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
|
1211 showed |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1212 self.__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
|
1213 self.__path: the position or path of the view in the page notebook |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1214 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
|
1215 and receives signals from/to others views |
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
|
1216 self.__widget: main widget. a gtk.VBox |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1217 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
|
1218 * DecompositionList object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1219 * Description object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1220 * Measure object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1221 * Sheet object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1222 * FileView object |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1223 * Comapany View |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1224 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
|
1225 False |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1226 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1227 Creates and shows a new view |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1228 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1229 self.__active_path_record = active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1230 self.__view_type = view_type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1231 self.__wr_page = wr_page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1232 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1233 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1234 self.__connected = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1235 # view_type liststore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1236 _liststore = gtk.ListStore(str) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1237 _liststore.append([_("Decomposition")]) #0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1238 _liststore.append([_("Description")]) #1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1239 _liststore.append([_("Measure")]) #2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1240 _liststore.append([_("Sheet of Conditions")]) #3 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1241 _liststore.append([_("Files")]) #4 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1242 _liststore.append([_("Companies")]) #5 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1243 _combobox = gtk.ComboBox(_liststore) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1244 _cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1245 _combobox.pack_start(_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1246 _combobox.add_attribute(_cell, 'text', 0) |
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
|
1247 self.__widget = gtk.VBox() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1248 _hbox = gtk.HBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1249 if view_type == "DecompositionList": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1250 self.__view = DecompositionList(budget, weakref.ref(self), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1251 path, active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1252 _combobox.set_active(0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1253 _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
|
1254 _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
|
1255 "DECOMPOSITION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1256 elif view_type == "RecordDescription": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1257 self.__view = Description(budget, weakref.ref(self), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1258 path, active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1259 _combobox.set_active(1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1260 _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
|
1261 _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
|
1262 "DESCRIPTION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1263 elif view_type == "Measure": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1264 self.__view = Measure(budget, weakref.ref(self), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1265 path, active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1266 _combobox.set_active(2) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1267 _view_icon = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1268 _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
|
1269 elif view_type == "Sheet of Conditions": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1270 self.__view = Sheet(budget, weakref.ref(self), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1271 path, active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1272 _combobox.set_active(3) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1273 _view_icon = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1274 _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
|
1275 elif view_type == "FileView": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1276 self.__view = FileView(budget, weakref.ref(self), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1277 path, active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1278 _combobox.set_active(4) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1279 _view_icon = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1280 _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
|
1281 elif view_type == "CompanyView": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1282 self.__view = CompanyView(budget, weakref.ref(self), path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1283 active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1284 _combobox.set_active(5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1285 _view_icon = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1286 _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
|
1287 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1288 raise ValueError, _(utils.mapping("Invalid type of View: $1", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1289 view_type)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1290 _view_icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1291 _combobox.connect("changed", self._change_combo) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1292 _combobox.show() |
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
|
1293 self.__widget.pack_start(_hbox,False) |
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
|
1294 self.__widget.pack_start(self.__view.widget, True, True) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1295 _hbox.pack_start(_view_icon, False, False,0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1296 _hbox.pack_start(_combobox, False, False,0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1297 _invisible = gtk.HBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1298 _invisible.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1299 _hbox.pack_start(_invisible, True, False,0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1300 _icon_menu = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1301 _icon_menu.set_from_file(globalVars.getAppPath("MENU-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1302 _icon_menu.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1303 _menu_button = gtk.ToolButton() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1304 _menu_button.set_icon_widget(_icon_menu) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1305 _menu_button.connect("clicked", self._menu_view) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1306 _menu_button.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1307 _icon_connected = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1308 _icon_connected.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1309 _icon_connected.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1310 _hbox.pack_start(_menu_button, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1311 self.__connected_button = gtk.ToolButton() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1312 self.__connected_button.set_icon_widget(_icon_connected) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1313 self.__connected_button.connect("clicked", self._connected) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1314 self.__connected_button.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1315 _hbox.pack_start(self.__connected_button, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1316 _icon_close = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1317 _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
|
1318 _icon_close.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1319 _close_button = gtk.ToolButton() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1320 _close_button.set_icon_widget(_icon_close) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1321 _close_button.connect("clicked", self._closeItem) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1322 _close_button.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1323 _hbox.pack_start(_close_button, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1324 _hbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1325 self.__widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1326 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1327 def getItem(self, path): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1328 """getItem(path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1329 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1330 Return itself. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1331 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1332 return self |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1333 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1334 def _closeItem(self, close_button): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1335 """_closeItem(close_button) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1336 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1337 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
|
1338 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
|
1339 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1340 self.propagateMessageFrom("autoclose", self.__path) |
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 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
|
1343 """_change_combo(combobox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1344 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1345 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
|
1346 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
|
1347 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1348 _index = combobox.get_active() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1349 _budget = self.__view.budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1350 _wr_page = self.__view.page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1351 _path = self.__view.path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1352 _path_record = self.__view.active_path_record |
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
|
1353 _hbox = self.__widget.get_children()[0] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1354 _combobox = _hbox.get_children()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1355 _hbox.remove(_combobox) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1356 _invisible = _hbox.get_children()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1357 _hbox.remove(_invisible) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1358 _menu_button = _hbox.get_children()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1359 _hbox.remove(_menu_button) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1360 _connected_button = _hbox.get_children()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1361 _hbox.remove(_connected_button) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1362 _close_button = _hbox.get_children()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1363 _hbox.remove(_close_button) |
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
|
1364 self.__widget.remove(self.__view.widget) |
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
|
1365 self.__widget.remove(_hbox) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1366 _hbox.destroy() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1367 _view_icon = gtk.Image() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1368 if _index == 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1369 self.__view = DecompositionList(_budget, _wr_page, _path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1370 _path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1371 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1372 _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
|
1373 "DECOMPOSITION-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1374 self.__view_type = "DecompositionList" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1375 elif _index == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1376 self.__view = Description(_budget, _wr_page, _path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1377 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1378 _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
|
1379 self.__view_type = "RecordDescription" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1380 elif _index == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1381 self.__view = Measure(_budget, _wr_page, _path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1382 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1383 _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
|
1384 self.__view_type = "Measure" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1385 elif _index == 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1386 self.__view = Sheet(_budget, _wr_page, _path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1387 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1388 _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
|
1389 self.__view_type = "Sheet of Conditions" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1390 elif _index == 4: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1391 self.__view = FileView(_budget, _wr_page, _path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1392 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1393 _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
|
1394 self.__view_type = "FileView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1395 elif _index == 5: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1396 self.__view = CompanyView(_budget, _wr_page, _path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1397 _path_record) |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1398 _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
|
1399 self.__view_type = "CompanyView" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1400 _view_icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1401 _hbox = gtk.HBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1402 _hbox.pack_start(_view_icon, False, False,0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1403 _hbox.pack_start(_combobox, False, False,0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1404 _hbox.pack_start(_invisible, True, False,0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1405 _hbox.pack_start(_menu_button, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1406 _hbox.pack_start(_connected_button, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1407 _hbox.pack_start(_close_button, False, False, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1408 _hbox.show() |
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
|
1409 self.__widget.pack_start(_hbox, False, False, 0) |
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
|
1410 self.__widget.pack_start(self.__view.widget, True, True, 0) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1411 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1412 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
|
1413 """_menu_view(widget) |
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 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
|
1416 It shows a popup menu with some options |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1417 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1418 _menu_view = gtk.Menu() |
3
a221c14c3c31
translate and clean gui
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
1419 _item_leftright = gtk.MenuItem(_("Split View Left/Right")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1420 _menu_view.append(_item_leftright) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1421 _item_leftright.connect_object("activate", self._split_view, "h") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1422 _item_leftright.show() |
3
a221c14c3c31
translate and clean gui
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
1423 _item_topbottom = gtk.MenuItem(_("Split View Top/Bottom")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1424 _menu_view.append(_item_topbottom) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1425 _item_topbottom.connect_object("activate", self._split_view, "v") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1426 _item_topbottom.show() |
3
a221c14c3c31
translate and clean gui
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
1427 _item_close = gtk.MenuItem(_("Close view")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1428 _menu_view.append(_item_close) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1429 _item_close.connect_object("activate", self._closeItem, None) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1430 _item_close.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1431 _menu_view.popup(None, None, None, 0, 0) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1432 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1433 def _split_view(self, orientation): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1434 """_menu_view(orientation) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1435 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1436 orientation: orientation split, "h" or "v" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1437 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1438 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
|
1439 _item_topbottom menu items. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1440 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
|
1441 specified orientation |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1442 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1443 self.propagateMessageFrom( "split " + orientation, self.__path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1444 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1445 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
|
1446 """_connected(widget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1447 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1448 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
|
1449 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
|
1450 _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
|
1451 to/from others views |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1452 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1453 if self.__connected: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1454 _icon = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1455 _icon.set_from_file(globalVars.getAppPath("DISCONNECTED-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1456 _icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1457 self.__connected_button.set_icon_widget(_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1458 self.__connected = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1459 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1460 _icon = gtk.Image() |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1461 _icon.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1462 _icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1463 self.__connected_button.set_icon_widget(_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1464 self.__connected = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1465 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1466 def propagateMessageFrom(self, message, 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
|
1467 """propagateMessageFrom(message, path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1468 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1469 message: string message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1470 path: tuple that represents the pane path which emits the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1471 arg: arguments for the message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1472 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
|
1473 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1474 if self.__connected or message == "autoclose" or \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1475 message == "split h" or message == "split v": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1476 self.__wr_page().propagateMessageFrom(message, path, arg) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1477 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1478 def runMessage(self, message, 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
|
1479 """runMessage(message, path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1480 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1481 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1482 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1483 "clear": clear instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1484 path: tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1485 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1486 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1487 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1488 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
|
1489 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1490 if self.__connected: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1491 self.__view.runMessage(message, path, arg) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1492 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1493 if self.__budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1494 _path_record = arg |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1495 self.__active_path_record = _path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1496 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1497 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1498 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1499 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1500 Return de pane widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1501 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1502 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1503 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1504 def _getPath(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1505 """_getPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1506 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1507 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
|
1508 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1509 return self.__view.path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1510 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1511 def _setPath(self, path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1512 """_setPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1513 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1514 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
|
1515 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1516 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1517 self.__view.path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1518 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1519 def getClone(self, new_path): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1520 """getClone(new_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1521 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1522 new_path: the path that identifies the clone view in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1523 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1524 return a clone of itself |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1525 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1526 return View(self.__view_type, self.__budget, self.__wr_page, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1527 new_path, self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1528 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1529 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
|
1530 """clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1531 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1532 Clear the intance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1533 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1534 del self.__wr_page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1535 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1536 del self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1537 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1538 del self.__view |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1539 del self.__connected |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1540 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
|
1541 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1542 path = property(_getPath, _setPath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1543 "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
|
1544 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
|
1545 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1546 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1547 class Paned(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1548 """gui.Paned: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1549 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1550 Description: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1551 It creates and shows gtk.Hpaned or gtk.Vpaned to show in page budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1552 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1553 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
|
1554 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
|
1555 "h" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1556 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
|
1557 widget2: the botton or right pane widget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1558 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1559 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1560 +-- Paned |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1561 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1562 widget: Read. Pane widget("gtk.VPaned" or "gtk.HPaned" object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1563 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
|
1564 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1565 getClone |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1566 getItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1567 setItem |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1568 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1569 clear(self) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1570 """ |
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
|
1571 # 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
|
1572 # 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
|
1573 # TODO: 0.0 no space for widget1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1574 # TODO: 1.0 all the space for widget1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1575 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1576 def __init__(self, orientation, path, item1, item2): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1577 """__init__(oritentation, path, item1, item2) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1578 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1579 orientation: The orientation of de gtk.Paned, can be "v" or "h" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1580 path: the paned path in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1581 item1: the top or left pane object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1582 item2: the bottom or right pane object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1583 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1584 self.__orientation: The orientation of de gtk.Paned, can be "v" or "h" |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1585 self.__widget: Main widget, a gtk.VPaned o gtk.HPaned |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1586 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
|
1587 Paned instances |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1588 self.__path: the paned path in the page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1589 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1590 Creates and shows a new gtk.Paned |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1591 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1592 self.__orientation = orientation |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1593 if not isinstance(item1.widget, gtk.Widget) or \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1594 not isinstance(item2.widget, gtk.Widget): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1595 raise ValueError, _("The item must be a widget object.") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1596 if orientation == "v": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1597 self.__widget = gtk.VPaned() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1598 elif orientation == "h": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1599 self.__widget = gtk.HPaned() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1600 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1601 raise ValueError, _("Invalid orientation.") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1602 self.__widget.pack1(item1.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1603 self.__widget.pack2(item2.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1604 self.__widget.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1605 self.__items = [item1, item2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1606 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1607 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1608 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
|
1609 """__getitem__(item) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1610 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1611 Called to implement evaluation of self[key]. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1612 The accepted keys should be integers 0 or 1. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1613 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1614 return self.__items[item] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1615 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1616 def getClone(self, new_path): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1617 """getClone(new_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1618 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1619 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
|
1620 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1621 return Paned(self.__orientation, new_path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1622 self.__items[0].getClone(new_path + (0,)), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1623 self.__items[1].getClone(new_path + (1,))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1624 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1625 def getItem(self,path): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1626 """getItem(path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1627 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1628 Return the item whith the specified path. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1629 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1630 _item = self.__items[path[0]] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1631 if len(path) == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1632 return _item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1633 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1634 return _item.getItem(path[1:]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1635 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1636 def setItem(self, path, item_list): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1637 """setItem(path, item_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1638 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1639 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
|
1640 remove the old item in this position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1641 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1642 item = item_list[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1643 if path == 0 or path == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1644 _old_item = self.__items[path] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1645 self.__widget.remove(_old_item.widget) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1646 self.__items[path] = item |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1647 if path == 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1648 self.__widget.pack1(item.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1649 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1650 self.__widget.pack2(item.widget,True,False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1651 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1652 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1653 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1654 def runMessage(self, message, 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
|
1655 """runMessage(message, page_path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1656 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1657 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1658 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1659 "clear": clear instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1660 page_path: tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1661 arg: arguments |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1662 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1663 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
|
1664 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1665 for _item in self.__items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1666 if not _item.path == path: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1667 _item.runMessage(message, path, arg) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1668 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1669 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1670 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1671 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1672 Return de gtk.Paned widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1673 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1674 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1675 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1676 def _getPath(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1677 """_getPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1678 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1679 Return de Paned path in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1680 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1681 return self.__path |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1682 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1683 def _setPath(self, path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1684 """_setPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1685 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1686 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
|
1687 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1688 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1689 self.__items[0].path = path + (0,) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1690 self.__items[1].path = path + (1,) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1691 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1692 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
|
1693 """clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1694 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1695 Delete atributes |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1696 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1697 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1698 del self.__orientation |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1699 del self.__items |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1700 del self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1701 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1702 widget = property(_getWidget, None, None, "gtk.Paned widget") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1703 path = property(_getPath, _setPath, None, "Pane path in the notebook page") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1704 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1705 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1706 class TreeView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1707 """gui.Treeviev: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1708 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1709 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1710 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
|
1711 DescompositionList and Measure classes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1712 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1713 TreView(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1714 args: list of tuples, the tuple items are: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1715 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1716 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1717 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1718 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1719 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1720 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1721 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1722 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1723 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1724 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1725 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1726 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1727 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1728 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1729 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1730 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1731 columns: list of columns (gtk.TreeViewColumn objects) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1732 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1733 createColumn |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1734 createTextBaseColumn |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1735 createBaseColumn |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1736 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1737 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1738 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
|
1739 """__init__(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1740 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1741 args: list of tuples, the tuple items are: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1742 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1743 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1744 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1745 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1746 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1747 * Calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1748 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1749 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1750 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1751 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1752 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1753 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1754 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1755 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
|
1756 each column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1757 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1758 self.columns = [ self.createColumn(arg) for arg in args ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1759 self.columns.append(self.createColumn(("END",))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1760 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1761 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
|
1762 """createColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1763 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1764 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1765 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1766 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1767 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1768 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1769 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1770 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1771 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1772 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1773 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1774 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1775 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1776 5. model column index |
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 Return a column created whith the arg info |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1779 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1780 if args[0] == "INDEX": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1781 _index_column = self.createBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1782 _text_index_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1783 _text_index_cell.set_property('foreground-gdk', |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1784 gtk.gdk.color_parse(globalVars.color["TEXT"])) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1785 _pixbuf_index_cell = gtk.CellRendererPixbuf() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1786 _arrow_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1787 globalVars.getAppPath("ARROW-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1788 _pixbuf_index_cell.set_property("pixbuf", _arrow_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1789 _index_column.pack_start(_text_index_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1790 _index_column.pack_start(_pixbuf_index_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1791 _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
|
1792 self._colorCell, |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1793 [gtk.gdk.color_parse(globalVars.color["INDEX-UNEVEN"]), |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1794 gtk.gdk.color_parse(globalVars.color["INDEX-EVEN"])]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1795 return _index_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1796 elif args[0] == "TEXT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1797 _column, _cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1798 _column.add_attribute(_cell, 'text', args[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1799 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1800 elif args[0] == "FLOAT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1801 _column, _cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1802 _column.add_attribute(_cell, 'text', args[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1803 _column.get_cell_renderers()[0].set_property('xalign', 1.0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1804 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1805 elif args[0] == "CALCULATED": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1806 _column, cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1807 _column.get_cell_renderers()[0].set_property('xalign', 1.0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1808 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1809 elif args[0] == "CALCULATEDTEXT": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1810 _column, cell = self.createTextBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1811 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1812 elif args[0] == "TYPE": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1813 _column = self.createBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1814 _type_cell1 = gtk.CellRendererPixbuf() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1815 _type_cell2 = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1816 _type_cell2.set_property('foreground-gdk', args[3]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1817 _column.pack_start(_type_cell1, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1818 _column.pack_start(_type_cell2, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1819 _column.add_attribute(_type_cell2, 'text', args[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1820 _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
|
1821 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1822 _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
|
1823 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1824 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1825 elif args[0] == "PIXBUF": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1826 _column = self.createBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1827 _type_cell1 = gtk.CellRendererPixbuf() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1828 _column.pack_start(_type_cell1, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1829 _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
|
1830 self._colorCell, args[4]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1831 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1832 elif args[0] == "END": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1833 _end_column = gtk.TreeViewColumn() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1834 _end_column.set_clickable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1835 _end_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1836 _end_cell.set_property('cell-background-gdk', |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1837 gtk.gdk.color_parse(globalVars.color["UNEVEN"])) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1838 _end_column.pack_start(_end_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1839 return _end_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1840 return None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1841 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1842 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
|
1843 """createTextBaseColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1844 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1845 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1846 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1847 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1848 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1849 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1850 * calculated text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1851 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1852 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1853 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1854 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1855 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1856 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1857 Return a column and its CellREndererText |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1858 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1859 _column = self.createBaseColumn(args) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1860 _cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1861 _cell.set_property('foreground-gdk', args[3]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1862 _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
|
1863 _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
|
1864 return _column, _cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1865 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1866 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
|
1867 """createBaseColumn(args) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1868 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1869 args: tuple with the args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1870 0.type: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1871 * index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1872 * float column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1873 * text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1874 * calculated column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1875 * calculated text column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1876 * type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1877 1. clicked method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1878 2. width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1879 3. text color |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1880 4. backgruound colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1881 5. model column index |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1882 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1883 Return a column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1884 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1885 _column = gtk.TreeViewColumn() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1886 _column.set_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1887 _column.connect("clicked", args[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1888 _column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1889 _column.set_fixed_width(args[2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1890 _column.set_resizable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1891 return _column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1892 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1893 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1894 class DecompositionList(TreeView): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1895 """gui.DecompositionList: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1896 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1897 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1898 Class to show a budget Decomposition List |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1899 Constructor: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1900 DecompositionList(budget, page, path, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1901 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1902 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1903 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
|
1904 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
|
1905 Returns the newly created DecompositionList instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1906 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1907 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1908 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1909 +-- DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1910 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1911 budget: Read. Budget to show, base.obra object. |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1912 widget: Read. Window that contains the table, gtk.ScrolledWindow |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1913 path: Read-Write. Pane page identifier |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1914 page: Read-Write. weak ref from Page object which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1915 active_path_record: Read. Active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1916 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1917 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1918 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1919 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1920 def __init__(self, budget, page, path, path_record=(0,)): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1921 """__init__(budget, page, path, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1922 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1923 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1924 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1925 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
|
1926 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
|
1927 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1928 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
|
1929 self.__page: weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1930 self.__path: tuple that represents the path of the List in the Page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1931 self.__liststore: list model which store the list data |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1932 (gtk.ListStore object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1933 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
|
1934 self.__treeview: widget for displaying decomposition lists |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1935 (gtk.TreeView) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1936 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
|
1937 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
|
1938 column cells when there is a chapter record, |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1939 list of gtk.gdk.Color objects [even cell, uneven cell] |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1940 self.__chapter_background_colors |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1941 self.__index_column: Index column (gtk.TreeViewColumn object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1942 self.__code_column: Record code column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1943 self.__type_column: Record Type column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1944 self.__unit_column: Unit of measure column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1945 self.__description_column: record's short description column |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1946 (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1947 self.__measure_column: Measure column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1948 self.__price_column: Price column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1949 self.__amount_column: Amount column(gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1950 self.__end_column: End empty column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1951 self.__chapter_icon: a gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1952 self.__unit_icon: a gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1953 self.__material_icon: a gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1954 self.__machinery_icon: a gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1955 self.__labourforce_icon: a gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1956 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
|
1957 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
|
1958 self.__cursor: cursor position in the table |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1959 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1960 Sets the init atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1961 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
|
1962 showing the top record descomposition |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1963 Creates the list in self.__treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1964 * Creates the columns and cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1965 * Sets te the column headers values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1966 * Sets the selection properties |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1967 * Connects the events |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1968 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1969 # TODO: to group all columns in a dicctionary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1970 # Budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1971 if not isinstance(budget, base.Budget): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1972 raise ValueError, _("Argument must be a Budget object") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1973 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1974 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1975 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1976 # ListStore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1977 self.__liststore = gtk.ListStore(object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1978 #, int, int, str, str, str, str, str,str |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1979 ) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1980 if path_record is None: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1981 print _("Record path can not be None") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1982 path_record = (0,) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1983 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
|
1984 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1985 # Treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1986 self.__treeview = gtk.TreeView(self.__liststore) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1987 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1988 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1989 self.__treeview.set_headers_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1990 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1991 # Scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1992 self.__scrolled_window = gtk.ScrolledWindow() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1993 self.__scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1994 gtk.POLICY_AUTOMATIC) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1995 self.__scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1996 # colors |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1997 _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1998 _background_color = [ |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
1999 gtk.gdk.color_parse(globalVars.color["UNEVEN"]), |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2000 gtk.gdk.color_parse(globalVars.color["EVEN"])] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2001 self.__chapter_background_colors = [ |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2002 gtk.gdk.color_parse(globalVars.color["CHAPTER-UNEVEN"]), |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2003 gtk.gdk.color_parse(globalVars.color["CHAPTER-EVEN"])] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2004 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
|
2005 [("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
|
2006 ("CALCULATEDTEXT", self._showParentRecord, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2007 gtk.Label("A"*10).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2008 _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
|
2009 ("PIXBUF", self._showParentRecord, 26, _text_color, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2010 _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2011 ("CALCULATEDTEXT", self._showParentRecord, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2012 gtk.Label(_("a"*4)).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2013 _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
|
2014 ("CALCULATEDTEXT", self._showParentRecord, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2015 gtk.Label("a"*30).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2016 _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
|
2017 ("CALCULATED", self._showParentRecord, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2018 gtk.Label("a"*10).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2019 _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
|
2020 ("CALCULATED", self._showParentRecord, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2021 gtk.Label("a"*10).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2022 _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
|
2023 ("CALCULATED", self._showParentRecord, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2024 gtk.Label("a"*10).size_request()[0] +10, |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2025 gtk.gdk.color_parse(globalVars.color["CALCULATED-TEXT"]), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2026 _background_color), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2027 ]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2028 self.__index_column = self.columns[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2029 self.__code_column = self.columns[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2030 self.__type_column = self.columns[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2031 self.__unit_column = self.columns[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2032 self.__description_column = self.columns[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2033 self.__measure_column = self.columns[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2034 self.__price_column = self.columns[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2035 self.__amount_column = self.columns[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2036 self.__end_column = self.columns[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2037 # Index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2038 self.__treeview.append_column(self.__index_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2039 # Code column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2040 self.__treeview.append_column(self.__code_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2041 # Type column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2042 self.__treeview.append_column(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
|
2043 self.__chapter_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2044 globalVars.getAppPath("CHAPTER-ICON")) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2045 self.__unit_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2046 globalVars.getAppPath("UNIT-ICON") ) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2047 self.__material_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2048 globalVars.getAppPath("MATERIAL-ICON") ) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2049 self.__machinery_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2050 globalVars.getAppPath("MACHINERY-ICON")) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2051 self.__labourforce_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2052 globalVars.getAppPath("LABOURFORCE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2053 self.__type_column.get_cell_renderers()[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
|
2054 self.__labourforce_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2055 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2056 # Unit column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2057 self.__treeview.append_column(self.__unit_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2058 # Description column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2059 self.__treeview.append_column(self.__description_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2060 # Measure Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2061 self.__treeview.append_column(self.__measure_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2062 # Price column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2063 self.__treeview.append_column(self.__price_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2064 # Amount column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2065 self.__treeview.append_column(self.__amount_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2066 # End Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2067 self.__treeview.append_column(self.__end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2068 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2069 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
|
2070 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
|
2071 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
|
2072 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
|
2073 self._treeviewClickedEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2074 self.__treeview.connect("cursor-changed", self._treeviewCursorChanged) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2075 # control selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2076 self.__treeselection = self.__treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2077 self.__treeselection.set_mode(gtk.SELECTION_MULTIPLE) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2078 self.__treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2079 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2080 if len(self.__liststore) > 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2081 self.__treeview.set_cursor_on_cell((0,),self.__unit_column, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2082 self.__unit_column.get_cell_renderers()[0],True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2083 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2084 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2085 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2086 self._setColumnsHeaders() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2087 self.__scrolled_window.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2088 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2089 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
|
2090 """_treeviewCursorChanged(treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2091 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2092 treeview: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2093 Method connected to "cursor-changed" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2094 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
|
2095 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
|
2096 unnecessary changes in cursor position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2097 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2098 event = gtk.get_current_event() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2099 (_cursor_path, _column) = treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2100 if event is None or event.type != gtk.gdk.BUTTON_RELEASE: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2101 if not _column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2102 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
|
2103 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2104 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
|
2105 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2106 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2107 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2108 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2109 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2110 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
|
2111 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2112 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
|
2113 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2114 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2115 The events in end column are ignored. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2116 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
|
2117 this row but not to the index column |
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 if event.button == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2120 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
|
2121 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2122 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2123 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2124 if _column == self.columns[-1]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2125 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2126 if _column is self.columns[0]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2127 self.__cursor[0] == _path_cursor |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2128 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2129 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2130 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
|
2131 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2132 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2133 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2134 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2135 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2136 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
|
2137 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2138 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
|
2139 Returns :FALSE to propagate the event further. |
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 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
|
2142 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
|
2143 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
|
2144 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2145 (_cursor_path, _column) = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2146 if (event.keyval == gtk.keysyms.Right \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2147 and _column == self.columns[-2]) \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2148 or (event.keyval == gtk.keysyms.Left \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2149 and _column == self.columns[1]): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2150 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2151 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2152 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2153 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
|
2154 """_moveCursor(treeview, step, count) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2155 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2156 treeview: the treeview that received the signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2157 step: the movement step size |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2158 count: the number of steps to take |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2159 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2160 Method connected to "move-cursor" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2161 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
|
2162 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
|
2163 Page Down, Home and End keys. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2164 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2165 Returns :TRUE if the signal was handled. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2166 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2167 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2168 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2169 def _controlSelection(self, selection): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2170 """_controlSelection(selection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2171 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2172 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2173 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2174 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2175 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
|
2176 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2177 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2178 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
|
2179 be left unchanged. |
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 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
|
2182 the previous selection is erased. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2183 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2184 _column = self.__treeview.get_cursor()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2185 if _column is self.columns[0] \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2186 or self.__selection_control == False: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2187 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2188 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2189 self.__selection_control = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2190 self.__treeselection.unselect_all() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2191 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2192 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2193 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2194 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
|
2195 """_selectAll(column) |
1
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 column: index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2198 Method connected to "clicked" event in the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2199 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
|
2200 all rows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2201 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2202 (_model, _pathlist) = self.__treeselection.get_selected_rows() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2203 # it avoid to set cursor in the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2204 self.__treeview.set_cursor(self.__cursor[0], self.__cursor[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2205 self.__selection_control = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2206 if len(_pathlist) == 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2207 # select all |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2208 self.__treeselection.select_all() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2209 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2210 # unselect all |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2211 self.__treeselection.unselect_all() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2212 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2213 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2214 def _setColumnsHeaders(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2215 """_setColumnsHeaders() |
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 Sets the headers column values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2218 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2219 _path_record = self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2220 _number = _path_record[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2221 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2222 _code = _budget.getCode(_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2223 _decomposition = _budget.getDecomposition(_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2224 _stryield = _budget.getStrYield(_decomposition.budgetMeasures[0], |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2225 _budget.getRecord(_code).recordType) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2226 _record = _budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2227 _unit = _record.unit |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2228 _description = _record.summary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2229 _price = _budget.getStrPriceFromRecord(self.budget.getActiveTitle(), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2230 _record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2231 # TODO: round to decimal places in amount |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2232 _amount = float(_stryield) * float(_price) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2233 if len(_path_record) == 1: # root record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2234 _amount = _price |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2235 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2236 _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
|
2237 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2238 _amount = _budget.getStrAmount(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2239 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2240 self.__code_column.set_title(_("Code") + chr(10) + "[" + _code + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2241 self.__unit_column.set_title(_("Unit") + chr(10) + "[" + _unit + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2242 self.__description_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2243 _("Description") + chr(10) + "[" + _description + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2244 self.__measure_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2245 _("Measure") + chr(10) + "[" + _stryield + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2246 self.__price_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2247 _("Price") + chr(10) + "[" + _price + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2248 self.__amount_column.set_title( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2249 _("Amount") + chr(10) + "[" + str(_amount) + "]") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2250 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2251 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
|
2252 """_setListstoreValues(path_record) |
1
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 path_record: Record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2255 Sets the liststore record values from a path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2256 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2257 self.__liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2258 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2259 if not _budget.hasPath(path_record): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2260 raise ValueError, _("Invalid path") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2261 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2262 _parent_code = _budget.getCode(path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2263 for N,_code in enumerate(_budget.getchildren(_parent_code)): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2264 _decomposition = _budget.getNDecomposition(_parent_code, N) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2265 _record = _budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2266 _values = [_record, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2267 #_record.hierarchy, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2268 #_record.type, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2269 #_record.subtype, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2270 #_code, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2271 #_record.unit, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2272 #_record.summary, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2273 #_decomposition.yield_, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2274 #_decomposition.budget[0].yield_, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2275 #_record.prices[_budget.getActiveTitle()].prices] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2276 #_record.getPrice(_budget.getActiveTitle()) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2277 ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2278 _treeiter = self.__liststore.append(_values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2279 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2280 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
|
2281 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2282 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2283 column: the gtk.TreeViewColumn in the treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2284 cell_renderer: a gtk.CellRenderer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2285 tree_model: the gtk.TreeModel |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2286 iter: gtk.TreeIter pointing at the row |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2287 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
|
2288 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2289 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
|
2290 The set_cell_data_func() method sets the data function (or method) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2291 to use for the column gtk.CellRenderer specified by cell_renderer. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2292 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
|
2293 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
|
2294 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
|
2295 current data function. The signature of func is: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2296 -def celldatafunction(column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2297 -def celldatamethod(self, column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2298 where column is the gtk.TreeViewColumn in the treeview, cell is the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2299 gtk.CellRenderer for column, model is the gtk.TreeModel for the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2300 treeview and iter is the gtk.TreeIter pointing at the row. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2301 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2302 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
|
2303 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2304 _row_path = tree_model.get_path(iter) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2305 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2306 _record = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2307 if column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2308 cell_renderer.set_property('text', str(_number + 1)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2309 self.__index_column.get_cell_renderers()[1].set_property( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2310 'cell-background-gdk', lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2311 elif column is self.__code_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2312 # if the record is a chapter |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2313 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
|
2314 lcolor = self.__chapter_background_colors |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2315 _code = _record.code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2316 cell_renderer.set_property('text', _code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2317 elif column is self.__unit_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2318 _unit = _record.unit |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2319 cell_renderer.set_property('text', _unit) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2320 elif column is self.__description_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2321 _summary = _record.summary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2322 cell_renderer.set_property('text', _summary) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2323 elif column is self.__measure_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2324 _parent_code = self.budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2325 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2326 _decomposition = _parent_record.children[_number] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2327 _stryield = self.__budget.getStrYield( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2328 _decomposition.budgetMeasures[0], _parent_record.recordType) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2329 cell_renderer.set_property('text', _stryield) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2330 elif column is self.__price_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2331 _price = self.budget.getStrPriceFromRecord( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2332 self.budget.getActiveTitle(), _record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2333 cell_renderer.set_property('text', _price) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2334 elif column is self.__amount_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2335 _parent_code = self.budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2336 _parent_record = self.__budget.getRecord(_parent_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2337 _amount = self.budget.getStrAmount( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2338 self.__active_path_record + (_number,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2339 cell_renderer.set_property('text', str(_amount)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2340 elif column is self.__type_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2341 _hierarchy = tree_model[_row_path][0].recordType.hierarchy |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2342 _type = tree_model[_row_path][0].recordType.type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2343 _subtype = tree_model[_row_path][0].recordType.subtype |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2344 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
|
2345 cell_renderer.set_property("pixbuf",self.__chapter_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2346 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2347 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
|
2348 cell_renderer.set_property("pixbuf",self.__unit_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2349 elif _type == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2350 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
|
2351 self.__labourforce_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2352 elif _type == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2353 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
|
2354 self.__machinery_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2355 else: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2356 cell_renderer.set_property("pixbuf",self.__material_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2357 if self.__treeview.get_cursor() == (_row_path,column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2358 cell_renderer.set_property('cell-background-gdk', |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2359 gtk.gdk.color_parse(globalVars.color["ACTIVE"])) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2360 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2361 cell_renderer.set_property('cell-background-gdk', |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2362 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2363 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2364 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
|
2365 """_showParentRecord(column) |
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 column: the column that is clicked |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2368 Method connected to "clicked" event of many columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2369 Show the parent record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2370 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2371 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2372 if len(self.__active_path_record) == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2373 # The active record is the root record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2374 # This avoid to move the cursor to the clicked column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2375 self.__treeview.set_cursor(self.__cursor[0], self.__cursor[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2376 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2377 _path_record = self.__active_path_record[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2378 _parent = self.__active_path_record[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2379 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
|
2380 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2381 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2382 arg = ( _path_record ) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2383 _page = self.__page() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2384 _page.propagateMessageFrom("change_active", self.__path, arg) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2385 self.__treeview.set_cursor(_parent, self.__cursor[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2386 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2387 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2388 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
|
2389 """_showMessageRecord(record_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2390 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2391 record_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2392 Method connected to "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2393 Show the record especified in the "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2394 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2395 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2396 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
|
2397 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2398 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2399 self.__treeview.set_cursor((0,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2400 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2401 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
|
2402 """_showRowRecord(treeview, treeview_path, column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2403 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2404 treeview: treview to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2405 treeview_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2406 code: the code of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2407 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2408 Method connected to "row-activated" event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2409 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
|
2410 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
|
2411 "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
|
2412 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
|
2413 Show the especified record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2414 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2415 if not (column is self.__end_column) and \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2416 not (column is self.__index_column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2417 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2418 _model = treeview.get_model() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2419 _iter = _model.get_iter(treeview_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2420 _code = _model.get_value(_iter, 0).code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2421 #_code = _model.get_value(_iter, 4) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2422 _path_record = self.__active_path_record + treeview_path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2423 if self.__budget.hasPath(_path_record): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2424 # if this record path is valid |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2425 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
|
2426 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2427 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2428 self.__treeview.set_cursor((0,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2429 _arg = ( _path_record ) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2430 _page = self.__page() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2431 _page.propagateMessageFrom("change_active", self.__path, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2432 _arg ) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2433 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2434 def runMessage(self, message, 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
|
2435 """runMessage(message, path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2436 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2437 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2438 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2439 "clear": clear instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2440 path: tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2441 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2442 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2443 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2444 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
|
2445 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2446 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2447 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2448 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2449 _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
|
2450 self._showMessageRecord( _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2451 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2452 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2453 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2454 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
|
2455 """_clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2456 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2457 it deletes the __budget reference |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2458 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2459 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2460 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2461 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2462 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2463 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2464 return the main widget (gtk.ScrolledWindow) |
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 return self.__scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2467 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2468 def _getPath(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2469 """_getPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2470 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2471 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
|
2472 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2473 return self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2474 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2475 def _setPath(self, path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2476 """_setPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2477 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2478 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
|
2479 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2480 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2481 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2482 def _getPage(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2483 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2484 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2485 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2486 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2487 return self.__page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2488 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2489 def _setPage(self,page): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2490 """_setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2491 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2492 set the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2493 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2494 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2495 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2496 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2497 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2498 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2499 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2500 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2501 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2502 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2503 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2504 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2505 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2506 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2507 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2508 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2509 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2510 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2511 "Pane configuration list") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2512 path = property(_getPath, _setPath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2513 "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
|
2514 page = property(_getPage, _setPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2515 "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
|
2516 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2517 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2518 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2519 "Active path record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2520 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2521 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2522 class Measure(TreeView): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2523 """gui.Measure: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2524 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2525 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2526 Class to show a Measure List |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2527 Constructor: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2528 Measure(budget, page, path, path_record=(0,) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2529 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2530 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2531 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
|
2532 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
|
2533 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2534 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2535 +-- TreeView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2536 +-- DecompositionList |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2537 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2538 budget: Read. Budget to show, base.obra instance. |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2539 widget: Read. Window that contains the table, gtk.ScrolledWindow |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2540 path: Read-Write. Pane page identifier |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2541 page: Read-Write. weak reference from Page instance which creates |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2542 this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2543 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
|
2544 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2545 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2546 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2547 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2548 def __init__(self, budget, page, path, path_record=(0,)): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2549 """__init__(budget, page, path, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2550 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2551 budget: budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2552 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2553 path: tuple that represents the path of the List in the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2554 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
|
2555 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2556 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
|
2557 self.__page: weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2558 self.__path: tuple that represents the path of the List in the Page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2559 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
|
2560 self.__liststore: list model which store the list data |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2561 (gtk.ListStore object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2562 self.__treeview: widget to display decomposition lists |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2563 (gtk.TreeView) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2564 self.__scrolled_window: widget to scroll the treeview |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2565 gtk.ScrolledWindow() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2566 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
|
2567 column cells when there is a chapter record |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2568 as a list of gtk.gdk.Color objects [even cell, uneven cell] |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2569 self.__index_column: Index column (gtk.TreeViewColumn object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2570 self.__linetype_column: Linetype column (gtk.TreeViewColumn object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2571 self.__comment_column: Comment column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2572 self.__unit_column: Unit column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2573 self.__length_column: Legth column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2574 self.__width_column: With column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2575 self.__height_column: Height column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2576 self.__formula_column: Formula column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2577 self.__parcial_column: Parcial column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2578 self.__subtotal_column: Subtotal column (gtk.TreeViewColumn) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2579 self.__end_column: End empty column (gtk.TreeViewColumn |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2580 self.__calculatedline_icon: gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2581 self.__normalline_icon: gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2582 self.__parcialline_icon: gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2583 self.__acumulatedline_icon: gtk.gdk.pixbuf |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2584 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
|
2585 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
|
2586 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
|
2587 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2588 Sets the init atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2589 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
|
2590 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
|
2591 Creates the list in self.__treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2592 * Creates the columns and cell |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2593 * Sets te the column headers values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2594 * Sets the selection properties |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2595 * Connects the events |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2596 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2597 # Seting init args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2598 if not isinstance(budget, base.Budget): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2599 raise ValueError, _("Argument must be a Budget object") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2600 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2601 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2602 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2603 if not isinstance(path_record, tuple): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2604 print _("Record path must be a tuple") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2605 path_record = (0,) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2606 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2607 # ListStore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2608 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
|
2609 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2610 # Treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2611 self.__treeview = gtk.TreeView(self.__liststore) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2612 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2613 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2614 self.__treeview.set_headers_clickable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2615 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2616 # Scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2617 self.__scrolled_window = gtk.ScrolledWindow() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2618 self.__scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2619 gtk.POLICY_AUTOMATIC) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2620 self.__scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2621 # colors |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2622 _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2623 _calculated_text =gtk.gdk.color_parse(globalVars.color["CALCULATED-TEXT"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2624 _background_color = [ |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2625 gtk.gdk.color_parse(globalVars.color["UNEVEN"]), |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2626 gtk.gdk.color_parse(globalVars.color["EVEN"])] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2627 self.__chapter_background_colors = [ |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2628 gtk.gdk.color_parse(globalVars.color["CHAPTER-UNEVEN"]), |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2629 gtk.gdk.color_parse(globalVars.color["CHAPTER-EVEN"])] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2630 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
|
2631 [("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
|
2632 ("PIXBUF", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2633 gtk.Label("A"*4).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2634 _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
|
2635 ("CALCULATEDTEXT", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2636 gtk.Label("A"*12).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2637 _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
|
2638 ("CALCULATED", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2639 gtk.Label("A"*5).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2640 _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
|
2641 ("CALCULATED", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2642 gtk.Label("A"*7).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2643 _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
|
2644 ("CALCULATED", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2645 gtk.Label("A"*7).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2646 _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
|
2647 ("CALCULATED", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2648 gtk.Label("A"*7).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2649 _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
|
2650 ("CALCULATEDTEXT", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2651 gtk.Label("A"*12).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2652 _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
|
2653 ("CALCULATED", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2654 gtk.Label("A"*7).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2655 _calculated_text, _background_color), |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2656 ("CALCULATED", self._passMethod, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2657 gtk.Label("A"*7).size_request()[0] +10, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2658 _calculated_text, _background_color), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2659 ]) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2660 # Colums |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2661 self.__index_column = self.columns[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2662 self.__linetype_column = self.columns[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2663 self.__comment_column = self.columns[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2664 self.__units_column = self.columns[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2665 self.__length_column = self.columns[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2666 self.__width_column = self.columns[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2667 self.__height_column = self.columns[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2668 self.__formula_column = self.columns[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2669 self.__parcial_column = self.columns[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2670 self.__subtotal_column = self.columns[9] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2671 self.__end_column = self.columns[10] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2672 # Index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2673 self.__treeview.append_column(self.__index_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2674 # Linetype column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2675 self.__treeview.append_column(self.__linetype_column) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2676 self.__calculatedline_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2677 globalVars.getAppPath("CALCULATEDLINE-ICON")) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2678 self.__normalline_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2679 globalVars.getAppPath("NORMALLINE-ICON") ) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2680 self.__parcialline_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2681 globalVars.getAppPath("PARCIALLINE-ICON") ) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2682 self.__acumulatedline_icon = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
2683 globalVars.getAppPath("ACUMULATEDLINE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2684 # Comment column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2685 self.__treeview.append_column(self.__comment_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2686 # Units column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2687 self.__treeview.append_column(self.__units_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2688 # Length column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2689 self.__treeview.append_column(self.__length_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2690 # Width_column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2691 self.__treeview.append_column(self.__width_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2692 # Height column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2693 self.__treeview.append_column(self.__height_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2694 # Formula column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2695 self.__treeview.append_column(self.__formula_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2696 # Parcial column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2697 self.__treeview.append_column(self.__parcial_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2698 # Subtotal column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2699 self.__treeview.append_column(self.__subtotal_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2700 # End Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2701 self.__treeview.append_column(self.__end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2702 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2703 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
|
2704 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
|
2705 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
|
2706 self._treeviewClickedEvent) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2707 self.__treeview.connect("cursor-changed", self._treeviewCursorChanged) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2708 # control selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2709 self.__treeselection = self.__treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2710 self.__treeselection.set_mode(gtk.SELECTION_MULTIPLE) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2711 self.__treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2712 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2713 self.__treeview.set_cursor_on_cell((1,), self.columns[1], |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2714 self.columns[1].get_cell_renderers()[0],True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2715 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2716 self.__cursor = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2717 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2718 self._setColumnsHeaders() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2719 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
|
2720 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2721 def _passMethod(self, column): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2722 """_passMethod(column) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2723 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2724 column: the column that is clicked |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2725 Method connected to "clicked" event of many columns |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2726 Do nothing |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2727 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2728 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2729 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2730 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
|
2731 """_setListstoreValues(path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2732 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2733 path_record: Record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2734 Sets the liststore record values from a path record |
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.__liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2737 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2738 if not _budget.hasPath(path_record): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2739 raise ValueError, _("Invalid path") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2740 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2741 _measure = _budget.getMeasure(path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2742 if isinstance(_measure, base.Measure): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2743 _lines = _measure.lines |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2744 for _line in _lines: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2745 _values = [ _line ] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2746 _treeiter = self.__liststore.append(_values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2747 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2748 raise ValueError, utils.mapping(_("measure must be a Measure "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2749 "object. Type: $1"), (type(_measure),)) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2750 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2751 def _setColumnsHeaders(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2752 """_setColumnsHeaders() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2753 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2754 Sets the headers column values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2755 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2756 _measure = self.__budget.getMeasure(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2757 _DS = self.__budget.getDecimals("DS") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2758 _total = _measure.measure |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2759 _total_str = ("%." + str(_DS) + "f" ) % _total |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2760 self.columns[1].set_title(_("Type")) # Σ parcial Σ total |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2761 self.columns[2].set_title(_("Comment")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2762 self.columns[3].set_title(_("N\n(a)")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2763 self.columns[4].set_title(_("Length\n(b)")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2764 self.columns[5].set_title(_("Width\n(c)")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2765 self.columns[6].set_title(_("Height\n(d)")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2766 self.columns[7].set_title(_("Formula")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2767 self.columns[8].set_title(_("Parcial\n[%s]" % _total_str)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2768 self.columns[9].set_title(_("Subtotal")) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2769 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2770 def _controlSelection(self, selection): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2771 """_controlSelection(selection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2772 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2773 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2774 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2775 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2776 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
|
2777 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2778 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2779 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
|
2780 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2781 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2782 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
|
2783 the previous selection is erased. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2784 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2785 _column = self.__treeview.get_cursor()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2786 if _column is self.columns[0] \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2787 or self.__selection_control == False: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2788 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2789 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2790 self.__selection_control = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2791 self.__treeselection.unselect_all() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2792 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2793 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2794 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2795 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
|
2796 """_showMessageRecord(record_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2797 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2798 record_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2799 Method connected to "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2800 Show the record especified in the "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2801 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2802 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2803 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
|
2804 self._setColumnsHeaders() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2805 self._setListstoreValues(self.__active_path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2806 self.__treeview.set_cursor((0,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2807 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2808 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
|
2809 """_treeviewCursorChanged(treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2810 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2811 treeview: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2812 Method connected to "cursor-changed" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2813 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
|
2814 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
|
2815 unnecessary changes in cursor position. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2816 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2817 event = gtk.get_current_event() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2818 (_cursor_path, _column) = treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2819 if event is None or event.type != gtk.gdk.BUTTON_RELEASE: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2820 if not _column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2821 self.__cursor = treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2822 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2823 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
|
2824 """moveCursor(treeview, step, count) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2825 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2826 treeview: the treeview that received the signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2827 step: the movement step size |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2828 count: the number of steps to take |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2829 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2830 Method connected to "move-cursor" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2831 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
|
2832 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
|
2833 Page Down, Home and End keys. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2834 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2835 Returns :TRUE if the signal was handled. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2836 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2837 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2838 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2839 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
|
2840 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2841 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2842 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2843 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2844 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2845 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
|
2846 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2847 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
|
2848 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2849 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2850 The events in end column are ignored. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2851 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
|
2852 this row but not to the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2853 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2854 if event.button == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2855 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
|
2856 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2857 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2858 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2859 if _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 if _column is self.columns[0]: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2862 self.__cursor[0] == _path_cursor |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2863 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2864 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2865 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
|
2866 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2867 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2868 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2869 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2870 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2871 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
|
2872 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2873 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
|
2874 Returns :FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2875 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2876 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
|
2877 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
|
2878 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
|
2879 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2880 (_cursor_path, _column) = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2881 if (event.keyval == gtk.keysyms.Right \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2882 and _column == self.columns[-2]) \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2883 or (event.keyval == gtk.keysyms.Left \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2884 and _column == self.columns[1]): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2885 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2886 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2887 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2888 def runMessage(self, message, 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
|
2889 """runMessage(message, path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2890 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2891 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2892 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2893 "clear": clear instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2894 path: tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2895 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2896 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2897 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2898 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
|
2899 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2900 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2901 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2902 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2903 _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
|
2904 self._showMessageRecord( _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2905 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2906 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2907 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2908 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
|
2909 """_selectAll(column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2910 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2911 column: index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2912 Method connected to "clicked" event in the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2913 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
|
2914 all rows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2915 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2916 (_model, _pathlist) = self.__treeselection.get_selected_rows() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2917 # it avoid to set cursor in the index column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2918 self.__treeview.set_cursor(self.__cursor[0], self.__cursor[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2919 self.__selection_control = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2920 if len(_pathlist) == 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2921 # select all |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2922 self.__treeselection.select_all() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2923 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2924 # unselect all |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2925 self.__treeselection.unselect_all() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2926 self.__selection_control = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2927 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2928 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
|
2929 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2930 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2931 column: the gtk.TreeViewColumn in the treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2932 cell_renderer: a gtk.CellRenderer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2933 tree_model: the gtk.TreeModel |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2934 iter: gtk.TreeIter pointing at the row |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2935 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
|
2936 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2937 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
|
2938 The set_cell_data_func() method sets the data function (or method) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2939 to use for the column gtk.CellRenderer specified by cell_renderer. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2940 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
|
2941 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
|
2942 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
|
2943 current data function. The signature of func is: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2944 -def celldatafunction(column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2945 -def celldatamethod(self, column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2946 where column is the gtk.TreeViewColumn in the treeview, cell is the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2947 gtk.CellRenderer for column, model is the gtk.TreeModel for the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2948 treeview and iter is the gtk.TreeIter pointing at the row. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2949 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2950 The method sets cell background color for all columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2951 and text for index and amount columns. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2952 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2953 _row_path = tree_model.get_path(iter) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2954 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2955 if column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2956 cell_renderer.set_property('text', str(_number + 1)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2957 self.__index_column.get_cell_renderers()[1].set_property( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2958 'cell-background-gdk', lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2959 elif column is self.__linetype_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2960 _measure = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2961 _type = _measure.lineType |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2962 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
|
2963 cell_renderer.set_property("pixbuf",self.__normalline_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2964 elif _type == 1: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
2965 cell_renderer.set_property("pixbuf",self.__parcialline_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2966 elif _type == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2967 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
|
2968 self.__acumulatedline_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2969 else: #elif _type == 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2970 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
|
2971 self.__calculatedline_icon) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2972 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2973 elif column is self.__comment_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2974 _measure = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2975 _comment = str(_measure.comment) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2976 cell_renderer.set_property('text', _comment) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2977 elif column is self.__units_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2978 _measure = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2979 _units = _measure.units |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2980 if isinstance(_units, float): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2981 _DN = self.__budget.getDecimals("DN") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2982 _units = ("%." + str(_DN) + "f" ) % _units |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2983 cell_renderer.set_property('text', _units) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2984 elif column is self.__length_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2985 _measure = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2986 _length = _measure.length |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2987 if isinstance(_length, float): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2988 _DD = self.__budget.getDecimals("DD") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2989 _length = ("%." + str(_DD) + "f" ) % _length |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2990 cell_renderer.set_property('text', _length) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2991 elif column is self.__width_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2992 _measure = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2993 _width = _measure.width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2994 if isinstance(_width, float): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2995 _DD = self.__budget.getDecimals("DD") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2996 _width = ("%." + str(_DD) + "f" ) % _width |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2997 cell_renderer.set_property('text', _width) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2998 elif column is self.__height_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2999 _measure = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3000 _height = _measure.height |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3001 if isinstance(_height, float): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3002 _DD = self.__budget.getDecimals("DD") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3003 _height = ("%." + str(_DD) + "f" ) % _height |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3004 cell_renderer.set_property('text', _height) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3005 elif column is self.__formula_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3006 _measure = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3007 _formula = _measure.formula |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3008 cell_renderer.set_property('text', _formula) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3009 elif column is self.__parcial_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3010 _measure_line = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3011 _parcial = _measure_line.parcial |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3012 _type = _measure_line.lineType |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3013 if _type == 1 or _type == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3014 _parcial = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3015 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3016 if isinstance(_parcial, float): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3017 _DS = self.__budget.getDecimals("DS") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3018 _parcial = ("%." + str(_DS) + "f" ) % _parcial |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3019 cell_renderer.set_property('text', _parcial) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3020 elif column is self.__subtotal_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3021 _measure_line = tree_model[_row_path][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3022 _type = _measure_line.lineType |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3023 if _type == 1 or _type == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3024 if _type == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3025 _color = gtk.gdk.color_parse( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3026 globalVars.color["SUBTOTAL-PARCIAL"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3027 _subtotal = _measure_line.parcial_subtotal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3028 else: #elif _type == 2: |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3029 _color = gtk.gdk.color_parse(globalVars.color["SUBTOTAL"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3030 _subtotal = _measure_line.acumulated_subtotal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3031 lcolor = [_color, _color] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3032 if isinstance(_subtotal, float): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3033 _DS = self.__budget.getDecimals("DS") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3034 _subtotal= ("%." + str(_DS) + "f" ) % _subtotal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3035 cell_renderer.set_property('text', _subtotal) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3036 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3037 cell_renderer.set_property('text', "") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3038 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3039 if self.__treeview.get_cursor() == (_row_path,column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3040 cell_renderer.set_property('cell-background-gdk', |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3041 gtk.gdk.color_parse(globalVars.color["ACTIVE"])) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3042 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3043 cell_renderer.set_property('cell-background-gdk', |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3044 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3045 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3046 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
|
3047 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3048 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3049 it deletes the __budget value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3050 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3051 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3052 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3053 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3054 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3055 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3056 return the main widget (gtk.ScrolledWindow) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3057 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3058 return self.__scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3059 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3060 def _getPath(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3061 """_getPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3062 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3063 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
|
3064 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3065 return self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3066 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3067 def _setPath(self, path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3068 """_setPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3069 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3070 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
|
3071 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3072 self.__path = path |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3073 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3074 def _getPage(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3075 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3076 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3077 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3078 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3079 return self.__page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3080 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3081 def _setPage(self,page): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3082 """_setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3083 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3084 set the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3085 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3086 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3087 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3088 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3089 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3090 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3091 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3092 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3093 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3094 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3095 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3096 """getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3097 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3098 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3099 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3100 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3101 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3102 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3103 "Pane configuration list") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3104 path = property(_getPath, _setPath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3105 "Path that identifies 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
|
3106 page = property(_getPage, _setPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3107 "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
|
3108 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3109 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3110 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3111 "Active Code") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3112 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3113 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3114 class Description(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3115 """gui.Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3116 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3117 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3118 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
|
3119 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3120 Description(budget, code) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3121 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
|
3122 code: record code |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3123 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3124 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3125 +-- Description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3126 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3127 widget: the main widget (gtk.ScrolledWindow object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3128 path: the tuple that identifies the pane in the notebook page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3129 budget: The budget (base.obra objetc) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3130 active_path_record: The active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3131 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3132 runMessage |
1
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 # TODO: make standar: "DecompositonList and Description" |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3135 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3136 def __init__(self, budget, page, path, path_record=(0,)): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3137 """__init__(budget, page, path, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3138 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3139 budget: the budget (base.obra object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3140 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3141 path: the path position of the description in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3142 path_record: the path of the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3143 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3144 self.__budget: the budget (base.obra object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3145 self.__page: weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3146 self.__path: the path position of the description in the page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3147 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
|
3148 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3149 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
|
3150 the record text. |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3151 self.__label: The gtk.label with the title of the pane |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3152 self.__widget: the main pane widget, a gtk.ScrolledWindow() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3153 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3154 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
|
3155 of the record to be showed in a pane. |
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 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3158 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3159 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3160 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3161 _budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3162 _text = _budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3163 self.__active_path_record)).text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3164 _scrollwindow = gtk.ScrolledWindow() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3165 _scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3166 gtk.POLICY_AUTOMATIC) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3167 _textview = gtk.TextView() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3168 _textview.set_wrap_mode(gtk.WRAP_WORD) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3169 self.__textbuffer = _textview.get_buffer() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3170 self.__textbuffer.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3171 _textview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3172 _hbox = gtk.HBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3173 _hbox.pack_start(_textview, True, True, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3174 _hbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3175 _vbox = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3176 self.__label = gtk.Label(utils.mapping(_("Description text of the "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3177 "record $1"), (self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3178 self.__active_path_record),))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3179 self.__label.set_alignment(0, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3180 self.__label.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3181 _vbox.pack_start(self.__label, False, False, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3182 _vbox.pack_start(_hbox, True, True, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3183 _vbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3184 _scrollwindow.add_with_viewport(_vbox) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3185 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3186 self.__widget = _scrollwindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3187 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3188 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3189 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
|
3190 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3191 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3192 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3193 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
|
3194 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3195 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3196 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3197 _code = _budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3198 self.__label.set_text(utils.mapping(_("Description text of the record "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3199 "$1"), (_code,))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3200 _text = _budget.getRecord(_code).text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3201 self.__textbuffer.set_text(_text) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3202 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3203 def runMessage(self, message, 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
|
3204 """runMessage(message, path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3205 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3206 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3207 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3208 "clear": clear instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3209 path: tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3210 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3211 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3212 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3213 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
|
3214 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3215 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3216 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3217 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
|
3218 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3219 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3220 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3221 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3222 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
|
3223 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3224 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3225 Delete all instance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3226 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3227 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3228 del self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3229 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3230 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3231 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3232 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3233 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3234 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3235 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3236 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3237 return the main widget (gtk.ScrolledWindow) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3238 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3239 return self.__widget |
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 def _getPath(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3242 """_getPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3243 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3244 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
|
3245 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3246 return self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3247 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3248 def _setPath(self, path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3249 """_setPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3250 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3251 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
|
3252 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3253 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3254 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3255 def _getPage(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3256 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3257 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3258 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3259 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3260 return self.__page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3261 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3262 def _setPage(self, page): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3263 """_setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3264 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3265 set the weak reference from Page instance |
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 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3268 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3269 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3270 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3271 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3272 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3273 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3274 return self.__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 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3277 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3278 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3279 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3280 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3281 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3282 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3283 path = property(_getPath, _setPath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3284 "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
|
3285 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3286 "The main widget (gtk.ScrolledWindow)") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3287 page = property(_getPage, _setPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3288 "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
|
3289 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3290 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3291 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3292 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3293 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3294 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3295 class Sheet(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3296 """gui.Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3297 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3298 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3299 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
|
3300 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3301 Sheet(budget, code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3302 budget: budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3303 code: code record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3304 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3305 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3306 +-- Sheet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3307 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3308 widget: the main widget (gtk.VBox() object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3309 path: the tuple that identifies the pane in the notebook page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3310 page: weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3311 budget: The budget (base.obra objetc) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3312 active_path_record: The active path record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3313 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3314 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3315 """ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3316 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3317 def __init__(self, budget, page, path, path_record=(0,)): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3318 """__init__(budget, page, path, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3319 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3320 budget: the budget (base.obra object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3321 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3322 path: the path position of the description in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3323 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
|
3324 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3325 self.__budget: the budget (base.obra object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3326 self.__page: weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3327 self.__path: the path position of the description in the page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3328 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
|
3329 self.__label: The gtk.label with the title of the pane |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3330 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
|
3331 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
|
3332 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
|
3333 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
|
3334 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
|
3335 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
|
3336 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
|
3337 the record text. |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3338 self.__widget: main widget, a gtk.VBox() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3339 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3340 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
|
3341 of the record to be showed in a pane. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3342 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3343 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3344 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3345 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3346 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3347 _budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3348 _main_box = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3349 self.__label = gtk.Label(utils.mapping(_("Sheet of Conditions of the "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3350 "record $1"), (self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3351 self.__active_path_record),))) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3352 self.__label.set_alignment(0, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3353 self.__label.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3354 _frame = gtk.Frame() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3355 _frame.set_shadow_type(gtk.SHADOW_IN) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3356 _frame_box = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3357 _list_box = gtk.HBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3358 self.__field_liststore = gtk.ListStore(str, str) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3359 self.__field_treeview = gtk.TreeView(self.__field_liststore) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3360 _field_treeselection = self.__field_treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3361 _field_treeselection.set_mode(gtk.SELECTION_SINGLE) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3362 self.__field_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3363 _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
|
3364 self._field_controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3365 self.__field_treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3366 _fieldcode_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3367 _field_column = gtk.TreeViewColumn(_("Field")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3368 _field_column.pack_start(_fieldcode_cell, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3369 _field_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3370 _field_column.pack_end(_field_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3371 _field_column.add_attribute(_fieldcode_cell, "text", 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3372 _field_column.add_attribute(_field_cell, "text", 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3373 self.__field_treeview.append_column(_field_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3374 _field_scrollwindow = gtk.ScrolledWindow() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3375 _field_scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3376 gtk.POLICY_AUTOMATIC) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3377 _field_scrollwindow.add(self.__field_treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3378 _field_scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3379 self.__section_liststore = gtk.ListStore(str, str) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3380 self.__section_treeview = gtk.TreeView(self.__section_liststore) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3381 _section_treeselection = self.__section_treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3382 _section_treeselection.set_mode(gtk.SELECTION_SINGLE) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3383 self.__section_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3384 _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
|
3385 self._section_controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3386 self.__section_treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3387 _sectioncode_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3388 _section_column = gtk.TreeViewColumn(_("Section")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3389 _section_column.pack_start(_sectioncode_cell, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3390 _section_column.add_attribute(_sectioncode_cell, "text", 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3391 _section_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3392 _section_column.pack_end(_section_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3393 _section_column.add_attribute(_section_cell, "text", 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3394 self.__section_treeview.append_column(_section_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3395 _section_scrollwindow = gtk.ScrolledWindow() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3396 _section_scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3397 gtk.POLICY_AUTOMATIC) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3398 _section_scrollwindow.add(self.__section_treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3399 _section_scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3400 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3401 _list_box.pack_start(_field_scrollwindow, True, True, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3402 _list_box.pack_start(_section_scrollwindow, True, True, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3403 _list_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3404 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3405 _scrollwindow = gtk.ScrolledWindow() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3406 _scrollwindow.set_policy(gtk.POLICY_AUTOMATIC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3407 gtk.POLICY_AUTOMATIC) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3408 _textview = gtk.TextView() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3409 _textview.set_wrap_mode(gtk.WRAP_WORD) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3410 self.__textbuffer = _textview.get_buffer() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3411 _textview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3412 _hbox = gtk.HBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3413 _hbox.pack_start(_textview, True, True, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3414 _hbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3415 _frame_box.pack_start(self.__label, False, False, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3416 _frame_box.pack_start(_list_box, False, False, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3417 _frame_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3418 _frame.add(_frame_box) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3419 _frame.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3420 _main_box.pack_start(_frame, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3421 _vbox = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3422 _vbox.pack_start(_hbox, True, True, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3423 _vbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3424 _main_box.pack_start(_scrollwindow, True, True, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3425 _main_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3426 _scrollwindow.add_with_viewport(_vbox) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3427 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3428 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
|
3429 self._setFields() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3430 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3431 def _setFields(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3432 """_setFields() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3433 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3434 Set the fields items in the field treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3435 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3436 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3437 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3438 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3439 _field_list = _sheet.getFields() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3440 self.__field_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3441 for _field in _field_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3442 _field_text = self.__budget.getSheetField(_field) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3443 _iter = self.__field_liststore.append([_field, _field_text]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3444 _treeselection = self.__field_treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3445 _treeselection.select_path(0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3446 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3447 def _setSection(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3448 """_setSection() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3449 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3450 Set the section items in the section treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3451 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3452 self.__section_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3453 if not self.__field_selection is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3454 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3455 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3456 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3457 _section_list = _sheet.getSections(self.__field_selection) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3458 for _section in _section_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3459 _section_text = self.__budget.getSheetSection(_section) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3460 _iter = self.__section_liststore.append([_section, _section_text]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3461 _treeselection = self.__section_treeview.get_selection() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3462 _treeselection.select_path(0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3463 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3464 def _setText(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3465 """_setText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3466 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3467 Set the text in the textview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3468 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3469 if not self.__section_selection is None and\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3470 not self.__field_selection is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3471 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3472 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3473 _sheet = _record.getSheet() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3474 _paragraph_code = _sheet.getParagraph(self.__field_selection, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3475 self.__section_selection) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3476 _paragraph = self.__budget.getSheetParagraph(_paragraph_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3477 self.__textbuffer.set_text(_paragraph) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3478 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3479 self.__textbuffer.set_text("") |
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 _field_controlSelection(self, selection): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3482 """_controlSelection(selection) |
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 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3485 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3486 Method connected to set_selection_function() in field treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3487 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
|
3488 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3489 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3490 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
|
3491 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3492 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3493 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
|
3494 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
|
3495 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3496 _treeiter = self.__field_liststore.get_iter(selection) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3497 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
|
3498 self._setSection() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3499 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3500 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3501 def _section_controlSelection(self, selection): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3502 """_section_controlSelection(selection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3503 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3504 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3505 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3506 Method connected to set_selection_function() in sector treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3507 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
|
3508 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3509 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3510 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
|
3511 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3512 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3513 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
|
3514 section in showed |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3515 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3516 _treeiter = self.__section_liststore.get_iter(selection) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3517 self.__section_selection = self.__section_liststore.get_value(_treeiter, 0) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3518 self._setText() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3519 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3520 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3521 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
|
3522 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3523 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3524 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3525 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3526 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
|
3527 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3528 self.__field_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3529 self.__field_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3530 self.__section_selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3531 self.__section_liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3532 self.__textbuffer.set_text("") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3533 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3534 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3535 _code = _budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3536 self.__label.set_text(utils.mapping(_("Sheet2 of Conditions of the "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3537 "record $1"), (_code,))) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3538 self._setFields() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3539 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3540 def runMessage(self, message, 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
|
3541 """runMessage(message, path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3542 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3543 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3544 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3545 "clear": clear instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3546 path: tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3547 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3548 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3549 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3550 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
|
3551 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3552 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3553 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3554 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
|
3555 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3556 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3557 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3558 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3559 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
|
3560 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3561 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3562 Deletes all the instance atributes |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3563 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3564 del self.__page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3565 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3566 del self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3567 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3568 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3569 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3570 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3571 del self.__textbuffer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3572 del self.__label |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3573 del self.__field_liststore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3574 del self.__field_treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3575 del self.__field_selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3576 del self.__section_liststore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3577 del self.__section_treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3578 del self.__section_selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3579 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3580 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3581 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3582 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3583 return the main widget (gtk.ScrolledWindow) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3584 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3585 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3586 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3587 def _getPath(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3588 """_getPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3589 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3590 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
|
3591 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3592 return self.__page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3593 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3594 def _setPath(self, path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3595 """_setPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3596 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3597 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
|
3598 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3599 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3600 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3601 def _getPage(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3602 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3603 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3604 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3605 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3606 return self.__page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3607 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3608 def _setPage(self, page): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3609 """_setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3610 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3611 set the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3612 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3613 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3614 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3615 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3616 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3617 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3618 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3619 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3620 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3621 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3622 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3623 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3624 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3625 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3626 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3627 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3628 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3629 path = property(_getPath, _setPath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3630 "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
|
3631 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3632 "Lista de configuracion de vistas") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3633 page = property(_getPage, _setPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3634 "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
|
3635 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3636 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3637 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3638 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3639 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3640 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3641 class FileView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3642 """gui.FileView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3643 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3644 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3645 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
|
3646 Constructor: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3647 Description(budget, page, path, path_record=(0,)) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3648 budget: the budget (base.obra object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3649 page: weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3650 path: the path position of the description in the page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3651 path_record: the path of the active record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3652 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3653 +-- object |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3654 +-- FileView |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3655 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3656 widget: the main widget (gtk.ScrolledWindow object) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3657 "path": 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
|
3658 "budget": The budget (base.obra objetc) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3659 "active_code": The active code of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3660 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3661 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3662 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3663 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3664 def __init__(self, budget, page, path, path_record=(0,)): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3665 """__init__(budget, page, path, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3666 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3667 budget: the budget (base.obra object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3668 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3669 path: the path position of the description in the page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3670 path_record: the path of the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3671 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3672 self.__budget: the budget (base.obra object) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3673 self.__page: weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3674 self.__path: the path position of the description in the page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3675 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
|
3676 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
|
3677 self.__icon_box: the box that contains the icon |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3678 self.__widget: main widget, a gtk.ScrolledWindow |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3679 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3680 Creates an shows the scroledwindow that contain icon files |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3681 of the record to be showed in a pane. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3682 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3683 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3684 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3685 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3686 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3687 self.__active_code = budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3688 _budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3689 _record = self.__budget.getRecord(self.__budget.getCode( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3690 self.__active_path_record)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3691 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3692 self.__icon_box = self._getIconBox(_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3693 _scrollwindow = gtk.ScrolledWindow() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3694 _scrollwindow.set_policy(gtk.POLICY_ALWAYS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3695 gtk.POLICY_NEVER) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3696 self.__icon_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3697 _scrollwindow.add_with_viewport(self.__icon_box) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3698 _scrollwindow.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3699 self.__widget = _scrollwindow |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3700 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3701 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
|
3702 """_getIconBox(record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3703 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3704 record: the active record object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3705 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3706 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
|
3707 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3708 ## TODO: add others filetypes: avi, pdf, ppt... |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3709 _files = record.getFiles() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3710 _hbox = gtk.HBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3711 _frame = gtk.Frame() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3712 _frame.set_shadow_type(gtk.SHADOW_IN) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3713 for _file in _files: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3714 _path = os.path.dirname(self.__budget.filename) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3715 _file_path = os.path.join(_path, _file.name) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3716 _filetype = utils.getFiletype(_file_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3717 _box = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3718 if _filetype == "image": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3719 _event_box = gtk.EventBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3720 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3721 _image_pixbuf = gtk.gdk.pixbuf_new_from_file(_file_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3722 _image_pixbuf = _image_pixbuf.scale_simple(64, 64, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3723 gtk.gdk.INTERP_BILINEAR) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3724 except: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3725 _image_pixbuf = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3726 globalVars.getAppPath("IMAGE-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3727 _image_pixbuf = _image_pixbuf.scale_simple(64, 64, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3728 gtk.gdk.INTERP_BILINEAR) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3729 _image_icon = gtk.Image() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3730 _image_icon.set_from_pixbuf(_image_pixbuf) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3731 _image_icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3732 _event_box.add(_image_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3733 _box.pack_start(_event_box, False, False, 5) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3734 _event_box.connect("button-press-event", self._launchFile, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3735 "image", _file_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3736 _event_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3737 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3738 elif _filetype == "dxf": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3739 _event_box = gtk.EventBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3740 _dxf_icon = gtk.Image() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3741 _dxf_pixbuf = gtk.gdk.pixbuf_new_from_file( |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3742 globalVars.getAppPath("DXF-ICON")) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3743 _dxf_pixbuf = _dxf_pixbuf.scale_simple(64, 64, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3744 gtk.gdk.INTERP_BILINEAR) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3745 _dxf_icon.set_from_pixbuf(_dxf_pixbuf) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3746 _dxf_icon.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3747 _event_box.add(_dxf_icon) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3748 _box.pack_start(_event_box, False, False, 5) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3749 _event_box.connect("button-press-event", self._launchFile, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3750 "dxf", _file_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3751 _event_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3752 _label_event_box = gtk.EventBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3753 _label = gtk.Label(_file.name) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3754 _label_event_box.add(_label) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3755 _label_event_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3756 _label.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3757 _box.pack_start(_label_event_box, False, False, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3758 _box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3759 _hbox.pack_start(_box, False, False, 5) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3760 _hbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3761 _frame.add(_hbox) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3762 return _frame |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3763 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3764 def _launchFile(self, widget, event, kind, file_path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3765 """_launchFile(widget, event, kind, file_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3766 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3767 widget: the widget that emit the signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3768 event: the event that emit the signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3769 king: kind of file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3770 file_path: the path file to be launch |
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 Launch the file if a double click emit the signal. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3773 Method connected to "button-press-event" signal in images event box |
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 if event.type is gtk.gdk._2BUTTON_PRESS: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3776 openwith.launch_file(kind, file_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3777 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3778 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
|
3779 """_setActivePathRecord(path_record)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3780 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3781 path_record: active path record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3782 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
|
3783 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3784 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3785 self.__active_path_record = path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3786 _code = _budget.getCode(self.__active_path_record) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3787 _record = self.__budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3788 self.__icon_box.destroy() |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3789 self.__icon_box = self._getIconBox(_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3790 self.__icon_box.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3791 self.__widget.add_with_viewport(self.__icon_box) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3792 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3793 def runMessage(self, message, 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
|
3794 """runMessage(message, path, arg=None) |
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 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3797 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3798 "clear": clear instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3799 path: tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3800 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3801 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3802 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3803 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
|
3804 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3805 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3806 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3807 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
|
3808 self._setActivePathRecord(arg) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3809 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3810 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3811 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3812 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
|
3813 """_clear() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3814 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3815 Delete all instance atributes |
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 del self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3818 del self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3819 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3820 del self.__active_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3821 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3822 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3823 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3824 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3825 return the main widget (gtk.ScrolledWindow) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3826 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3827 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3828 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3829 def _getPath(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3830 """_getPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3831 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3832 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
|
3833 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3834 return self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3835 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3836 def _setPath(self, path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3837 """_setPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3838 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3839 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
|
3840 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3841 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3842 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3843 def _getPage(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3844 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3845 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3846 return the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3847 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3848 return self.__page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3849 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3850 def _setPage(self, page): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3851 """setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3852 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3853 set the weak reference from Page instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3854 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3855 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3856 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3857 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3858 """getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3859 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3860 return the budget object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3861 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3862 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3863 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3864 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3865 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3866 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3867 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3868 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3869 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3870 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3871 path = property(_getPath, _setPath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3872 "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
|
3873 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3874 "The main widget (gtk.ScrolledWindow)") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3875 page = property(_getPage, _setPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3876 "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
|
3877 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3878 "Budget object") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3879 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3880 "Active Path Record") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3881 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3882 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3883 class CompanyView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3884 """gui.CompanyView: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3885 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3886 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3887 Class to show the company records of a budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3888 Constructor: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3889 CompanyView(budget, page, path, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3890 budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3891 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3892 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
|
3893 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
|
3894 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3895 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3896 +-- CompanyView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3897 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3898 active_path_record: Read. 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
|
3899 widget: Read. Window that contains the main widget, a gtk.HPaned |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3900 path: Read-Write. Pane page identifier |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3901 page: Read-Write. weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3902 budget: Read. Budget to show, base.budget instance. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3903 Methods: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3904 runMessage |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3905 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3906 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3907 def __init__(self, budget, page, path, path_record=(0,)): |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3908 """__init__(budget, page, path, path_record=(0,)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3909 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3910 budget: budget: budget showed ("base.Budget" object) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3911 page: weak reference from Page instance which creates this class |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3912 path: tuple that represents the path of the List in the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3913 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
|
3914 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3915 self.__selection: |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3916 self.__budget: 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
|
3917 self.__page: weak reference from Page instance which creates this class |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3918 self.__path: tuple that represents the path of the List in the Page |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3919 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
|
3920 self.__widget: main widget, a gtk.HPaned |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3921 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
|
3922 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
|
3923 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3924 Creates an shows the scroledwindow that contain the company data. |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3925 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3926 self.__selection = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3927 # Seting init args |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3928 if not isinstance(budget, base.Budget): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3929 raise ValueError, _("Argument must be a Budget object") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3930 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3931 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3932 self.__path = path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3933 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
|
3934 # main widget |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3935 self.__widget = gtk.HPaned() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3936 self.__widget.set_position(230) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3937 # TreeStore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3938 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
|
3939 self._setTreeStoreValues() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3940 # Select Treeview |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3941 _select_treeview = gtk.TreeView(self.__treestore) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3942 _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
|
3943 _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
|
3944 _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
|
3945 _select_treeview.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3946 # Scrolled_window |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3947 _scrolled_window = gtk.ScrolledWindow() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3948 _scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3949 gtk.POLICY_AUTOMATIC) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3950 _scrolled_window.add(_select_treeview) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3951 # colors |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3952 _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3953 _background_color = [ |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3954 gtk.gdk.color_parse(globalVars.color["UNEVEN"]), |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
3955 gtk.gdk.color_parse(globalVars.color["EVEN"])] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3956 _code_column = gtk.TreeViewColumn() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3957 _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
|
3958 _code_column.set_fixed_width(200) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3959 _code_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3960 _code_cell.set_property('foreground-gdk', _text_color) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3961 _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
|
3962 _code_column.add_attribute(_code_cell, 'text', 0) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3963 _summary_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3964 _summary_cell.set_property('foreground-gdk', _text_color) |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3965 _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
|
3966 _code_column.add_attribute(_summary_cell, 'text', 1) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3967 # Index column |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3968 _select_treeview.append_column(_code_column) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3969 # control selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3970 _treeselection = _select_treeview.get_selection() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3971 _treeselection.set_mode(gtk.SELECTION_SINGLE) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3972 _treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3973 # Show |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3974 _scrolled_window.show() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3975 # Option View |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3976 self.__option_View = OptionView("") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3977 # Selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3978 _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
|
3979 _select_treeview.grab_focus() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3980 # |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3981 self.__widget.add1(_scrolled_window) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3982 self.__widget.add2(self.__option_View.widget) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3983 self.__widget.show() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3984 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3985 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
|
3986 """_setOptions(type) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3987 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
3988 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
|
3989 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
|
3990 """ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3991 if type == "company": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3992 _options = [("code", _("Code"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3993 _("""Code that define the company""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3994 ("summary", _("Summary"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3995 _("""Summary of the company name""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3996 ("name", _("Name"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3997 _("""Complete name""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3998 ("cif", _("CIF"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3999 _("""Fiscal identifier number""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4000 ("web", _("Web"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4001 _("""Company web page""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4002 ("email", _("Email"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4003 _("""Company email""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4004 ] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4005 self.__option_View.options = _options |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4006 elif type == "office": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4007 _options = [("type", _("Type"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4008 _("""Type of Office: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4009 C: Central office |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4010 D: Local office |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4011 R: Performer""")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4012 ("subname", _("Name"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4013 _("Office name")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4014 ("address", _("Address"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4015 ("postal code", _("Postal code"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4016 ("town", _("Town"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4017 ("province", _("Province"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4018 ("country", _("Country"), "string",""), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4019 ("phone", _("Phone"), "list", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4020 _("Phone numbers of the office")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4021 ("fax", _("Fax"), "list", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4022 _("Fax numbers of the office")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4023 ("contact person", _("Contact person"), "string", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4024 _("Contact persons in the office")), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4025 ] |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4026 self.__option_View.options = _options |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4027 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4028 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
|
4029 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4030 def _setTreeStoreValues(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4031 """_setTreeStoreValues() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4032 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4033 Sets the treestore values from the budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4034 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4035 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4036 _company_keys = _budget.getCompanyKeys() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4037 for _company_key in _company_keys: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4038 _company = _budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4039 _values = [_company_key, _company.summary] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4040 _treeiter = self.__treestore.append(None, _values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4041 _offices = _company.offices |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4042 for _office in _offices: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4043 # TODO: Test offices |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4044 _values = [_office.officeType, _office.subname] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4045 self.__treestore.append(_treeiter, _values) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4046 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4047 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4048 def _controlSelection(self, selection): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4049 """_controlSelection(selection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4050 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4051 selection: selection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4052 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4053 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4054 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
|
4055 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4056 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4057 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
|
4058 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4059 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4060 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
|
4061 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4062 if len(selection) == 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4063 # The selection is a company |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4064 _company_key = self.__treestore[selection][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4065 _company = self.__budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4066 _selection = "company" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4067 _values = _company.values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4068 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4069 # The selection is a office |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4070 _company_key = self.__treestore[selection[:1]][0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4071 _company = self.__budget.getCompany(_company_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4072 _selection = "office" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4073 _office = _company.offices[selection[1]] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4074 _values = _office.values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4075 if not self.__selection == _selection: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4076 self.__selection = _selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4077 self.options = _selection |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4078 self.__option_View.values = _values |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4079 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4080 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4081 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4082 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
|
4083 """_showMessageRecord(record_path) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4084 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4085 record_path: the path of the record to show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4086 Method connected to "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4087 Show the record especified in the "change_active" message |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4088 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4089 self.__active_path_record = record_path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4090 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4091 def runMessage(self, message, 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
|
4092 """runMessage(message, path, arg=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4093 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4094 message: the message type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4095 "change_active": change the active record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4096 "clear": clear instance |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4097 path: tuple that identifies the pane in the notebook page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4098 arg: tuple whit two items: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4099 0: record path in the budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4100 1: record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4101 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
|
4102 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4103 _budget = self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4104 if message == "change_active": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4105 if _budget.hasPath(arg): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4106 _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
|
4107 self._showMessageRecord( _path_record) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4108 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4109 elif message == "clear": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4110 self._clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4111 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4112 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
|
4113 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4114 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4115 column: the gtk.TreeViewColumn in the treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4116 cell_renderer: a gtk.CellRenderer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4117 tree_model: the gtk.TreeModel |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4118 iter: gtk.TreeIter pointing at the row |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4119 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
|
4120 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4121 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
|
4122 The set_cell_data_func() method sets the data function (or method) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4123 to use for the column gtk.CellRenderer specified by cell_renderer. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4124 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
|
4125 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
|
4126 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
|
4127 current data function. The signature of func is: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4128 -def celldatafunction(column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4129 -def celldatamethod(self, column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4130 where column is the gtk.TreeViewColumn in the treeview, cell is the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4131 gtk.CellRenderer for column, model is the gtk.TreeModel for the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4132 treeview and iter is the gtk.TreeIter pointing at the row. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4133 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4134 The method sets cell background color for all columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4135 and text for index and amount columns. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4136 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4137 _row_path = tree_model.get_path(iter) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4138 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4139 if column is self.__index_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4140 cell_renderer.set_property('text', str(_number + 1)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4141 self.__index_column.get_cell_renderers()[1].set_property( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4142 'cell-background-gdk', lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4143 if self.__treeview.get_cursor() == (_row_path,column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4144 cell_renderer.set_property('cell-background-gdk', |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
4145 gtk.gdk.color_parse(globalVars.color["ACTIVE"])) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4146 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4147 cell_renderer.set_property('cell-background-gdk', |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4148 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4149 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4150 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
|
4151 """_clear() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4152 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4153 it deletes the self.__budget value |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4154 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4155 del self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4156 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4157 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4158 """_getWidget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4159 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4160 return the main widget (gtk.ScrolledWindow) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4161 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4162 return self.__widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4163 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4164 def _getPath(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4165 """_getPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4166 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4167 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
|
4168 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4169 return self.__path |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4170 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4171 def _setPath(self, path): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4172 """_setPath() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4173 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4174 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
|
4175 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4176 self.__path = path |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4177 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4178 def _getPage(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4179 """_getPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4180 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4181 return the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4182 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4183 return self.__page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4184 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4185 def _setPage(self,page): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4186 """_setPage() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4187 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4188 set the Page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4189 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4190 self.__page = page |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4191 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4192 def _getBudget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4193 """_getBudget() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4194 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4195 return the Budget objet |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4196 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4197 return self.__budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4198 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4199 def _getActivePathRecord(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4200 """_getActivePathRecord() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4201 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4202 return the Active Path Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4203 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4204 return self.__active_path_record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4205 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4206 active_path_record = property(_getActivePathRecord, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4207 "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
|
4208 widget = property(_getWidget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4209 "main widget") |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4210 path = property(_getPath, _setPath, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4211 "Path that identifies 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
|
4212 page = property(_getPage, _setPage, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4213 "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
|
4214 budget = property(_getBudget, None, None, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4215 "Budget object") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4216 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4217 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4218 class OptionView(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4219 """gui.OptionView: |
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 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4222 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
|
4223 and "Type" to show and edit Options |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4224 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4225 OptionView(option_list) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4226 option_list: list of options |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4227 (option_name, type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4228 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4229 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4230 +-- OptionView |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4231 Atributes: |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4232 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
|
4233 options: Write |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4234 values: Write |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4235 Methods: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4236 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4237 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4238 def __init__(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
|
4239 """__init__(option_list) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4240 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4241 self.__option_dict: |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4242 {"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
|
4243 "option_description"]} |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4244 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
|
4245 self.__option_types: valid option types list |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4246 self.__liststore: gtk.ListStore |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4247 self.__treeview: gtk.TreeView |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4248 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
|
4249 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
|
4250 self.__type_column: type column |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4251 self.__description_label: gtk.Label |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4252 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
|
4253 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4254 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
|
4255 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4256 self.__option_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4257 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
|
4258 self.__option_types = {"boolean" : _("Boolean"), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4259 "integer": _("Integer"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4260 "string": _("Text"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4261 "color" : _("Color"), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4262 "list" : _("List")} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4263 # ListStore |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4264 self.__liststore = gtk.ListStore(str, str, str, str, str) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4265 # Treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4266 self.__treeview = gtk.TreeView(self.__liststore) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4267 self.__treeview.set_enable_search(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4268 self.__treeview.set_reorderable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4269 self.__treeview.set_headers_clickable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4270 # vbox |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4271 _vbox = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4272 # Scrolled_window |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4273 _scrolled_window = gtk.ScrolledWindow() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4274 _scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4275 gtk.POLICY_AUTOMATIC) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4276 _scrolled_window.add(self.__treeview) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4277 _scrolled_window.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4278 _vbox.pack_start(_scrolled_window) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4279 # colors |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
4280 _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4281 _background_color = [ |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
4282 gtk.gdk.color_parse(globalVars.color["UNEVEN"]), |
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
4283 gtk.gdk.color_parse(globalVars.color["EVEN"])] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4284 # Option Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4285 self.__option_column = gtk.TreeViewColumn() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4286 self.__option_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4287 self.__option_column.set_fixed_width(150) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4288 self.__option_column.set_resizable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4289 _option_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4290 _option_cell.set_property('foreground-gdk', _text_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4291 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
|
4292 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
|
4293 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4294 self.__option_column.set_title(_("Option name")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4295 self.__option_column.add_attribute(_option_cell, 'text', 1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4296 self.__treeview.append_column(self.__option_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4297 # Value Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4298 self.__value_column = gtk.TreeViewColumn() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4299 self.__value_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4300 self.__value_column.set_fixed_width(275) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4301 self.__value_column.set_resizable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4302 _value_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4303 _value_cell.set_property('foreground-gdk', _text_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4304 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
|
4305 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
|
4306 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4307 self.__value_column.set_title(_("Value")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4308 self.__value_column.add_attribute(_value_cell, 'text', 2) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4309 self.__treeview.append_column(self.__value_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4310 # Type Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4311 self.__type_column = gtk.TreeViewColumn() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4312 self.__type_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4313 self.__type_column.set_fixed_width(70) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4314 self.__type_column.set_resizable(True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4315 _type_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4316 _type_cell.set_property('foreground-gdk', _text_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4317 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
|
4318 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
|
4319 _background_color) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4320 self.__type_column.set_title(_("Type")) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4321 self.__treeview.append_column(self.__type_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4322 # End Column |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4323 _end_column = gtk.TreeViewColumn() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4324 _end_column.set_clickable(False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4325 _end_cell = gtk.CellRendererText() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4326 _end_cell.set_property('cell-background-gdk', |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
4327 gtk.gdk.color_parse(globalVars.color["UNEVEN"])) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4328 _end_column.pack_start(_end_cell, True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4329 self.__treeview.append_column(_end_column) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4330 # Connect |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4331 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
|
4332 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
|
4333 self._treeviewClickedEvent) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4334 # control selection |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4335 _treeselection = self.__treeview.get_selection() |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4336 _treeselection.set_mode(gtk.SELECTION_MULTIPLE) |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4337 _treeselection.set_select_function(self._controlSelection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4338 # labels |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4339 _frame = gtk.Frame() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4340 _frame.set_shadow_type(gtk.SHADOW_OUT) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4341 _vbox2 = gtk.VBox() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4342 _frame.add(_vbox2) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4343 _alignement = gtk.Alignment(xalign=0, yalign=0, xscale=0, yscale=0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4344 _alignement.set_padding(0, 0, 12, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4345 _label = gtk.Label() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4346 _label.set_markup("<b>" + _("Description:") + "</b>") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4347 _label.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4348 _alignement.add(_label) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4349 _alignement.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4350 _alignement2 = gtk.Alignment(xalign=0, yalign=0, xscale=0, yscale=0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4351 _alignement2.set_padding(0, 0, 24, 0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4352 self.__description_label = gtk.Label() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4353 self.__description_label.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4354 _alignement2.add(self.__description_label) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4355 _alignement2.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4356 _vbox2.pack_start(_alignement, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4357 _vbox2.pack_start(_alignement2, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4358 _vbox2.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4359 _frame.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4360 _vbox.pack_start(_frame, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4361 # Show |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4362 self.__treeview.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4363 _vbox.show() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4364 self.__widget = _vbox |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4365 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4366 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
|
4367 """_treeviewKeyPressEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4368 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4369 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4370 event: Key Press event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4371 Method connected to "key-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4372 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
|
4373 on the keyboard. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4374 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
|
4375 Returns :FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4376 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4377 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
|
4378 value 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
|
4379 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
|
4380 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4381 (_cursor_path, _column) = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4382 if (event.keyval == gtk.keysyms.Right \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4383 and _column == self.__value_column) \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4384 or (event.keyval == gtk.keysyms.Left \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4385 and _column == self.__value_column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4386 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4387 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4388 _description = self.__liststore[_cursor_path][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4389 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4390 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4391 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4392 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
|
4393 """_treeviewClickedEvent(widget, event) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4394 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4395 widget: treewiew widget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4396 event: clicked event |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4397 Method connected to "button-press-event" signal |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4398 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
|
4399 pressed. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4400 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
|
4401 Returns FALSE to propagate the event further. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4402 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4403 The cursos is moved to value column. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4404 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4405 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
|
4406 int(event.y)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4407 if not path_at_pos is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4408 _path_cursor, _column, _x, _y = path_at_pos |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4409 _description = self.__liststore[_path_cursor][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4410 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4411 if _column == self.__value_column: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4412 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4413 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4414 self.__treeview.set_cursor(_path_cursor,self.__value_column, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4415 True) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4416 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4417 return True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4418 return True |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4419 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4420 def _controlSelection(self, selection): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4421 """_controlSelection(selection) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4422 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4423 selection: treeselection |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4424 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4425 Method connected to set_selection_function() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4426 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
|
4427 giving some control over which nodes are selected. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4428 The selection function should return TRUE if the state |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4429 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
|
4430 be left unchanged. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4431 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4432 Return False so none row is selected |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4433 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4434 return False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4435 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4436 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
|
4437 """_colorCell(column, cell_renderer, tree_model, iter, lcolor) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4438 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4439 column: the gtk.TreeViewColumn in the treeview |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4440 cell_renderer: a gtk.CellRenderer |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4441 tree_model: the gtk.TreeModel |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4442 iter: gtk.TreeIter pointing at the row |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4443 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
|
4444 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4445 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
|
4446 The set_cell_data_func() method sets the data function (or method) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4447 to use for the column gtk.CellRenderer specified by cell_renderer. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4448 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
|
4449 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
|
4450 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
|
4451 current data function. The signature of func is: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4452 -def celldatafunction(column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4453 -def celldatamethod(self, column, cell, model, iter, user_data) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4454 where column is the gtk.TreeViewColumn in the treeview, cell is the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4455 gtk.CellRenderer for column, model is the gtk.TreeModel for the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4456 treeview and iter is the gtk.TreeIter pointing at the row. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4457 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4458 The method sets cell background color for all columns |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4459 and text for type column. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4460 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4461 _row_path = tree_model.get_path(iter) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4462 _number = _row_path[-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4463 if self.__treeview.get_cursor() == (_row_path,column): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4464 cell_renderer.set_property('cell-background-gdk', |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
4465 gtk.gdk.color_parse(globalVars.color["ACTIVE"])) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4466 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4467 cell_renderer.set_property('cell-background-gdk', |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4468 lcolor[_number % 2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4469 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
|
4470 _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
|
4471 cell_renderer.set_property('text', _type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4472 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4473 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
|
4474 """_setOptions(option_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4475 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4476 option_list: list of tuples |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4477 (option, option name, type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4478 option: option identifier |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4479 option name: a string with the option name |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4480 Description: a string with the option description |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4481 type: can be "boolean" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4482 "integer" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4483 "string" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4484 "color" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4485 Sets the Options in the treeview rows |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4486 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4487 self.__option_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4488 self.__option_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4489 self.__liststore.clear() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4490 if isinstance(option_list, list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4491 for _option in option_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4492 if isinstance(_option, tuple) and len(_option) == 4: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4493 _option_key = _option[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4494 _option_name = _option[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4495 _option_type = _option[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4496 _option_description = _option[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4497 if isinstance(_option_key, str) and \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4498 (isinstance(_option_name, str) or\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4499 isinstance(_option_name, unicode))and \ |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4500 _option_type in self.__option_types.keys(): |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4501 self.__liststore.append([_option_key, _option_name, "", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4502 _option_type, _option_description]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4503 self.__option_dict[_option_key] = [_option_name, "", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4504 _option_type, _option_description] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4505 self.__option_list.append(_option_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4506 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4507 print _("Option values must be strings") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4508 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4509 print _("Option must be a tuple with 4 items") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4510 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4511 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
|
4512 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4513 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
|
4514 """_setValues(values) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4515 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4516 values: dictionary {option : value} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4517 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4518 Sets the Options values |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4519 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4520 if isinstance(values, dict): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4521 for _option, _value in values.iteritems(): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4522 if _option in self.__option_dict: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4523 _type = self.__option_dict[_option][2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4524 if _type == "boolean": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4525 if isinstance(_value, bool): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4526 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4527 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4528 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4529 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4530 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4531 print _("Icorrect type, must be boolean") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4532 elif _type == "integer": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4533 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4534 _value = int(_value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4535 except ValueError: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4536 print _("Icorrect type, must be integer") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4537 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4538 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4539 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4540 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4541 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4542 elif _type == "string": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4543 if isinstance(_value, str): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4544 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4545 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4546 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4547 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4548 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4549 print _("Icorrect type, must be string") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4550 elif _type == "list": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4551 if isinstance(_value, list): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4552 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4553 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4554 _str_value = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4555 for _item_value in _value: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4556 _str_value = _str_value + _item_value + "," |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4557 if _str_value[-1] == ",": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4558 _str_value = _str_value[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4559 self.__liststore.set_value(_iter, 2, _str_value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4560 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4561 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4562 print _("Icorrect type, must be list") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4563 elif _type == "color": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4564 if isinstance(_value, str): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4565 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4566 _color = gtk.gdk.color_parse(_value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4567 except ValueError: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4568 print _("Icorrect type, must be a parseable " \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4569 "color") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4570 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4571 _num = self.__option_list.index(_option) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4572 _iter = self.__liststore.get_iter((_num,)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4573 self.__liststore.set_value(_iter, 2, _value) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4574 self.__option_dict[_option][1] = _value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4575 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4576 print _("Type must be boolean, integer, string or "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4577 "color") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4578 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4579 print _("Value must be in the option dict") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4580 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4581 print _("Values must be a dict") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4582 self.__treeview.set_cursor((0),self.__value_column, False) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4583 self.__treeview.grab_focus() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4584 (_cursor_path, _column) = self.__treeview.get_cursor() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4585 _description = self.__liststore[_cursor_path][4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4586 self.__description_label.set_text(_description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4587 |
8
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4588 def _getWidget(self): |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4589 """_getWidget() |
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 return the main widget (gtk.ScrolledWindow) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4592 """ |
7
0359329a1c26
Navigation buttons. Version of the data structure.
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
6
diff
changeset
|
4593 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
|
4594 |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4595 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
|
4596 "main widget") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4597 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
|
4598 "values") |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4599 options = property(None, _setOptions, None, |
55df0b15706b
Docstrings and names in GTK/gui.py
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
4600 "options") |