| 169 | |
| 170 | |
| 171 | class ResultSetting(BaseSetting): |
| 172 | class ExportFileType(Enum): |
| 173 | HTML= 0 |
| 174 | Excel = 1 |
| 175 | JSON = 2 |
| 176 | |
| 177 | |
| 178 | __setting_key__ = "Results" |
| 179 | |
| 180 | @property |
| 181 | def output(self)->str: |
| 182 | output_dir = self._get_value("output") |
| 183 | if output_dir: |
| 184 | output_dir = os.path.expanduser(output_dir) |
| 185 | |
| 186 | return output_dir |
| 187 | |
| 188 | @output.setter |
| 189 | def output(self, value)->str: |
| 190 | Settings.setting[self.__setting_key__]["output"]=value |
| 191 | |
| 192 | @property |
| 193 | def format(self)->str: |
| 194 | return self._get_value("format") |
| 195 | |
| 196 | @property |
| 197 | def get_FileType(self) -> ExportFileType: |
| 198 | if self.format.lower() == 'html': |
| 199 | return ResultSetting.ExportFileType.HTML |
| 200 | elif self.format.lower() == 'xlsx': |
| 201 | return ResultSetting.ExportFileType.Excel |
| 202 | elif self.format.lower() == 'json': |
| 203 | return ResultSetting.ExportFileType.JSON |
| 204 | else: |
| 205 | raise MapXploreException(message_key="errors.invalid_format") |
| 206 | |
| 207 | @property |
| 208 | def include_columns(self) -> bool: |
| 209 | return self._get_bool("includeAllColumns") |
| 210 | |
| 211 | def get_folder_output(self, path_to_join=None): |
| 212 | database_name = "" |
| 213 | if DatabaseSetting().database_name: |
| 214 | database_name = DatabaseSetting().database_name |
| 215 | elif SqlMapSetting().database: |
| 216 | database_name = SqlMapSetting().database |
| 217 | |
| 218 | main_directory = os.path.expanduser(self.output) |
| 219 | if path_to_join: |
| 220 | return os.path.join(main_directory, database_name, path_to_join) |
| 221 | else: |
| 222 | return os.path.join(main_directory, database_name) |
| 223 | |
| 224 | |
| 225 | class DatabaseSetting(BaseSetting): |
no outgoing calls
no test coverage detected