Mercurial > pyarq-presupuestos
diff 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 |
line wrap: on
line diff
--- a/Gtk/gui.py Sat Nov 06 21:30:33 2010 +0100 +++ b/Gtk/gui.py Sat Nov 06 22:33:32 2010 +0100 @@ -58,22 +58,22 @@ from Generic import fiebdc from Generic import durusdatabase from Generic import utils -from Generic import globals +from Generic import globalVars from Generic import openwith # Load default icon -if os.path.exists(globals.getAppPath("ICON")): - icon = gtk.gdk.pixbuf_new_from_file(globals.getAppPath("ICON")) +if os.path.exists(globalVars.getAppPath("ICON")): + icon = gtk.gdk.pixbuf_new_from_file(globalVars.getAppPath("ICON")) gtk.window_set_default_icon_list(icon) else: print utils.mapping(_("The icon file does not exist. '$1'"), - (globals.getAppPath("ICON"),)) + (globalVars.getAppPath("ICON"),)) # Autodetect desktop -if globals.desktop["autodetect"]: +if globalVars.desktop["autodetect"]: openwith.autodetect_desktop() print utils.mapping(_("pyArq-Presupuestos running on $1"), - (globals.desktop["desktop"],)) + (globalVars.desktop["desktop"],)) class MainWindow(object): """gui.MainWindow: @@ -356,13 +356,13 @@ self.__main_item = None self.__widget.show() self.__throbber = gtk.Image() - self.__throbber.set_from_file(globals.getAppPath("THROBBER-ICON")) + self.__throbber.set_from_file(globalVars.getAppPath("THROBBER-ICON")) self.__throbber.show() self.__animationThobber = gtk.gdk.PixbufAnimation( - globals.getAppPath("THROBBER-GIF")) + globalVars.getAppPath("THROBBER-GIF")) self.__quietThobber = self.__throbber.get_pixbuf() self.__budget_icon = gtk.gdk.pixbuf_new_from_file_at_size( - globals.getAppPath("BUDGET-ICON"), 16, 16) + globalVars.getAppPath("BUDGET-ICON"), 16, 16) _filename = os.path.basename(filename) _rootfilename = os.path.splitext(_filename)[0] if not _rootfilename == "": @@ -378,7 +378,7 @@ _align = gtk.Alignment(0.5, 0.5, 0, 0) _iconVbox = gtk.VBox() _pyArqIcon = gtk.Image() - _pyArqIcon.set_from_file(globals.getAppPath("PYARQ-ICON")) + _pyArqIcon.set_from_file(globalVars.getAppPath("PYARQ-ICON")) _pyArqIcon.show() _iconVbox.pack_start(_pyArqIcon, True, True, 0) _link = gtk.LinkButton("http://pyarq.obraencurso.es", @@ -957,37 +957,37 @@ path, active_path_record) _combobox.set_active(0) _view_icon = gtk.Image() - _view_icon.set_from_file(globals.getAppPath("DECOMPOSITION-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("DECOMPOSITION-ICON")) elif view_type == "RecordDescription": self.__view = Description(budget, weakref.ref(self), path, active_path_record) _combobox.set_active(1) _view_icon = gtk.Image() - _view_icon.set_from_file(globals.getAppPath("DESCRIPTION-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("DESCRIPTION-ICON")) elif view_type == "Measure": self.__view = Measure(budget, weakref.ref(self), path, active_path_record) _combobox.set_active(2) _view_icon = gtk.Image() - _view_icon.set_from_file(globals.getAppPath("MEASURE-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) elif view_type == "Sheet of Conditions": self.__view = Sheet(budget, weakref.ref(self), path, active_path_record) _combobox.set_active(3) _view_icon = gtk.Image() - _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) elif view_type == "FileView": self.__view = FileView(budget, weakref.ref(self), path, active_path_record) _combobox.set_active(4) _view_icon = gtk.Image() - _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) elif view_type == "CompanyView": self.__view = CompanyView(budget, weakref.ref(self), path, active_path_record) _combobox.set_active(5) _view_icon = gtk.Image() - _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) else: raise ValueError, _(utils.mapping("Invalid type of View: $1", @@ -1003,14 +1003,14 @@ _invisible.show() _hbox.pack_start(_invisible, True, False,0) _icon_menu = gtk.Image() - _icon_menu.set_from_file(globals.getAppPath("MENU-ICON")) + _icon_menu.set_from_file(globalVars.getAppPath("MENU-ICON")) _icon_menu.show() _menu_button = gtk.ToolButton() _menu_button.set_icon_widget(_icon_menu) _menu_button.connect("clicked", self._menu_view) _menu_button.show() _icon_connected = gtk.Image() - _icon_connected.set_from_file(globals.getAppPath("CONNECTED-ICON")) + _icon_connected.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) _icon_connected.show() _hbox.pack_start(_menu_button, False, False, 0) self.__connected_button = gtk.ToolButton() @@ -1019,7 +1019,7 @@ self.__connected_button.show() _hbox.pack_start(self.__connected_button, False, False, 0) _icon_close = gtk.Image() - _icon_close.set_from_file(globals.getAppPath("CLOSE-ICON")) + _icon_close.set_from_file(globalVars.getAppPath("CLOSE-ICON")) _icon_close.show() _close_button = gtk.ToolButton() _close_button.set_icon_widget(_icon_close) @@ -1076,32 +1076,32 @@ self.__view = DecompositionList(_budget, _wr_page, _path, _path_record) - _view_icon.set_from_file(globals.getAppPath("DECOMPOSITION-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("DECOMPOSITION-ICON")) self.__view_type = "DecompositionList" elif _index == 1: self.__view = Description(_budget, _wr_page, _path, _path_record) - _view_icon.set_from_file(globals.getAppPath("DESCRIPTION-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("DESCRIPTION-ICON")) self.__view_type = "RecordDescription" elif _index == 2: self.__view = Measure(_budget, _wr_page, _path, _path_record) - _view_icon.set_from_file(globals.getAppPath("MEASURE-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("MEASURE-ICON")) self.__view_type = "Measure" elif _index == 3: self.__view = Sheet(_budget, _wr_page, _path, _path_record) - _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) self.__view_type = "Sheet of Conditions" elif _index == 4: self.__view = FileView(_budget, _wr_page, _path, _path_record) - _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) self.__view_type = "FileView" elif _index == 5: self.__view = CompanyView(_budget, _wr_page, _path, _path_record) - _view_icon.set_from_file(globals.getAppPath("SHEET-ICON")) + _view_icon.set_from_file(globalVars.getAppPath("SHEET-ICON")) self.__view_type = "CompanyView" _view_icon.show() _hbox = gtk.HBox() @@ -1158,13 +1158,13 @@ """ if self.__connected: _icon = gtk.Image() - _icon.set_from_file(globals.getAppPath("DISCONNECTED-ICON")) + _icon.set_from_file(globalVars.getAppPath("DISCONNECTED-ICON")) _icon.show() self.__connected_button.set_icon_widget(_icon) self.__connected = False else: _icon = gtk.Image() - _icon.set_from_file(globals.getAppPath("CONNECTED-ICON")) + _icon.set_from_file(globalVars.getAppPath("CONNECTED-ICON")) _icon.show() self.__connected_button.set_icon_widget(_icon) self.__connected = True @@ -1486,17 +1486,17 @@ _index_column = self.createBaseColumn(args) _text_index_cell = gtk.CellRendererText() _text_index_cell.set_property('foreground-gdk', - gtk.gdk.color_parse(globals.color["TEXT"])) + gtk.gdk.color_parse(globalVars.color["TEXT"])) _pixbuf_index_cell = gtk.CellRendererPixbuf() _arrow_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("ARROW-ICON")) + globalVars.getAppPath("ARROW-ICON")) _pixbuf_index_cell.set_property("pixbuf", _arrow_icon) _index_column.pack_start(_text_index_cell, True) _index_column.pack_start(_pixbuf_index_cell, True) _index_column.set_cell_data_func(_text_index_cell, self.colorCell, - [gtk.gdk.color_parse(globals.color["INDEX-UNEVEN"]), - gtk.gdk.color_parse(globals.color["INDEX-EVEN"])]) + [gtk.gdk.color_parse(globalVars.color["INDEX-UNEVEN"]), + gtk.gdk.color_parse(globalVars.color["INDEX-EVEN"])]) return _index_column elif args[0] == "TEXT": _column, _cell = self.createTextBaseColumn(args) @@ -1539,7 +1539,7 @@ _end_column.set_clickable(False) _end_cell = gtk.CellRendererText() _end_cell.set_property('cell-background-gdk', - gtk.gdk.color_parse(globals.color["UNEVEN"])) + gtk.gdk.color_parse(globalVars.color["UNEVEN"])) _end_column.pack_start(_end_cell, True) return _end_column return None @@ -1705,13 +1705,13 @@ gtk.POLICY_AUTOMATIC) self.__scrolled_window.add(self.__treeview) # colors - _text_color = gtk.gdk.color_parse(globals.color["TEXT"]) + _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) _background_color = [ - gtk.gdk.color_parse(globals.color["UNEVEN"]), - gtk.gdk.color_parse(globals.color["EVEN"])] + gtk.gdk.color_parse(globalVars.color["UNEVEN"]), + gtk.gdk.color_parse(globalVars.color["EVEN"])] self.__chapter_background_colors = [ - gtk.gdk.color_parse(globals.color["CHAPTER-UNEVEN"]), - gtk.gdk.color_parse(globals.color["CHAPTER-EVEN"])] + gtk.gdk.color_parse(globalVars.color["CHAPTER-UNEVEN"]), + gtk.gdk.color_parse(globalVars.color["CHAPTER-EVEN"])] super(DecompositionList,self).__init__( [("INDEX",self.selectAll,42), ("CALCULATEDTEXT", self.showParentRecord, @@ -1733,7 +1733,7 @@ _text_color, _background_color), ("CALCULATED", self.showParentRecord, gtk.Label("a"*10).size_request()[0] +10, - gtk.gdk.color_parse(globals.color["CALCULATED-TEXT"]), + gtk.gdk.color_parse(globalVars.color["CALCULATED-TEXT"]), _background_color), ]) self.__index_column = self.columns[0] @@ -1752,15 +1752,15 @@ # Type column self.__treeview.append_column(self.__type_column) self.chapter_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("CHAPTER-ICON")) + globalVars.getAppPath("CHAPTER-ICON")) self.unit_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("UNIT-ICON") ) + globalVars.getAppPath("UNIT-ICON") ) self.material_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("MATERIAL-ICON") ) + globalVars.getAppPath("MATERIAL-ICON") ) self.machinery_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("MACHINERY-ICON")) + globalVars.getAppPath("MACHINERY-ICON")) self.labourforce_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("LABOURFORCE-ICON")) + globalVars.getAppPath("LABOURFORCE-ICON")) self.__type_column.get_cell_renderers()[0].set_property("pixbuf", self.labourforce_icon) @@ -2067,7 +2067,7 @@ cell_renderer.set_property("pixbuf",self.material_icon) if self.__treeview.get_cursor() == (_row_path,column): cell_renderer.set_property('cell-background-gdk', - gtk.gdk.color_parse(globals.color["ACTIVE"])) + gtk.gdk.color_parse(globalVars.color["ACTIVE"])) else: cell_renderer.set_property('cell-background-gdk', lcolor[_number % 2]) @@ -2337,14 +2337,14 @@ gtk.POLICY_AUTOMATIC) self.__scrolled_window.add(self.__treeview) # colors - _text_color = gtk.gdk.color_parse(globals.color["TEXT"]) - _calculated_text =gtk.gdk.color_parse(globals.color["CALCULATED-TEXT"]) + _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) + _calculated_text =gtk.gdk.color_parse(globalVars.color["CALCULATED-TEXT"]) _background_color = [ - gtk.gdk.color_parse(globals.color["UNEVEN"]), - gtk.gdk.color_parse(globals.color["EVEN"])] + gtk.gdk.color_parse(globalVars.color["UNEVEN"]), + gtk.gdk.color_parse(globalVars.color["EVEN"])] self.__chapter_background_colors = [ - gtk.gdk.color_parse(globals.color["CHAPTER-UNEVEN"]), - gtk.gdk.color_parse(globals.color["CHAPTER-EVEN"])] + gtk.gdk.color_parse(globalVars.color["CHAPTER-UNEVEN"]), + gtk.gdk.color_parse(globalVars.color["CHAPTER-EVEN"])] super(Measure,self).__init__( [("INDEX",self.selectAll,42), ("PIXBUF", self.passMethod, @@ -2391,13 +2391,13 @@ # Linetype column self.__treeview.append_column(self.__linetype_column) self.calculatedline_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("CALCULATEDLINE-ICON")) + globalVars.getAppPath("CALCULATEDLINE-ICON")) self.normalline_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("NORMALLINE-ICON") ) + globalVars.getAppPath("NORMALLINE-ICON") ) self.parcialline_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("PARCIALLINE-ICON") ) + globalVars.getAppPath("PARCIALLINE-ICON") ) self.acumulatedline_icon = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("ACUMULATEDLINE-ICON")) + globalVars.getAppPath("ACUMULATEDLINE-ICON")) # Comment column self.__treeview.append_column(self.__comment_column) # Units column @@ -2739,10 +2739,10 @@ if _type == 1 or _type == 2: if _type == 1: _color = gtk.gdk.color_parse( - globals.color["SUBTOTAL-PARCIAL"]) + globalVars.color["SUBTOTAL-PARCIAL"]) _subtotal = _measure_line.parcial_subtotal else: #elif _type == 2: - _color = gtk.gdk.color_parse(globals.color["SUBTOTAL"]) + _color = gtk.gdk.color_parse(globalVars.color["SUBTOTAL"]) _subtotal = _measure_line.acumulated_subtotal lcolor = [_color, _color] if isinstance(_subtotal, float): @@ -2754,7 +2754,7 @@ if self.__treeview.get_cursor() == (_row_path,column): cell_renderer.set_property('cell-background-gdk', - gtk.gdk.color_parse(globals.color["ACTIVE"])) + gtk.gdk.color_parse(globalVars.color["ACTIVE"])) else: cell_renderer.set_property('cell-background-gdk', lcolor[_number % 2]) @@ -3453,7 +3453,7 @@ gtk.gdk.INTERP_BILINEAR) except: _image_pixbuf = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("IMAGE-ICON")) + globalVars.getAppPath("IMAGE-ICON")) _image_pixbuf = _image_pixbuf.scale_simple(64, 64, gtk.gdk.INTERP_BILINEAR) _image_icon = gtk.Image() @@ -3469,7 +3469,7 @@ _event_box = gtk.EventBox() _dxf_icon = gtk.Image() _dxf_pixbuf = gtk.gdk.pixbuf_new_from_file( - globals.getAppPath("DXF-ICON")) + globalVars.getAppPath("DXF-ICON")) _dxf_pixbuf = _dxf_pixbuf.scale_simple(64, 64, gtk.gdk.INTERP_BILINEAR) _dxf_icon.set_from_pixbuf(_dxf_pixbuf) @@ -3747,10 +3747,10 @@ gtk.POLICY_AUTOMATIC) self.__scrolled_window.add(self.__select_treeview) # colors - _text_color = gtk.gdk.color_parse(globals.color["TEXT"]) + _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) _background_color = [ - gtk.gdk.color_parse(globals.color["UNEVEN"]), - gtk.gdk.color_parse(globals.color["EVEN"])] + gtk.gdk.color_parse(globalVars.color["UNEVEN"]), + gtk.gdk.color_parse(globalVars.color["EVEN"])] self.__code_column = gtk.TreeViewColumn() self.__code_column.set_clickable(True) self.__code_column.set_fixed_width(200) @@ -3951,7 +3951,7 @@ 'cell-background-gdk', lcolor[_number % 2]) if self.__treeview.get_cursor() == (_row_path,column): cell_renderer.set_property('cell-background-gdk', - gtk.gdk.color_parse(globals.color["ACTIVE"])) + gtk.gdk.color_parse(globalVars.color["ACTIVE"])) else: cell_renderer.set_property('cell-background-gdk', lcolor[_number % 2]) @@ -4086,10 +4086,10 @@ _scrolled_window.show() _vbox.pack_start(_scrolled_window) # colors - _text_color = gtk.gdk.color_parse(globals.color["TEXT"]) + _text_color = gtk.gdk.color_parse(globalVars.color["TEXT"]) _background_color = [ - gtk.gdk.color_parse(globals.color["UNEVEN"]), - gtk.gdk.color_parse(globals.color["EVEN"])] + gtk.gdk.color_parse(globalVars.color["UNEVEN"]), + gtk.gdk.color_parse(globalVars.color["EVEN"])] # Option Column self.__option_column = gtk.TreeViewColumn() self.__option_column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED) @@ -4133,7 +4133,7 @@ _end_column.set_clickable(False) _end_cell = gtk.CellRendererText() _end_cell.set_property('cell-background-gdk', - gtk.gdk.color_parse(globals.color["UNEVEN"])) + gtk.gdk.color_parse(globalVars.color["UNEVEN"])) _end_column.pack_start(_end_cell, True) self.__treeview.append_column(_end_column) # Connect @@ -4271,7 +4271,7 @@ _number = _row_path[-1] if self.__treeview.get_cursor() == (_row_path,column): cell_renderer.set_property('cell-background-gdk', - gtk.gdk.color_parse(globals.color["ACTIVE"])) + gtk.gdk.color_parse(globalVars.color["ACTIVE"])) else: cell_renderer.set_property('cell-background-gdk', lcolor[_number % 2])