Mercurial > pyarq-presupuestos
annotate Generic/fiebdc.py @ 26:16f91684686b default tip
Upgrade to python 3. Keep python 2/3 compatibility
author | Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es> |
---|---|
date | Tue, 18 Jun 2019 17:50:23 +0200 |
parents | 189f8274aecd |
children |
rev | line source |
---|---|
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1 #!/usr/bin/python |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
3 ## File fiebdc.py |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
4 ## This file is part of pyArq-Presupuestos. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
5 ## |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
6 ## Copyright (C) 2010-2019 Miguel Ángel Bárcena Rodríguez |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
7 ## <miguelangel@obraencurso.es> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
8 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
9 ## pyArq-Presupuestos is free software: you can redistribute it and/or modify |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
10 ## it under the terms of the GNU General Public License as published by |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
11 ## the Free Software Foundation, either version 3 of the License, or |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
12 ## (at your option) any later version. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
13 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
14 ## pyArq-Presupuestos is distributed in the hope that it will be useful, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
17 ## GNU General Public License for more details. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
18 ## |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
19 ## You should have received a copy of the GNU General Public License |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
20 ## along with this program. If not, see <http://www.gnu.org/licenses/>. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
21 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
22 # specifications in http://www.fiebdc.org |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
23 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
24 # Modules |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
25 |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
26 # python 2/3 compatibility |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
27 from __future__ import absolute_import, division, print_function, unicode_literals |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
28 from builtins import str as text |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
29 from six import text_type |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
30 from io import open |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
31 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
32 import time |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
33 import re |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
34 import calendar |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
35 import os.path |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
36 import unicodedata |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
37 import hashlib |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
38 # pyArq-Presupuestos modules |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
39 from Generic import utils |
6
2fc6b47dbe70
rename module globals to globalVars
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
5
diff
changeset
|
40 from Generic import globalVars |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
41 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
42 class Read(object): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
43 """fiebdc.Read: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
44 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
45 Description: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
46 Reads and parses a fiebdc file |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
47 +-- __budget: budget ("base.Budget" object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
48 +-- __file_format: File format of the fiebdc file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
49 +-- __format_list: List of file format that can be readed |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
50 +-- __character_sets_dict: Dictionary with the character sets supported |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
51 +-- __character_set: character_set of the file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
52 +- __generator: program which the file is created |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
53 +-- __cancel: Boolean value, True mean that the read process must stop |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
54 +-- __filename: The filename of the fiebdc file that is readed |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
55 +-- __pattern: re compiled pattern dict |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
56 +-- __statistics: Statistics object, records number |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
57 Constructor: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
58 fiebdc.Read(filename=None, budget=None) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
59 Ancestry: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
60 +-- object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
61 +-- Read |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
62 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
63 No public Atributes |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
64 Methods: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
65 cancel() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
66 eraseControlCharacters(string) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
67 validateCode(code) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
68 parseDate(date) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
69 parseRecord(record) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
70 readFile(budget=None, filename=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
71 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
72 def __init__(self, filename=None, budget=None): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
73 """def __init__(filename=None, budget=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
74 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
75 Sets the instance attributes |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
76 __budget: budget ("base.Budget" object) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
77 __file_format: File format of the fiebdc file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
78 __format_list: List of file format that can be readed |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
79 __character_sets_dict: Dictionary with the character sets supported |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
80 __character_set: character_set of the file |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
81 __generator: program which the file is created |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
82 __cancel: Boolean value, True mean that the read process must stop |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
83 __filename: The filename of the fiebdc file that is readed |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
84 __pattern: re compiled pattern dict |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
85 __statistics: Statistics object, records number |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
86 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
87 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
88 self.__filename = filename |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
89 if not self.__budget is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
90 self.__budget.filename = self.__filename |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
91 self.__cancel = False |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
92 self.__format_list = ["FIEBDC-3/95", "FIEBDC-3/98", "FIEBDC-3/2002", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
93 "FIEBDC-3/2004", "FIEBDC-3/2007"] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
94 # ANSI->¿"ISO-8859-15" or "latin1 ISO-8859-1" or "cp1252 windows-1252"? |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
95 # 850 -> IBM850 -> cp850 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
96 # 437 -> IBM437 -> cp437 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
97 self.__character_sets_dict = {"ANSI" : "cp1252", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
98 "850" : "850", |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
99 "437" : "cp437"} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
100 self.__file_format = "FIEBDC-3/2007" |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
101 self.__generator = globalVars.name + " " + globalVars.version |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
102 self.__character_set = "850" # ¿set default character set to cp1252? |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
103 self.__pattern = { |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
104 "control_tilde" : re.compile("((\r\n)| |\t)+~"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
105 "control_vbar" : re.compile("((\r\n)| |\t)+\|"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
106 "control_backslash" : re.compile(r"((\r\n)| |\t)+\\"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
107 "valid_code" : re.compile("[^A-Za-z0-9ñÑ.$#%&_]"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
108 "special_char": re.compile("[#%&]"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
109 "no_float": re.compile("[^\-0-9.]"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
110 "formula" : re.compile(".*[^0123456789\.()\+\-\*/\^abcdp ].*"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
111 "comment": re.compile("#.*\r\n"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
112 "empty_line": re.compile(r"(\r\n) *\r\n"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
113 "space_before_backslash" : re.compile(r"( )+\\"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
114 "space_after_backslash" : re.compile(r"\\( )+"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
115 "start_noend_backslash" : re.compile("(\r\n\\\.*[^\\\])\r\n"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
116 "end_oper": re.compile("(\+|-|\*|/|/^|@|&|<|>|<=|>=|=|!) *\r\n"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
117 "matricial_var" : re.compile("(\r\n *[%|\$][A-ZÑ].*=.*,) *\r\n"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
118 "descomposition" : re.compile("^([^:]+):(.*)$"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
119 "var" : re.compile("^([$%][A-ZÑ][()0-9, ]*)=(.*)$"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
120 "after_first_tilde" : re.compile("^[^~]*~"), |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
121 "end_control" : re.compile("((\r\n)| |\t)+$"), |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
122 } |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
123 self.__statistics = Statistics() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
124 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
125 def cancel(self): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
126 """def cancel() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
127 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
128 Sets the "__cancel" attribute to True, It stops the read process. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
129 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
130 self.__cancel = True |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
131 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
132 def eraseControlCharacters(self, string): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
133 """eraseControlCharacters(string) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
134 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
135 Return a copy of the string with the blank characters (32), |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
136 tabs (9) and end of line (13 and 10) before of the separators |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
137 '~', '|' erased. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
138 Before separator \ not deleted because it affects the reading of the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
139 record ~P |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
140 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
141 # "control_tilde" : "((\r\n)| |\t)+~" |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
142 string = self.__pattern["control_tilde"].sub("~",string) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
143 # "control_vbar" : "((\r\n)| |\t)+\|" |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
144 string = self.__pattern["control_vbar"].sub("|",string) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
145 # "control_backslash" : r"((\r\n)| |\t)+\\" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
146 #string = self.__pattern["control_backslash"].sub(r"\\",string) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
147 return string |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
148 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
149 def validateCode(self, code): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
150 """validateCode(code) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
151 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
152 Test if the code have invalid characters and try to erase it, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
153 if it is posible return a valid code else return a empty string. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
154 """ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
155 if not isinstance(code, text_type): |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
156 _tuni = _("Invalid code, it must be a text string") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
157 print(_tuni) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
158 return "" |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
159 # Valid chararcter: A-Z a-z 0-9 ñ Ñ . $ # % & _ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
160 # "valid_code" : "[^A-Za-z0-9ñÑ.$#%&_]" |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
161 _ucode = self.__pattern["valid_code"].sub("_", code) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
162 if _ucode != code: |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
163 try: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
164 _tuni = _("The code '$1' have invalid characters," \ |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
165 " replaced by '$2'.") |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
166 _uni = utils.mapping(_tuni, (code, _ucode)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
167 print(_uni) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
168 except: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
169 _tuni = _("The code '$1' have invalid characters and can not" \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
170 " be encoded in utf-8.") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
171 _uni = utils.mapping(_tuni, (code,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
172 print(_uni) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
173 |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
174 if len(_ucode) == 0: |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
175 _normalize_code = "" |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
176 for c in unicodedata.normalize('NFD', _ucode): |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
177 if unicodedata.category(c) != 'Mn': |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
178 _normalize_code.join(c) |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
179 #_normalize_code = ''.join((c for c in unicodedata.normalize( |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
180 # 'NFD', _ucode) if unicodedata.category(c) != 'Mn')) |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
181 # from http://www.leccionespracticas.com/uncategorized/ |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
182 # eliminar-tildes-con-python-solucionado/ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
183 _ucode = self.__pattern["valid_code"].sub("", _normalize_code) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
184 if len(_ucode) == 0: |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
185 _hash_code = hashlib.sha256() |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
186 _hash_code.update(code.encode('utf-8')) |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
187 _hexdigest_code = _hash_code.hexdigest() |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
188 _p_valid_code = self.__pattern["valid_code"] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
189 _ucode = _p_valid_code.sub("", _hexdigest_code) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
190 code = _ucode |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
191 if code == "##": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
192 # root code is an empty code : set to ROOT |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
193 return "ROOT" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
194 # the lasts characters can not be <#> or <##> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
195 # <##> -> root record in FIEFDC-3 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
196 # <#> -> chapter record in FIEFDC-3 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
197 if len(code) > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
198 while code[-1] == "#": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
199 code = code[:-1] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
200 if len(code) == 0: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
201 return code |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
202 if len(code) > 20: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
203 code = code[:20] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
204 # only one charecter # % or & |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
205 if sum([code.count(c) for c in u'#%&']) > 1: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
206 _tuni = _("The code '$1' contains special characters repeated.") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
207 _uni = utils.mapping(_tuni, (code,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
208 print(_uni) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
209 _i = min([code.find(c) for c in u'#%&']) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
210 code = code[:_i+1] + \ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
211 self.__pattern["special_char"].sub("", code[_i+1:]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
212 return code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
213 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
214 def parseDate(self, date): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
215 """parseDate(date) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
216 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
217 date: in the format: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
218 uneven len: add a Leading 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
219 len = 8 DDMMYYYY |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
220 len <= 6 DDMMYY “80/20”. >80 -> >1980 <80 -> <2080 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
221 len < 5 MMYY |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
222 len < 3 YY |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
223 Test date string and return a tuple (YYYY, MM, DD) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
224 or None if the date format is invalid |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
225 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
226 # All characters must be numbers, len <= 8 and not empty string |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
227 if not date.isdigit() or len(date) > 8 or date == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
228 return None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
229 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
230 if len(date)%2 == 1: # uneven len: add a leading 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
231 date = "0" + date |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
232 if len(date) == 8: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
233 _d = int(date[:2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
234 _m = int(date[2:4]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
235 _y = int(date[4:8]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
236 elif len(date) <= 6: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
237 _y = int(date[-2:]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
238 if _y < 80: _y = 2000 + _y |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
239 else: _y = 1900 + _y |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
240 if len(date) == 6: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
241 _d = int(date[:2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
242 _m = int(date[2:4]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
243 elif len(date) == 4: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
244 _d = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
245 _m = int(date[:2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
246 elif len(date) == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
247 _d = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
248 _m = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
249 if not _d in range(1,31): _d = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
250 if not _m in range(1,12): _m = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
251 if _m == 0: _d = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
252 if _m != 0 and _d != 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
253 if calendar.monthrange(_y, _m)[1] < _d: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
254 _d = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
255 return (_y, _m, _d) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
256 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
257 def parseRecord(self, record, interface): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
258 """parseRecord(record, interface) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
259 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
260 record: the record line readed from the file whith the format: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
261 type|field|field|subfield\\subfield|... |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
262 [a] nothing or "a" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
263 {a} zero or more #-#twice#-# "a" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
264 <a> one or more #-#twice#-# "a" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
265 Types: V C D Y M N T K L Q J G E X B F A |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
266 V: Property and Version |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
267 1- [File_Owner] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
268 2- Format_Version[\\DDMMYYYY] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
269 3- [Program_Generator] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
270 4- [Header]\\{Title\\} |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
271 5- [Chaters_set] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
272 6- [Comment] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
273 C: Record: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
274 1- Code{\\Code} |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
275 2- [Unit] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
276 3- [Summary] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
277 4- {Price\\} |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
278 5- {Date\\} |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
279 6- [Type] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
280 D or Y: DECOMPOSITION or ADD DECOMPOSITION |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
281 1- Parent Code |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
282 2- <Child Code\\ [Factor]\\ [Yield]> |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
283 M or N: MEASURE or ADD MEASURE |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
284 1- [Parent Code\\]Child Code |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
285 2- {Path\} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
286 3- TOTAL MEASURE |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
287 4- {Type\\Comment\\Unit\\Length\\Width\\Height\\} |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
288 5- [Label] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
289 T: Text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
290 1- Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
291 2- Description text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
292 K: Coefficients |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
293 1- { DN \\ DD \\ DS \\ DR \\ DI \\ DP \\ DC \\ DM \\ DIVISA \\ } |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
294 2- CI \\ GG \\ BI \\ BAJA \\ IVA |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
295 3- { DRC \\ DC \\ DRO \\ DFS \\ DRS \\ DFO \\ DUO \\ DI \\ DES \\ DN \\ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
296 DD \\ DS \\ DIVISA \\ } |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
297 4- [ n ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
298 L: Sheet of Conditions 1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
299 A) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
300 1- Empty |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
301 2- {Section Code\\Section Title} |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
302 B) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
303 1- Record Code |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
304 2- {Section Code\\Section Text} |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
305 3- {Section Code\\RTF file} |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
306 4- {Section Code\\HTM file} |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
307 Q: Sheet of Conditions 2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
308 1- Record Code |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
309 2- {Section Code\\Paragraph key\\{Field key;}\\}| |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
310 J: Sheet of Conditions 3 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
311 1- Paragraph code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
312 2- [Paragraph text] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
313 3- [RTF file] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
314 4- [HTML file] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
315 G: Grafic info |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
316 1- <grafic_file.ext\\> |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
317 E: Company |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
318 1- company Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
319 2 [ summary ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
320 3- [ name ] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
321 4- { [ type ] \\ [ subname ] \\ [ address ] \\ [ postal_code ] |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
322 \\ [ town ] \\ [ province ] \\ [ country ] \\ { phone; } |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
323 \\ { fax; } \\ {contact_person; } \\ } |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
324 5- [ cif ] \\ [ web ] \\ [ email ] \\ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
325 X: Tecnical information |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
326 A) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
327 1- Empty |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
328 2- < TI_Code \\ TI_Descitption \\ TI_Unit > |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
329 B) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
330 1- Record_code |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
331 2- < TI_Code \\ TI_value > |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
332 F: #-#Adjunto#-# File |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
333 1- Record code |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
334 2- { Type \\ { Filenames; } \\ [Description] } |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
335 B: Change code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
336 1- Record Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
337 2- New code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
338 A: Labels |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
339 1- Record Code |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
340 2- <Label\\> |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
341 interface: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
342 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
343 # TODO: ~L ~J RTF and HTML files |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
344 # TODO: test ~Q ~J ~G |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
345 # TODO: ~P. Registro tipo Descripción Paramétrica. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
346 # TODO: ~O. Registro tipo Relación Comercial. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
347 # TODO: test records |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
348 _field_list = record.split("|") |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
349 self.__statistics.records = self.__statistics.records +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
350 _budget = self.__budget |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
351 if _field_list[0] == "V": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
352 self.__statistics.V += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
353 self._parseV(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
354 elif _field_list[0] == "C": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
355 self.__statistics.C += 1 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
356 self._parseC(_field_list, interface) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
357 elif _field_list[0] == "D": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
358 self.__statistics.D += 1 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
359 self._parseDY(_field_list, interface) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
360 elif _field_list[0] == "Y": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
361 self.__statistics.Y += 1 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
362 self._parseDY(_field_list, interface) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
363 elif _field_list[0] == "M": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
364 self.__statistics.M += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
365 self._parseMN(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
366 elif _field_list[0] == "N": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
367 self.__statistics.N += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
368 self._parseMN(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
369 elif _field_list[0] == "T": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
370 self.__statistics.T += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
371 self._parseT(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
372 elif _field_list[0] == "K": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
373 self.__statistics.K += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
374 self._parseK(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
375 elif _field_list[0] == "W": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
376 self.__statistics.W += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
377 self._parseW(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
378 elif _field_list[0] == "L": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
379 self.__statistics.L += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
380 self._parseL(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
381 elif _field_list[0] == "Q": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
382 self.__statistics.Q += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
383 self._parseQ(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
384 elif _field_list[0] == "J": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
385 self.__statistics.J += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
386 self._parseJ(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
387 elif _field_list[0] == "G": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
388 self.__statistics.G += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
389 self._parseG(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
390 elif _field_list[0] == "E": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
391 self.__statistics.E += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
392 self._parseE(_field_list) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
393 elif _field_list[0] == "O": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
394 self.__statistics.O += 1 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
395 elif _field_list[0] == "P": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
396 self.__statistics.P += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
397 self._parseP(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
398 elif _field_list[0] == "X": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
399 self.__statistics.X += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
400 self._parseX(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
401 elif _field_list[0] == "B": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
402 self.__statistics.B += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
403 self._parseB(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
404 elif _field_list[0] == "F": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
405 self.__statistics.F += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
406 self._parseF(_field_list) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
407 elif _field_list[0] == "A": |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
408 self.__statistics.A += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
409 self._parseA(_field_list) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
410 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
411 _tuni = _("FIEBDC. Unknow record: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
412 _uni = utils.mapping(_tuni, (record[:100],)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
413 print(_uni) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
414 self.__statistics.unknow += 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
415 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
416 def _parseV(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
417 """_parseV(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
418 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
419 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
420 0- V :Property and Version |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
421 1- [File_Owner] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
422 2- Format_Version[\DDMMYYYY] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
423 3- [Program_Generator] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
424 4- [Header]\{Title\} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
425 5- [Chaters_set] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
426 6- [Comment] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
427 7- [Data type] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
428 8- [Number budget certificate] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
429 9- [Date budget certificate] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
430 """ |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
431 if self.__statistics.records != 1: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
432 _tuni = _("The 'V' record (Property and Version) "\ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
433 "must be the first record in the file but it is the "\ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
434 "number: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
435 _uni = utils.mapping(_tuni, (text(self.__statistics.records),)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
436 print(_uni) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
437 _tuni = _("The default values were taken and this V record is "\ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
438 "ignored") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
439 print(_tuni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
440 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
441 # _____number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
442 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
443 if len(field_list) > 10: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
444 field_list = field_list[:10] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
445 # If there are no sufficient fields, the fields are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
446 # with empty value:"" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
447 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
448 field_list = field_list + [""]*(10-len(field_list)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
449 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
450 # only leading and trailing whitespace in owner, generator, comment |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
451 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
452 _record_type = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
453 _owner = field_list[1].strip() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
454 _owner = self.delete_control(_owner) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
455 _version_date = self.delete_control_space(field_list[2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
456 _generator = field_list[3].strip() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
457 _generator = self.delete_control(_generator) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
458 _header_title = field_list[4].strip() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
459 _header_title = self.delete_control(_header_title) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
460 _character_set = self.delete_control_space(field_list[5]) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
461 _comment = field_list[6].strip("\t \n\r") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
462 _data_type = self.delete_control_space(field_list[7]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
463 _number_certificate = self.delete_control_space(field_list[8]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
464 __date_certificate = self.delete_control_space(field_list[9]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
465 # _____Owner_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
466 self.__budget.setOwner(_owner) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
467 # _____Version-Date_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
468 _version_date = _version_date.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
469 _file_format = _version_date[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
470 if _file_format in self.__format_list: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
471 self.__file_format = _file_format |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
472 _tuni = _("FIEBDC format: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
473 _uni = utils.mapping(_tuni, (_file_format,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
474 print(_uni) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
475 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
476 if len(_version_date) > 1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
477 _date = _version_date[1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
478 if _date != "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
479 _parsed_date = self.parseDate(_date) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
480 if _parsed_date is not None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
481 self.__budget.setDate(_parsed_date) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
482 # _____Generator_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
483 # ignored field |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
484 _tuni = _("FIEBDC file generated by $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
485 _uni = utils.mapping(_tuni, (_generator,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
486 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
487 # _____Header_Title_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
488 _header_title = _header_title.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
489 _header_title = [_title.strip() for _title in _header_title] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
490 _header = _header_title.pop(0) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
491 _title = [ ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
492 for _title_index in _header_title: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
493 if _title_index != "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
494 _title.append(_title_index) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
495 if _header != "": |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
496 self.__budget.setTitleList([ _header, _title]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
497 # _____Characters_set_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
498 # field parsed in readFile method |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
499 # _____Comment_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
500 if _comment != "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
501 self.__budget.setComment(_comment) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
502 # _____Data type_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
503 # 1 -> Base data. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
504 # 2 -> Budget. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
505 # 3 -> Budget certificate. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
506 # 4 -> Base date update. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
507 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
508 _data_type = int(_data_type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
509 except ValueError: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
510 _data_type = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
511 if _data_type == 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
512 # _____Number budget certificate_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
513 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
514 _number_certificate = int(_number_certificate) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
515 except ValueError: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
516 _number_certificate = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
517 # _____Date budget certificate_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
518 if _date_certificate != "": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
519 _parsed_date_certificate = self.parseDate(_date_certificate) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
520 if _parsed_date_certificate is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
521 _date_certificate = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
522 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
523 _date_certificate = _parsed_date_certificate |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
524 self.__budget.setBudgetype(_data_type) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
525 self.__budget.setCertificateOrder(_number_certificate) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
526 self.__budget.setCertificateDate(_parsed_date_cerfificate) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
527 elif _data_type != "": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
528 self.__budget.setBudgeType(_data_type) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
529 self.__statistics.valid = self.__statistics.valid + 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
530 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
531 def _parseK(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
532 """_parseK(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
533 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
534 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
535 0- K: Coefficients |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
536 1- { DN \ DD \ DS \ DR \ DI \ DP \ DC \ DM \ DIVISA \ } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
537 2- CI \ GG \ BI \ BAJA \ IVA |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
538 3- |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
539 A){ DRC \ DC \ DRO \ DFS \ DRS \ DFO \ DUO \ DI \ DES \ DN \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
540 DD \ DS \ DIVISA \ } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
541 B){ DRC \ DC \ \ DFS \ DRS \ \ DUO \ DI \ DES \ DN \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
542 DD \ DS \ DSP\ DEC\ DIVISA \ } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
543 4- [ n ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
544 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
545 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
546 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
547 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
548 # The last field is ignored, pyArq hate dll's |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
549 if len(field_list) > 4: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
550 field_list = field_list[1:4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
551 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
552 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
553 field_list = field_list[1:] + [""]*(4-len(field_list)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
554 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
555 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
556 _field0 = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
557 _field1 = self.delete_control_space(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
558 _field2 = self.delete_control_space(field_list[2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
559 # _____Field 1_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
560 if len(_field1) > 0 and _field1[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
561 _field1 = _field1[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
562 # if there are a \ character at the end it must be erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
563 _percentages = _field1.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
564 if len(_percentages) > 5: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
565 _percentages = _percentages[:5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
566 # If there are no sufficient subfields, the subfields are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
567 # with empty value:"" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
568 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
569 _percentages = _percentages + [""]*(5-len(_percentages)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
570 _percentage_titles = [ "CI", "GG", "BI", "BAJA", "IVA" ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
571 _percentage_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
572 for _percentage_index in range(len(_percentages)): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
573 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
574 _percentage = int(_percentages[_percentage_index]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
575 except ValueError: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
576 _percentage = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
577 _percentage_dict[_percentage_titles[_percentage_index]] = \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
578 _percentage |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
579 self.__budget.setPercentages(_percentage_dict) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
580 # _____Field 0 and 1_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
581 # Default number of decimal places |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
582 # Number of titles in ~V record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
583 _title_num = len(self.__budget.getTitleList()[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
584 if _title_num == 0: _title_num = 1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
585 # If the field 2 is empty, the field 0 is readed |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
586 if _field2 == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
587 # _____Field 0_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
588 if _field0[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
589 _field0 = _field0[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
590 # if there are a \ character at the end it must be erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
591 _decimal_list = _field0.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
592 _decimal_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
593 if len(_decimal_list)%9 != 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
594 # if it is not multiple of 9, empty subfield are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
595 _decimal_list = _decimal_list + [""]*(9 - \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
596 len(_decimal_list)%9) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
597 # The number of decimal values is the same as the numbers of |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
598 # titles in the V record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
599 if len(_decimal_list)//9 > _title_num: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
600 _decimal_list = _decimal_list[:_title_num*9] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
601 elif len(_decimal_list)//9 < _title_num: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
602 _decimal_list = _decimal_list + _decimal_list[-9:] * \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
603 (_title_num-(len(_decimal_list)//9)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
604 while _decimal_index <= len(_decimal_list)-9: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
605 _decimals = _decimal_list[_decimal_index:(_decimal_index + 9)] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
606 _forlist = range(len(_decimals)-1) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
607 for _index in range(len(_decimals)): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
608 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
609 #TODO: test this |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
610 _decimals[_index] = int(_decimals[_index]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
611 except ValueError: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
612 _decimals[_index] = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
613 _DN = _decimals[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
614 _DD = _decimals[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
615 _DS = _decimals[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
616 _DR = _decimals[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
617 _DI = _decimals[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
618 _DP = _decimals[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
619 _DC = _decimals[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
620 _DM = _decimals[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
621 _DIVISA = _decimals[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
622 _percentage_dict = {"DN" : _DN, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
623 "DD" : _DD, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
624 "DSP" : _DS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
625 "DS" : _DS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
626 "DFC" : _DR, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
627 "DFPU" : _DR, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
628 "DFUO" : _DR, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
629 "DFA" : _DR, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
630 "DRC" : _DR, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
631 "DRPU" : _DR, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
632 "DRUO" : _DR, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
633 "DRA" : _DR, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
634 "DP" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
635 "DC" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
636 "DPU" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
637 "DUO" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
638 "DEA" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
639 "DES" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
640 "DIR" : _DI, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
641 "DIRC" : _DI, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
642 "DCD" : _DP, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
643 "DIVISA": _DIVISA } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
644 _decimal_index = _decimal_index + 9 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
645 self.__budget.setDecimals(_percentage_dict, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
646 (_decimal_index//9)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
647 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
648 # _____Field 3_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
649 if _field2[-1] == "\\": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
650 _field2 = _field2[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
651 # if there are a \ character at the end it must be erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
652 _decimal_list = _field2.split("\\") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
653 # test if the Divisa subfield is 12 or 14 position |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
654 # Divisa is the only Alphanumeric subfield |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
655 # "no_float": "[^0-9.]" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
656 if len(_decimal_list) >= 13 and \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
657 self.__pattern["no_float"].search(_decimal_list[12]): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
658 _multiple = 13 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
659 elif len(_decimal_list) >= 15 and \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
660 self.__pattern["no_float"].search(_decimal_list[14]): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
661 _multiple = 15 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
662 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
663 if self.__file_format == "FIEBDC-3/2002": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
664 _multiple = 13 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
665 elif self.__file_format == "FIEBDC-3/2004": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
666 _multiple = 13 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
667 elif self.__file_format == "FIEBDC-3/2007": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
668 _multiple = 15 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
669 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
670 _multiple = 15 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
671 _decimal_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
672 if len(_decimal_list)%_multiple != 0 : |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
673 # if it is not multiple of _multiple, empty subfield are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
674 _decimal_list = _decimal_list + \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
675 [""]*(_multiple-len(_decimal_list)%_multiple) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
676 # The number of decimal values is the same as the numbers of |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
677 # titles in the V record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
678 if len(_decimal_list)//_multiple > _title_num: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
679 _decimal_list = _decimal_list[:_title_num*_multiple] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
680 elif len(_decimal_list)//_multiple < _title_num: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
681 _decimal_list = _decimal_list + [_decimal_list[-_multiple:]]*\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
682 (_title_num-(len(_decimal_list)//_multiple)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
683 while _decimal_index <= len(_decimal_list)-_multiple: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
684 _decimals = _decimal_list[_decimal_index:(_decimal_index +\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
685 _multiple)] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
686 for _index in range(len(_decimals)-1): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
687 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
688 _decimals[_index] = int(_decimals[_index]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
689 except: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
690 _decimals[_index] = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
691 if _multiple == 13: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
692 _DRC = _decimals[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
693 _DC = _decimals[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
694 _DRO = _decimals[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
695 _DFS = _decimals[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
696 _DRS = _decimals[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
697 _DFO = _decimals[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
698 _DUO = _decimals[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
699 _DI = _decimals[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
700 _DES = _decimals[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
701 _DN = _decimals[9] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
702 _DD = _decimals[10] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
703 _DS = _decimals[11] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
704 _DIVISA = _decimals[12] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
705 _percentage_dict = { |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
706 "DN" : _DN, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
707 "DD" : _DD, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
708 "DSP" : _DS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
709 "DS" : _DS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
710 "DFC" : _DFS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
711 "DFPU" : _DRC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
712 "DFUO" : _DFS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
713 "DFA" : _DFS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
714 "DRC" : _DRS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
715 "DRPU" : _DRC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
716 "DRUO" : _DRS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
717 "DRA" : _DRS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
718 "DP" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
719 "DC" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
720 "DPU" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
721 "DUO" : _DUO, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
722 "DEA" : _DES, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
723 "DES" : _DES, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
724 "DIR" : _DI, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
725 "DIRC" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
726 "DCD" : _DI, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
727 "DIVISA": _DIVISA, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
728 } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
729 else: # _multiple == 15: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
730 _DRC = _decimals[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
731 _DC = _decimals[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
732 _DRO = _decimals[2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
733 _DFS = _decimals[3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
734 _DRS = _decimals[4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
735 _DFO = _decimals[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
736 _DUO = _decimals[6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
737 _DI = _decimals[7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
738 _DES = _decimals[8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
739 _DN = _decimals[9] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
740 _DD = _decimals[10] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
741 _DS = _decimals[11] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
742 _DSP = _decimals[12] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
743 _DEC = _decimals[13] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
744 _DIVISA = _decimals[14] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
745 _percentage_dict = { |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
746 "DN" : _DN, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
747 "DD" : _DD, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
748 "DSP" : _DSP, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
749 "DS" : _DS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
750 "DFC" : _DFS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
751 "DFPU" : _DRC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
752 "DFUO" : _DFS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
753 "DFA" : _DFS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
754 "DRC" : _DRS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
755 "DRPU" : _DRC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
756 "DRUO" : _DRS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
757 "DRA" : _DRS, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
758 "DP" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
759 "DC" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
760 "DPU" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
761 "DUO" : _DUO, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
762 "DEA" : _DEC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
763 "DES" : _DES, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
764 "DIR" : _DI, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
765 "DIRC" : _DC, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
766 "DCD" : _DI, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
767 "DIVISA": _DIVISA} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
768 _decimal_index = _decimal_index + 13 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
769 self.__budget.setDecimals(_percentage_dict, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
770 (_decimal_index//13)) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
771 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
772 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
773 def _parseC(self, field_list, interface): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
774 """_parseC(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
775 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
776 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
777 0- C: Record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
778 1- Code{\Code} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
779 2- [Unit] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
780 3- [Summary] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
781 4- {Price\} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
782 5- {Date\} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
783 6- [Type] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
784 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
785 # _____number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
786 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
787 if len(field_list) > 7: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
788 field_list = field_list[:7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
789 # If there are no sufficient fields, the fields are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
790 # with empty value:"" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
791 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
792 field_list = field_list + [""]*(7-len(field_list)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
793 # control character are erased: en of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
794 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
795 _record_type = field_list[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
796 _codes = self.delete_control_space(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
797 _unit = self.delete_control_space(field_list[2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
798 _summary = self.delete_control(field_list[3]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
799 _prices = self.delete_control_space(field_list[4]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
800 _dates = self.delete_control_space(field_list[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
801 _type = self.delete_control_space(field_list[6]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
802 # _____Code_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
803 _codes = _codes.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
804 if len(_codes) > 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
805 # parse the hierarchy of the first code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
806 # hierarchy: 0->root, 1->Chapter/subchapter, 2->other |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
807 if len(_codes[0]) > 1 and _codes[0][-2:] == "##": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
808 _hierarchy = 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
809 elif len(_codes[0]) > 0 and _codes[0][-1:] == "#": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
810 _hierarchy = 1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
811 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
812 _hierarchy = 2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
813 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
814 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
815 # maximun len 20 characters |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
816 _codes = [self.validateCode(_code) for _code in _codes] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
817 # empty codes are ignored |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
818 while "" in _codes: |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
819 _codes.remove("") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
820 if len(_codes) > 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
821 #TODO: test this |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
822 _code = _codes[0] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
823 _synonyms = [synonym for synonym in _codes] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
824 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
825 _tuni = _("Record C without a valid code") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
826 print(_tuni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
827 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
828 # _____Unit_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
829 # nothing to do |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
830 # _____Summary_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
831 # nothing to do |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
832 # _____Price_____ and _____Dates_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
833 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
834 if len(_dates) > 0 and _dates[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
835 _dates = _dates[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
836 if len(_prices) > 0 and _prices[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
837 _prices = _prices[:-1] |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
838 interface.updateGui() |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
839 _dates = _dates.split("\\") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
840 _prices = _prices.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
841 # number of prices = number of titles in "V" line |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
842 # if there are no sufficient prices it takes the last price defined |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
843 _title_num = len(self.__budget.getTitleList()[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
844 if _title_num == 0: _title_num = 1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
845 if len(_prices) > _title_num: _prices = _prices[:_title_num] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
846 elif len(_prices) < _title_num: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
847 _prices = _prices + [_prices[-1]]*(_title_num-len(_prices)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
848 # number of dates = number of prices |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
849 # if there are no sufficient dates it takes the last date defined |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
850 if len(_dates) > len(_prices): _dates = _dates[:len(_prices)] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
851 elif len(_dates) < len(_prices): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
852 _dates = _dates + [_dates[-1]]*(len(_prices)-len(_dates)) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
853 for _index in range(len(_prices)): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
854 # TODO: lack to specify the number of decimals of the price |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
855 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
856 _prices[_index] = float(_prices[_index]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
857 except: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
858 _prices[_index] = 0.0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
859 _parsed_date = self.parseDate(_dates[_index]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
860 if _parsed_date is None: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
861 _dates[_index] = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
862 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
863 _dates[_index] = _parsed_date |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
864 # _____Type_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
865 # 0 Without classifying |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
866 # EA Auxiliary element |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
867 # EU Unitary element |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
868 # EC Complex element |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
869 # EF Functional element |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
870 # OB Construction site |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
871 # PA Cost overrun |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
872 # PU Unitary budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
873 # 1 Labourforce |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
874 # H Labourforce |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
875 # 2 Machinery and auxiliary equipment |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
876 # Q Machinery |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
877 # % Auxiliary equipment |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
878 # 3 Building materials |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
879 # MC Cement |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
880 # MCr Ceramic |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
881 # MM Wood |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
882 # MS Iron and steel |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
883 # ME Energy |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
884 # MCu Copper |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
885 # MAl Aluminium |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
886 # ML Bonding agents |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
887 # M Others materials |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
888 # Hierarchy type subtype |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
889 # 0->root -> 0 -> None,OB |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
890 # 1->[sub]chapter -> 0 -> None,PU |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
891 # 2->Other -> 0 -> None,EA,EU,EC,EF,PA |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
892 # 1 -> None,H |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
893 # 2 -> None,Q,% |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
894 # 3 -> None,MC,MCr,MM,MS,ME,MCu,Mal,ML,M |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
895 interface.updateGui() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
896 if _hierarchy == 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
897 if _type == "OB": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
898 _subtype = _type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
899 _type = 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
900 elif _type == "0" or _type == "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
901 _subtype = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
902 _type = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
903 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
904 _tuni = _("Incorrect type ($1) in the code $2") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
905 _uni = utils.mapping(_tuni, (_type, _code)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
906 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
907 _type = 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
908 _subtype = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
909 elif _hierarchy == 1: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
910 if _type == "PU": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
911 _subtype = _type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
912 _type = 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
913 elif _type == "0" or _type == "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
914 _subtype = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
915 _type = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
916 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
917 _tuni = _("Incorrect type ($1) in the code $2") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
918 _uni = utils.mapping(_tuni, (_type, _code)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
919 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
920 _type = 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
921 _subtype = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
922 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
923 if _type == "EA" or _type == "EU" or _type == "EC" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
924 _type == "EF" or _type == "PA": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
925 _subtype = _type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
926 _type = 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
927 elif _type == "H": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
928 _subtype = _type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
929 _type = 1 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
930 elif _type == "Q" or _type == "%": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
931 _subtype = _type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
932 _type = 2 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
933 elif _type == "MC" or _type == "MCr" or _type == "MM" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
934 _type == "MS" or _type == "ME" or _type == "MCu" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
935 _type == "Mal" or _type == "ML" or _type == "M": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
936 _subtype = _type |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
937 _type = 3 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
938 elif _type == "0" or _type == "1" or _type == "2" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
939 _type == "3": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
940 _subtype = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
941 _type = int(_type) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
942 elif _type == "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
943 _subtype = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
944 _type = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
945 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
946 _tuni = _("Incorrect type ($1) in the code $2") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
947 _uni = utils.mapping(_tuni, (_type, _code)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
948 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
949 _type = 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
950 _subtype = "" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
951 self.__budget.setRecord(_code, _synonyms, _hierarchy, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
952 _unit, _summary, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
953 _prices, _dates, _type, _subtype) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
954 self.__statistics.valid = self.__statistics.valid + 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
955 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
956 def _parseDY(self, field_list, interface): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
957 """_parseDY(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
958 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
959 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
960 0- D or Y: DECOMPOSITION or ADD DECOMPOSITION |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
961 1- Parent Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
962 2- <Child Code\ [Factor]\ [Yield]> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
963 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
964 # _____number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
965 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
966 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
967 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
968 field_list = field_list[:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
969 # If there are no sufficient fields, the fields are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
970 # with empty value:"" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
971 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
972 field_list = field_list + [""]*(3-len(field_list)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
973 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
974 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
975 _record_type = field_list[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
976 _code = self.delete_control_space(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
977 _children = self.delete_control_space(field_list[2]) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
978 interface.updateGui() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
979 # _____Code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
980 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
981 # invalid characters are also erased |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
982 _code = self.validateCode(_code) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
983 # _____children_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
984 # TODO: test the number of decimals in factor an yield values |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
985 _children = _children.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
986 _children_list = [ ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
987 _child_index = 0 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
988 interface.updateGui() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
989 while _child_index < len(_children)-3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
990 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
991 _child_code = _children[_child_index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
992 _factor = _children[_child_index+1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
993 _yield = _children[_child_index+2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
994 # _____child_code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
995 _child_code = self.validateCode(_child_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
996 # _____factor_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
997 if _factor != "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
998 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
999 _factor = float(_factor) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1000 except ValueError: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1001 _tuni = _("ValueError loadig the "\ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1002 "descomposition of the record $1, the factor "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1003 "of the child $2 must be a float number and "\ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1004 "can not be $3, seted default value 1.0") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1005 _uni = utils.mapping(_tuni, (_code, _child_code, _factor)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1006 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1007 _factor = 1.0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1008 #____yield___ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1009 if _yield != "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1010 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1011 _yield = float(_yield) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1012 except ValueError: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1013 _tuni = _("ValueError loading the "\ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1014 "descomposition of the record $1, the yield of "\ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1015 "the child $2, must be a float number and can"\ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1016 "not be $3, seted default value 1.0") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1017 _uni = utils.mapping(_tuni, (_code, _child_code, _factor)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1018 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1019 _yield = 1.0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1020 if _child_code != "" and _code != "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1021 _children_list.append([_child_code, _factor, _yield ]) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1022 if _record_type == "D": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1023 _position = _child_index // 3 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1024 else: #_record_type == "Y" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1025 _position = -1 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1026 self.__budget.setTree(_code, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1027 _child_code, _position, _factor, |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1028 _yield, "", "", "", "") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1029 _child_index = _child_index + 3 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1030 interface.updateGui() |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1031 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1032 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1033 def _parseT(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1034 """_parseT(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1035 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1036 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1037 0- T: Text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1038 1- Record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1039 2- Description text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1040 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1041 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1042 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1043 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1044 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1045 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1046 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1047 if len(field_list) != 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1048 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1049 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1050 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1051 _code = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1052 _text = field_list[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1053 # _____Code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1054 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1055 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1056 _code = self.validateCode(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1057 # _____Text_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1058 self.__budget.setText(_code, _text) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1059 self.__statistics.valid = self.__statistics.valid + 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1060 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1061 def _parseMN(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1062 """_parseMN(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1063 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1064 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1065 0- M or N: MEASURE or ADD MEASURE |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1066 1- [Parent Code\\]Child Code |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1067 2- {Path\\} |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1068 3- TOTAL MEASURE |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1069 4- {Type\\Comment\\Unit\\Length\\Width\\Height\\} |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1070 5- [Label] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1071 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1072 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1073 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1074 # The record must have 6 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1075 if len(field_list) > 6: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1076 field_list = field_list[:6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1077 # If there are no sufficient fields, the fields are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1078 # with empty value:"" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1079 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1080 field_list = field_list + [""]*(6-len(field_list)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1081 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1082 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1083 _record_type = field_list[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1084 _codes = self.delete_control_space(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1085 _path = self.delete_control_space(field_list[2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1086 _total = self.delete_control_space(field_list[3]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1087 _lines = self.delete_control(field_list[4]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1088 _label = self.delete_control_space(field_list[5]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1089 # _____Codes_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1090 _code_list = _codes.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1091 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1092 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1093 if len(_code_list) == 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1094 _parent_code = self.validateCode(_code_list[0]) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1095 if _parent_code == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1096 _parent_code = None |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1097 _child_code = self.validateCode(_code_list[1]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1098 elif len(_code_list) == 1: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1099 _child_code = self.validateCode(_code_list[0]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1100 _parent_code = None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1101 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1102 _tuni = _("Invalid codes in $1 record, codes $2") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1103 _uni = utils.mapping(_tuni, (_record_type, _codes)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1104 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1105 return |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1106 if _child_code == "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1107 _tuni = _("Empty child code in $1 record, codes: $2") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1108 _uni = utils.mapping(_tuni, (_record_type, _codes)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1109 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1110 return |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1111 if _parent_code == None: |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1112 # Empty parent code. No-estructured measures. |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1113 pass |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1114 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1115 # _____Path_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1116 _path_list = _path.split( "\\" ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1117 if len(_path_list) > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1118 while len(_path_list) > 0 and _path_list[-1] == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1119 _path_list = _path_list[:-1] |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1120 if len(_path_list) == 0: |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1121 # Empty path. No-estructured measures. Path fixed to -2 |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1122 _path = -2 |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1123 else: |
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1124 _path = _path_list[-1] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1125 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1126 _path = int(_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1127 except ValueError: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1128 _tuni = _("Invalid path in $1 record, codes $2") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1129 _uni = utils.mapping(_tuni, (_record_type, _codes)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1130 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1131 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1132 if _path > 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1133 _path -= 1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1134 else: |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1135 _path = -2 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1136 # _____Total_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1137 try: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1138 _total = float(_total) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1139 except ValueError: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1140 _tuni = _("Invalid Total Measure value in $1 "\ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1141 "record, codes $2. Total fixed to 0.") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1142 _uni = utils.mapping(_tuni, (_record_type, _codes)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1143 print(_uni) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1144 _total = 0 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1145 # _____Measure lines_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1146 _lines = _lines.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1147 _line_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1148 _line_list = [ ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1149 while _line_index < len(_lines)-6: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1150 _linetype = _lines[_line_index] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1151 if _linetype == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1152 _linetype = 0 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1153 elif _linetype == "1" or _linetype == "2" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1154 _linetype == "3": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1155 _linetype = int(_linetype) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1156 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1157 _linetype = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1158 _comment= _lines[_line_index + 1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1159 if _linetype == 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1160 # "formula": ".*[^0123456789\.()\+\-\*/\^abcdp ].*" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1161 if self.__pattern["formula"].match(_comment): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1162 _tuni = _("The comment is not a formula or "\ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1163 "its have invalid characters, in the $1 record, "\ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1164 "codes $2") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1165 _uni = utils.mapping(_tuni, (_record_type, _codes)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1166 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1167 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1168 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1169 _formula = _comment |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1170 _comment = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1171 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1172 _formula = "" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1173 _units = _lines[_line_index + 2] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1174 _units = self.__pattern["no_float"].sub("", _units) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1175 _length = _lines[_line_index + 3] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1176 _length = self.__pattern["no_float"].sub("", _length) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1177 _width = _lines[_line_index + 4] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1178 _width = self.__pattern["no_float"].sub("", _width) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1179 _height = _lines[_line_index + 5] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1180 _height = self.__pattern["no_float"].sub("", _height) |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1181 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1182 try: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1183 if _units != "": |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1184 _units = float(_units) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1185 if _length != "": _length = float(_length) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1186 if _width != "": _width = float(_width) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1187 if _height != "": _height = float(_height) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1188 except ValueError: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1189 _tuni = _("The measure values are not float "\ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1190 "numbers, code $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1191 _uni = utils.mapping(_tuni, (_codes,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1192 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1193 return |
20
f5ec50b625d1
Prevent subfield units remains empty
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
19
diff
changeset
|
1194 # Prevent subfield units remains empty. |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1195 if (_units == "" and (_length != "" or _width != "" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1196 or _height != "")): |
20
f5ec50b625d1
Prevent subfield units remains empty
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
19
diff
changeset
|
1197 _units = 1.0 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1198 _line_list.append([_linetype, _comment, _units, |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1199 _length, _width, _height, _formula]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1200 _line_index = _line_index + 6 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1201 self.__budget.setTree(_parent_code, _child_code, _path, "", "", |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1202 _total, _line_list, _label, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1203 _record_type) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1204 self.__statistics.valid = self.__statistics.valid + 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1205 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1206 def _parseW(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1207 """_parseW(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1208 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1209 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1210 0- W: Geografical field |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1211 1- Field Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1212 2- Field |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1213 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1214 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1215 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1216 # The record must have 2 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1217 if len(field_list) >= 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1218 field_list = field_list[1:2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1219 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1220 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1221 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1222 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1223 _code_fields = field_list[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1224 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1225 if len(_code_fields) and _code_fields[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1226 _code_fields = _code_fields[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1227 _code_fields = _code_fields.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1228 _field_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1229 _field_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1230 while _field_index < len(_code_fields)-1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1231 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1232 _field_code = _code_fields[_field_index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1233 _field_title = _code_fields[_field_index+1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1234 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1235 # _____section_code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1236 #"control": "[\t \n\r]" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1237 _field_code = self.delete_control_space(_field_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1238 # _____section_title_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1239 if _field_code != "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1240 _field_dict[_field_code] = _field_title |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1241 _field_index = _field_index + 2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1242 self.__budget.setSheetFields(_field_dict) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1243 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1244 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1245 def _parseL(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1246 """_parseL(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1247 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1248 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1249 0- L: Sheet of Conditions 1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1250 A: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1251 1- Empty |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1252 2- {Section Code\Section Title} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1253 B: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1254 1- Record Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1255 2- {Section Code\Section Text} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1256 3- {Section Code\RTF file} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1257 4- {Section Code\HTM file} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1258 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1259 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1260 # The record must have at least 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1261 if len(field_list) < 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1262 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1263 _code = field_list[1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1264 if _code == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1265 # A: Section Titles |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1266 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1267 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1268 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1269 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1270 field_list = field_list[1:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1271 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1272 _section_codes = field_list[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1273 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1274 if len(_section_codes) and _section_codes[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1275 _section_codes = _section_codes[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1276 _section_codes = _section_codes.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1277 _section_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1278 _section_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1279 while _section_index < len(_section_codes)-1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1280 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1281 _section_code = _section_codes[_section_index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1282 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1283 _section_title = _section_codes[_section_index+1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1284 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1285 # _____section_code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1286 _section_code = self.delete_control_space(_section_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1287 # _____section_title_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1288 _section_title = self.delete_control_space(_section_title) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1289 if _section_code != "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1290 _section_dict[_section_code] = _section_title |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1291 _section_index = _section_index + 2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1292 self.__budget.setSheetSections(_section_dict) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1293 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1294 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1295 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1296 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1297 # The record must have 5 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1298 if len(field_list) > 5: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1299 field_list = field_list[0:5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1300 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1301 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1302 # _____Record Code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1303 _record_code = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1304 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1305 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1306 _record_code = self.validateCode(_record_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1307 _scodes_text = field_list[1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1308 if _scodes_text == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1309 # TODO: rtf and html files |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1310 _uni = "Html and rtf files not yet implemented in ~L record" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1311 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1312 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1313 # _____Section-code_Section-text_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1314 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1315 if len(_scodes_text) and _scodes_text[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1316 _scodes_text = _scodes_text[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1317 _scodes_text = _scodes_text.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1318 _paragraph_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1319 _section_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1320 _section_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1321 while _section_index < len(_scodes_text)-1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1322 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1323 _section_code = _scodes_text[_section_index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1324 _section_text = _scodes_text[_section_index+1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1325 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1326 # _____section_code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1327 _section_code = self.delete_control_space(_section_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1328 # _____section_text_____ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1329 if _section_code != "" and _section_text != "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1330 #-# paragraph #-# |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1331 _paragraph_code = _record_code + _section_code + "*" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1332 _paragraph_dict[_paragraph_code] = _section_text |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1333 _section_dict[_section_code] = _paragraph_code |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1334 _section_index = _section_index + 2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1335 self.__budget.setSheetParagraphs(_paragraph_dict) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1336 self.__budget.setSheetRecord(_record_code, "*", _section_dict) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1337 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1338 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1339 def _parseQ(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1340 """_parseQ(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1341 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1342 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1343 0- Q: Sheet of Conditions 2 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1344 1- Record Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1345 2- {Section Code\Paragraph key\{Field key;}\}| |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1346 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1347 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1348 # The record must have at least 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1349 if len(field_list) < 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1350 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1351 _code = field_list[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1352 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1353 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1354 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1355 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1356 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1357 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1358 # _____Record Code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1359 _record_code = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1360 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1361 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1362 _record_code = self.validateCode(_record_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1363 _scodes_pkey = field_list[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1364 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1365 if len(_scodes_pkey) and _scodes_pkey[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1366 _scodes_pkey = _scodes_pkey[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1367 _scodes_pkey = _scodes_pkey.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1368 _field_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1369 _section_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1370 while _section_index < len(_scodes_pkey) -1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1371 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1372 _section_code = _scodes_pkey[_section_index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1373 _paragraph_key = _scodes_text[_section_index+1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1374 _field_keys = _scodes_text[_section_index+2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1375 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1376 # _____section_code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1377 _section_code = self.delete_control_space(_section_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1378 # _____section_text_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1379 _paragraph_key = self.delete_control_space(_paragraph_key) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1380 # _____Fields keys_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1381 _field_keys = self.delete_control_space(_field_keys) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1382 # last ; is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1383 if len(_field_keys) and _field_keys[-1] == ";": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1384 _field_keys = _field_keys[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1385 _field_keys_list = _scodes_pkey.split(";") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1386 for _field_key in _field_keys_list: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1387 if _field_key != "" and _section_code != "" and \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1388 _paragraph_key != "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1389 if _field_key in _field_dict: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1390 _section_dict = _field_dict[_field_key] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1391 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1392 _section_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1393 _field_dict[_field_key] = _section_dict |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1394 _section_dict[_section_code] = _paragraph_code |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1395 _section_index = _section_index + 3 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1396 for _field, _section_dict in _field_dict.items(): |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1397 self.__budget.setSheetRecord(_record_code, _field, _section_dict) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1398 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1399 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1400 def _parseJ(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1401 """_parseJ(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1402 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1403 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1404 0- J: Sheet of Conditions 3 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1405 1- Paragraph code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1406 2- [Paragraph text] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1407 3- [RTF file] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1408 4- [HTML file] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1409 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1410 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1411 # The record must have at least 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1412 if len(field_list) < 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1413 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1414 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1415 # The record must have 5 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1416 if len(field_list) > 5: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1417 field_list = field_list[0:5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1418 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1419 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1420 # _____Paragraph code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1421 _paragraph_code = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1422 # _____Paragraph text_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1423 _paragraph_text = field_list[1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1424 if _paragraph_text == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1425 # TODO: rtf and html files |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1426 _uni = "Html and rtf files not yet implemented in ~J record" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1427 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1428 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1429 self.__budget.setSheetParagraph(paragraph_code, paragraph_text) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1430 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1431 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1432 def _parseG(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1433 """_parseG(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1434 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1435 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1436 0- G: Grafic info |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1437 1- record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1438 2- <grafic_file.ext\> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1439 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1440 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1441 # The record must have at least 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1442 if len(field_list) < 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1443 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1444 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1445 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1446 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1447 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1448 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1449 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1450 # _____Record Code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1451 _record_code = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1452 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1453 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1454 _record_code = self.validateCode(_record_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1455 # _____Grafic files_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1456 _grafic_files = self.delete_control(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1457 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1458 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1459 if len(_grafic_files) and _grafic_files[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1460 _grafic_files = _grafic_files[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1461 _grafic_file_list = _grafic_files.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1462 _tested_grafic_file_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1463 for _grafic_file in _grafic_file_list: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1464 _path = os.path.dirname(self.__filename) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1465 _grafic_file_path = os.path.join(_path, _grafic_file) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1466 if os.path.exists(_grafic_file_path): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1467 _tested_grafic_file_list.append(_grafic_file_path) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1468 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1469 _name_ext = os.path.splitext(_grafic_file) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1470 _grafic_file_name = _name_ext[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1471 _grafic_file_ext = _name_ext[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1472 _grafic_file_name_u = _grafic_file_name.upper() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1473 _grafic_file_name_l = _grafic_file_name.lower() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1474 _grafic_file_ext_u = _grafic_file_ext.upper() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1475 _grafic_file_ext_l = _grafic_file_ext.lower() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1476 _uu = _grafic_file_name_u + _grafic_file_ext_u |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1477 _ul = _grafic_file_name_u + _grafic_file_ext_l |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1478 _lu = _grafic_file_name_l + _grafic_file_ext_u |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1479 _ll = _grafic_file_name_l + _grafic_file_ext_l |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1480 _grafic_file_path_uu = os.path.join(_path, _uu) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1481 _grafic_file_path_ul = os.path.join(_path, _ul) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1482 _grafic_file_path_lu = os.path.join(_path, _lu) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1483 _grafic_file_path_ll = os.path.join(_path, _ll) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1484 if os.path.exists(_grafic_file_path_uu): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1485 _tested_grafic_file_list.append(_grafic_file_path_uu) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1486 elif os.path.exists(_grafic_file_path_ul): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1487 _tested_grafic_file_list.append(_grafic_file_path_ul) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1488 elif os.path.exists(_grafic_file_path_lu): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1489 _tested_grafic_file_list.append(_grafic_file_path_lu) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1490 elif os.path.exists(_grafic_file_path_ll): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1491 _tested_grafic_file_list.append(_grafic_file_path_ll) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1492 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1493 _tuni = _("The file $1 do not exist") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1494 _uni = utils.mapping(_tuni, (_grafic_file_path,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1495 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1496 if len(_grafic_file_list) > 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1497 for _grafic_file in _tested_grafic_file_list: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1498 self.__budget.addFile(_record_code, _grafic_file, "img", "") |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1499 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1500 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1501 def _parseE(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1502 """_parseE(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1503 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1504 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1505 0- E: Company |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1506 1- company Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1507 2 [ summary ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1508 3- [ name ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1509 4- { [ type ] \ [ subname ] \ [ address ] \ [ postal_code ] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1510 \ [ town ] \ [ province ] \ [ country ] \ { phone; } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1511 \ { fax; } \ {contact_person; } \ } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1512 5- [ cif ] \ [ web ] \ [ email ] \ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1513 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1514 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1515 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1516 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1517 # The record must have 6 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1518 if len(field_list) > 6: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1519 field_list = field_list[1:6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1520 # If there are no sufficient fields, the fields are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1521 # with empty value:"" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1522 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1523 field_list = field_list[1:] + [""]*(6-len(field_list)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1524 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1525 # _____company Code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1526 _company_code = self.delete_control_space(field_list[0]) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1527 if _company_code == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1528 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1529 # _____Summary_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1530 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1531 _sumamary = self.delete_control(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1532 # _____Name_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1533 _name = self.delete_control(field_list[2]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1534 # _____local_offices_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1535 _local_offices = self.delete_control(field_list[3]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1536 # _____subfields of local_offices_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1537 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1538 if len(_local_offices) and _local_offices[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1539 _local_offices = _local_offices[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1540 _local_offices_list = _local_offices.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1541 # If there are no sufficent subfields, the subfields are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1542 # whith empty value |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1543 _nsub = len(_local_offices_list) % 10 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1544 if _nsub != 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1545 _local_offices_list = _local_offices_list + \ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1546 [""]*(10-len(field_list)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1547 _local_offices = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1548 _local_offices_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1549 while _local_offices_index < len(_local_offices_list)-9: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1550 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1551 _type = _local_offices_list[_local_offices_index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1552 _subname = _local_offices_list[_local_offices_index+1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1553 _address = _local_offices_list[_local_offices_index+2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1554 _postal_code = _local_offices_list[_local_offices_index+3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1555 _town = _local_offices_list[_local_offices_index+4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1556 _province = _local_offices_list[_local_offices_index+5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1557 _country = _local_offices_list[_local_offices_index+6] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1558 _phone = _local_offices_list[_local_offices_index+7] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1559 # last ; is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1560 if len(_phone) and _phone[-1] == ";": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1561 _phone = _phone[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1562 _phone_list = _phone.split(";") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1563 _fax = _local_offices_list[_local_offices_index+8] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1564 # last ; is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1565 if len(_fax) and _fax[-1] == ";": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1566 _fax = _fax[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1567 _fax_list = _fax.split(";") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1568 _contact_person = _local_offices_list[_local_offices_index+9] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1569 if _type != "" or _subname != "" or _address != "" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1570 _postal_code != "" or _town != "" or _province != "" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1571 _country != "" or _phone != "" or _fax != "" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1572 _contact_person != "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1573 _local_offices.append([_type, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1574 _subname, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1575 _address, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1576 _postal_code, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1577 _town, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1578 _province, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1579 _country, |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1580 _phone_list, |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1581 _fax_list, |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1582 _contact_person]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1583 _local_offices_index = _local_offices_index + 10 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1584 # _____cif web email_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1585 _c_w_e = self.delete_control_space(field_list[4]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1586 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1587 if len(_c_w_e) and _c_w_e[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1588 _c_w_e = _c_w_e[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1589 _c_w_e_list = _c_w_e.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1590 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1591 # If there are no sufficient fields, the fields are added |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1592 # with empty value:"" |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1593 _c_w_e_list = _c_w_e_list + [""]*(3-len(_c_w_e_list)) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1594 _cif = _c_w_e_list[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1595 _web = _c_w_e_list[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1596 _email = _c_w_e_list[2] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1597 self.__budget.setCompany(_company_code, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1598 _sumamary, _name, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1599 _local_offices, _cif, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1600 _web, _email) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1601 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1602 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1603 def _parseX(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1604 """_parseX(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1605 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1606 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1607 A) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1608 0- X: Tecnical information |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1609 1- Empty |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1610 2- < TI_Code \ TI_Descitption \ TI_Unit > |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1611 B) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1612 0- X: Tecnical information |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1613 1- Record_code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1614 2- < TI_Code \ TI_value > |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1615 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1616 # Tecnical information |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1617 # The record must have at least 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1618 if len(field_list) < 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1619 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1620 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1621 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1622 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1623 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1624 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1625 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1626 # "control": "[\t \n\r]" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1627 _field_1 = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1628 _field_2 = self.delete_control_space(field_list[1]) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1629 if _field_1 == "": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1630 # A) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1631 _field_2_list = _field_2.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1632 _ti_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1633 while _ti_index < len(_field_2_list)-3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1634 _ti_code = _field_2_list[_ti_index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1635 _ti_description = _field_2_list[_ti_index+1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1636 _ti_unit = _field_2_list[_ti_index+2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1637 if _ti_code != "": |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1638 self.__budget.addTecInfo(_ti_code, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1639 _ti_description, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1640 _ti_unit) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1641 _ti_index = _ti_index + 3 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1642 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1643 # B) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1644 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1645 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1646 _record_code = self.validateCode(_field_1) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1647 _field_2_list = _field_2.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1648 _ti_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1649 _ti_dict = {} |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1650 while _ti_index < len(_field_2_list)-2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1651 _ti_code = _field_2_list[_ti_index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1652 _ti_value = _field_2_list[_ti_index+1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1653 if _ti_code != "" and _ti_value != "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1654 _ti_dict[_ti_code] = _ti_value |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1655 _ti_index = _ti_index + 2 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1656 self.__budget.setTecnicalInformation(_record_code, _ti_dict) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1657 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1658 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1659 def _parseF(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1660 """_parseF(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1661 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1662 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1663 0- F: Files |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1664 1- Record code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1665 2- { Type \ { Filenames; } \ [Description] } |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1666 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1667 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1668 # The record must have at least 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1669 if len(field_list) < 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1670 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1671 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1672 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1673 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1674 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1675 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1676 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1677 # _____Record Code_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1678 _record_code = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1679 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1680 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1681 _record_code = self.validateCode(_record_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1682 # _____Grafic files_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1683 _files = self.delete_control(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1684 # _____subfields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1685 # last \ is erased |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1686 if len(_files) and _files[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1687 _files = _files[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1688 _files_list = _files.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1689 # adding empty subfiels if necesary |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1690 if len(_files_list)%3 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1691 _files_list.extend[""]*(3 - len(_files_list)%3) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1692 _file_index = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1693 _tested_files_list = [] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1694 while _file_index < len(_files_list)-3: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1695 _type = _files_list[_file_index].replace(" ","") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1696 ## _types = { |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1697 ## "0": _("others"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1698 ## "1": _("características técnicas y de fabricación"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1699 ## "2": _("manual de colocación, uso y mantenimiento"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1700 ## "3": _("certificado/s de elementos y sistemas"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1701 ## "4": _("normativa y bibliografía"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1702 ## "5": _("tarifa de precios"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1703 ## "6": _("condiciones de venta"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1704 ## "7": _("carta de colores"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1705 ## "8": _("ámbito de aplicación y criterios selección"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1706 ## "9": _("cálculo de elementos y sistemas"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1707 ## "10": _("presentación, datos generales, objetivos, " \ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1708 ## "etc. de empresa"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1709 ## "11": _("certificado/s de empresa"), |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1710 ## "12": _("obras realizadas")} |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1711 _types = ["0", "1", "2", "3", "4", "5", "6", "7", "8", |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1712 "9", "10", "11", "12"] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1713 if not _type in _types: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1714 _type = "0" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1715 _filenames = _files_list[_file_index + 1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1716 _description = _files_list[_file_index + 2] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1717 _file_index += 3 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1718 if len(_filenames) and _filenames[-1] == ";": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1719 _files = _files[:-1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1720 _filenames_list = _filenames.split(";") |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1721 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1722 _path = os.path.dirname(self.__filename) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1723 for _filename in _filenames_list: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1724 _file_path = os.path.join(_path, _filename) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1725 if os.path.exists(_file_path): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1726 _tested_files_list.append([_file_path, _type, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1727 _description]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1728 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1729 _name_ext = os.path.splitext(_filename) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1730 _file_name = _name_ext[0] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1731 _file_ext = _name_ext[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1732 _file_name_u = _file_name.upper() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1733 _file_name_l = _file_name.lower() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1734 _file_ext_u = _file_ext.upper() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1735 _file_ext_l = _file_ext.lower() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1736 _uu = _file_name_u + _file_ext_u |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1737 _ul = _file_name_u + _file_ext_l |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1738 _lu = _file_name_l + _file_ext_u |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1739 _ll = _file_name_l + _file_ext_l |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1740 _file_path_uu = os.path.join(_path, _uu) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1741 _file_path_ul = os.path.join(_path, _ul) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1742 _file_path_lu = os.path.join(_path, _lu) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1743 _file_path_ll = os.path.join(_path, _ll) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1744 if os.path.exists(_file_path_uu): |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1745 _tested_files_list.append([_file_path_uu, |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1746 _type, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1747 _description]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1748 elif os.path.exists(_grafic_file_path_ul): |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1749 _tested_files_list.append([_file_path_ul, |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1750 _type, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1751 _description]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1752 elif os.path.exists(_grafic_file_path_lu): |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1753 _tested_files_list.append([_file_path_lu, |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1754 _type, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1755 _description]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1756 elif os.path.exists(_grafic_file_path_ll): |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1757 _tested_files_list.append([_file_path_ll, |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1758 _type, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1759 _description]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1760 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1761 _tuni = _("The file $1 do not exist") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1762 _uni = utils.mapping(_tuni, (_file_path,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1763 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1764 if len(_tested_files_list) > 0: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1765 for _file in _tested_files_list: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1766 self.__budget.addFile(_record_code, _file[0], |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1767 _file[1], _file[2]) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1768 self.__statistics.valid = self.__statistics.valid +1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1769 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1770 def _parseB(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1771 """_parseB(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1772 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1773 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1774 0- B: Change code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1775 1- Record Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1776 2- New code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1777 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1778 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1779 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1780 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1781 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1782 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1783 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1784 if len(field_list) != 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1785 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1786 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1787 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1788 _code = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1789 _new_code = self.delete_control_space(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1790 # _____Codes_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1791 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1792 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1793 _code = self.validateCode(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1794 _new_code = self.validateCode(_new_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1795 # change code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1796 self.__budget.changeCode(_code, _new_code) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1797 self.__statistics.valid = self.__statistics.valid + 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1798 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1799 def _parseA(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1800 """_parseA(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1801 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1802 field_list: field list of the record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1803 0- A: Labels |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1804 1- Record Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1805 2- <Label\> |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1806 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1807 # _____Number of fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1808 # Any INFORMATION after last field separator is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1809 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1810 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1811 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1812 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1813 if len(field_list) != 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1814 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1815 # control character are erased: end of line, tab, space |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1816 # _____Fields_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1817 # "control": "[\t \n\r]" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1818 _code = self.delete_control_space(field_list[0]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1819 _labels = self.delete_control_space(field_list[1]) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1820 # _____Codes_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1821 # "#" and "##" characters at the end of the code are erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1822 # invalid characters are also erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1823 _code = self.validateCode(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1824 # _____Labels_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1825 # last \ is erased |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1826 # TODO: change the others parsers to this: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1827 while len(_labels) > 0 and _labels[-1] == "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1828 _labels = _labels[:-1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1829 # replace "_" to " " |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1830 _labels = _labels.replace("_"," ") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1831 _label_list = _labels.split("\\") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1832 for _label in _label_list: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1833 self.__budget.addLabel(_code, _label) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
1834 self.__statistics.valid = self.__statistics.valid + 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1835 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1836 def _parseP(self, field_list): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1837 """_parseP(field_list) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1838 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1839 field_list: Parametric record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1840 A) Global paremetric record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1841 0- P: Parametric |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1842 1- Empty |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1843 2- [Parametric description] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1844 3- [library.DLL] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1845 B) Family Parametric record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1846 0- P: Parametric |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1847 1- Family Code |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1848 2- [Parametric description] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1849 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1850 # TODO: Use global parametric record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1851 if len(field_list) > 2: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1852 # delete control caracters and spaces |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1853 _family_code = self.delete_control_space(field_list[1]) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1854 if _family_code == "": # A)Global paremetric record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1855 # The record must have 3 or 4 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1856 if len(field_list) > 4: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1857 field_list = field_list[0:4] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1858 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1859 if len(field_list) == 2: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1860 field_list.append("") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1861 if len(field_list) != 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1862 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1863 else: # B)Family Parametric record |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1864 # The record must have 3 fields |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1865 if len(field_list) > 3: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1866 field_list = field_list[0:3] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1867 field_list = field_list[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1868 if len(field_list) != 2: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1869 _tuni = _("PyArq hates parametric DLLs") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1870 print(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1871 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1872 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1873 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1874 # _____Description_____ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1875 _description = field_list[1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1876 if _description == "": |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1877 _tuni = _("PyArq hates parametric DLLs") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1878 print(_tuni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1879 return |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1880 # Adding last end of line |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1881 _description = _description + "\r\n" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1882 # Delete comments |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1883 # "comment" : "#.*\r\n" |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1884 _description = self.__pattern["comment"].sub("\r\n",_description) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1885 # Tabs to spaces |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1886 _description = _description.replace("\t"," ") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1887 # Delete empty lines |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1888 # "empty_line": r"(\r\n) *\r\n" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1889 while self.__pattern["empty_line"].search(_description): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1890 _description = self.__pattern["empty_line"].sub( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1891 lambda x: x.groups()[0], _description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1892 # Delete spaces before and after / |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1893 # "space_before_backslash" : r"( )+\\" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1894 _description = self.__pattern["space_before_backslash"].sub( |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1895 r"\\",_description) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1896 # "space_after_backslash" : r"\\( )+" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1897 _description = self.__pattern["space_after_backslash"].sub( |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1898 r"\\",_description) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1899 # Join lines that start but not end with / |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1900 _description = "\r\n" + _description # add leading end of line |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1901 # "start_noend_backslash": "(\r\n\\\.*[^\\\])\r\n" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1902 while self.__pattern["start_noend_backslash"].search(_description): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1903 _description = self.__pattern["start_noend_backslash"].sub( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1904 lambda x: x.groups()[0], _description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1905 # Join lines that end with a + - * / ^ and @ & < > <= >= = <> ! |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1906 # "end_oper" : "(\+|-|\*|/|/^|@|&|<|>|<=|>=|=|!) *\r\n" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1907 _description = self.__pattern["end_oper"].sub( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1908 lambda x: x.groups()[0], _description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1909 # Join lines for matricial vars |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1910 # matricial_var : "(\r\n *[%|\$][A-ZÑ].*=.*,) *\r\n" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1911 while self.__pattern["matricial_var"].search(_description): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1912 _description = self.__pattern["matricial_var"].sub( |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1913 lambda x: x.groups()[0], _description) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1914 _description = _description[2:] # remove leading end of line |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1915 #_description = re.sub(r"\\( )+",r"\\",_description) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1916 _lines = _description.split("\r\n") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1917 _final_description = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1918 _pass_line = 0 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1919 for index in range(len(_lines)): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1920 _line = _lines[index] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1921 # Parse lines |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1922 if len(_line) != 0: # Delete empty lines |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1923 if _pass_line > 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1924 _pass_line = _pass_line -1 |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1925 _line = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1926 elif _line.isspace(): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1927 _line = "" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1928 elif _line[0] != "\\": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1929 # Delete spaces out "" delimiter |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1930 _list = _line.split(u'"') |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1931 _final_line = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1932 for index1 in range(len(_list)): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1933 if index1 % 2 != 0: |
17
a7b9f7e7dfa4
Improvements importing FIEBDC files
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
7
diff
changeset
|
1934 _parcial_line = u'"' + _list[index1] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1935 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1936 _parcial_line = _list[index1].replace(" ","") |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1937 _parcial_line = u'"' + _parcial_line |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1938 _final_line = _final_line + _parcial_line |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1939 _line = _final_line[1:] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1940 _lines[index] = _line |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1941 # parse data |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1942 if len(_line) > 2 and _line[:2] == "::": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1943 # Delete spaces out " delimiter |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1944 #print("__PRECIO__" + _line[2:]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1945 pass |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1946 elif len(_line) > 2 and _line[:2] == "%:": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1947 # Delete spaces out " delimiter |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1948 #print("__%AUX__" + _line[2:]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1949 pass |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1950 elif len(_line) > 3 and _line[:2] == "%%:": |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1951 # Delete spaces out " delimiter |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1952 #print("__%%AUX__" + _line[2:] ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1953 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1954 elif self.__pattern["var"].search(_line): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1955 # Delete spaces out " delimiter |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1956 #print( "line =", _line ) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1957 while _line.count('"') % 2 == 1 and \ |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1958 index + _pass_line + 1 < len(_lines) -1: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1959 _line = _line + _lines[index + _pass_line + 1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1960 _pass_line = _pass_line + 1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1961 _search = self.__pattern["var"].search(_line) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1962 if _search is not None: |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1963 _var0 = _search.groups()[0] |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1964 _var1 = _search.groups()[1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1965 _var = _var0 + " = " + _var1 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1966 #print("__VAR__" + str(_var) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1967 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1968 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1969 #print( "no __VAR__", _line ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1970 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1971 elif self.__pattern["descomposition"].search(_line): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1972 # Delete spaces out " delimiter |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1973 #_patern = "(^[^:]*):(.*)$" |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1974 _search = self.__pattern["descomposition"].search(_line) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1975 if _search is not None: |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1976 _var0 = _search.groups()[0] |
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1977 _var1 = _search.groups()[1] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1978 _var = _var0 + ":" + _var1 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1979 #print( "__Descomposición__" + str(_var) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1980 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1981 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
1982 #print("no __Descomposición__", _line ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1983 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
1984 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1985 _tuni = _("Parametric: code: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1986 _uni = utils.mapping(_tuni, (_family_code,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1987 print(_uni) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1988 _tuni = _("******* Desconocido *** : $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1989 _uni = utils.mapping(_tuni, (_line,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1990 print(_uni) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1991 if index-10 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1992 print("-11 : " + _lines[index-11] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1993 if index-10 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1994 print("-10 : " + _lines[index-10] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1995 if index-9 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1996 print("-9 : " + _lines[index-9] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1997 if index-8 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
1998 print("-8 : " + _lines[index-8] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
1999 if index-7 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2000 print("-7 : " + _lines[index-7] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2001 if index-6 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2002 print("-6 : " + _lines[index-6] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2003 if index-5 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2004 print("-5 : " + _lines[index-5] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2005 if index-4 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2006 print("-4 : " + _lines[index-4] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2007 if index-3 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2008 print("-3 : " + _lines[index-3] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2009 if index-2 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2010 print("-2 : " + _lines[index-2] ) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2011 if index-1 > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2012 print("-1 : " + _lines[index-1] ) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2013 print(("-0 :" + _lines[index-0]) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2014 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2015 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2016 _parameter_list = _line.split("\\")[1:-1] |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2017 if len(_parameter_list) >= 2: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2018 if _parameter_list[0] == "C" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2019 _parameter_list[0] == "COMENTARIO": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2020 #print( "__COMENTARIO__" + _parameter_list[1]) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2021 self.__budget.setParametricSelectComment( |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2022 _family_code, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2023 _parameter_list[1]) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2024 elif _parameter_list[0] == "R" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2025 _parameter_list[0] == "RESUMEN": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2026 #print( "__RESUMEN__" + _parameter_list[1]) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2027 self.__budget.setParametricSummary( |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2028 _family_code, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2029 _parameter_list[1]) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2030 elif _parameter_list[0] == "T" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2031 _parameter_list[0] == "TEXTO": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2032 #print( "__TEXTO__" + _parameter_list[1]) |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2033 self.__budget.setParametricText( |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2034 _family_code, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2035 _parameter_list[1]) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2036 elif _parameter_list[0] == "P" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2037 _parameter_list[0] == "PLIEGO": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2038 #print( "__PLIEGO__" + str(_parameter_list[1:]) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2039 pass |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2040 elif _parameter_list[0] == "K" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2041 _parameter_list[0] == "CLAVES": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2042 #print( "__CLAVES__" + str(_parameter_list[1:]) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2043 pass |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2044 elif _parameter_list[0] == "F" or \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2045 _parameter_list[0] == "COMERCIAL": |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2046 #print( "__COMERCIAL__" + str(_parameter_list[1:]) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2047 pass |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2048 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2049 #print( "==PARAMETRO==" + str(_parameter_list[:]) ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2050 pass |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2051 _final_description = _final_description + _line + "\r\n" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2052 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2053 #print( _line ) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2054 # Delete last empty line |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2055 _description = _final_description[:-2] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2056 _lines = _description.split("\r\n") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2057 for _line in _lines: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2058 pass |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2059 #print( _line ) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2060 self.__statistics.valid = self.__statistics.valid + 1 |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2061 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2062 def readFile(self, budget=None, filename=None, interface=None): |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2063 """readFile(budget=None, filename=None) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2064 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2065 filename: the filename of the fiebdc file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2066 budget: base.obra object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2067 interface: a object to send messages |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2068 must have readFile_send_message(message) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2069 readFile_set_statistics(statistics) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2070 readFile_progress(percent) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2071 readFile_end() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2072 readFile_cancel() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2073 updateGui() |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2074 Return None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2075 """ |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
2076 if not filename is None and not budget is None: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2077 self.__filename = filename |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2078 self.__budget = budget |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2079 self.__budget.filename = self.__filename |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
2080 if self.__filename is None or self.__budget is None or self.__cancel: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2081 return None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2082 if not os.path.exists(self.__filename): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2083 return None |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2084 if interface is None: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2085 interface = Interface() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2086 interface.readFile_set_statistics(self.__statistics) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2087 _time = time.time() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2088 try: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2089 _file = open(self.__filename, 'rb') |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2090 except IOError: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2091 _tuni = "IOError: $1" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2092 _uni = utils.mapping(_tuni, (self.__filename,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2093 print(_uni) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2094 return None |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2095 _filesize = float(os.path.getsize(self.__filename)) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2096 if _filesize == 0.0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2097 _tuni = "Empty File: $1" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2098 _uni = utils.mapping(_uni, (self.__filename,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2099 print(_uni) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2100 # Todo: Create empty budget |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2101 return None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2102 self.__budget.filename = self.__filename |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2103 _tuni = _("Loading file $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2104 _uni = utils.mapping(_tuni, (self.__filename,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2105 interface.readFile_send_message(_uni) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2106 interface.readFile_progress(_file.tell() / _filesize) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2107 _buffer = _file.read(1000) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2108 _dbuffer = text(_buffer, self.__character_set) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2109 interface.updateGui() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2110 # set codepage from V record |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2111 _record_list = _dbuffer.split("~") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2112 registro_V = _record_list[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2113 # ~V|[PROPIEDAD_ARCHIVO]|VERSION_FORMATO[\DDMMAAAA]|[PROGRAMA_EMISION]| |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2114 # [CABECERA]\{ ROTULO_IDENTIFICACION \}|[JUEGO_CARACTERES]| |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2115 # [COMENTARIO]|[TIPO INFORMACIÓN]|[NÚMERO CERTIFICACIÓN]| |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2116 # [FECHA CERTIFICACIÓN ] | |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2117 registro_V = registro_V.split("|") |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2118 if registro_V[0] == "V": |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2119 #_codepage = registro_V[5] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2120 if len(registro_V) > 5: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2121 _version = registro_V[5].strip() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2122 # remove leading spaces |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2123 if _version in self.__character_sets_dict: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2124 self.__character_set = self.__character_sets_dict[_version] |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2125 _tuni = _("FIEBDC character encoding: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2126 _uni = utils.mapping(_tuni, (self.__character_set,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2127 interface.readFile_send_message(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2128 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2129 _tuni = _("This Character encoding do not exist in "\ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2130 "FIEBDC3! Default Character encoding: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2131 _uni = utils.mapping(_tuni, (self.__character_set,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2132 interface.readFile_send_message(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2133 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2134 _tuni = _("This V record dot have a character encoding! "\ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2135 "Default character encoding: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2136 _uni = utils.mapping(_tuni, (self.__character_set,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2137 interface.readFile_send_message(_uni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2138 else: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2139 _tuni = _("Not 'V' record in File! Default character encoding: $1") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2140 _uni = utils.mapping(_tuni, (self.__character_set,)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2141 interface.readFile_send_message(_uni) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2142 _dbuffer = text(_buffer, self.__character_set) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2143 interface.updateGui() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2144 # Any INFORMATION between the beginning of the file and the |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2145 # beginning of the first registry “~” is ignored |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2146 #"after_first_tilde" : "^[^~]*~" |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2147 _dbuffer = self.__pattern["after_first_tilde"].sub("",_dbuffer) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2148 while _dbuffer != "" and not self.__cancel: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2149 #-# the blank characters (32), tabs (9) and end of line (13 and 10) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2150 # before the separators '~', '|' are erased. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2151 # Before separator \ not deleted because it affects the reading of |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2152 # the record ~P |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2153 _dbuffer = self.eraseControlCharacters(_dbuffer) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2154 _record_list = _dbuffer.split("~") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2155 # The last record can be incomplete unless it is the last one of |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2156 # the file |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2157 #if len(_record_list) > 1: |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2158 if (_file.tell() / _filesize) != 1.0: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2159 # not the end |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2160 _last_record = _record_list.pop() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2161 else: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2162 # The last record |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2163 # The blank characters (32), tabs (9) and end of line |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2164 # (13 and 10) at the end of the file are ignored. |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2165 #"end_control" : "((\r\n)| |\t)+$" |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2166 _record_list[-1] = self.__pattern["end_control"].sub("", |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2167 _record_list[-1]) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2168 _last_record = "" |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2169 for record in _record_list: |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
2170 if self.__cancel: |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2171 break |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2172 self.parseRecord(record, interface) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2173 interface.updateGui() |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2174 interface.readFile_progress(_file.tell() / _filesize) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2175 _buffer2 = _file.read(100000) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2176 interface.updateGui() |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2177 _dbuffer2 = text(_buffer2, self.__character_set) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2178 _dbuffer = _last_record + _dbuffer2 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2179 interface.updateGui() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2180 _file.close() |
5
6502bfdaa84d
update import durus database
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
1
diff
changeset
|
2181 if self.__cancel: |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2182 interface.readFile_cancel() |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2183 return None |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2184 else: |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2185 self.__statistics.time = time.time()-_time |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2186 if self.__statistics.O > 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2187 _tuni = _("$1 unsuported record type O: Comercial Relationship") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2188 _uni = utils.mapping(_tuni, (text(self.__statistics.O,))) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2189 interface.readFile_send_message(_uni) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2190 if self.__statistics.valid == 0: |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2191 _tuni = _("This file is not a valid FIBDC3 file") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2192 interface.readFile_send_message(_tuni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2193 return None |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2194 interface.readFile_end() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2195 self._testBudget(self.__budget, interface) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2196 return None |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2197 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2198 def _testBudget(self, budget, interface): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2199 """testBudget(budget) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2200 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2201 budget: base.obra object |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2202 Test and repair budget object after read it from bc3 file |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2203 """ |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2204 # TODO: more to do here |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2205 _tuni = _("Testing budget ...") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2206 print(_tuni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2207 # Add price to records without price |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2208 _iter = budget.iter() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2209 _titlelist = budget.getTitleList()[1] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2210 if len(_titlelist) == 0: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2211 _titlenum = 1 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2212 else: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2213 _titlenum = len(_titlelist) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2214 for _code in _iter: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2215 _record = budget.getRecord(_code) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2216 _prices = _record.getPrices() |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2217 _len_prices = len(_prices) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2218 if _titlenum > _len_prices: |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2219 _leftprices = _titlenum - _len_prices |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2220 for _index in range(0,_leftprices): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2221 _root = budget.getRecord(budget.getRoot()) |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2222 _price = [0.0, _root.getDate(_len_prices + _index)] |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2223 budget.addPriceToRecord(_price,_record) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2224 interface.updateGui() |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2225 _tuni = _("End Test") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2226 print(_tuni) |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2227 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2228 def delete_control_space(self, text): |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2229 text = self.delete_control(text) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2230 text = text.replace(" ", "") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2231 return text |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2232 |
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2233 def delete_control(self, text): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2234 text = text.replace("\t", "") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2235 text = text.replace("\r", "") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2236 text = text.replace("\n", "") |
1
2ac1551ad2ab
add code
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
diff
changeset
|
2237 return text |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2238 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2239 class Interface(object): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2240 """fiebdc.Interface |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2241 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2242 Description: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2243 An example interface |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2244 Constructor: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2245 fiebdc.Interface() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2246 Ancestry: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2247 +-- object |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2248 +-- Interface |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2249 Atributes: |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2250 "endSuccessfully": True/False |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2251 "__progress": The progress percentage |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2252 "__statistics": The record statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2253 Methods: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2254 __init__(self) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2255 readFile_send_message(message) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2256 readFile_progress(percent) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2257 readFile_set_statistics(statistics) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2258 readFile_end() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2259 readFile_cancel() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2260 updateGui() |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2261 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2262 """ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2263 def __init__(self): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2264 self.__progress = 0.0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2265 self.__statistics = Statistics() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2266 self.endSuccessfully = False |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2267 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2268 def readFile_set_statistics(self, statistics): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2269 """readFile_set_statistics(statistics) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2270 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2271 statistics: record statistics from readFile method |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2272 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2273 sets record statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2274 """ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2275 self.__statistics = statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2276 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2277 def readFile_send_message(self, message): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2278 """readFile_send_message(message) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2279 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2280 message: mesage from readFile method |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2281 |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2282 print( message ) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2283 """ |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2284 print(message) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2285 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2286 def readFile_progress(self, percent): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2287 """progress(percent) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2288 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2289 percent: Percentage executed. |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2290 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2291 Sets progress |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2292 """ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2293 self.__progress = percent |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2294 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2295 def readFile_end(self): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2296 """readFile_end() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2297 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2298 The readFile method end successfully |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2299 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2300 self.endSuccessfully == True |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2301 print(self.__statistics) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2302 _tuni = "progreso = $1" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2303 _uni = utils.mapping(_tuni, (text(self.__progress,))) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2304 print(_uni) |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2305 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2306 def readFile_cancel(self): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2307 """readFile_cancel() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2308 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2309 The readFile method is canceled |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2310 """ |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2311 self.endSuccessfully == False |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2312 _tuni = _("Process terminated") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2313 print(_tuni) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2314 _tuni = "progreso = $1" |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2315 _uni = utils.mapping(_tuni, (text(self.__progress,))) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2316 print(_tuni) |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2317 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2318 def updateGui(self): |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2319 """updateGui(self) |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2320 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2321 Some interfaces need update gui while doing some time intensive |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2322 computation. Do it here. |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2323 """ |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2324 pass |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2325 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2326 class Statistics(object): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2327 """fiebdc.Statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2328 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2329 Description: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2330 BC3 Statistics. Records types. |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2331 Constructor: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2332 fiebdc.Statistics() |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2333 Ancestry: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2334 +-- object |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2335 +-- Statistics |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2336 Atributes: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2337 "records": number of records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2338 "valid": number of valid records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2339 "V": number of V records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2340 "C": number of C records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2341 "D":number of D records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2342 "Y":number of Y records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2343 "M":number of M records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2344 "N":number of N records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2345 "T":number of T records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2346 "K":number of K records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2347 "W":number of W records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2348 "L":number of L records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2349 "Q":number of Q records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2350 "J": number of J records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2351 "G":number of G records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2352 "E":number of E records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2353 "O":number of O records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2354 "P":number of P records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2355 "X":number of X records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2356 "B":number of B records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2357 "F":number of F records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2358 "A":number of A records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2359 "unknow": number of Unknow records |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2360 "time": Time to load |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2361 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2362 Methods: |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2363 __init__(self) |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2364 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2365 """ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2366 def __init__(self): |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2367 self.records = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2368 self.valid = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2369 self.V = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2370 self.C = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2371 self.D = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2372 self.Y = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2373 self.M = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2374 self.N = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2375 self.T = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2376 self.K = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2377 self.W = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2378 self.L = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2379 self.Q = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2380 self.J = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2381 self.G = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2382 self.E = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2383 self.O = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2384 self.P = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2385 self.X = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2386 self.B = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2387 self.F = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2388 self.A = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2389 self.unknow = 0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2390 self.time = 0.0 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2391 |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2392 def __str__(self): |
25
189f8274aecd
gui. switch navigation menu on switch page
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
23
diff
changeset
|
2393 return self.str() |
23
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2394 |
65e7ae0d0e63
GTK2 to GTK3
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
21
diff
changeset
|
2395 def str(self): |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2396 _tuni1 = _("Time to load: $1 seconds") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2397 _uni1 = utils.mapping(_tuni1, (("%.2f" %(self.time)),)) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2398 _tuni2 = _("Records/Valid Records: $1/$2") |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2399 _uni2 = utils.mapping(_tuni2, |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2400 (text(self.records), text(self.valid))) |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2401 _uni = _uni1 + "\n" + \ |
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2402 _uni2 + "\n" +\ |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2403 "V: %s\n" %(self.V,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2404 "C: %s\n" %(self.C,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2405 "D: %s\n" %(self.D,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2406 "Y: %s\n" %(self.Y,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2407 "M: %s\n" %(self.M,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2408 "N: %s\n" %(self.N,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2409 "T: %s\n" %(self.T,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2410 "K: %s\n" %(self.K,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2411 "W: %s\n" %(self.W,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2412 "L: %s\n" %(self.L,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2413 "Q: %s\n" %(self.Q,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2414 "J: %s\n" %(self.J,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2415 "G: %s\n" %(self.G,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2416 "E: %s\n" %(self.E,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2417 "O: %s\n" %(self.O,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2418 "P: %s\n" %(self.P,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2419 "X: %s\n" %(self.X,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2420 "B: %s\n" %(self.B,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2421 "F: %s\n" %(self.F,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2422 "A: %s\n" %(self.A,) + \ |
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2423 "?: %s\n" %(self.unknow,) |
26
16f91684686b
Upgrade to python 3. Keep python 2/3 compatibility
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
25
diff
changeset
|
2424 return _uni |
21
f7e0cc58737f
Default interface in readFile method
Miguel Ángel Bárcena Rodríguez <miguelangel@obraencurso.es>
parents:
20
diff
changeset
|
2425 |