Mercurial > pyarq-presupuestos
comparison Gtk/gui.py @ 6:2fc6b47dbe70
rename module globals to globalVars
author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
---|---|
date | Sat, 06 Nov 2010 22:33:32 +0100 |
parents | 6502bfdaa84d |
children | 0359329a1c26 |
comparison
equal
deleted
inserted
replaced
5:6502bfdaa84d | 6:2fc6b47dbe70 |
---|---|
56 from Gtk import importFiebdc | 56 from Gtk import importFiebdc |
57 from Generic import base | 57 from Generic import base |
58 from Generic import fiebdc | 58 from Generic import fiebdc |
59 from Generic import durusdatabase | 59 from Generic import durusdatabase |
60 from Generic import utils | 60 from Generic import utils |
61 from Generic import globals | 61 from Generic import globalVars |
62 from Generic import openwith | 62 from Generic import openwith |
63 | 63 |
64 # Load default icon | 64 # Load default icon |
65 if os.path.exists(globals.getAppPath("ICON")): | 65 if os.path.exists(globalVars.getAppPath("ICON")): |
66 icon = gtk.gdk.pixbuf_new_from_file(globals.getAppPath("ICON")) | 66 icon = gtk.gdk.pixbuf_new_from_file(globalVars.getAppPath("ICON")) |
67 gtk.window_set_default_icon_list(icon) | 67 gtk.window_set_default_icon_list(icon) |
68 else: | 68 else: |
69 print utils.mapping(_("The icon file does not exist. '$1'"), | 69 print utils.mapping(_("The icon file does not exist. '$1'"), |
70 (globals.getAppPath("ICON"),)) | 70 (globalVars.getAppPath("ICON"),)) |
71 | 71 |
72 # Autodetect desktop | 72 # Autodetect desktop |
73 if globals.desktop["autodetect"]: | 73 if globalVars.desktop["autodetect"]: |
74 openwith.autodetect_desktop() | 74 openwith.autodetect_desktop() |
75 print utils.mapping(_("pyArq-Presupuestos running on $1"), | 75 print utils.mapping(_("pyArq-Presupuestos running on $1"), |
76 (globals.desktop["desktop"],)) | 76 (globalVars.desktop["desktop"],)) |
77 | 77 |
78 class MainWindow(object): | 78 class MainWindow(object): |
79 """gui.MainWindow: | 79 """gui.MainWindow: |
80 | 80 |
81 Description: | 81 Description: |
354 self.__progress = 0.0 | 354 self.__progress = 0.0 |
355 self.__widget = gtk.VBox() | 355 self.__widget = gtk.VBox() |
356 self.__main_item = None | 356 self.__main_item = None |
357 self.__widget.show() | 357 self.__widget.show() |
358 self.__throbber = gtk.Image() | 358 self.__throbber = gtk.Image() |
359 self.__throbber.set_from_file(globals.getAppPath("THROBBER-ICON")) | 359 self.__throbber.set_from_file(globalVars.getAppPath("THROBBER-ICON")) |
360 self.__throbber.show() | 360 self.__throbber.show() |
361 self.__animationThobber = gtk.gdk.PixbufAnimation( | 361 self.__animationThobber = gtk.gdk.PixbufAnimation( |
362 globals.getAppPath("THROBBER-GIF")) | 362 globalVars.getAppPath("THROBBER-GIF")) |
363 self.__quietThobber = self.__throbber.get_pixbuf() | 363 self.__quietThobber = self.__throbber.get_pixbuf() |
364 self.__budget_icon = gtk.gdk.pixbuf_new_from_file_at_size( | 364 self.__budget_icon = gtk.gdk.pixbuf_new_from_file_at_size( |
365 globals.getAppPath("BUDGET-ICON"), 16, 16) | 365 globalVars.getAppPath("BUDGET-ICON"), 16, 16) |
366 _filename = os.path.basename(filename) | 366 _filename = os.path.basename(filename) |
367 _rootfilename = os.path.splitext(_filename)[0] | 367 _rootfilename = os.path.splitext(_filename)[0] |
368 if not _rootfilename == "": | 368 if not _rootfilename == "": |
369 _filename = _rootfilename | 369 _filename = _rootfilename |
370 _titleLabel = gtk.Label(_filename) | 370 _titleLabel = gtk.Label(_filename) |
376 self.__statuscontext = self.__statusbar.get_context_id("Statusbar") | 376 self.__statuscontext = self.__statusbar.get_context_id("Statusbar") |
377 self.__statusbar.show() | 377 self.__statusbar.show() |
378 _align = gtk.Alignment(0.5, 0.5, 0, 0) | 378 _align = gtk.Alignment(0.5, 0.5, 0, 0) |
379 _iconVbox = gtk.VBox() | 379 _iconVbox = gtk.VBox() |
380 _pyArqIcon = gtk.Image() | 380 _pyArqIcon = gtk.Image() |
381 _pyArqIcon.set_from_file(globals.getAppPath("PYARQ-ICON")) | 381 _pyArqIcon.set_from_file(globalVars.getAppPath("PYARQ-ICON")) |
382 _pyArqIcon.show() | 382 _pyArqIcon.show() |
383 _iconVbox.pack_start(_pyArqIcon, True, True, 0) | 383 _iconVbox.pack_start(_pyArqIcon, True, True, 0) |
384 _link = gtk.LinkButton("http://pyarq.obraencurso.es", | 384 _link = gtk.LinkButton("http://pyarq.obraencurso.es", |
385 "http://pyarq.obraencurso.es") | 385 "http://pyarq.obraencurso.es") |
386 _iconVbox.pack_start(_link, True, True, 0) | 386 _iconVbox.pack_start(_link, True, True, 0) |
955 if view_type == "DecompositionList": | 955 if view_type == "DecompositionList": |
956 self.__view = DecompositionList(budget, weakref.ref(self), | 956 self.__view = DecompositionList(budget, weakref.ref(self), |
957 path, active_path_record) | 957 path, active_path_record) |
958 _combobox.set_active(0) | 958 _combobox.set_active(0) |
959 _view_icon = gtk.Image() | 959 _view_icon = gtk.Image() |
960 _view_icon.set_from_file(globals.getAppPath("DECOMPOSITION-ICON")) | 960 _view_icon.set_from_file(globalVars.getAppPath("DECOMPOSITION-ICON")) |
961 elif view_type == "RecordDescription": | 961 elif view_type == "RecordDescription": |
962 self.__view = Description(budget, weakref.ref(self), | 962 self.__view = Description(budget, weakref.ref(self), |
963 path, active_path_record) | 963 path, active_path_record) |
964 _combobox.set_active(1) | 964 _combobox.set_active(1) |
965 _view_icon = gtk.Image() | 965 _view_icon = gtk.Image() |
966 _view_icon.set_from_file(globals.getAppPath("DESCRIPTION-ICON")) | 966 _view_icon.set_from_file(globalVars.getAppPath("DESCRIPTION-ICON")) |
967 elif view_type == "Measure": | 967 elif view_type == "Measure": |
968 self.__view = Measure(budget, weakref.ref(self), | 968 self.__view = Measure(budget, weakref.ref(self), |
969 path, active_path_record) | 969 path, active_path_record) |
970 _combobox.set_active(2) | 970 _combobox.set_active(2) |
971 _view_icon = gtk.Image() | 971 _view_icon = gtk.Image() |
972 _view_icon.set_from_file(globals.getAppPath("MEASURE-ICON")) | 972 _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) |
973 elif view_type == "Sheet of Conditions": | 973 elif view_type == "Sheet of Conditions": |
974 self.__view = Sheet(budget, weakref.ref(self), | 974 self.__view = Sheet(budget, weakref.ref(self), |
975 path, active_path_record) | 975 path, active_path_record) |
976 _combobox.set_active(3) | 976 _combobox.set_active(3) |
977 _view_icon = gtk.Image() | 977 _view_icon = gtk.Image() |
978 _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) | 978 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
979 elif view_type == "FileView": | 979 elif view_type == "FileView": |
980 self.__view = FileView(budget, weakref.ref(self), | 980 self.__view = FileView(budget, weakref.ref(self), |
981 path, active_path_record) | 981 path, active_path_record) |
982 _combobox.set_active(4) | 982 _combobox.set_active(4) |
983 _view_icon = gtk.Image() | 983 _view_icon = gtk.Image() |
984 _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) | 984 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
985 elif view_type == "CompanyView": | 985 elif view_type == "CompanyView": |
986 self.__view = CompanyView(budget, weakref.ref(self), path, | 986 self.__view = CompanyView(budget, weakref.ref(self), path, |
987 active_path_record) | 987 active_path_record) |
988 _combobox.set_active(5) | 988 _combobox.set_active(5) |
989 _view_icon = gtk.Image() | 989 _view_icon = gtk.Image() |
990 _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) | 990 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
991 | 991 |
992 else: | 992 else: |
993 raise ValueError, _(utils.mapping("Invalid type of View: $1", | 993 raise ValueError, _(utils.mapping("Invalid type of View: $1", |
994 view_type)) | 994 view_type)) |
995 _view_icon.show() | 995 _view_icon.show() |
1001 _hbox.pack_start(_combobox, False, False,0) | 1001 _hbox.pack_start(_combobox, False, False,0) |
1002 _invisible = gtk.HBox() | 1002 _invisible = gtk.HBox() |
1003 _invisible.show() | 1003 _invisible.show() |
1004 _hbox.pack_start(_invisible, True, False,0) | 1004 _hbox.pack_start(_invisible, True, False,0) |
1005 _icon_menu = gtk.Image() | 1005 _icon_menu = gtk.Image() |
1006 _icon_menu.set_from_file(globals.getAppPath("MENU-ICON")) | 1006 _icon_menu.set_from_file(globalVars.getAppPath("MENU-ICON")) |
1007 _icon_menu.show() | 1007 _icon_menu.show() |
1008 _menu_button = gtk.ToolButton() | 1008 _menu_button = gtk.ToolButton() |
1009 _menu_button.set_icon_widget(_icon_menu) | 1009 _menu_button.set_icon_widget(_icon_menu) |
1010 _menu_button.connect("clicked", self._menu_view) | 1010 _menu_button.connect("clicked", self._menu_view) |
1011 _menu_button.show() | 1011 _menu_button.show() |
1012 _icon_connected = gtk.Image() | 1012 _icon_connected = gtk.Image() |
1013 _icon_connected.set_from_file(globals.getAppPath("CONNECTED-ICON")) | 1013 _icon_connected.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) |
1014 _icon_connected.show() | 1014 _icon_connected.show() |
1015 _hbox.pack_start(_menu_button, False, False, 0) | 1015 _hbox.pack_start(_menu_button, False, False, 0) |
1016 self.__connected_button = gtk.ToolButton() | 1016 self.__connected_button = gtk.ToolButton() |
1017 self.__connected_button.set_icon_widget(_icon_connected) | 1017 self.__connected_button.set_icon_widget(_icon_connected) |
1018 self.__connected_button.connect("clicked", self._connected) | 1018 self.__connected_button.connect("clicked", self._connected) |
1019 self.__connected_button.show() | 1019 self.__connected_button.show() |
1020 _hbox.pack_start(self.__connected_button, False, False, 0) | 1020 _hbox.pack_start(self.__connected_button, False, False, 0) |
1021 _icon_close = gtk.Image() | 1021 _icon_close = gtk.Image() |
1022 _icon_close.set_from_file(globals.getAppPath("CLOSE-ICON")) | 1022 _icon_close.set_from_file(globalVars.getAppPath("CLOSE-ICON")) |
1023 _icon_close.show() | 1023 _icon_close.show() |
1024 _close_button = gtk.ToolButton() | 1024 _close_button = gtk.ToolButton() |
1025 _close_button.set_icon_widget(_icon_close) | 1025 _close_button.set_icon_widget(_icon_close) |
1026 _close_button.connect("clicked", self._closeItem) | 1026 _close_button.connect("clicked", self._closeItem) |
1027 _close_button.show() | 1027 _close_button.show() |
1074 _view_icon = gtk.Image() | 1074 _view_icon = gtk.Image() |
1075 if _index == 0: | 1075 if _index == 0: |
1076 self.__view = DecompositionList(_budget, _wr_page, _path, | 1076 self.__view = DecompositionList(_budget, _wr_page, _path, |
1077 _path_record) | 1077 _path_record) |
1078 | 1078 |
1079 _view_icon.set_from_file(globals.getAppPath("DECOMPOSITION-ICON")) | 1079 _view_icon.set_from_file(globalVars.getAppPath("DECOMPOSITION-ICON")) |
1080 self.__view_type = "DecompositionList" | 1080 self.__view_type = "DecompositionList" |
1081 elif _index == 1: | 1081 elif _index == 1: |
1082 self.__view = Description(_budget, _wr_page, _path, | 1082 self.__view = Description(_budget, _wr_page, _path, |
1083 _path_record) | 1083 _path_record) |
1084 _view_icon.set_from_file(globals.getAppPath("DESCRIPTION-ICON")) | 1084 _view_icon.set_from_file(globalVars.getAppPath("DESCRIPTION-ICON")) |
1085 self.__view_type = "RecordDescription" | 1085 self.__view_type = "RecordDescription" |
1086 elif _index == 2: | 1086 elif _index == 2: |
1087 self.__view = Measure(_budget, _wr_page, _path, | 1087 self.__view = Measure(_budget, _wr_page, _path, |
1088 _path_record) | 1088 _path_record) |
1089 _view_icon.set_from_file(globals.getAppPath("MEASURE-ICON")) | 1089 _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) |
1090 self.__view_type = "Measure" | 1090 self.__view_type = "Measure" |
1091 elif _index == 3: | 1091 elif _index == 3: |
1092 self.__view = Sheet(_budget, _wr_page, _path, | 1092 self.__view = Sheet(_budget, _wr_page, _path, |
1093 _path_record) | 1093 _path_record) |
1094 _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) | 1094 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1095 self.__view_type = "Sheet of Conditions" | 1095 self.__view_type = "Sheet of Conditions" |
1096 elif _index == 4: | 1096 elif _index == 4: |
1097 self.__view = FileView(_budget, _wr_page, _path, | 1097 self.__view = FileView(_budget, _wr_page, _path, |
1098 _path_record) | 1098 _path_record) |
1099 _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) | 1099 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1100 self.__view_type = "FileView" | 1100 self.__view_type = "FileView" |
1101 elif _index == 5: | 1101 elif _index == 5: |
1102 self.__view = CompanyView(_budget, _wr_page, _path, | 1102 self.__view = CompanyView(_budget, _wr_page, _path, |
1103 _path_record) | 1103 _path_record) |
1104 _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) | 1104 _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) |
1105 self.__view_type = "CompanyView" | 1105 self.__view_type = "CompanyView" |
1106 _view_icon.show() | 1106 _view_icon.show() |
1107 _hbox = gtk.HBox() | 1107 _hbox = gtk.HBox() |
1108 _hbox.pack_start(_view_icon, False, False,0) | 1108 _hbox.pack_start(_view_icon, False, False,0) |
1109 _hbox.pack_start(_combobox, False, False,0) | 1109 _hbox.pack_start(_combobox, False, False,0) |
1156 _connected atribute is False the view do not send and receive messages | 1156 _connected atribute is False the view do not send and receive messages |
1157 to/from others views | 1157 to/from others views |
1158 """ | 1158 """ |
1159 if self.__connected: | 1159 if self.__connected: |
1160 _icon = gtk.Image() | 1160 _icon = gtk.Image() |
1161 _icon.set_from_file(globals.getAppPath("DISCONNECTED-ICON")) | 1161 _icon.set_from_file(globalVars.getAppPath("DISCONNECTED-ICON")) |
1162 _icon.show() | 1162 _icon.show() |
1163 self.__connected_button.set_icon_widget(_icon) | 1163 self.__connected_button.set_icon_widget(_icon) |
1164 self.__connected = False | 1164 self.__connected = False |
1165 else: | 1165 else: |
1166 _icon = gtk.Image() | 1166 _icon = gtk.Image() |
1167 _icon.set_from_file(globals.getAppPath("CONNECTED-ICON")) | 1167 _icon.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) |
1168 _icon.show() | 1168 _icon.show() |
1169 self.__connected_button.set_icon_widget(_icon) | 1169 self.__connected_button.set_icon_widget(_icon) |
1170 self.__connected = True | 1170 self.__connected = True |
1171 | 1171 |
1172 def propagateMessageFrom(self, message, path, arg=None): | 1172 def propagateMessageFrom(self, message, path, arg=None): |
1484 """ | 1484 """ |
1485 if args[0] == "INDEX": | 1485 if args[0] == "INDEX": |
1486 _index_column = self.createBaseColumn(args) | 1486 _index_column = self.createBaseColumn(args) |
1487 _text_index_cell = gtk.CellRendererText() | 1487 _text_index_cell = gtk.CellRendererText() |
1488 _text_index_cell.set_property('foreground-gdk', | 1488 _text_index_cell.set_property('foreground-gdk', |
1489 gtk.gdk.color_parse(globals.color["TEXT"])) | 1489 gtk.gdk.color_parse(globalVars.color["TEXT"])) |
1490 _pixbuf_index_cell = gtk.CellRendererPixbuf() | 1490 _pixbuf_index_cell = gtk.CellRendererPixbuf() |
1491 _arrow_icon = gtk.gdk.pixbuf_new_from_file( | 1491 _arrow_icon = gtk.gdk.pixbuf_new_from_file( |
1492 globals.getAppPath("ARROW-ICON")) | 1492 globalVars.getAppPath("ARROW-ICON")) |
1493 _pixbuf_index_cell.set_property("pixbuf", _arrow_icon) | 1493 _pixbuf_index_cell.set_property("pixbuf", _arrow_icon) |
1494 _index_column.pack_start(_text_index_cell, True) | 1494 _index_column.pack_start(_text_index_cell, True) |
1495 _index_column.pack_start(_pixbuf_index_cell, True) | 1495 _index_column.pack_start(_pixbuf_index_cell, True) |
1496 _index_column.set_cell_data_func(_text_index_cell, | 1496 _index_column.set_cell_data_func(_text_index_cell, |
1497 self.colorCell, | 1497 self.colorCell, |
1498 [gtk.gdk.color_parse(globals.color["INDEX-UNEVEN"]), | 1498 [gtk.gdk.color_parse(globalVars.color["INDEX-UNEVEN"]), |
1499 gtk.gdk.color_parse(globals.color["INDEX-EVEN"])]) | 1499 gtk.gdk.color_parse(globalVars.color["INDEX-EVEN"])]) |
1500 return _index_column | 1500 return _index_column |
1501 elif args[0] == "TEXT": | 1501 elif args[0] == "TEXT": |
1502 _column, _cell = self.createTextBaseColumn(args) | 1502 _column, _cell = self.createTextBaseColumn(args) |
1503 _column.add_attribute(_cell, 'text', args[5]) | 1503 _column.add_attribute(_cell, 'text', args[5]) |
1504 return _column | 1504 return _column |
1537 elif args[0] == "END": | 1537 elif args[0] == "END": |
1538 _end_column = gtk.TreeViewColumn() | 1538 _end_column = gtk.TreeViewColumn() |
1539 _end_column.set_clickable(False) | 1539 _end_column.set_clickable(False) |
1540 _end_cell = gtk.CellRendererText() | 1540 _end_cell = gtk.CellRendererText() |
1541 _end_cell.set_property('cell-background-gdk', | 1541 _end_cell.set_property('cell-background-gdk', |
1542 gtk.gdk.color_parse(globals.color["UNEVEN"])) | 1542 gtk.gdk.color_parse(globalVars.color["UNEVEN"])) |
1543 _end_column.pack_start(_end_cell, True) | 1543 _end_column.pack_start(_end_cell, True) |
1544 return _end_column | 1544 return _end_column |
1545 return None | 1545 return None |
1546 | 1546 |
1547 def createTextBaseColumn(self,args): | 1547 def createTextBaseColumn(self,args): |
1703 self.__scrolled_window = gtk.ScrolledWindow() | 1703 self.__scrolled_window = gtk.ScrolledWindow() |
1704 self.__scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, | 1704 self.__scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, |
1705 gtk.POLICY_AUTOMATIC) | 1705 gtk.POLICY_AUTOMATIC) |
1706 self.__scrolled_window.add(self.__treeview) | 1706 self.__scrolled_window.add(self.__treeview) |
1707 # colors | 1707 # colors |
1708 _text_color = gtk.gdk.color_parse(globals.color["TEXT"]) | 1708 _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) |
1709 _background_color = [ | 1709 _background_color = [ |
1710 gtk.gdk.color_parse(globals.color["UNEVEN"]), | 1710 gtk.gdk.color_parse(globalVars.color["UNEVEN"]), |
1711 gtk.gdk.color_parse(globals.color["EVEN"])] | 1711 gtk.gdk.color_parse(globalVars.color["EVEN"])] |
1712 self.__chapter_background_colors = [ | 1712 self.__chapter_background_colors = [ |
1713 gtk.gdk.color_parse(globals.color["CHAPTER-UNEVEN"]), | 1713 gtk.gdk.color_parse(globalVars.color["CHAPTER-UNEVEN"]), |
1714 gtk.gdk.color_parse(globals.color["CHAPTER-EVEN"])] | 1714 gtk.gdk.color_parse(globalVars.color["CHAPTER-EVEN"])] |
1715 super(DecompositionList,self).__init__( | 1715 super(DecompositionList,self).__init__( |
1716 [("INDEX",self.selectAll,42), | 1716 [("INDEX",self.selectAll,42), |
1717 ("CALCULATEDTEXT", self.showParentRecord, | 1717 ("CALCULATEDTEXT", self.showParentRecord, |
1718 gtk.Label("A"*10).size_request()[0] +10, | 1718 gtk.Label("A"*10).size_request()[0] +10, |
1719 _text_color, _background_color), | 1719 _text_color, _background_color), |
1731 ("CALCULATED", self.showParentRecord, | 1731 ("CALCULATED", self.showParentRecord, |
1732 gtk.Label("a"*10).size_request()[0] +10, | 1732 gtk.Label("a"*10).size_request()[0] +10, |
1733 _text_color, _background_color), | 1733 _text_color, _background_color), |
1734 ("CALCULATED", self.showParentRecord, | 1734 ("CALCULATED", self.showParentRecord, |
1735 gtk.Label("a"*10).size_request()[0] +10, | 1735 gtk.Label("a"*10).size_request()[0] +10, |
1736 gtk.gdk.color_parse(globals.color["CALCULATED-TEXT"]), | 1736 gtk.gdk.color_parse(globalVars.color["CALCULATED-TEXT"]), |
1737 _background_color), | 1737 _background_color), |
1738 ]) | 1738 ]) |
1739 self.__index_column = self.columns[0] | 1739 self.__index_column = self.columns[0] |
1740 self.__code_column = self.columns[1] | 1740 self.__code_column = self.columns[1] |
1741 self.__type_column = self.columns[2] | 1741 self.__type_column = self.columns[2] |
1750 # Code column | 1750 # Code column |
1751 self.__treeview.append_column(self.__code_column) | 1751 self.__treeview.append_column(self.__code_column) |
1752 # Type column | 1752 # Type column |
1753 self.__treeview.append_column(self.__type_column) | 1753 self.__treeview.append_column(self.__type_column) |
1754 self.chapter_icon = gtk.gdk.pixbuf_new_from_file( | 1754 self.chapter_icon = gtk.gdk.pixbuf_new_from_file( |
1755 globals.getAppPath("CHAPTER-ICON")) | 1755 globalVars.getAppPath("CHAPTER-ICON")) |
1756 self.unit_icon = gtk.gdk.pixbuf_new_from_file( | 1756 self.unit_icon = gtk.gdk.pixbuf_new_from_file( |
1757 globals.getAppPath("UNIT-ICON") ) | 1757 globalVars.getAppPath("UNIT-ICON") ) |
1758 self.material_icon = gtk.gdk.pixbuf_new_from_file( | 1758 self.material_icon = gtk.gdk.pixbuf_new_from_file( |
1759 globals.getAppPath("MATERIAL-ICON") ) | 1759 globalVars.getAppPath("MATERIAL-ICON") ) |
1760 self.machinery_icon = gtk.gdk.pixbuf_new_from_file( | 1760 self.machinery_icon = gtk.gdk.pixbuf_new_from_file( |
1761 globals.getAppPath("MACHINERY-ICON")) | 1761 globalVars.getAppPath("MACHINERY-ICON")) |
1762 self.labourforce_icon = gtk.gdk.pixbuf_new_from_file( | 1762 self.labourforce_icon = gtk.gdk.pixbuf_new_from_file( |
1763 globals.getAppPath("LABOURFORCE-ICON")) | 1763 globalVars.getAppPath("LABOURFORCE-ICON")) |
1764 self.__type_column.get_cell_renderers()[0].set_property("pixbuf", | 1764 self.__type_column.get_cell_renderers()[0].set_property("pixbuf", |
1765 self.labourforce_icon) | 1765 self.labourforce_icon) |
1766 | 1766 |
1767 # Unit column | 1767 # Unit column |
1768 self.__treeview.append_column(self.__unit_column) | 1768 self.__treeview.append_column(self.__unit_column) |
2065 self.machinery_icon) | 2065 self.machinery_icon) |
2066 else: | 2066 else: |
2067 cell_renderer.set_property("pixbuf",self.material_icon) | 2067 cell_renderer.set_property("pixbuf",self.material_icon) |
2068 if self.__treeview.get_cursor() == (_row_path,column): | 2068 if self.__treeview.get_cursor() == (_row_path,column): |
2069 cell_renderer.set_property('cell-background-gdk', | 2069 cell_renderer.set_property('cell-background-gdk', |
2070 gtk.gdk.color_parse(globals.color["ACTIVE"])) | 2070 gtk.gdk.color_parse(globalVars.color["ACTIVE"])) |
2071 else: | 2071 else: |
2072 cell_renderer.set_property('cell-background-gdk', | 2072 cell_renderer.set_property('cell-background-gdk', |
2073 lcolor[_number % 2]) | 2073 lcolor[_number % 2]) |
2074 | 2074 |
2075 def showParentRecord(self, column): | 2075 def showParentRecord(self, column): |
2335 self.__scrolled_window = gtk.ScrolledWindow() | 2335 self.__scrolled_window = gtk.ScrolledWindow() |
2336 self.__scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, | 2336 self.__scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, |
2337 gtk.POLICY_AUTOMATIC) | 2337 gtk.POLICY_AUTOMATIC) |
2338 self.__scrolled_window.add(self.__treeview) | 2338 self.__scrolled_window.add(self.__treeview) |
2339 # colors | 2339 # colors |
2340 _text_color = gtk.gdk.color_parse(globals.color["TEXT"]) | 2340 _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) |
2341 _calculated_text =gtk.gdk.color_parse(globals.color["CALCULATED-TEXT"]) | 2341 _calculated_text =gtk.gdk.color_parse(globalVars.color["CALCULATED-TEXT"]) |
2342 _background_color = [ | 2342 _background_color = [ |
2343 gtk.gdk.color_parse(globals.color["UNEVEN"]), | 2343 gtk.gdk.color_parse(globalVars.color["UNEVEN"]), |
2344 gtk.gdk.color_parse(globals.color["EVEN"])] | 2344 gtk.gdk.color_parse(globalVars.color["EVEN"])] |
2345 self.__chapter_background_colors = [ | 2345 self.__chapter_background_colors = [ |
2346 gtk.gdk.color_parse(globals.color["CHAPTER-UNEVEN"]), | 2346 gtk.gdk.color_parse(globalVars.color["CHAPTER-UNEVEN"]), |
2347 gtk.gdk.color_parse(globals.color["CHAPTER-EVEN"])] | 2347 gtk.gdk.color_parse(globalVars.color["CHAPTER-EVEN"])] |
2348 super(Measure,self).__init__( | 2348 super(Measure,self).__init__( |
2349 [("INDEX",self.selectAll,42), | 2349 [("INDEX",self.selectAll,42), |
2350 ("PIXBUF", self.passMethod, | 2350 ("PIXBUF", self.passMethod, |
2351 gtk.Label("A"*4).size_request()[0] +10, | 2351 gtk.Label("A"*4).size_request()[0] +10, |
2352 _text_color, _background_color), | 2352 _text_color, _background_color), |
2389 # Index column | 2389 # Index column |
2390 self.__treeview.append_column(self.__index_column) | 2390 self.__treeview.append_column(self.__index_column) |
2391 # Linetype column | 2391 # Linetype column |
2392 self.__treeview.append_column(self.__linetype_column) | 2392 self.__treeview.append_column(self.__linetype_column) |
2393 self.calculatedline_icon = gtk.gdk.pixbuf_new_from_file( | 2393 self.calculatedline_icon = gtk.gdk.pixbuf_new_from_file( |
2394 globals.getAppPath("CALCULATEDLINE-ICON")) | 2394 globalVars.getAppPath("CALCULATEDLINE-ICON")) |
2395 self.normalline_icon = gtk.gdk.pixbuf_new_from_file( | 2395 self.normalline_icon = gtk.gdk.pixbuf_new_from_file( |
2396 globals.getAppPath("NORMALLINE-ICON") ) | 2396 globalVars.getAppPath("NORMALLINE-ICON") ) |
2397 self.parcialline_icon = gtk.gdk.pixbuf_new_from_file( | 2397 self.parcialline_icon = gtk.gdk.pixbuf_new_from_file( |
2398 globals.getAppPath("PARCIALLINE-ICON") ) | 2398 globalVars.getAppPath("PARCIALLINE-ICON") ) |
2399 self.acumulatedline_icon = gtk.gdk.pixbuf_new_from_file( | 2399 self.acumulatedline_icon = gtk.gdk.pixbuf_new_from_file( |
2400 globals.getAppPath("ACUMULATEDLINE-ICON")) | 2400 globalVars.getAppPath("ACUMULATEDLINE-ICON")) |
2401 # Comment column | 2401 # Comment column |
2402 self.__treeview.append_column(self.__comment_column) | 2402 self.__treeview.append_column(self.__comment_column) |
2403 # Units column | 2403 # Units column |
2404 self.__treeview.append_column(self.__units_column) | 2404 self.__treeview.append_column(self.__units_column) |
2405 # Length column | 2405 # Length column |
2737 _measure_line = tree_model[_row_path][0] | 2737 _measure_line = tree_model[_row_path][0] |
2738 _type = _measure_line.lineType | 2738 _type = _measure_line.lineType |
2739 if _type == 1 or _type == 2: | 2739 if _type == 1 or _type == 2: |
2740 if _type == 1: | 2740 if _type == 1: |
2741 _color = gtk.gdk.color_parse( | 2741 _color = gtk.gdk.color_parse( |
2742 globals.color["SUBTOTAL-PARCIAL"]) | 2742 globalVars.color["SUBTOTAL-PARCIAL"]) |
2743 _subtotal = _measure_line.parcial_subtotal | 2743 _subtotal = _measure_line.parcial_subtotal |
2744 else: #elif _type == 2: | 2744 else: #elif _type == 2: |
2745 _color = gtk.gdk.color_parse(globals.color["SUBTOTAL"]) | 2745 _color = gtk.gdk.color_parse(globalVars.color["SUBTOTAL"]) |
2746 _subtotal = _measure_line.acumulated_subtotal | 2746 _subtotal = _measure_line.acumulated_subtotal |
2747 lcolor = [_color, _color] | 2747 lcolor = [_color, _color] |
2748 if isinstance(_subtotal, float): | 2748 if isinstance(_subtotal, float): |
2749 _DS = self.__budget.getDecimals("DS") | 2749 _DS = self.__budget.getDecimals("DS") |
2750 _subtotal= ("%." + str(_DS) + "f" ) % _subtotal | 2750 _subtotal= ("%." + str(_DS) + "f" ) % _subtotal |
2752 else: | 2752 else: |
2753 cell_renderer.set_property('text', "") | 2753 cell_renderer.set_property('text', "") |
2754 | 2754 |
2755 if self.__treeview.get_cursor() == (_row_path,column): | 2755 if self.__treeview.get_cursor() == (_row_path,column): |
2756 cell_renderer.set_property('cell-background-gdk', | 2756 cell_renderer.set_property('cell-background-gdk', |
2757 gtk.gdk.color_parse(globals.color["ACTIVE"])) | 2757 gtk.gdk.color_parse(globalVars.color["ACTIVE"])) |
2758 else: | 2758 else: |
2759 cell_renderer.set_property('cell-background-gdk', | 2759 cell_renderer.set_property('cell-background-gdk', |
2760 lcolor[_number % 2]) | 2760 lcolor[_number % 2]) |
2761 | 2761 |
2762 def _clear(self): | 2762 def _clear(self): |
3451 _image_pixbuf = gtk.gdk.pixbuf_new_from_file(_file_path) | 3451 _image_pixbuf = gtk.gdk.pixbuf_new_from_file(_file_path) |
3452 _image_pixbuf = _image_pixbuf.scale_simple(64, 64, | 3452 _image_pixbuf = _image_pixbuf.scale_simple(64, 64, |
3453 gtk.gdk.INTERP_BILINEAR) | 3453 gtk.gdk.INTERP_BILINEAR) |
3454 except: | 3454 except: |
3455 _image_pixbuf = gtk.gdk.pixbuf_new_from_file( | 3455 _image_pixbuf = gtk.gdk.pixbuf_new_from_file( |
3456 globals.getAppPath("IMAGE-ICON")) | 3456 globalVars.getAppPath("IMAGE-ICON")) |
3457 _image_pixbuf = _image_pixbuf.scale_simple(64, 64, | 3457 _image_pixbuf = _image_pixbuf.scale_simple(64, 64, |
3458 gtk.gdk.INTERP_BILINEAR) | 3458 gtk.gdk.INTERP_BILINEAR) |
3459 _image_icon = gtk.Image() | 3459 _image_icon = gtk.Image() |
3460 _image_icon.set_from_pixbuf(_image_pixbuf) | 3460 _image_icon.set_from_pixbuf(_image_pixbuf) |
3461 _image_icon.show() | 3461 _image_icon.show() |
3467 | 3467 |
3468 elif _filetype == "dxf": | 3468 elif _filetype == "dxf": |
3469 _event_box = gtk.EventBox() | 3469 _event_box = gtk.EventBox() |
3470 _dxf_icon = gtk.Image() | 3470 _dxf_icon = gtk.Image() |
3471 _dxf_pixbuf = gtk.gdk.pixbuf_new_from_file( | 3471 _dxf_pixbuf = gtk.gdk.pixbuf_new_from_file( |
3472 globals.getAppPath("DXF-ICON")) | 3472 globalVars.getAppPath("DXF-ICON")) |
3473 _dxf_pixbuf = _dxf_pixbuf.scale_simple(64, 64, | 3473 _dxf_pixbuf = _dxf_pixbuf.scale_simple(64, 64, |
3474 gtk.gdk.INTERP_BILINEAR) | 3474 gtk.gdk.INTERP_BILINEAR) |
3475 _dxf_icon.set_from_pixbuf(_dxf_pixbuf) | 3475 _dxf_icon.set_from_pixbuf(_dxf_pixbuf) |
3476 _dxf_icon.show() | 3476 _dxf_icon.show() |
3477 _event_box.add(_dxf_icon) | 3477 _event_box.add(_dxf_icon) |
3745 self.__scrolled_window = gtk.ScrolledWindow() | 3745 self.__scrolled_window = gtk.ScrolledWindow() |
3746 self.__scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, | 3746 self.__scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, |
3747 gtk.POLICY_AUTOMATIC) | 3747 gtk.POLICY_AUTOMATIC) |
3748 self.__scrolled_window.add(self.__select_treeview) | 3748 self.__scrolled_window.add(self.__select_treeview) |
3749 # colors | 3749 # colors |
3750 _text_color = gtk.gdk.color_parse(globals.color["TEXT"]) | 3750 _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) |
3751 _background_color = [ | 3751 _background_color = [ |
3752 gtk.gdk.color_parse(globals.color["UNEVEN"]), | 3752 gtk.gdk.color_parse(globalVars.color["UNEVEN"]), |
3753 gtk.gdk.color_parse(globals.color["EVEN"])] | 3753 gtk.gdk.color_parse(globalVars.color["EVEN"])] |
3754 self.__code_column = gtk.TreeViewColumn() | 3754 self.__code_column = gtk.TreeViewColumn() |
3755 self.__code_column.set_clickable(True) | 3755 self.__code_column.set_clickable(True) |
3756 self.__code_column.set_fixed_width(200) | 3756 self.__code_column.set_fixed_width(200) |
3757 _code_cell = gtk.CellRendererText() | 3757 _code_cell = gtk.CellRendererText() |
3758 _code_cell.set_property('foreground-gdk', _text_color) | 3758 _code_cell.set_property('foreground-gdk', _text_color) |
3949 cell_renderer.set_property('text', str(_number + 1)) | 3949 cell_renderer.set_property('text', str(_number + 1)) |
3950 self.__index_column.get_cell_renderers()[1].set_property( | 3950 self.__index_column.get_cell_renderers()[1].set_property( |
3951 'cell-background-gdk', lcolor[_number % 2]) | 3951 'cell-background-gdk', lcolor[_number % 2]) |
3952 if self.__treeview.get_cursor() == (_row_path,column): | 3952 if self.__treeview.get_cursor() == (_row_path,column): |
3953 cell_renderer.set_property('cell-background-gdk', | 3953 cell_renderer.set_property('cell-background-gdk', |
3954 gtk.gdk.color_parse(globals.color["ACTIVE"])) | 3954 gtk.gdk.color_parse(globalVars.color["ACTIVE"])) |
3955 else: | 3955 else: |
3956 cell_renderer.set_property('cell-background-gdk', | 3956 cell_renderer.set_property('cell-background-gdk', |
3957 lcolor[_number % 2]) | 3957 lcolor[_number % 2]) |
3958 | 3958 |
3959 def _clear(self): | 3959 def _clear(self): |
4084 gtk.POLICY_AUTOMATIC) | 4084 gtk.POLICY_AUTOMATIC) |
4085 _scrolled_window.add(self.__treeview) | 4085 _scrolled_window.add(self.__treeview) |
4086 _scrolled_window.show() | 4086 _scrolled_window.show() |
4087 _vbox.pack_start(_scrolled_window) | 4087 _vbox.pack_start(_scrolled_window) |
4088 # colors | 4088 # colors |
4089 _text_color = gtk.gdk.color_parse(globals.color["TEXT"]) | 4089 _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) |
4090 _background_color = [ | 4090 _background_color = [ |
4091 gtk.gdk.color_parse(globals.color["UNEVEN"]), | 4091 gtk.gdk.color_parse(globalVars.color["UNEVEN"]), |
4092 gtk.gdk.color_parse(globals.color["EVEN"])] | 4092 gtk.gdk.color_parse(globalVars.color["EVEN"])] |
4093 # Option Column | 4093 # Option Column |
4094 self.__option_column = gtk.TreeViewColumn() | 4094 self.__option_column = gtk.TreeViewColumn() |
4095 self.__option_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) | 4095 self.__option_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) |
4096 self.__option_column.set_fixed_width(150) | 4096 self.__option_column.set_fixed_width(150) |
4097 self.__option_column.set_resizable(True) | 4097 self.__option_column.set_resizable(True) |
4131 # End Column | 4131 # End Column |
4132 _end_column = gtk.TreeViewColumn() | 4132 _end_column = gtk.TreeViewColumn() |
4133 _end_column.set_clickable(False) | 4133 _end_column.set_clickable(False) |
4134 _end_cell = gtk.CellRendererText() | 4134 _end_cell = gtk.CellRendererText() |
4135 _end_cell.set_property('cell-background-gdk', | 4135 _end_cell.set_property('cell-background-gdk', |
4136 gtk.gdk.color_parse(globals.color["UNEVEN"])) | 4136 gtk.gdk.color_parse(globalVars.color["UNEVEN"])) |
4137 _end_column.pack_start(_end_cell, True) | 4137 _end_column.pack_start(_end_cell, True) |
4138 self.__treeview.append_column(_end_column) | 4138 self.__treeview.append_column(_end_column) |
4139 # Connect | 4139 # Connect |
4140 self.__treeview.connect("key-press-event", self.treeviewKeyPressEvent) | 4140 self.__treeview.connect("key-press-event", self.treeviewKeyPressEvent) |
4141 self.__treeview.connect("button-press-event", self.treeviewClickedEvent) | 4141 self.__treeview.connect("button-press-event", self.treeviewClickedEvent) |
4269 """ | 4269 """ |
4270 _row_path = tree_model.get_path(iter) | 4270 _row_path = tree_model.get_path(iter) |
4271 _number = _row_path[-1] | 4271 _number = _row_path[-1] |
4272 if self.__treeview.get_cursor() == (_row_path,column): | 4272 if self.__treeview.get_cursor() == (_row_path,column): |
4273 cell_renderer.set_property('cell-background-gdk', | 4273 cell_renderer.set_property('cell-background-gdk', |
4274 gtk.gdk.color_parse(globals.color["ACTIVE"])) | 4274 gtk.gdk.color_parse(globalVars.color["ACTIVE"])) |
4275 else: | 4275 else: |
4276 cell_renderer.set_property('cell-background-gdk', | 4276 cell_renderer.set_property('cell-background-gdk', |
4277 lcolor[_number % 2]) | 4277 lcolor[_number % 2]) |
4278 if column is self.__type_column: | 4278 if column is self.__type_column: |
4279 _type = self.option_types[tree_model[_row_path][3]] | 4279 _type = self.option_types[tree_model[_row_path][3]] |