Check configuration relative to project data
offlate/core/config.py
43 | 43 | ConfigSpec.__init__(self, key, name, description, optional, link) | |
44 | 44 | self.placeholder = placeholder | |
45 | 45 | ||
46 | - | def isConfigured(self, conf): | |
46 | + | def isConfigured(self, conf, data): | |
47 | 47 | return ConfigSpec.isConfigured(self, conf) and \ | |
48 | 48 | (self.optional or (conf[self.key] != None and conf[self.key] != '')) | |
49 | 49 | ||
… | |||
58 | 58 | self.indexKey = indexKey | |
59 | 59 | self.hasRequiredRow = hasRequiredRow | |
60 | 60 | ||
61 | - | def isConfigured(self, conf): | |
61 | + | def isConfigured(self, conf, data): | |
62 | 62 | if not ConfigSpec.isConfigured(self, conf): | |
63 | 63 | return False | |
64 | 64 | ||
65 | 65 | subconf = conf[self.key] | |
66 | 66 | ||
67 | 67 | if self.hasRequiredRow: | |
68 | - | if not self.hasRequiredRow(conf, subconf): | |
68 | + | if not self.hasRequiredRow(data, subconf): | |
69 | 69 | return False | |
70 | 70 | ||
71 | - | for spec in self.specifications: | |
72 | - | if not spec.isConfigured(subconf): | |
73 | - | return False | |
74 | - | ||
75 | 71 | return True |
offlate/core/manager.py
175 | 175 | self.projects = [x for x in self.projects if x['name'] != name] | |
176 | 176 | return self.createProject(name, lang, system, info, callback) | |
177 | 177 | ||
178 | - | def isConfigured(self, system): | |
178 | + | def isConfigured(self, system, data): | |
179 | 179 | if not "Generic" in self.settings.conf: | |
180 | 180 | self.settings.conf["Generic"] = {} | |
181 | 181 | ||
… | |||
185 | 185 | settings = self.settings.conf[system['key']] | |
186 | 186 | for s in self.settings.conf['Generic'].keys(): | |
187 | 187 | settings[s] = self.settings.conf['Generic'][s] | |
188 | - | return Project.isConfigured(system['system'], settings) | |
188 | + | return Project.isConfigured(system['system'], settings, data) | |
189 | 189 | ||
190 | 190 | def isNew(self): | |
191 | 191 | if not 'Generic' in self.settings.conf: |
offlate/systems/project.py
111 | 111 | raise Exception("Unimplemented method in concrete class: reload") | |
112 | 112 | ||
113 | 113 | @staticmethod | |
114 | - | def isConfigured(project_class, conf): | |
114 | + | def isConfigured(project_class, conf, data): | |
115 | 115 | """ | |
116 | 116 | :param dict conf: Offlate configuration | |
117 | 117 | :returns: Whether the configuration is sufficient for this project (system) | |
118 | 118 | :rtype: bool | |
119 | 119 | """ | |
120 | 120 | for spec in project_class.getSystemConfigSpec(): | |
121 | - | if not spec.isConfigured(conf): | |
121 | + | if not spec.isConfigured(conf, data): | |
122 | 122 | return False | |
123 | 123 | return True | |
124 | 124 |
offlate/ui/manager.py
163 | 163 | w.exec_() | |
164 | 164 | if not w.wantNew(): | |
165 | 165 | return | |
166 | - | res = self.manager.isConfigured(w.getProjectSystem()) | |
166 | + | res = self.manager.isConfigured(w.getProjectSystem(), w.getProjectInfo()) | |
167 | 167 | while not res: | |
168 | 168 | if not self.configureSystem(w.getProjectSystem()): | |
169 | 169 | return | |
170 | - | res = self.manager.isConfigured(w.getProjectSystem()) | |
170 | + | res = self.manager.isConfigured(w.getProjectSystem(), w.getProjectInfo()) | |
171 | 171 | worker = NewRunnable(self, w.getProjectName(), w.getProjectLang(), | |
172 | 172 | w.getProjectSystem(), w.getProjectInfo()) | |
173 | 173 | worker.signals.finished.connect(self.openProject) | |
… | |||
182 | 182 | w.exec_() | |
183 | 183 | if not w.wantNew(): | |
184 | 184 | return | |
185 | - | res = self.manager.isConfigured(w.getProjectSystem()) | |
185 | + | res = self.manager.isConfigured(w.getProjectSystem(), w.getProjectInfo()) | |
186 | 186 | while not res: | |
187 | 187 | if not self.configureSystem(w.getProjectSystem()): | |
188 | 188 | return | |
189 | - | res = self.manager.isConfigured(w.getProjectSystem()) | |
189 | + | res = self.manager.isConfigured(w.getProjectSystem(), w.getProjectInfo()) | |
190 | 190 | worker = NewRunnable(self, w.getProjectName(), w.getProjectLang(), | |
191 | 191 | w.getProjectSystem(), w.getProjectInfo()) | |
192 | 192 | worker.signals.finished.connect(self.openProject) |