Mercurial > pyarq-presupuestos
comparison Gtk/gui.py @ 10:d2cbc0278b30
bug fix: A except is raised when a user splits a pane, closes one of the new panes and splits again.
author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
---|---|
date | Fri, 19 Nov 2010 19:17:11 +0100 |
parents | 229986217a3d |
children | fe9c55f86698 |
comparison
equal
deleted
inserted
replaced
9:229986217a3d | 10:d2cbc0278b30 |
---|---|
862 pane_path: tuple that represents the pane pane_path which emits the message | 862 pane_path: tuple that represents the pane pane_path which emits the message |
863 arg: arguments for the message | 863 arg: arguments for the message |
864 | 864 |
865 Sends a message to a pane | 865 Sends a message to a pane |
866 """ | 866 """ |
867 if not pane.path == pane_path: | 867 if not pane.pane_path == pane_path: |
868 pane.runMessage(message, pane_path, arg) | 868 pane.runMessage(message, pane_path, arg) |
869 | 869 |
870 def close(self): | 870 def close(self): |
871 """close() | 871 """close() |
872 | 872 |
923 | 923 |
924 Splits the item that is identifies by the pane_path and the orientation | 924 Splits the item that is identifies by the pane_path and the orientation |
925 """ | 925 """ |
926 _item = self.getItem(pane_path) | 926 _item = self.getItem(pane_path) |
927 _parent = self.getItem(pane_path[:-1]) | 927 _parent = self.getItem(pane_path[:-1]) |
928 _item.path = pane_path + (0,) | 928 _item.pane_path = pane_path + (0,) |
929 _item_clone0 = _item.getClone(pane_path + (0,)) | 929 _item_clone0 = _item.getClone(pane_path + (0,)) |
930 _item_clone1 = _item.getClone(pane_path + (1,)) | 930 _item_clone1 = _item.getClone(pane_path + (1,)) |
931 _paned = Paned(orientation, pane_path, _item_clone0, _item_clone1) | 931 _paned = Paned(orientation, pane_path, _item_clone0, _item_clone1) |
932 if len(pane_path) > 1: | 932 if len(pane_path) > 1: |
933 _parent.setItem(pane_path[-1], [_paned]) | 933 _parent.setItem(pane_path[-1], [_paned]) |
1155 """gui.View: | 1155 """gui.View: |
1156 | 1156 |
1157 Description: | 1157 Description: |
1158 It creates a view to show the budget info | 1158 It creates a view to show the budget info |
1159 Constructor: | 1159 Constructor: |
1160 View(view_type, budget, wr_page, path, active_path_record) | 1160 View(view_type, budget, wr_page, pane_path, active_path_record) |
1161 view_type: the object type to show | 1161 view_type: the object type to show |
1162 * DecompositionList | 1162 * DecompositionList |
1163 * Description | 1163 * Description |
1164 * Measure | 1164 * Measure |
1165 * Sheet | 1165 * Sheet |
1166 * FileView | 1166 * FileView |
1167 * CompanyView | 1167 * CompanyView |
1168 budget: the budget to show | 1168 budget: the budget to show |
1169 wr_page: weak reference to the page where the view must be showed | 1169 wr_page: weak reference to the page where the view must be showed |
1170 path: the position or path of the view in the page notebook | 1170 pane_path: the position or path of the view in the page notebook |
1171 active_path_record: the record path that must be showed | 1171 active_path_record: the record path that must be showed |
1172 Ancestry: | 1172 Ancestry: |
1173 +-- object | 1173 +-- object |
1174 +-- View | 1174 +-- View |
1175 Atributes: | 1175 Atributes: |
1176 path: Read-Write. The tuple that identifies the view in the main | 1176 pane_path: Read-Write. The tuple that identifies the view in the main |
1177 notebook page | 1177 notebook page |
1178 widget: Read. the main gtk widget to show in a view object, | 1178 widget: Read. the main gtk widget to show in a view object, |
1179 a gtk.VBox object | 1179 a gtk.VBox object |
1180 Methods: | 1180 Methods: |
1181 getItem | 1181 getItem |
1183 runMessage | 1183 runMessage |
1184 getClone | 1184 getClone |
1185 clear | 1185 clear |
1186 """ | 1186 """ |
1187 | 1187 |
1188 def __init__(self, view_type, budget, wr_page, path, active_path_record): | 1188 def __init__(self, view_type, budget, wr_page, pane_path, |
1189 """__init__(view_type, budget, wr_page, path, active_path_record) | 1189 active_path_record): |
1190 """__init__(view_type, budget, wr_page, pane_path, active_path_record) | |
1190 view_type: the object type to show | 1191 view_type: the object type to show |
1191 * DecompositionList | 1192 * DecompositionList |
1192 * Description | 1193 * Description |
1193 * Measure | 1194 * Measure |
1194 * Sheet | 1195 * Sheet |
1195 * FileView | 1196 * FileView |
1196 * CompanyView | 1197 * CompanyView |
1197 budget: the budget to show | 1198 budget: the budget to show |
1198 wr_page: weak reference to the page where the view must be showed | 1199 wr_page: weak reference to the page where the view must be showed |
1199 path: the position or path of the view in the page notebook | 1200 pane_path: the position or path of the view in the page notebook |
1200 active_path_record: the record path that must be showed | 1201 active_path_record: the record path that must be showed |
1201 | 1202 |
1202 self.__active_path_record: the record path that must be showed | 1203 self.__active_path_record: the record path that must be showed |
1203 self.__view_type: the object type to show | 1204 self.__view_type: the object type to show |
1204 * DecompositionList | 1205 * DecompositionList |
1208 * FileView | 1209 * FileView |
1209 * CompanyView | 1210 * CompanyView |
1210 self.__wr_page: weak reference to the page where the view must be | 1211 self.__wr_page: weak reference to the page where the view must be |
1211 showed | 1212 showed |
1212 self.__budget: the budget to show | 1213 self.__budget: the budget to show |
1213 self.__path: the position or path of the view in the page notebook | 1214 self.__pane_path: the position or path of the view in the page notebook |
1214 self.__connected: boolean value, True means that the View object sends | 1215 self.__connected: boolean value, True means that the View object sends |
1215 and receives signals from/to others views | 1216 and receives signals from/to others views |
1216 self.__widget: main widget. a gtk.VBox | 1217 self.__widget: main widget. a gtk.VBox |
1217 self.__view: the object to show: | 1218 self.__view: the object to show: |
1218 * DecompositionList object | 1219 * DecompositionList object |
1228 """ | 1229 """ |
1229 self.__active_path_record = active_path_record | 1230 self.__active_path_record = active_path_record |
1230 self.__view_type = view_type | 1231 self.__view_type = view_type |
1231 self.__wr_page = wr_page | 1232 self.__wr_page = wr_page |
1232 self.__budget = budget | 1233 self.__budget = budget |
1233 self.__path = path | 1234 self.__pane_path = pane_path |
1234 self.__connected = True | 1235 self.__connected = True |
1235 # view_type liststore | 1236 # view_type liststore |
1236 _liststore = gtk.ListStore(str) | 1237 _liststore = gtk.ListStore(str) |
1237 _liststore.append([_("Decomposition")]) #0 | 1238 _liststore.append([_("Decomposition")]) #0 |
1238 _liststore.append([_("Description")]) #1 | 1239 _liststore.append([_("Description")]) #1 |
1246 _combobox.add_attribute(_cell, 'text', 0) | 1247 _combobox.add_attribute(_cell, 'text', 0) |
1247 self.__widget = gtk.VBox() | 1248 self.__widget = gtk.VBox() |
1248 _hbox = gtk.HBox() | 1249 _hbox = gtk.HBox() |
1249 if view_type == "DecompositionList": | 1250 if view_type == "DecompositionList": |
1250 self.__view = DecompositionList(budget, weakref.ref(self), | 1251 self.__view = DecompositionList(budget, weakref.ref(self), |
1251 path, active_path_record) | 1252 pane_path, active_path_record) |
1252 _combobox.set_active(0) | 1253 _combobox.set_active(0) |
1253 _view_icon = gtk.Image() | 1254 _view_icon = gtk.Image() |
1254 _view_icon.set_from_file(globalVars.getAppPath( | 1255 _view_icon.set_from_file(globalVars.getAppPath( |
1255 "DECOMPOSITION-ICON")) | 1256 "DECOMPOSITION-ICON")) |
1256 elif view_type == "RecordDescription": | 1257 elif view_type == "RecordDescription": |
1257 self.__view = Description(budget, weakref.ref(self), | 1258 self.__view = Description(budget, weakref.ref(self), |
1258 path, active_path_record) | 1259 pane_path, active_path_record) |
1259 _combobox.set_active(1) | 1260 _combobox.set_active(1) |
1260 _view_icon = gtk.Image() | 1261 _view_icon = gtk.Image() |
1261 _view_icon.set_from_file(globalVars.getAppPath( | 1262 _view_icon.set_from_file(globalVars.getAppPath( |
1262 "DESCRIPTION-ICON")) | 1263 "DESCRIPTION-ICON")) |
1263 elif view_type == "Measure": | 1264 elif view_type == "Measure": |
1264 self.__view = Measure(budget, weakref.ref(self), | 1265 self.__view = Measure(budget, weakref.ref(self), |
1265 path, active_path_record) | 1266 pane_path, active_path_record) |
1266 _combobox.set_active(2) | 1267 _combobox.set_active(2) |
1267 _view_icon = gtk.Image() | 1268 _view_icon = gtk.Image() |
1268 _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) | 1269 _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) |
1269 elif view_type == "Sheet of Conditions": | 1270 elif view_type == "Sheet of Conditions": |
1270 self.__view = Sheet(budget, weakref.ref(self), | 1271 self.__view = Sheet(budget, weakref.ref(self), |
1271 path, active_path_record) | 1272 pane_path, active_path_record) |
1272 _combobox.set_active(3) | 1273 _combobox.set_active(3) |
1273 _view_icon = gtk.Image() | 1274 _view_icon = gtk.Image() |
1274 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) | 1275 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1275 elif view_type == "FileView": | 1276 elif view_type == "FileView": |
1276 self.__view = FileView(budget, weakref.ref(self), | 1277 self.__view = FileView(budget, weakref.ref(self), |
1277 path, active_path_record) | 1278 pane_path, active_path_record) |
1278 _combobox.set_active(4) | 1279 _combobox.set_active(4) |
1279 _view_icon = gtk.Image() | 1280 _view_icon = gtk.Image() |
1280 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) | 1281 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1281 elif view_type == "CompanyView": | 1282 elif view_type == "CompanyView": |
1282 self.__view = CompanyView(budget, weakref.ref(self), path, | 1283 self.__view = CompanyView(budget, weakref.ref(self), pane_path, |
1283 active_path_record) | 1284 active_path_record) |
1284 _combobox.set_active(5) | 1285 _combobox.set_active(5) |
1285 _view_icon = gtk.Image() | 1286 _view_icon = gtk.Image() |
1286 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) | 1287 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1287 else: | 1288 else: |
1322 _close_button.show() | 1323 _close_button.show() |
1323 _hbox.pack_start(_close_button, False, False, 0) | 1324 _hbox.pack_start(_close_button, False, False, 0) |
1324 _hbox.show() | 1325 _hbox.show() |
1325 self.__widget.show() | 1326 self.__widget.show() |
1326 | 1327 |
1327 def getItem(self, path): | 1328 def getItem(self, pane_path): |
1328 """getItem(path) | 1329 """getItem(pane_path) |
1329 | 1330 |
1330 Return itself. | 1331 Return itself. |
1331 """ | 1332 """ |
1332 return self | 1333 return self |
1333 | 1334 |
1335 """_closeItem(close_button) | 1336 """_closeItem(close_button) |
1336 | 1337 |
1337 Method connected to the "clicked" signal of the _close_button widget | 1338 Method connected to the "clicked" signal of the _close_button widget |
1338 Send the "autoclose" message to the page to close this view | 1339 Send the "autoclose" message to the page to close this view |
1339 """ | 1340 """ |
1340 self.propagateMessageFrom("autoclose", self.__path) | 1341 self.propagateMessageFrom("autoclose", self.__pane_path) |
1341 | 1342 |
1342 def _change_combo(self, combobox): | 1343 def _change_combo(self, combobox): |
1343 """_change_combo(combobox) | 1344 """_change_combo(combobox) |
1344 | 1345 |
1345 Method connected to the "changed" signal of the _combobox widget | 1346 Method connected to the "changed" signal of the _combobox widget |
1346 It changes the view type to the type selected in the combobox | 1347 It changes the view type to the type selected in the combobox |
1347 """ | 1348 """ |
1348 _index = combobox.get_active() | 1349 _index = combobox.get_active() |
1349 _budget = self.__view.budget | 1350 _budget = self.__view.budget |
1350 _wr_page = self.__view.page | 1351 _wr_page = self.__view.page |
1351 _path = self.__view.path | 1352 _pane_path = self.__view.pane_path |
1352 _path_record = self.__view.active_path_record | 1353 _path_record = self.__view.active_path_record |
1353 _hbox = self.__widget.get_children()[0] | 1354 _hbox = self.__widget.get_children()[0] |
1354 _combobox = _hbox.get_children()[1] | 1355 _combobox = _hbox.get_children()[1] |
1355 _hbox.remove(_combobox) | 1356 _hbox.remove(_combobox) |
1356 _invisible = _hbox.get_children()[1] | 1357 _invisible = _hbox.get_children()[1] |
1364 self.__widget.remove(self.__view.widget) | 1365 self.__widget.remove(self.__view.widget) |
1365 self.__widget.remove(_hbox) | 1366 self.__widget.remove(_hbox) |
1366 _hbox.destroy() | 1367 _hbox.destroy() |
1367 _view_icon = gtk.Image() | 1368 _view_icon = gtk.Image() |
1368 if _index == 0: | 1369 if _index == 0: |
1369 self.__view = DecompositionList(_budget, _wr_page, _path, | 1370 self.__view = DecompositionList(_budget, _wr_page, _pane_path, |
1370 _path_record) | 1371 _path_record) |
1371 | 1372 |
1372 _view_icon.set_from_file(globalVars.getAppPath( | 1373 _view_icon.set_from_file(globalVars.getAppPath( |
1373 "DECOMPOSITION-ICON")) | 1374 "DECOMPOSITION-ICON")) |
1374 self.__view_type = "DecompositionList" | 1375 self.__view_type = "DecompositionList" |
1375 elif _index == 1: | 1376 elif _index == 1: |
1376 self.__view = Description(_budget, _wr_page, _path, | 1377 self.__view = Description(_budget, _wr_page, _pane_path, |
1377 _path_record) | 1378 _path_record) |
1378 _view_icon.set_from_file(globalVars.getAppPath("DESCRIPTION-ICON")) | 1379 _view_icon.set_from_file(globalVars.getAppPath("DESCRIPTION-ICON")) |
1379 self.__view_type = "RecordDescription" | 1380 self.__view_type = "RecordDescription" |
1380 elif _index == 2: | 1381 elif _index == 2: |
1381 self.__view = Measure(_budget, _wr_page, _path, | 1382 self.__view = Measure(_budget, _wr_page, _pane_path, |
1382 _path_record) | 1383 _path_record) |
1383 _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) | 1384 _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) |
1384 self.__view_type = "Measure" | 1385 self.__view_type = "Measure" |
1385 elif _index == 3: | 1386 elif _index == 3: |
1386 self.__view = Sheet(_budget, _wr_page, _path, | 1387 self.__view = Sheet(_budget, _wr_page, _pane_path, |
1387 _path_record) | 1388 _path_record) |
1388 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) | 1389 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1389 self.__view_type = "Sheet of Conditions" | 1390 self.__view_type = "Sheet of Conditions" |
1390 elif _index == 4: | 1391 elif _index == 4: |
1391 self.__view = FileView(_budget, _wr_page, _path, | 1392 self.__view = FileView(_budget, _wr_page, _pane_path, |
1392 _path_record) | 1393 _path_record) |
1393 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) | 1394 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1394 self.__view_type = "FileView" | 1395 self.__view_type = "FileView" |
1395 elif _index == 5: | 1396 elif _index == 5: |
1396 self.__view = CompanyView(_budget, _wr_page, _path, | 1397 self.__view = CompanyView(_budget, _wr_page, _pane_path, |
1397 _path_record) | 1398 _path_record) |
1398 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) | 1399 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1399 self.__view_type = "CompanyView" | 1400 self.__view_type = "CompanyView" |
1400 _view_icon.show() | 1401 _view_icon.show() |
1401 _hbox = gtk.HBox() | 1402 _hbox = gtk.HBox() |
1438 Method connected to the "activate" signal of the _item_leftright and | 1439 Method connected to the "activate" signal of the _item_leftright and |
1439 _item_topbottom menu items. | 1440 _item_topbottom menu items. |
1440 It sends the "split" message to the page to splits the view in the | 1441 It sends the "split" message to the page to splits the view in the |
1441 specified orientation | 1442 specified orientation |
1442 """ | 1443 """ |
1443 self.propagateMessageFrom( "split " + orientation, self.__path) | 1444 self.propagateMessageFrom( "split " + orientation, self.__pane_path) |
1444 | 1445 |
1445 def _connected(self, widget): | 1446 def _connected(self, widget): |
1446 """_connected(widget) | 1447 """_connected(widget) |
1447 | 1448 |
1448 Method connected to the "clicked" signal of the _menu_button | 1449 Method connected to the "clicked" signal of the _menu_button |
1461 _icon.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) | 1462 _icon.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) |
1462 _icon.show() | 1463 _icon.show() |
1463 self.__connected_button.set_icon_widget(_icon) | 1464 self.__connected_button.set_icon_widget(_icon) |
1464 self.__connected = True | 1465 self.__connected = True |
1465 | 1466 |
1466 def propagateMessageFrom(self, message, path, arg=None): | 1467 def propagateMessageFrom(self, message, pane_path, arg=None): |
1467 """propagateMessageFrom(message, path, arg=None) | 1468 """propagateMessageFrom(message, pane_path, arg=None) |
1468 | 1469 |
1469 message: string message | 1470 message: string message |
1470 path: tuple that represents the pane path which emits the message | 1471 pane_path: tuple that represents the pane path which emits the message |
1471 arg: arguments for the message | 1472 arg: arguments for the message |
1472 The panes are connectted to this method to send messages to other panes | 1473 The panes are connectted to this method to send messages to other panes |
1473 """ | 1474 """ |
1474 if self.__connected or message == "autoclose" or \ | 1475 if self.__connected or message == "autoclose" or \ |
1475 message == "split h" or message == "split v": | 1476 message == "split h" or message == "split v": |
1476 self.__wr_page().propagateMessageFrom(message, path, arg) | 1477 self.__wr_page().propagateMessageFrom(message, pane_path, arg) |
1477 | 1478 |
1478 def runMessage(self, message, path, arg=None): | 1479 def runMessage(self, message, pane_path, arg=None): |
1479 """runMessage(message, path, arg=None) | 1480 """runMessage(message, pane_path, arg=None) |
1480 | 1481 |
1481 message: the message type | 1482 message: the message type |
1482 "change_active": change the active record | 1483 "change_active": change the active record |
1483 "clear": clear instance | 1484 "clear": clear instance |
1484 path: tuple that identifies the pane in the notebook page | 1485 pane_path: tuple that identifies the pane in the notebook page |
1485 arg: tuple whit two items: | 1486 arg: tuple whit two items: |
1486 0: record path in the budget | 1487 0: record path in the budget |
1487 1: record code | 1488 1: record code |
1488 This method receives a message and executes its corresponding action | 1489 This method receives a message and executes its corresponding action |
1489 """ | 1490 """ |
1490 if self.__connected: | 1491 if self.__connected: |
1491 self.__view.runMessage(message, path, arg) | 1492 self.__view.runMessage(message, pane_path, arg) |
1492 if message == "change_active": | 1493 if message == "change_active": |
1493 if self.__budget.hasPath(arg): | 1494 if self.__budget.hasPath(arg): |
1494 _path_record = arg | 1495 _path_record = arg |
1495 self.__active_path_record = _path_record | 1496 self.__active_path_record = _path_record |
1496 | 1497 |
1499 | 1500 |
1500 Return de pane widget | 1501 Return de pane widget |
1501 """ | 1502 """ |
1502 return self.__widget | 1503 return self.__widget |
1503 | 1504 |
1504 def _getPath(self): | 1505 def _getPanePath(self): |
1505 """_getPath() | 1506 """_getPanePath() |
1506 | 1507 |
1507 return the tuple that identifies the pane in the notebook page | 1508 return the tuple that identifies the pane in the notebook page |
1508 """ | 1509 """ |
1509 return self.__view.path | 1510 return self.__view.pane_path |
1510 | 1511 |
1511 def _setPath(self, path): | 1512 def _setPanePath(self, pane_path): |
1512 """_setPath() | 1513 """_setPanePath() |
1513 | 1514 |
1514 set the tuple that identifies the pane in the notebook page | 1515 set the tuple that identifies the pane in the notebook page |
1515 """ | 1516 """ |
1516 self.__path = path | 1517 self.__pane_path = pane_path |
1517 self.__view.path = path | 1518 self.__view.pane_path = pane_path |
1518 | 1519 |
1519 def getClone(self, new_path): | 1520 def getClone(self, new_pane_path): |
1520 """getClone(new_path) | 1521 """getClone(new_pane_path) |
1521 | 1522 |
1522 new_path: the path that identifies the clone view in the page | 1523 new_pane_path: the path that identifies the clone view in the page |
1523 | 1524 |
1524 return a clone of itself | 1525 return a clone of itself |
1525 """ | 1526 """ |
1526 return View(self.__view_type, self.__budget, self.__wr_page, | 1527 return View(self.__view_type, self.__budget, self.__wr_page, |
1527 new_path, self.__active_path_record) | 1528 new_pane_path, self.__active_path_record) |
1528 | 1529 |
1529 def clear(self): | 1530 def clear(self): |
1530 """clear() | 1531 """clear() |
1531 | 1532 |
1532 Clear the intance atributes | 1533 Clear the intance atributes |
1533 """ | 1534 """ |
1534 del self.__wr_page | 1535 del self.__wr_page |
1535 del self.__budget | 1536 del self.__budget |
1536 del self.__path | 1537 del self.__pane_path |
1537 del self.__widget | 1538 del self.__widget |
1538 del self.__view | 1539 del self.__view |
1539 del self.__connected | 1540 del self.__connected |
1540 del self.__connected_button | 1541 del self.__connected_button |
1541 | 1542 |
1542 path = property(_getPath, _setPath, None, | 1543 pane_path = property(_getPanePath, _setPanePath, None, |
1543 "path that identifies the item in the notebook page") | 1544 "path that identifies the item in the notebook page") |
1544 widget = property(_getWidget, None, None, "View widget") | 1545 widget = property(_getWidget, None, None, "View widget") |
1545 | 1546 |
1546 | 1547 |
1547 class Paned(object): | 1548 class Paned(object): |
1558 Ancestry: | 1559 Ancestry: |
1559 +-- object | 1560 +-- object |
1560 +-- Paned | 1561 +-- Paned |
1561 Atributes: | 1562 Atributes: |
1562 widget: Read. Pane widget("gtk.VPaned" or "gtk.HPaned" object) | 1563 widget: Read. Pane widget("gtk.VPaned" or "gtk.HPaned" object) |
1563 path: Read-Write. The paned path in the page | 1564 pane_path: Read-Write. The paned path in the page |
1564 Methods: | 1565 Methods: |
1565 getClone | 1566 getClone |
1566 getItem | 1567 getItem |
1567 setItem | 1568 setItem |
1568 runMessage | 1569 runMessage |
1571 # TODO: *control the position paned separator. Now is always in the middle | 1572 # TODO: *control the position paned separator. Now is always in the middle |
1572 # TODO: can be with a float(0.0-1.0) aspect ratio | 1573 # TODO: can be with a float(0.0-1.0) aspect ratio |
1573 # TODO: 0.0 no space for widget1 | 1574 # TODO: 0.0 no space for widget1 |
1574 # TODO: 1.0 all the space for widget1 | 1575 # TODO: 1.0 all the space for widget1 |
1575 | 1576 |
1576 def __init__(self, orientation, path, item1, item2): | 1577 def __init__(self, orientation, pane_path, item1, item2): |
1577 """__init__(oritentation, path, item1, item2) | 1578 """__init__(oritentation, pane_path, item1, item2) |
1578 | 1579 |
1579 orientation: The orientation of de gtk.Paned, can be "v" or "h" | 1580 orientation: The orientation of de gtk.Paned, can be "v" or "h" |
1580 path: the paned path in the page | 1581 pane_path: the paned path in the page |
1581 item1: the top or left pane object | 1582 item1: the top or left pane object |
1582 item2: the bottom or right pane object | 1583 item2: the bottom or right pane object |
1583 | 1584 |
1584 self.__orientation: The orientation of de gtk.Paned, can be "v" or "h" | 1585 self.__orientation: The orientation of de gtk.Paned, can be "v" or "h" |
1585 self.__widget: Main widget, a gtk.VPaned o gtk.HPaned | 1586 self.__widget: Main widget, a gtk.VPaned o gtk.HPaned |
1586 self.__items: list of items showed in the paned, its can be View or | 1587 self.__items: list of items showed in the paned, its can be View or |
1587 Paned instances | 1588 Paned instances |
1588 self.__path: the paned path in the page | 1589 self.__pane_path: the paned path in the page |
1589 | 1590 |
1590 Creates and shows a new gtk.Paned | 1591 Creates and shows a new gtk.Paned |
1591 """ | 1592 """ |
1592 self.__orientation = orientation | 1593 self.__orientation = orientation |
1593 if not isinstance(item1.widget, gtk.Widget) or \ | 1594 if not isinstance(item1.widget, gtk.Widget) or \ |
1601 raise ValueError, _("Invalid orientation.") | 1602 raise ValueError, _("Invalid orientation.") |
1602 self.__widget.pack1(item1.widget,True,False) | 1603 self.__widget.pack1(item1.widget,True,False) |
1603 self.__widget.pack2(item2.widget,True,False) | 1604 self.__widget.pack2(item2.widget,True,False) |
1604 self.__widget.show() | 1605 self.__widget.show() |
1605 self.__items = [item1, item2] | 1606 self.__items = [item1, item2] |
1606 self.__path = path | 1607 self.__pane_path = pane_path |
1607 | 1608 |
1608 def __getitem__(self, item): | 1609 def __getitem__(self, item): |
1609 """__getitem__(item) | 1610 """__getitem__(item) |
1610 | 1611 |
1611 Called to implement evaluation of self[key]. | 1612 Called to implement evaluation of self[key]. |
1612 The accepted keys should be integers 0 or 1. | 1613 The accepted keys should be integers 0 or 1. |
1613 """ | 1614 """ |
1614 return self.__items[item] | 1615 return self.__items[item] |
1615 | 1616 |
1616 def getClone(self, new_path): | 1617 def getClone(self, new_pane_path): |
1617 """getClone(new_path) | 1618 """getClone(new_pane_path) |
1618 | 1619 |
1619 Return a clone Paned instance with the path new_path | 1620 Return a clone Paned instance with the path new_path |
1620 """ | 1621 """ |
1621 return Paned(self.__orientation, new_path, | 1622 return Paned(self.__orientation, new_pane_path, |
1622 self.__items[0].getClone(new_path + (0,)), | 1623 self.__items[0].getClone(new_pane_path + (0,)), |
1623 self.__items[1].getClone(new_path + (1,))) | 1624 self.__items[1].getClone(new_pane_path + (1,))) |
1624 | 1625 |
1625 def getItem(self,path): | 1626 def getItem(self,pane_path): |
1626 """getItem(path) | 1627 """getItem(pane_path) |
1627 | 1628 |
1628 Return the item whith the specified path. | 1629 Return the item whith the specified path. |
1629 """ | 1630 """ |
1630 _item = self.__items[path[0]] | 1631 _item = self.__items[pane_path[0]] |
1631 if len(path) == 1: | 1632 if len(pane_path) == 1: |
1632 return _item | 1633 return _item |
1633 else: | 1634 else: |
1634 return _item.getItem(path[1:]) | 1635 return _item.getItem(pane_path[1:]) |
1635 | 1636 |
1636 def setItem(self, path, item_list): | 1637 def setItem(self, pane_path, item_list): |
1637 """setItem(path, item_list) | 1638 """setItem(pane_path, item_list) |
1638 | 1639 |
1639 Sets the first item in the item_list whith the especified path and | 1640 Sets the first item in the item_list whith the especified path and |
1640 remove the old item in this position. | 1641 remove the old item in this position. |
1641 """ | 1642 """ |
1642 item = item_list[0] | 1643 item = item_list[0] |
1643 if path == 0 or path == 1: | 1644 if pane_path == 0 or pane_path == 1: |
1644 _old_item = self.__items[path] | 1645 _old_item = self.__items[pane_path] |
1645 self.__widget.remove(_old_item.widget) | 1646 self.__widget.remove(_old_item.widget) |
1646 self.__items[path] = item | 1647 self.__items[pane_path] = item |
1647 if path == 0: | 1648 if pane_path == 0: |
1648 self.__widget.pack1(item.widget,True,False) | 1649 self.__widget.pack1(item.widget,True,False) |
1649 else: | 1650 else: |
1650 self.__widget.pack2(item.widget,True,False) | 1651 self.__widget.pack2(item.widget,True,False) |
1651 return True | 1652 return True |
1652 return False | 1653 return False |
1653 | 1654 |
1654 def runMessage(self, message, path, arg=None): | 1655 def runMessage(self, message, pane_path, arg=None): |
1655 """runMessage(message, page_path, arg=None) | 1656 """runMessage(message, pane_path, arg=None) |
1656 | 1657 |
1657 message: the message type | 1658 message: the message type |
1658 "change_active": change the active record | 1659 "change_active": change the active record |
1659 "clear": clear instance | 1660 "clear": clear instance |
1660 page_path: tuple that identifies the pane in the notebook page | 1661 pane_path: tuple that identifies the pane in the notebook page |
1661 arg: arguments | 1662 arg: arguments |
1662 | 1663 |
1663 This method receives a message and send this to the items of the paned | 1664 This method receives a message and send this to the items of the paned |
1664 """ | 1665 """ |
1665 for _item in self.__items: | 1666 for _item in self.__items: |
1666 if not _item.path == path: | 1667 if not _item.pane_path == pane_path: |
1667 _item.runMessage(message, path, arg) | 1668 _item.runMessage(message, pane_path, arg) |
1668 | 1669 |
1669 def _getWidget(self): | 1670 def _getWidget(self): |
1670 """_getWidget() | 1671 """_getWidget() |
1671 | 1672 |
1672 Return de gtk.Paned widget | 1673 Return de gtk.Paned widget |
1673 """ | 1674 """ |
1674 return self.__widget | 1675 return self.__widget |
1675 | 1676 |
1676 def _getPath(self): | 1677 def _getPanePath(self): |
1677 """_getPath() | 1678 """_getPanePath() |
1678 | 1679 |
1679 Return de Paned path in the notebook page | 1680 Return de Paned path in the notebook page |
1680 """ | 1681 """ |
1681 return self.__path | 1682 return self.__pane_path |
1682 | 1683 |
1683 def _setPath(self, path): | 1684 def _setPanePath(self, pane_path): |
1684 """_setPath() | 1685 """_setPanePath() |
1685 | 1686 |
1686 sets the tuple that identifies the pane in the notebook page | 1687 sets the tuple that identifies the pane in the notebook page |
1687 """ | 1688 """ |
1688 self.__path = path | 1689 self.__pane_path = pane_path |
1689 self.__items[0].path = path + (0,) | 1690 self.__items[0].pane_path = pane_path + (0,) |
1690 self.__items[1].path = path + (1,) | 1691 self.__items[1].pane_path = pane_path + (1,) |
1691 | 1692 |
1692 def clear(self): | 1693 def clear(self): |
1693 """clear() | 1694 """clear() |
1694 | 1695 |
1695 Delete atributes | 1696 Delete atributes |
1696 """ | 1697 """ |
1697 del self.__widget | 1698 del self.__widget |
1698 del self.__orientation | 1699 del self.__orientation |
1699 del self.__items | 1700 del self.__items |
1700 del self.__path | 1701 del self.__pane_path |
1701 | 1702 |
1702 widget = property(_getWidget, None, None, "gtk.Paned widget") | 1703 widget = property(_getWidget, None, None, "gtk.Paned widget") |
1703 path = property(_getPath, _setPath, None, "Pane path in the notebook page") | 1704 pane_path = property(_getPanePath, _setPanePath, None, |
1705 "Pane path in the notebook page") | |
1704 | 1706 |
1705 | 1707 |
1706 class TreeView(object): | 1708 class TreeView(object): |
1707 """gui.Treeviev: | 1709 """gui.Treeviev: |
1708 | 1710 |
1895 """gui.DecompositionList: | 1897 """gui.DecompositionList: |
1896 | 1898 |
1897 Description: | 1899 Description: |
1898 Class to show a budget Decomposition List | 1900 Class to show a budget Decomposition List |
1899 Constructor: | 1901 Constructor: |
1900 DecompositionList(budget, page, path, path_record=(0,)) | 1902 DecompositionList(budget, page, pane_path, path_record=(0,)) |
1901 budget: budget showed ("base.Budget" object) | 1903 budget: budget showed ("base.Budget" object) |
1902 page: weak reference from Page instance which creates this class | 1904 page: weak reference from Page instance which creates this class |
1903 path: tuple that represents the view path in the Page | 1905 pane_path: tuple that represents the view path in the Page |
1904 path_record: the record path that must be showed | 1906 path_record: the record path that must be showed |
1905 Returns the newly created DecompositionList instance | 1907 Returns the newly created DecompositionList instance |
1906 Ancestry: | 1908 Ancestry: |
1907 +-- object | 1909 +-- object |
1908 +-- TreeView | 1910 +-- TreeView |
1909 +-- DecompositionList | 1911 +-- DecompositionList |
1910 Atributes: | 1912 Atributes: |
1911 budget: Read. Budget to show, base.obra object. | 1913 budget: Read. Budget to show, base.obra object. |
1912 widget: Read. Window that contains the table, gtk.ScrolledWindow | 1914 widget: Read. Window that contains the table, gtk.ScrolledWindow |
1913 path: Read-Write. Pane page identifier | 1915 pane_path: Read-Write. Pane page identifier |
1914 page: Read-Write. weak ref from Page object which creates this class | 1916 page: Read-Write. weak ref from Page object which creates this class |
1915 active_path_record: Read. Active path record | 1917 active_path_record: Read. Active path record |
1916 Methods: | 1918 Methods: |
1917 runMessage | 1919 runMessage |
1918 """ | 1920 """ |
1919 | 1921 |
1920 def __init__(self, budget, page, path, path_record=(0,)): | 1922 def __init__(self, budget, page, pane_path, path_record=(0,)): |
1921 """__init__(budget, page, path, path_record=(0,)) | 1923 """__init__(budget, page, pane_path, path_record=(0,)) |
1922 | 1924 |
1923 budget: budget showed ("base.Budget" object) | 1925 budget: budget showed ("base.Budget" object) |
1924 page: weak reference from Page instance which creates this class | 1926 page: weak reference from Page instance which creates this class |
1925 path: tuple that represents the path of the List in the Page | 1927 pane_path: tuple that represents the path of the List in the Page |
1926 path_record: the record path that must be showed | 1928 path_record: the record path that must be showed |
1927 | 1929 |
1928 self.__budget: budget showed ("base.Budget" object) | 1930 self.__budget: budget showed ("base.Budget" object) |
1929 self.__page: weak reference from Page instance which creates this class | 1931 self.__page: weak reference from Page instance which creates this class |
1930 self.__path: tuple that represents the path of the List in the Page | 1932 self.__pane_path: tuple that represents the path of the List in the Page |
1931 self.__liststore: list model which store the list data | 1933 self.__liststore: list model which store the list data |
1932 (gtk.ListStore object) | 1934 (gtk.ListStore object) |
1933 self.__active_path_record: the record path that must be showed | 1935 self.__active_path_record: the record path that must be showed |
1934 self.__treeview: widget for displaying decomposition lists | 1936 self.__treeview: widget for displaying decomposition lists |
1935 (gtk.TreeView) | 1937 (gtk.TreeView) |
1970 # Budget | 1972 # Budget |
1971 if not isinstance(budget, base.Budget): | 1973 if not isinstance(budget, base.Budget): |
1972 raise ValueError, _("Argument must be a Budget object") | 1974 raise ValueError, _("Argument must be a Budget object") |
1973 self.__budget = budget | 1975 self.__budget = budget |
1974 self.__page = page | 1976 self.__page = page |
1975 self.__path = path | 1977 self.__pane_path = pane_path |
1976 # ListStore | 1978 # ListStore |
1977 self.__liststore = gtk.ListStore(object | 1979 self.__liststore = gtk.ListStore(object |
1978 #, int, int, str, str, str, str, str,str | 1980 #, int, int, str, str, str, str, str,str |
1979 ) | 1981 ) |
1980 if path_record is None: | 1982 if path_record is None: |
2379 self.__active_path_record = _path_record | 2381 self.__active_path_record = _path_record |
2380 self._setColumnsHeaders() | 2382 self._setColumnsHeaders() |
2381 self._setListstoreValues(self.__active_path_record) | 2383 self._setListstoreValues(self.__active_path_record) |
2382 arg = ( _path_record ) | 2384 arg = ( _path_record ) |
2383 _page = self.__page() | 2385 _page = self.__page() |
2384 _page.propagateMessageFrom("change_active", self.__path, arg) | 2386 _page.propagateMessageFrom("change_active", self.__pane_path, arg) |
2385 self.__treeview.set_cursor(_parent, self.__cursor[1]) | 2387 self.__treeview.set_cursor(_parent, self.__cursor[1]) |
2386 self.__cursor = self.__treeview.get_cursor() | 2388 self.__cursor = self.__treeview.get_cursor() |
2387 | 2389 |
2388 def _showMessageRecord(self, record_path): | 2390 def _showMessageRecord(self, record_path): |
2389 """_showMessageRecord(record_path) | 2391 """_showMessageRecord(record_path) |
2426 self._setColumnsHeaders() | 2428 self._setColumnsHeaders() |
2427 self._setListstoreValues(self.__active_path_record) | 2429 self._setListstoreValues(self.__active_path_record) |
2428 self.__treeview.set_cursor((0,)) | 2430 self.__treeview.set_cursor((0,)) |
2429 _arg = ( _path_record ) | 2431 _arg = ( _path_record ) |
2430 _page = self.__page() | 2432 _page = self.__page() |
2431 _page.propagateMessageFrom("change_active", self.__path, | 2433 _page.propagateMessageFrom("change_active", self.__pane_path, |
2432 _arg ) | 2434 _arg ) |
2433 | 2435 |
2434 def runMessage(self, message, path, arg=None): | 2436 def runMessage(self, message, pane_path, arg=None): |
2435 """runMessage(message, path, arg=None) | 2437 """runMessage(message, pane_path, arg=None) |
2436 | 2438 |
2437 message: the message type | 2439 message: the message type |
2438 "change_active": change the active record | 2440 "change_active": change the active record |
2439 "clear": clear instance | 2441 "clear": clear instance |
2440 path: tuple that identifies the pane in the notebook page | 2442 pane_path: tuple that identifies the pane in the notebook page |
2441 arg: tuple whit two items: | 2443 arg: tuple whit two items: |
2442 0: record path in the budget | 2444 0: record path in the budget |
2443 1: record code | 2445 1: record code |
2444 This method receives a message and executes its corresponding action | 2446 This method receives a message and executes its corresponding action |
2445 """ | 2447 """ |
2463 | 2465 |
2464 return the main widget (gtk.ScrolledWindow) | 2466 return the main widget (gtk.ScrolledWindow) |
2465 """ | 2467 """ |
2466 return self.__scrolled_window | 2468 return self.__scrolled_window |
2467 | 2469 |
2468 def _getPath(self): | 2470 def _getPanePath(self): |
2469 """_getPath() | 2471 """_getPanePath() |
2470 | 2472 |
2471 return the tuple that identifies the pane in the notebook page | 2473 return the tuple that identifies the pane in the notebook page |
2472 """ | 2474 """ |
2473 return self.__path | 2475 return self.__pane_path |
2474 | 2476 |
2475 def _setPath(self, path): | 2477 def _setPanePath(self, pane_path): |
2476 """_setPath() | 2478 """_setPanePath() |
2477 | 2479 |
2478 sets the tuple that identifies the pane in the notebook page | 2480 sets the tuple that identifies the pane in the notebook page |
2479 """ | 2481 """ |
2480 self.__path = path | 2482 self.__pane_path = pane_path |
2481 | 2483 |
2482 def _getPage(self): | 2484 def _getPage(self): |
2483 """_getPage() | 2485 """_getPage() |
2484 | 2486 |
2485 return the Page | 2487 return the Page |
2507 """ | 2509 """ |
2508 return self.__active_path_record | 2510 return self.__active_path_record |
2509 | 2511 |
2510 widget = property(_getWidget, None, None, | 2512 widget = property(_getWidget, None, None, |
2511 "Pane configuration list") | 2513 "Pane configuration list") |
2512 path = property(_getPath, _setPath, None, | 2514 pane_path = property(_getPanePath, _setPanePath, None, |
2513 "path that identifie the item in the page notebook") | 2515 "path that identifie the item in the page notebook") |
2514 page = property(_getPage, _setPage, None, | 2516 page = property(_getPage, _setPage, None, |
2515 "weak reference from Page instance which creates this class") | 2517 "weak reference from Page instance which creates this class") |
2516 budget = property(_getBudget, None, None, | 2518 budget = property(_getBudget, None, None, |
2517 "Budget object") | 2519 "Budget object") |
2523 """gui.Measure: | 2525 """gui.Measure: |
2524 | 2526 |
2525 Description: | 2527 Description: |
2526 Class to show a Measure List | 2528 Class to show a Measure List |
2527 Constructor: | 2529 Constructor: |
2528 Measure(budget, page, path, path_record=(0,) | 2530 Measure(budget, page, pane_path, path_record=(0,) |
2529 budget: budget showed ("base.Budget" object) | 2531 budget: budget showed ("base.Budget" object) |
2530 page: weak reference from Page instance which creates this class | 2532 page: weak reference from Page instance which creates this class |
2531 path: tuple that represents the path of the List in the Page | 2533 pane_path: tuple that represents the path of the List in the Page |
2532 path_record: path of the active record in the budget | 2534 path_record: path of the active record in the budget |
2533 Ancestry: | 2535 Ancestry: |
2534 +-- object | 2536 +-- object |
2535 +-- TreeView | 2537 +-- TreeView |
2536 +-- DecompositionList | 2538 +-- DecompositionList |
2537 Atributes: | 2539 Atributes: |
2538 budget: Read. Budget to show, base.obra instance. | 2540 budget: Read. Budget to show, base.obra instance. |
2539 widget: Read. Window that contains the table, gtk.ScrolledWindow | 2541 widget: Read. Window that contains the table, gtk.ScrolledWindow |
2540 path: Read-Write. Pane page identifier | 2542 pane_path: Read-Write. Pane page identifier |
2541 page: Read-Write. weak reference from Page instance which creates | 2543 page: Read-Write. weak reference from Page instance which creates |
2542 this class | 2544 this class |
2543 active_path_record: Read. Path of the active record in the budget | 2545 active_path_record: Read. Path of the active record in the budget |
2544 Methods: | 2546 Methods: |
2545 runMessage | 2547 runMessage |
2546 """ | 2548 """ |
2547 | 2549 |
2548 def __init__(self, budget, page, path, path_record=(0,)): | 2550 def __init__(self, budget, page, pane_path, path_record=(0,)): |
2549 """__init__(budget, page, path, path_record=(0,)) | 2551 """__init__(budget, page, pane_path, path_record=(0,)) |
2550 | 2552 |
2551 budget: budget: budget showed ("base.Budget" object) | 2553 budget: budget: budget showed ("base.Budget" object) |
2552 page: weak reference from Page instance which creates this class | 2554 page: weak reference from Page instance which creates this class |
2553 path: tuple that represents the path of the List in the Page | 2555 pane_path: tuple that represents the path of the List in the Page |
2554 path_record: path of the active record in the budget | 2556 path_record: path of the active record in the budget |
2555 | 2557 |
2556 self.__budget: budget showed ("base.Budget" object) | 2558 self.__budget: budget showed ("base.Budget" object) |
2557 self.__page: weak reference from Page instance which creates this class | 2559 self.__page: weak reference from Page instance which creates this class |
2558 self.__path: tuple that represents the path of the List in the Page | 2560 self.__pane_path: tuple that represents the path of the List in the Page |
2559 self.__active_path_record: path of the active record in the budget | 2561 self.__active_path_record: path of the active record in the budget |
2560 self.__liststore: list model which store the list data | 2562 self.__liststore: list model which store the list data |
2561 (gtk.ListStore object) | 2563 (gtk.ListStore object) |
2562 self.__treeview: widget to display decomposition lists | 2564 self.__treeview: widget to display decomposition lists |
2563 (gtk.TreeView) | 2565 (gtk.TreeView) |
2597 # Seting init args | 2599 # Seting init args |
2598 if not isinstance(budget, base.Budget): | 2600 if not isinstance(budget, base.Budget): |
2599 raise ValueError, _("Argument must be a Budget object") | 2601 raise ValueError, _("Argument must be a Budget object") |
2600 self.__budget = budget | 2602 self.__budget = budget |
2601 self.__page = page | 2603 self.__page = page |
2602 self.__path = path | 2604 self.__pane_path = pane_path |
2603 if not isinstance(path_record, tuple): | 2605 if not isinstance(path_record, tuple): |
2604 print _("Record path must be a tuple") | 2606 print _("Record path must be a tuple") |
2605 path_record = (0,) | 2607 path_record = (0,) |
2606 self.__active_path_record = path_record | 2608 self.__active_path_record = path_record |
2607 # ListStore | 2609 # ListStore |
2883 or (event.keyval == gtk.keysyms.Left \ | 2885 or (event.keyval == gtk.keysyms.Left \ |
2884 and _column == self.columns[1]): | 2886 and _column == self.columns[1]): |
2885 return True | 2887 return True |
2886 return False | 2888 return False |
2887 | 2889 |
2888 def runMessage(self, message, path, arg=None): | 2890 def runMessage(self, message, pane_path, arg=None): |
2889 """runMessage(message, path, arg=None) | 2891 """runMessage(message, pane_path, arg=None) |
2890 | 2892 |
2891 message: the message type | 2893 message: the message type |
2892 "change_active": change the active record | 2894 "change_active": change the active record |
2893 "clear": clear instance | 2895 "clear": clear instance |
2894 path: tuple that identifies the pane in the notebook page | 2896 pane_path: tuple that identifies the pane in the notebook page |
2895 arg: tuple whit two items: | 2897 arg: tuple whit two items: |
2896 0: record path in the budget | 2898 0: record path in the budget |
2897 1: record code | 2899 1: record code |
2898 This method receives a message and executes its corresponding action | 2900 This method receives a message and executes its corresponding action |
2899 """ | 2901 """ |
3055 | 3057 |
3056 return the main widget (gtk.ScrolledWindow) | 3058 return the main widget (gtk.ScrolledWindow) |
3057 """ | 3059 """ |
3058 return self.__scrolled_window | 3060 return self.__scrolled_window |
3059 | 3061 |
3060 def _getPath(self): | 3062 def _getPanePath(self): |
3061 """_getPath() | 3063 """_getPanePath() |
3062 | 3064 |
3063 return the tuple that identifies the pane in the notebook page | 3065 return the tuple that identifies the pane in the notebook page |
3064 """ | 3066 """ |
3065 return self.__path | 3067 return self.__pane_path |
3066 | 3068 |
3067 def _setPath(self, path): | 3069 def _setPanePath(self, pane_path): |
3068 """_setPath() | 3070 """_setPanePath() |
3069 | 3071 |
3070 sets the tuple that identifies the pane in the notebook page | 3072 sets the tuple that identifies the pane in the notebook page |
3071 """ | 3073 """ |
3072 self.__path = path | 3074 self.__pane_path = pane_path |
3073 | 3075 |
3074 def _getPage(self): | 3076 def _getPage(self): |
3075 """_getPage() | 3077 """_getPage() |
3076 | 3078 |
3077 return the Page | 3079 return the Page |
3099 """ | 3101 """ |
3100 return self.__active_path_record | 3102 return self.__active_path_record |
3101 | 3103 |
3102 widget = property(_getWidget, None, None, | 3104 widget = property(_getWidget, None, None, |
3103 "Pane configuration list") | 3105 "Pane configuration list") |
3104 path = property(_getPath, _setPath, None, | 3106 pane_path = property(_getPanePath, _setPanePath, None, |
3105 "Path that identifies the item in the page notebook") | 3107 "Path that identifies the item in the page notebook") |
3106 page = property(_getPage, _setPage, None, | 3108 page = property(_getPage, _setPage, None, |
3107 "Weak reference from Page instance which creates this class") | 3109 "Weak reference from Page instance which creates this class") |
3108 budget = property(_getBudget, None, None, | 3110 budget = property(_getBudget, None, None, |
3109 "Budget object") | 3111 "Budget object") |
3123 Ancestry: | 3125 Ancestry: |
3124 +-- object | 3126 +-- object |
3125 +-- Description | 3127 +-- Description |
3126 Atributes: | 3128 Atributes: |
3127 widget: the main widget (gtk.ScrolledWindow object) | 3129 widget: the main widget (gtk.ScrolledWindow object) |
3128 path: the tuple that identifies the pane in the notebook page | 3130 pane_path: the tuple that identifies the pane in the notebook page |
3129 budget: The budget (base.obra objetc) | 3131 budget: The budget (base.obra objetc) |
3130 active_path_record: The active path record | 3132 active_path_record: The active path record |
3131 Methods: | 3133 Methods: |
3132 runMessage | 3134 runMessage |
3133 """ | 3135 """ |
3134 # TODO: make standar: "DecompositonList and Description" | 3136 # TODO: make standar: "DecompositonList and Description" |
3135 | 3137 |
3136 def __init__(self, budget, page, path, path_record=(0,)): | 3138 def __init__(self, budget, page, pane_path, path_record=(0,)): |
3137 """__init__(budget, page, path, path_record=(0,)) | 3139 """__init__(budget, page, pane_path, path_record=(0,)) |
3138 | 3140 |
3139 budget: the budget (base.obra object) | 3141 budget: the budget (base.obra object) |
3140 page: weak reference from Page instance which creates this class | 3142 page: weak reference from Page instance which creates this class |
3141 path: the path position of the description in the page | 3143 pane_path: the path position of the description in the page |
3142 path_record: the path of the active record | 3144 path_record: the path of the active record |
3143 | 3145 |
3144 self.__budget: the budget (base.obra object) | 3146 self.__budget: the budget (base.obra object) |
3145 self.__page: weak reference from Page instance which creates this class | 3147 self.__page: weak reference from Page instance which creates this class |
3146 self.__path: the path position of the description in the page | 3148 self.__pane_path: the path position of the description in the page |
3147 self.__active_path_recordthe path of the active record | 3149 self.__active_path_recordthe path of the active record |
3148 | 3150 |
3149 self.__textbuffer: The textbuffer of the textview that contain | 3151 self.__textbuffer: The textbuffer of the textview that contain |
3150 the record text. | 3152 the record text. |
3151 self.__label: The gtk.label with the title of the pane | 3153 self.__label: The gtk.label with the title of the pane |
3154 Creates an shows the scroledwindow that contain the description text | 3156 Creates an shows the scroledwindow that contain the description text |
3155 of the record to be showed in a pane. | 3157 of the record to be showed in a pane. |
3156 """ | 3158 """ |
3157 self.__budget = budget | 3159 self.__budget = budget |
3158 self.__page = page | 3160 self.__page = page |
3159 self.__path = path | 3161 self.__pane_path = pane_path |
3160 self.__active_path_record = path_record | 3162 self.__active_path_record = path_record |
3161 _budget = budget | 3163 _budget = budget |
3162 _text = _budget.getRecord(self.__budget.getCode( | 3164 _text = _budget.getRecord(self.__budget.getCode( |
3163 self.__active_path_record)).text | 3165 self.__active_path_record)).text |
3164 _scrollwindow = gtk.ScrolledWindow() | 3166 _scrollwindow = gtk.ScrolledWindow() |
3198 self.__label.set_text(utils.mapping(_("Description text of the record "\ | 3200 self.__label.set_text(utils.mapping(_("Description text of the record "\ |
3199 "$1"), (_code,))) | 3201 "$1"), (_code,))) |
3200 _text = _budget.getRecord(_code).text | 3202 _text = _budget.getRecord(_code).text |
3201 self.__textbuffer.set_text(_text) | 3203 self.__textbuffer.set_text(_text) |
3202 | 3204 |
3203 def runMessage(self, message, path, arg=None): | 3205 def runMessage(self, message, pane_path, arg=None): |
3204 """runMessage(message, path, arg=None) | 3206 """runMessage(message, pane_path, arg=None) |
3205 | 3207 |
3206 message: the message type | 3208 message: the message type |
3207 "change_active": change the active record | 3209 "change_active": change the active record |
3208 "clear": clear instance | 3210 "clear": clear instance |
3209 path: tuple that identifies the pane in the notebook page | 3211 pane_path: tuple that identifies the pane in the notebook page |
3210 arg: tuple whit two items: | 3212 arg: tuple whit two items: |
3211 0: record path in the budget | 3213 0: record path in the budget |
3212 1: record code | 3214 1: record code |
3213 This method receives a message and executes its corresponding action | 3215 This method receives a message and executes its corresponding action |
3214 """ | 3216 """ |
3223 """_clear() | 3225 """_clear() |
3224 | 3226 |
3225 Delete all instance atributes | 3227 Delete all instance atributes |
3226 """ | 3228 """ |
3227 del self.__widget | 3229 del self.__widget |
3228 del self.__path | 3230 del self.__pane_path |
3229 del self.__budget | 3231 del self.__budget |
3230 del self.__active_code | 3232 del self.__active_code |
3231 del self.__textbuffer | 3233 del self.__textbuffer |
3232 del self.__label | 3234 del self.__label |
3233 | 3235 |
3236 | 3238 |
3237 return the main widget (gtk.ScrolledWindow) | 3239 return the main widget (gtk.ScrolledWindow) |
3238 """ | 3240 """ |
3239 return self.__widget | 3241 return self.__widget |
3240 | 3242 |
3241 def _getPath(self): | 3243 def _getPanePath(self): |
3242 """_getPath() | 3244 """_getPanePath() |
3243 | 3245 |
3244 return the tuple that identifies the pane in the notebook page | 3246 return the tuple that identifies the pane in the notebook page |
3245 """ | 3247 """ |
3246 return self.__path | 3248 return self.__pane_path |
3247 | 3249 |
3248 def _setPath(self, path): | 3250 def _setPanePath(self, pane_path): |
3249 """_setPath() | 3251 """_setPanePath() |
3250 | 3252 |
3251 sets the tuple that identifies the pane in the notebook page | 3253 sets the tuple that identifies the pane in the notebook page |
3252 """ | 3254 """ |
3253 self.__path = path | 3255 self.__pane_path = pane_path |
3254 | 3256 |
3255 def _getPage(self): | 3257 def _getPage(self): |
3256 """_getPage() | 3258 """_getPage() |
3257 | 3259 |
3258 return the weak reference from Page instance | 3260 return the weak reference from Page instance |
3278 | 3280 |
3279 return the Active Path Record | 3281 return the Active Path Record |
3280 """ | 3282 """ |
3281 return self.__active_path_record | 3283 return self.__active_path_record |
3282 | 3284 |
3283 path = property(_getPath, _setPath, None, | 3285 pane_path = property(_getPanePath, _setPanePath, None, |
3284 "Path that identifie the item in the page notebook") | 3286 "Path that identifie the item in the page notebook") |
3285 widget = property(_getWidget, None, None, | 3287 widget = property(_getWidget, None, None, |
3286 "The main widget (gtk.ScrolledWindow)") | 3288 "The main widget (gtk.ScrolledWindow)") |
3287 page = property(_getPage, _setPage, None, | 3289 page = property(_getPage, _setPage, None, |
3288 "Weak reference from Page instance which creates this class") | 3290 "Weak reference from Page instance which creates this class") |
3304 Ancestry: | 3306 Ancestry: |
3305 +-- object | 3307 +-- object |
3306 +-- Sheet | 3308 +-- Sheet |
3307 Atributes: | 3309 Atributes: |
3308 widget: the main widget (gtk.VBox() object) | 3310 widget: the main widget (gtk.VBox() object) |
3309 path: the tuple that identifies the pane in the notebook page | 3311 pane_path: the tuple that identifies the pane in the notebook page |
3310 page: weak reference from Page instance which creates this class | 3312 page: weak reference from Page instance which creates this class |
3311 budget: The budget (base.obra objetc) | 3313 budget: The budget (base.obra objetc) |
3312 active_path_record: The active path record | 3314 active_path_record: The active path record |
3313 Methods: | 3315 Methods: |
3314 runMessage | 3316 runMessage |
3315 """ | 3317 """ |
3316 | 3318 |
3317 def __init__(self, budget, page, path, path_record=(0,)): | 3319 def __init__(self, budget, page, pane_path, path_record=(0,)): |
3318 """__init__(budget, page, path, path_record=(0,)) | 3320 """__init__(budget, page, pane_path, path_record=(0,)) |
3319 | 3321 |
3320 budget: the budget (base.obra object) | 3322 budget: the budget (base.obra object) |
3321 page: weak reference from Page instance which creates this class | 3323 page: weak reference from Page instance which creates this class |
3322 path: the path position of the description in the page | 3324 pane_path: the path position of the description in the page |
3323 path_record: the path of the active record | 3325 path_record: the path of the active record |
3324 | 3326 |
3325 self.__budget: the budget (base.obra object) | 3327 self.__budget: the budget (base.obra object) |
3326 self.__page: weak reference from Page instance which creates this class | 3328 self.__page: weak reference from Page instance which creates this class |
3327 self.__path: the path position of the description in the page | 3329 self.__pane_path: the path position of the description in the page |
3328 self.__active_path_record: the path of the active record | 3330 self.__active_path_record: the path of the active record |
3329 self.__label: The gtk.label with the title of the pane | 3331 self.__label: The gtk.label with the title of the pane |
3330 self.__field_liststore: the field liststore | 3332 self.__field_liststore: the field liststore |
3331 self.__field_treeview: the field treeview | 3333 self.__field_treeview: the field treeview |
3332 self.__field_selection: the field selected in field treview | 3334 self.__field_selection: the field selected in field treview |
3340 Creates an shows the scroledwindow that contain the description text | 3342 Creates an shows the scroledwindow that contain the description text |
3341 of the record to be showed in a pane. | 3343 of the record to be showed in a pane. |
3342 """ | 3344 """ |
3343 self.__budget = budget | 3345 self.__budget = budget |
3344 self.__page = page | 3346 self.__page = page |
3345 self.__path = path | 3347 self.__pane_path = pane_path |
3346 self.__active_path_record = path_record | 3348 self.__active_path_record = path_record |
3347 _budget = budget | 3349 _budget = budget |
3348 _main_box = gtk.VBox() | 3350 _main_box = gtk.VBox() |
3349 self.__label = gtk.Label(utils.mapping(_("Sheet of Conditions of the "\ | 3351 self.__label = gtk.Label(utils.mapping(_("Sheet of Conditions of the "\ |
3350 "record $1"), (self.__budget.getCode( | 3352 "record $1"), (self.__budget.getCode( |
3535 _code = _budget.getCode(self.__active_path_record) | 3537 _code = _budget.getCode(self.__active_path_record) |
3536 self.__label.set_text(utils.mapping(_("Sheet2 of Conditions of the "\ | 3538 self.__label.set_text(utils.mapping(_("Sheet2 of Conditions of the "\ |
3537 "record $1"), (_code,))) | 3539 "record $1"), (_code,))) |
3538 self._setFields() | 3540 self._setFields() |
3539 | 3541 |
3540 def runMessage(self, message, path, arg=None): | 3542 def runMessage(self, message, pane_path, arg=None): |
3541 """runMessage(message, path, arg=None) | 3543 """runMessage(message, pane_path, arg=None) |
3542 | 3544 |
3543 message: the message type | 3545 message: the message type |
3544 "change_active": change the active record | 3546 "change_active": change the active record |
3545 "clear": clear instance | 3547 "clear": clear instance |
3546 path: tuple that identifies the pane in the notebook page | 3548 pane_path: tuple that identifies the pane in the notebook page |
3547 arg: tuple whit two items: | 3549 arg: tuple whit two items: |
3548 0: record path in the budget | 3550 0: record path in the budget |
3549 1: record code | 3551 1: record code |
3550 This method receives a message and executes its corresponding action | 3552 This method receives a message and executes its corresponding action |
3551 """ | 3553 """ |
3561 | 3563 |
3562 Deletes all the instance atributes | 3564 Deletes all the instance atributes |
3563 """ | 3565 """ |
3564 del self.__page | 3566 del self.__page |
3565 del self.__widget | 3567 del self.__widget |
3566 del self.__path | 3568 del self.__pane_path |
3567 del self.__budget | 3569 del self.__budget |
3568 del self.__active_code | 3570 del self.__active_code |
3569 del self.__textbuffer | 3571 del self.__textbuffer |
3570 del self.__label | 3572 del self.__label |
3571 del self.__textbuffer | 3573 del self.__textbuffer |
3582 | 3584 |
3583 return the main widget (gtk.ScrolledWindow) | 3585 return the main widget (gtk.ScrolledWindow) |
3584 """ | 3586 """ |
3585 return self.__widget | 3587 return self.__widget |
3586 | 3588 |
3587 def _getPath(self): | 3589 def _getPanePath(self): |
3588 """_getPath() | 3590 """_getPanePath() |
3589 | 3591 |
3590 return the tuple that identifies the pane in the notebook page | 3592 return the tuple that identifies the pane in the notebook page |
3591 """ | 3593 """ |
3592 return self.__page | 3594 return self.__pane_path |
3593 | 3595 |
3594 def _setPath(self, path): | 3596 def _setPanePath(self, pane_path): |
3595 """_setPath() | 3597 """_setPanePath() |
3596 | 3598 |
3597 sets the tuple that identifies the pane in the notebook page | 3599 sets the tuple that identifies the pane in the notebook page |
3598 """ | 3600 """ |
3599 self.__path = path | 3601 self.__pane_path = pane_path |
3600 | 3602 |
3601 def _getPage(self): | 3603 def _getPage(self): |
3602 """_getPage() | 3604 """_getPage() |
3603 | 3605 |
3604 return the weak reference from Page instance | 3606 return the weak reference from Page instance |
3624 | 3626 |
3625 return the Active Path Record | 3627 return the Active Path Record |
3626 """ | 3628 """ |
3627 return self.__active_path_record | 3629 return self.__active_path_record |
3628 | 3630 |
3629 path = property(_getPath, _setPath, None, | 3631 pane_path = property(_getPanePath, _setPanePath, None, |
3630 "Path that identifie the item in the page notebook") | 3632 "Path that identifie the item in the page notebook") |
3631 widget = property(_getWidget, None, None, | 3633 widget = property(_getWidget, None, None, |
3632 "Lista de configuracion de vistas") | 3634 "Lista de configuracion de vistas") |
3633 page = property(_getPage, _setPage, None, | 3635 page = property(_getPage, _setPage, None, |
3634 "Weak reference from Page instance which creates this class") | 3636 "Weak reference from Page instance which creates this class") |
3642 """gui.FileView | 3644 """gui.FileView |
3643 | 3645 |
3644 Description: | 3646 Description: |
3645 Class to show the file icons of a record in a pane | 3647 Class to show the file icons of a record in a pane |
3646 Constructor: | 3648 Constructor: |
3647 Description(budget, page, path, path_record=(0,)) | 3649 Description(budget, page, pane_path, path_record=(0,)) |
3648 budget: the budget (base.obra object) | 3650 budget: the budget (base.obra object) |
3649 page: weak reference from Page instance which creates this class | 3651 page: weak reference from Page instance which creates this class |
3650 path: the path position of the description in the page | 3652 pane_path: the path position of the description in the page |
3651 path_record: the path of the active record | 3653 path_record: the path of the active record |
3652 Ancestry: | 3654 Ancestry: |
3653 +-- object | 3655 +-- object |
3654 +-- FileView | 3656 +-- FileView |
3655 Atributes: | 3657 Atributes: |
3656 widget: the main widget (gtk.ScrolledWindow object) | 3658 widget: the main widget (gtk.ScrolledWindow object) |
3657 "path": the tuple that identifies the pane in the notebook page | 3659 pane_path: the tuple that identifies the pane in the notebook page |
3658 "budget": The budget (base.obra objetc) | 3660 budget: The budget (base.obra objetc) |
3659 "active_code": The active code of the record | 3661 active_code: The active code of the record |
3660 Methods: | 3662 Methods: |
3661 runMessage | 3663 runMessage |
3662 """ | 3664 """ |
3663 | 3665 |
3664 def __init__(self, budget, page, path, path_record=(0,)): | 3666 def __init__(self, budget, page, pane_path, path_record=(0,)): |
3665 """__init__(budget, page, path, path_record=(0,)) | 3667 """__init__(budget, page, pane_path, path_record=(0,)) |
3666 | 3668 |
3667 budget: the budget (base.obra object) | 3669 budget: the budget (base.obra object) |
3668 page: weak reference from Page instance which creates this class | 3670 page: weak reference from Page instance which creates this class |
3669 path: the path position of the description in the page | 3671 pane_path: the path position of the description in the page |
3670 path_record: the path of the active record | 3672 path_record: the path of the active record |
3671 | 3673 |
3672 self.__budget: the budget (base.obra object) | 3674 self.__budget: the budget (base.obra object) |
3673 self.__page: weak reference from Page instance which creates this class | 3675 self.__page: weak reference from Page instance which creates this class |
3674 self.__path: the path position of the description in the page | 3676 self.__pane_path: the path position of the description in the page |
3675 self.__active_path_record: the path of the active record | 3677 self.__active_path_record: the path of the active record |
3676 self.__active_code: the code of the active record | 3678 self.__active_code: the code of the active record |
3677 self.__icon_box: the box that contains the icon | 3679 self.__icon_box: the box that contains the icon |
3678 self.__widget: main widget, a gtk.ScrolledWindow | 3680 self.__widget: main widget, a gtk.ScrolledWindow |
3679 | 3681 |
3680 Creates an shows the scroledwindow that contain icon files | 3682 Creates an shows the scroledwindow that contain icon files |
3681 of the record to be showed in a pane. | 3683 of the record to be showed in a pane. |
3682 """ | 3684 """ |
3683 self.__budget = budget | 3685 self.__budget = budget |
3684 self.__page = page | 3686 self.__page = page |
3685 self.__path = path | 3687 self.__pane_path = pane_path |
3686 self.__active_path_record = path_record | 3688 self.__active_path_record = path_record |
3687 self.__active_code = budget.getCode(self.__active_path_record) | 3689 self.__active_code = budget.getCode(self.__active_path_record) |
3688 _budget = budget | 3690 _budget = budget |
3689 _record = self.__budget.getRecord(self.__budget.getCode( | 3691 _record = self.__budget.getRecord(self.__budget.getCode( |
3690 self.__active_path_record)) | 3692 self.__active_path_record)) |
3788 self.__icon_box.destroy() | 3790 self.__icon_box.destroy() |
3789 self.__icon_box = self._getIconBox(_record) | 3791 self.__icon_box = self._getIconBox(_record) |
3790 self.__icon_box.show() | 3792 self.__icon_box.show() |
3791 self.__widget.add_with_viewport(self.__icon_box) | 3793 self.__widget.add_with_viewport(self.__icon_box) |
3792 | 3794 |
3793 def runMessage(self, message, path, arg=None): | 3795 def runMessage(self, message, pane_path, arg=None): |
3794 """runMessage(message, path, arg=None) | 3796 """runMessage(message, pane_path, arg=None) |
3795 | 3797 |
3796 message: the message type | 3798 message: the message type |
3797 "change_active": change the active record | 3799 "change_active": change the active record |
3798 "clear": clear instance | 3800 "clear": clear instance |
3799 path: tuple that identifies the pane in the notebook page | 3801 pane_path: tuple that identifies the pane in the notebook page |
3800 arg: tuple whit two items: | 3802 arg: tuple whit two items: |
3801 0: record path in the budget | 3803 0: record path in the budget |
3802 1: record code | 3804 1: record code |
3803 This method receives a message and executes its corresponding action | 3805 This method receives a message and executes its corresponding action |
3804 """ | 3806 """ |
3813 """_clear() | 3815 """_clear() |
3814 | 3816 |
3815 Delete all instance atributes | 3817 Delete all instance atributes |
3816 """ | 3818 """ |
3817 del self.__widget | 3819 del self.__widget |
3818 del self.__path | 3820 del self.__pane_path |
3819 del self.__budget | 3821 del self.__budget |
3820 del self.__active_code | 3822 del self.__active_code |
3821 | 3823 |
3822 def _getWidget(self): | 3824 def _getWidget(self): |
3823 """_getWidget() | 3825 """_getWidget() |
3824 | 3826 |
3825 return the main widget (gtk.ScrolledWindow) | 3827 return the main widget (gtk.ScrolledWindow) |
3826 """ | 3828 """ |
3827 return self.__widget | 3829 return self.__widget |
3828 | 3830 |
3829 def _getPath(self): | 3831 def _getPanePath(self): |
3830 """_getPath() | 3832 """_getPanePath() |
3831 | 3833 |
3832 return the tuple that identifies the pane in the notebook page | 3834 return the tuple that identifies the pane in the notebook page |
3833 """ | 3835 """ |
3834 return self.__path | 3836 return self.__pane_path |
3835 | 3837 |
3836 def _setPath(self, path): | 3838 def _setPanePath(self, pane_path): |
3837 """_setPath() | 3839 """_setPanePath() |
3838 | 3840 |
3839 sets the tuple that identifies the pane in the notebook page | 3841 sets the tuple that identifies the pane in the notebook page |
3840 """ | 3842 """ |
3841 self.__path = path | 3843 self.__pane_path = pane_path |
3842 | 3844 |
3843 def _getPage(self): | 3845 def _getPage(self): |
3844 """_getPage() | 3846 """_getPage() |
3845 | 3847 |
3846 return the weak reference from Page instance | 3848 return the weak reference from Page instance |
3866 | 3868 |
3867 return the Active Path Record | 3869 return the Active Path Record |
3868 """ | 3870 """ |
3869 return self.__active_path_record | 3871 return self.__active_path_record |
3870 | 3872 |
3871 path = property(_getPath, _setPath, None, | 3873 pane_path = property(_getPanePath, _setPanePath, None, |
3872 "Path that identifie the item in the page notebook") | 3874 "Path that identifie the item in the page notebook") |
3873 widget = property(_getWidget, None, None, | 3875 widget = property(_getWidget, None, None, |
3874 "The main widget (gtk.ScrolledWindow)") | 3876 "The main widget (gtk.ScrolledWindow)") |
3875 page = property(_getPage, _setPage, None, | 3877 page = property(_getPage, _setPage, None, |
3876 "Weak reference from Page instance which creates this class") | 3878 "Weak reference from Page instance which creates this class") |
3884 """gui.CompanyView: | 3886 """gui.CompanyView: |
3885 | 3887 |
3886 Description: | 3888 Description: |
3887 Class to show the company records of a budget | 3889 Class to show the company records of a budget |
3888 Constructor: | 3890 Constructor: |
3889 CompanyView(budget, page, path, path_record=(0,)) | 3891 CompanyView(budget, page, pane_path, path_record=(0,)) |
3890 budget: budget showed ("base.Budget" object) | 3892 budget: budget showed ("base.Budget" object) |
3891 page: weak reference from Page instance which creates this class | 3893 page: weak reference from Page instance which creates this class |
3892 path: tuple that represents the path of the List in the Page | 3894 pane_path: tuple that represents the path of the List in the Page |
3893 path_record: path of the active record in the budget | 3895 path_record: path of the active record in the budget |
3894 Ancestry: | 3896 Ancestry: |
3895 +-- object | 3897 +-- object |
3896 +-- CompanyView | 3898 +-- CompanyView |
3897 Atributes: | 3899 Atributes: |
3898 active_path_record: Read. Path of the active record in the budget | 3900 active_path_record: Read. Path of the active record in the budget |
3899 widget: Read. Window that contains the main widget, a gtk.HPaned | 3901 widget: Read. Window that contains the main widget, a gtk.HPaned |
3900 path: Read-Write. Pane page identifier | 3902 pane_path: Read-Write. Pane page identifier |
3901 page: Read-Write. weak reference from Page instance which creates this class | 3903 page: Read-Write. weak reference from Page instance which creates this class |
3902 budget: Read. Budget to show, base.budget instance. | 3904 budget: Read. Budget to show, base.budget instance. |
3903 Methods: | 3905 Methods: |
3904 runMessage | 3906 runMessage |
3905 """ | 3907 """ |
3906 | 3908 |
3907 def __init__(self, budget, page, path, path_record=(0,)): | 3909 def __init__(self, budget, page, pane_path, path_record=(0,)): |
3908 """__init__(budget, page, path, path_record=(0,)) | 3910 """__init__(budget, page, pane_path, path_record=(0,)) |
3909 | 3911 |
3910 budget: budget: budget showed ("base.Budget" object) | 3912 budget: budget: budget showed ("base.Budget" object) |
3911 page: weak reference from Page instance which creates this class | 3913 page: weak reference from Page instance which creates this class |
3912 path: tuple that represents the path of the List in the Page | 3914 pane_path: tuple that represents the path of the List in the Page |
3913 path_record: path of the active record in the budget | 3915 path_record: path of the active record in the budget |
3914 | 3916 |
3915 self.__selection: | 3917 self.__selection: |
3916 self.__budget: budget: budget showed ("base.Budget" object) | 3918 self.__budget: budget: budget showed ("base.Budget" object) |
3917 self.__page: weak reference from Page instance which creates this class | 3919 self.__page: weak reference from Page instance which creates this class |
3918 self.__path: tuple that represents the path of the List in the Page | 3920 self.__pane_path: tuple that represents the path of the List in the Page |
3919 self.__active_path_record: path of the active record in the budget | 3921 self.__active_path_record: path of the active record in the budget |
3920 self.__widget: main widget, a gtk.HPaned | 3922 self.__widget: main widget, a gtk.HPaned |
3921 self.__treestore: to store companys data | 3923 self.__treestore: to store companys data |
3922 self.__option_View: OptionView object | 3924 self.__option_View: OptionView object |
3923 | 3925 |
3927 # Seting init args | 3929 # Seting init args |
3928 if not isinstance(budget, base.Budget): | 3930 if not isinstance(budget, base.Budget): |
3929 raise ValueError, _("Argument must be a Budget object") | 3931 raise ValueError, _("Argument must be a Budget object") |
3930 self.__budget = budget | 3932 self.__budget = budget |
3931 self.__page = page | 3933 self.__page = page |
3932 self.__path = path | 3934 self.__pane_path = pane_path |
3933 self.__active_path_record = path_record | 3935 self.__active_path_record = path_record |
3934 # main widget | 3936 # main widget |
3935 self.__widget = gtk.HPaned() | 3937 self.__widget = gtk.HPaned() |
3936 self.__widget.set_position(230) | 3938 self.__widget.set_position(230) |
3937 # TreeStore | 3939 # TreeStore |
4086 Method connected to "change_active" message | 4088 Method connected to "change_active" message |
4087 Show the record especified in the "change_active" message | 4089 Show the record especified in the "change_active" message |
4088 """ | 4090 """ |
4089 self.__active_path_record = record_path | 4091 self.__active_path_record = record_path |
4090 | 4092 |
4091 def runMessage(self, message, path, arg=None): | 4093 def runMessage(self, message, pane_path, arg=None): |
4092 """runMessage(message, path, arg=None) | 4094 """runMessage(message, pane_path, arg=None) |
4093 | 4095 |
4094 message: the message type | 4096 message: the message type |
4095 "change_active": change the active record | 4097 "change_active": change the active record |
4096 "clear": clear instance | 4098 "clear": clear instance |
4097 path: tuple that identifies the pane in the notebook page | 4099 pane_path: tuple that identifies the pane in the notebook page |
4098 arg: tuple whit two items: | 4100 arg: tuple whit two items: |
4099 0: record path in the budget | 4101 0: record path in the budget |
4100 1: record code | 4102 1: record code |
4101 This method receives a message and executes its corresponding action | 4103 This method receives a message and executes its corresponding action |
4102 """ | 4104 """ |
4159 | 4161 |
4160 return the main widget (gtk.ScrolledWindow) | 4162 return the main widget (gtk.ScrolledWindow) |
4161 """ | 4163 """ |
4162 return self.__widget | 4164 return self.__widget |
4163 | 4165 |
4164 def _getPath(self): | 4166 def _getPanePath(self): |
4165 """_getPath() | 4167 """_getPanePath() |
4166 | 4168 |
4167 return the tuple that identifies the pane in the notebook page | 4169 return the tuple that identifies the pane in the notebook page |
4168 """ | 4170 """ |
4169 return self.__path | 4171 return self.__pane_path |
4170 | 4172 |
4171 def _setPath(self, path): | 4173 def _setPanePath(self, pane_path): |
4172 """_setPath() | 4174 """_setPanePath() |
4173 | 4175 |
4174 sets the tuple that identifies the pane in the notebook page | 4176 sets the tuple that identifies the pane in the notebook page |
4175 """ | 4177 """ |
4176 self.__path = path | 4178 self.__pane_path = pane_path |
4177 | 4179 |
4178 def _getPage(self): | 4180 def _getPage(self): |
4179 """_getPage() | 4181 """_getPage() |
4180 | 4182 |
4181 return the Page | 4183 return the Page |
4205 | 4207 |
4206 active_path_record = property(_getActivePathRecord, None, None, | 4208 active_path_record = property(_getActivePathRecord, None, None, |
4207 "Active path record") | 4209 "Active path record") |
4208 widget = property(_getWidget, None, None, | 4210 widget = property(_getWidget, None, None, |
4209 "main widget") | 4211 "main widget") |
4210 path = property(_getPath, _setPath, None, | 4212 pane_path = property(_getPanePath, _setPanePath, None, |
4211 "Path that identifies the item in the page notebook") | 4213 "Path that identifies the item in the page notebook") |
4212 page = property(_getPage, _setPage, None, | 4214 page = property(_getPage, _setPage, None, |
4213 "Weak reference from Page instance which creates this class") | 4215 "Weak reference from Page instance which creates this class") |
4214 budget = property(_getBudget, None, None, | 4216 budget = property(_getBudget, None, None, |
4215 "Budget object") | 4217 "Budget object") |