Config aangepasst
Project-Dialog um Postgres DB erweitert
This commit is contained in:
+10
-3
@@ -3,7 +3,6 @@ from pathlib import Path
|
||||
from sys import platform
|
||||
from typing import Tuple, Type
|
||||
from pydantic_yaml import to_yaml_str, parse_yaml_file_as
|
||||
import polars as pl
|
||||
|
||||
from pydantic import BaseModel
|
||||
from pydantic_settings import BaseSettings, PydanticBaseSettingsSource, SettingsConfigDict, JsonConfigSettingsSource
|
||||
@@ -77,7 +76,7 @@ class PdfProject(BaseModel):
|
||||
saxon_jar_id: int
|
||||
apache_fop_id: int
|
||||
xsl_dir_id: int
|
||||
default_xslt_params: dict[str, str] = {}
|
||||
postgre_sql_db_id: int
|
||||
|
||||
def getXsl(self) -> str:
|
||||
global app_settings
|
||||
@@ -109,6 +108,12 @@ class PdfProject(BaseModel):
|
||||
|
||||
return value[0] if len(value) else ""
|
||||
|
||||
def getPostgreSqlDb(self) -> str:
|
||||
global app_settings
|
||||
value = [x.name for x in app_settings.postgresql_dbs if x.id == self.postgre_sql_db_id]
|
||||
|
||||
return value[0] if len(value) else ""
|
||||
|
||||
|
||||
class AppSettings(BaseSettings):
|
||||
java_vms: list[JavaVm] = []
|
||||
@@ -155,18 +160,20 @@ class XslFile(BaseModel):
|
||||
id: tuple
|
||||
bez: str
|
||||
xsl_file: Path
|
||||
xslt_params: dict[str, str] = {}
|
||||
xmls: list[Xml] = []
|
||||
|
||||
|
||||
class TreeNode(BaseModel):
|
||||
id: tuple
|
||||
bez: str
|
||||
xslt_params: dict[str, str] = {}
|
||||
children: list["TreeNode|XslFile"]
|
||||
|
||||
|
||||
class PdfProjectSettings(BaseModel):
|
||||
"""
|
||||
Speichert Projekt-Einstellungen direkt im Ordner des Projekts in einer Klartextdatei YAML
|
||||
Speichert die Projekteinstellungen direkt im Projektordner in einer .yaml-Datei.
|
||||
"""
|
||||
|
||||
nodes: list[TreeNode] = []
|
||||
|
||||
Reference in New Issue
Block a user