# HG changeset patch # User Miguel Ángel Bárcena Rodríguez # Date 1289079212 -3600 # Node ID 2fc6b47dbe708a188ffd1ed444dbf9b9873850db # Parent 6502bfdaa84dc09fa5534a681ba1d3f1f0a12fb9 rename module globals to globalVars diff -r 6502bfdaa84d -r 2fc6b47dbe70 Generic/__init__.py --- a/Generic/__init__.py Sat Nov 06 21:30:33 2010 +0100 +++ b/Generic/__init__.py Sat Nov 06 22:33:32 2010 +0100 @@ -25,7 +25,7 @@ 'config', 'durusdatabase', 'fiebdc', - 'globals', + 'globalVars', 'openwith', 'utils', ] diff -r 6502bfdaa84d -r 2fc6b47dbe70 Generic/fiebdc.py --- a/Generic/fiebdc.py Sat Nov 06 21:30:33 2010 +0100 +++ b/Generic/fiebdc.py Sat Nov 06 22:33:32 2010 +0100 @@ -30,7 +30,7 @@ # pyArq-Presupuestos modules import base from Generic import utils -from Generic import globals +from Generic import globalVars class Read(object): """fiebdc.Read: @@ -94,7 +94,7 @@ "850" : "850", "437" : "cp437"} self.__file_format = "FIEBDC-3/2007" - self.__generator = globals.version + self.__generator = globalVars.version self.__character_set = "850" self.__pattern = { "control_tilde" : re.compile("((\r\n)| |\t)+~"), diff -r 6502bfdaa84d -r 2fc6b47dbe70 Generic/globalVars.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Generic/globalVars.py Sat Nov 06 22:33:32 2010 +0100 @@ -0,0 +1,94 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +## File globalVars.py +## This file is part of pyArq-Presupuestos. +## +## Copyright (C) 2010 Miguel Ángel Bárcena Rodríguez +## +## +## pyArq-Presupuestos is free software: you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## (at your option) any later version. +## +## pyArq-Presupuestos is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program. If not, see . + +# module for global variables +import os +# path: Paths where find the program files needed + +version = "pyArq-Presupuestos v0.0.0" +path = { + "HOME" : "", + "APPDATA" : "", + "ICON" : "/images/pyArq-Presupuestos.svg", + "CHAPTER-ICON" : "/images/chapter.svg", + "UNIT-ICON" : "/images/unit.svg", + "MATERIAL-ICON" : "/images/material.svg", + "MACHINERY-ICON" : "/images/machinery.svg", + "LABOURFORCE-ICON": "/images/labourforce.svg", + "MENU-ICON": "/images/menu.svg", + "CONNECTED-ICON": "/images/connected.svg", + "DISCONNECTED-ICON": "/images/disconnected.svg", + "CLOSE-ICON": "/images/close.svg", + "DESCRIPTION-ICON": "/images/description.svg", + "SHEET-ICON": "/images/sheet.svg", + "DECOMPOSITION-ICON" : "/images/decomposition.svg", + "MEASURE-ICON" : "/images/measure.svg", + "ACUMULATEDLINE-ICON" : "/images/acumulatedline.svg", + "PARCIALLINE-ICON" : "/images/parcialline.svg", + "NORMALLINE-ICON" : "/images/normalline.svg", + "CALCULATEDLINE-ICON" : "/images/calculatedline.svg", + "ARROW-ICON": "/images/arrow.svg", + "IMAGE-ICON": "/images/image.svg", + "DXF-ICON": "/images/dxf.svg", + "DURUS-DATABASE": "/pyArq-Presupuestos/durus/", + "BUDGET": "/pyArq-Presupuestos/budget/", + "THROBBER-ICON": "/images/throbber.png", + "THROBBER-GIF": "/images/throbber.gif", + "BUDGET-ICON": "/images/budget.svg", + "PYARQ-ICON": "/images/pyArq.png", + } + +color = { + "ACTIVE" : "#CDD7FF", # blue + "INDEX-EVEN" : "#C4C4C4", # dark grey + "INDEX-UNEVEN" : "#DDDDDD", # grey + "EVEN" : "#E6E6E6", # dark white + "UNEVEN": "#FFFFFF", # white + "CHAPTER-EVEN": "#D8E6E6", # dark cian + "CHAPTER-UNEVEN": "#F0FFFF", # cian + "TEXT": "#000000", # black + "CALCULATED-TEXT": "#FF00FF", # + "SUBTOTAL": "#FAC8C8", + "SUBTOTAL-PARCIAL": "#ADD8E6", + } +desktop = { + "autodetect" : True, + "desktop" : "", + "browser" : "firefox", + "mailapp" : "evolution", + "imageapp" : "gthumb", + "cadapp" : "qcad", + } + +def getAppPath(key): + return path["APPDATA"] + path[key] +def getHomePath(key): + return path["HOME"] + path[key] +if os.name == 'posix': + path["HOME"] = os.environ.get('HOME') +elif sys.platform == 'win32': + path["HOME"] = os.environ.get('HOMEPATH') + # TODO: Mac Os, + # TODO: Test in diferents os + +#-# +path["BUDGET"] = "/pyArq-Presupuestos/" +#-# diff -r 6502bfdaa84d -r 2fc6b47dbe70 Generic/globals.py --- a/Generic/globals.py Sat Nov 06 21:30:33 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,94 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -## File globals.py -## This file is part of pyArq-Presupuestos. -## -## Copyright (C) 2010 Miguel Ángel Bárcena Rodríguez -## -## -## pyArq-Presupuestos is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License as published by -## the Free Software Foundation, either version 3 of the License, or -## (at your option) any later version. -## -## pyArq-Presupuestos is distributed in the hope that it will be useful, -## but WITHOUT ANY WARRANTY; without even the implied warranty of -## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -## GNU General Public License for more details. -## -## You should have received a copy of the GNU General Public License -## along with this program. If not, see . - -# module for global variables -import os -# path: Paths where find the program files needed - -version = "pyArq-Presupuestos v0.0.0" -path = { - "HOME" : "", - "APPDATA" : "", - "ICON" : "/images/pyArq-Presupuestos.svg", - "CHAPTER-ICON" : "/images/chapter.svg", - "UNIT-ICON" : "/images/unit.svg", - "MATERIAL-ICON" : "/images/material.svg", - "MACHINERY-ICON" : "/images/machinery.svg", - "LABOURFORCE-ICON": "/images/labourforce.svg", - "MENU-ICON": "/images/menu.svg", - "CONNECTED-ICON": "/images/connected.svg", - "DISCONNECTED-ICON": "/images/disconnected.svg", - "CLOSE-ICON": "/images/close.svg", - "DESCRIPTION-ICON": "/images/description.svg", - "SHEET-ICON": "/images/sheet.svg", - "DECOMPOSITION-ICON" : "/images/decomposition.svg", - "MEASURE-ICON" : "/images/measure.svg", - "ACUMULATEDLINE-ICON" : "/images/acumulatedline.svg", - "PARCIALLINE-ICON" : "/images/parcialline.svg", - "NORMALLINE-ICON" : "/images/normalline.svg", - "CALCULATEDLINE-ICON" : "/images/calculatedline.svg", - "ARROW-ICON": "/images/arrow.svg", - "IMAGE-ICON": "/images/image.svg", - "DXF-ICON": "/images/dxf.svg", - "DURUS-DATABASE": "/pyArq-Presupuestos/durus/", - "BUDGET": "/pyArq-Presupuestos/budget/", - "THROBBER-ICON": "/images/throbber.png", - "THROBBER-GIF": "/images/throbber.gif", - "BUDGET-ICON": "/images/budget.svg", - "PYARQ-ICON": "/images/pyArq.png", - } - -color = { - "ACTIVE" : "#CDD7FF", # blue - "INDEX-EVEN" : "#C4C4C4", # dark grey - "INDEX-UNEVEN" : "#DDDDDD", # grey - "EVEN" : "#E6E6E6", # dark white - "UNEVEN": "#FFFFFF", # white - "CHAPTER-EVEN": "#D8E6E6", # dark cian - "CHAPTER-UNEVEN": "#F0FFFF", # cian - "TEXT": "#000000", # black - "CALCULATED-TEXT": "#FF00FF", # - "SUBTOTAL": "#FAC8C8", - "SUBTOTAL-PARCIAL": "#ADD8E6", - } -desktop = { - "autodetect" : True, - "desktop" : "", - "browser" : "firefox", - "mailapp" : "evolution", - "imageapp" : "gthumb", - "cadapp" : "qcad", - } - -def getAppPath(key): - return path["APPDATA"] + path[key] -def getHomePath(key): - return path["HOME"] + path[key] -if os.name == 'posix': - path["HOME"] = os.environ.get('HOME') -elif sys.platform == 'win32': - path["HOME"] = os.environ.get('HOMEPATH') - # TODO: Mac Os, - # TODO: Test in diferents os - -#-# -path["BUDGET"] = "/pyArq-Presupuestos/" -#-# diff -r 6502bfdaa84d -r 2fc6b47dbe70 Generic/openwith.py --- a/Generic/openwith.py Sat Nov 06 21:30:33 2010 +0100 +++ b/Generic/openwith.py Sat Nov 06 22:33:32 2010 +0100 @@ -37,23 +37,23 @@ import os # pyArq-Presupuestos modules -import globals +import globalVars # from gtkgui_helpers.py def autodetect_desktop(): - # recognize the environment and sets it in globals + # recognize the environment and sets it in globalVars if os.name == 'nt': - globals.desktop["desktop"] = "windows" + globalVars.desktop["desktop"] = "windows" else: _processes = get_running_processes() if 'gnome-session' in _processes: - globals.desktop["desktop"] = "gnome" + globalVars.desktop["desktop"] = "gnome" elif 'startkde' in _processes: - globals.desktop["desktop"] = "kde" + globalVars.desktop["desktop"] = "kde" elif 'startxfce4' in _processes or 'xfce4-session' in _processes: - globals.desktop["desktop"] = "xfce" + globalVars.desktop["desktop"] = "xfce" else: - globals.desktop["desktop"] = "" + globalVars.desktop["desktop"] = "" def get_running_processes(): '''returns running processes or None (if not /proc exists)''' @@ -104,7 +104,7 @@ def launch_file(kind, uri): # kind = "url" ,"mail", "image", "dxf" - _desktop = globals.desktop["desktop"] + _desktop = globalVars.desktop["desktop"] if _desktop == "windows": try: os.startfile(uri) # if pywin32 is installed we open @@ -121,13 +121,13 @@ command = 'exo-open' else: if kind == 'url': - command = globals.desktop["browser"] + command = globalVars.desktop["browser"] elif kind == 'mail': - command = globals.desktop["mailapp"] + command = globalVars.desktop["mailapp"] elif kind == 'image': - command = globals.desktop["imageapp"] + command = globalVars.desktop["imageapp"] elif kind == 'dxf': - command = globals.desktop["cadapp"] + command = globalVars.desktop["cadapp"] else: # if no app is configured return command = build_command(command, uri) diff -r 6502bfdaa84d -r 2fc6b47dbe70 Gtk/gui.py --- 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]) diff -r 6502bfdaa84d -r 2fc6b47dbe70 Gtk/importFiebdc.py --- a/Gtk/importFiebdc.py Sat Nov 06 21:30:33 2010 +0100 +++ b/Gtk/importFiebdc.py Sat Nov 06 22:33:32 2010 +0100 @@ -32,7 +32,7 @@ # pyArq-Presupuestos Modules from Generic import utils -from Generic import globals +from Generic import globalVars from Generic import durusdatabase import gui @@ -94,10 +94,10 @@ gtk.STOCK_OPEN,gtk.RESPONSE_OK)) self.__window.set_default_response(gtk.RESPONSE_OK) if self.__filetype == "budget" or self.__filetype == "database": - self.__window.set_current_folder(globals.getHomePath("BUDGET")) + self.__window.set_current_folder(globalVars.getHomePath("BUDGET")) else: # "durus" self.__window.set_current_folder( - globals.getHomePath("DURUS-DATABASE")) + globalVars.getHomePath("DURUS-DATABASE")) if self.__window.run() == gtk.RESPONSE_OK: self._openFile(self.__window.get_filename()) self.__window.destroy() @@ -223,10 +223,10 @@ self.__label.show() _Vbox1.add(self.__label) self.__throbber = gtk.Image() - self.__throbber.set_from_file(globals.getAppPath("THROBBER-ICON")) + self.__throbber.set_from_file(globalVars.getAppPath("THROBBER-ICON")) _Vbox1.add(self.__throbber) self.__throbber.show() - self.__animation = gtk.gdk.PixbufAnimation(globals.getAppPath("THROBBER-GIF")) + self.__animation = gtk.gdk.PixbufAnimation(globalVars.getAppPath("THROBBER-GIF")) _pixbuf = self.__throbber.get_pixbuf() self.__throbber.set_from_animation(self.__animation) _Hbox1 = gtk.HBox(False, 0) @@ -431,7 +431,7 @@ self.clear() def saveDurusDatabase(self): - _path = globals.getHomePath("DURUS-DATABASE") + _path = globalVars.getHomePath("DURUS-DATABASE") _file_whit_path_bc3 = self.__budget.filename _filename_bc3 = _file_whit_path_bc3.split("/")[-1] _filename = _filename_bc3.split(".")[-2] diff -r 6502bfdaa84d -r 2fc6b47dbe70 pyArq-Presupuestos --- a/pyArq-Presupuestos Sat Nov 06 21:30:33 2010 +0100 +++ b/pyArq-Presupuestos Sat Nov 06 22:33:32 2010 +0100 @@ -25,7 +25,7 @@ Translates the program using gettext module """ _app = "pyArq-Presupuestos" - _dir = globals.path["APPDATA"] + "/mo/" + _dir = globalVars.path["APPDATA"] + "/mo/" gettext.install(_app, _dir, unicode=1) def _run_gui(): @@ -40,10 +40,10 @@ # Modules import gettext import sys - from Generic import globals + from Generic import globalVars # take path to find mo file _path = sys.path[0] - globals.path["APPDATA"]= _path + globalVars.path["APPDATA"]= _path _translate() from Gtk import gui _run_gui()