generated from dopt-python/py311
combobox retrieval
This commit is contained in:
@@ -53,6 +53,7 @@ QSS = """
|
|||||||
border: 1px dashed #cbd5e1;
|
border: 1px dashed #cbd5e1;
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
|
DROPDOWN_DEFAULT: str = "--- Bitte wählen ---"
|
||||||
|
|
||||||
|
|
||||||
class CompanyForm_Search(QWidget):
|
class CompanyForm_Search(QWidget):
|
||||||
@@ -271,6 +272,20 @@ class FormFieldType(enum.StrEnum):
|
|||||||
DYNAMIC_LIST = enum.auto()
|
DYNAMIC_LIST = enum.auto()
|
||||||
|
|
||||||
|
|
||||||
|
@dc.dataclass(slots=True)
|
||||||
|
class DropdownOption:
|
||||||
|
label: str
|
||||||
|
_data: dc.InitVar[Any | None] = None
|
||||||
|
data: Any = dc.field(init=False)
|
||||||
|
|
||||||
|
def __post_init__(
|
||||||
|
self,
|
||||||
|
_data: Any | None,
|
||||||
|
) -> None:
|
||||||
|
if _data is None:
|
||||||
|
self.data = self.label
|
||||||
|
|
||||||
|
|
||||||
@dc.dataclass(slots=True)
|
@dc.dataclass(slots=True)
|
||||||
class FormField:
|
class FormField:
|
||||||
label: str
|
label: str
|
||||||
@@ -278,14 +293,18 @@ class FormField:
|
|||||||
children: Sequence[FormField] = dc.field(default_factory=list)
|
children: Sequence[FormField] = dc.field(default_factory=list)
|
||||||
parent: FormField | None = None
|
parent: FormField | None = None
|
||||||
required: bool = False
|
required: bool = False
|
||||||
placeholder: str | None = None
|
placeholder: str = ""
|
||||||
fill_value: str | None = None
|
fill_value: str = ""
|
||||||
readonly: bool = False
|
readonly: bool = False
|
||||||
options: Sequence[str] | None = None
|
options: dc.InitVar[Sequence[tuple[str, Any]]] = tuple()
|
||||||
|
dropdown_options: Sequence[DropdownOption] = dc.field(default=tuple(), init=False)
|
||||||
key: str = ""
|
key: str = ""
|
||||||
tooltip: str = ""
|
tooltip: str = ""
|
||||||
|
|
||||||
def __post_init__(self) -> None:
|
def __post_init__(
|
||||||
|
self,
|
||||||
|
options: Sequence[tuple[str, Any]],
|
||||||
|
) -> None:
|
||||||
if not self.key:
|
if not self.key:
|
||||||
self.key = str(uuid.uuid4())
|
self.key = str(uuid.uuid4())
|
||||||
|
|
||||||
@@ -295,25 +314,15 @@ class FormField:
|
|||||||
if self.required:
|
if self.required:
|
||||||
self.label += "*"
|
self.label += "*"
|
||||||
|
|
||||||
if self.type is FormFieldType.DROPDOWN and self.options is None:
|
if self.type is FormFieldType.DROPDOWN and not options:
|
||||||
raise ValueError("Invalid field definition: Dropdown requires options")
|
raise ValueError("Invalid field definition: Dropdown requires options")
|
||||||
|
elif self.type is FormFieldType.DROPDOWN:
|
||||||
|
self.dropdown_options = tuple(DropdownOption(op[0], op[1]) for op in options)
|
||||||
|
|
||||||
for child in self.children:
|
for child in self.children:
|
||||||
child.parent = self
|
child.parent = self
|
||||||
|
|
||||||
|
|
||||||
@dc.dataclass(slots=True)
|
|
||||||
class FormFieldDynList:
|
|
||||||
label: str
|
|
||||||
fields: Sequence[FormField]
|
|
||||||
|
|
||||||
|
|
||||||
# @dc.dataclass(slots=True)
|
|
||||||
# class FormFieldGroup:
|
|
||||||
# label: str | None
|
|
||||||
# fields: Sequence[FormField] | FormFieldDynList
|
|
||||||
|
|
||||||
|
|
||||||
class WidgetRegistryEntry(TypedDict):
|
class WidgetRegistryEntry(TypedDict):
|
||||||
widget: QWidget
|
widget: QWidget
|
||||||
form_field: FormField
|
form_field: FormField
|
||||||
@@ -427,6 +436,7 @@ FORM_FIELDS_CONTACT_PERSON = [
|
|||||||
FormField(
|
FormField(
|
||||||
"Name Unternehmen/Netzwerkpartner (pre-filled von Suche)",
|
"Name Unternehmen/Netzwerkpartner (pre-filled von Suche)",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t1",
|
||||||
required=False,
|
required=False,
|
||||||
placeholder="Text wird nach gewähltem Unternehmen angezeigt",
|
placeholder="Text wird nach gewähltem Unternehmen angezeigt",
|
||||||
readonly=True,
|
readonly=True,
|
||||||
@@ -434,6 +444,7 @@ FORM_FIELDS_CONTACT_PERSON = [
|
|||||||
FormField(
|
FormField(
|
||||||
"Titel",
|
"Titel",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t2",
|
||||||
required=False,
|
required=False,
|
||||||
tooltip=(
|
tooltip=(
|
||||||
"* nur wenn anrufende Person oder kontaktaufnehmende Person "
|
"* nur wenn anrufende Person oder kontaktaufnehmende Person "
|
||||||
@@ -443,41 +454,49 @@ FORM_FIELDS_CONTACT_PERSON = [
|
|||||||
FormField(
|
FormField(
|
||||||
"Anrede_Anschrift",
|
"Anrede_Anschrift",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t3",
|
||||||
required=True,
|
required=True,
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Name",
|
"Name",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t4",
|
||||||
required=True,
|
required=True,
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Vorname",
|
"Vorname",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t5",
|
||||||
required=False,
|
required=False,
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Festnetznummer",
|
"Festnetznummer",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t6",
|
||||||
required=False,
|
required=False,
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Mobilfunknummer",
|
"Mobilfunknummer",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t7",
|
||||||
required=False,
|
required=False,
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"E-Mail",
|
"E-Mail",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t8",
|
||||||
required=False,
|
required=False,
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Funktion/Beziehung zur beratenden Person",
|
"Funktion/Beziehung zur beratenden Person",
|
||||||
FormFieldType.TEXT,
|
FormFieldType.TEXT,
|
||||||
|
key="t9",
|
||||||
required=False,
|
required=False,
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Adresse",
|
"Adresse",
|
||||||
FormFieldType.LONGTEXT,
|
FormFieldType.LONGTEXT,
|
||||||
|
key="t10",
|
||||||
required=False,
|
required=False,
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@@ -520,28 +539,28 @@ FORM_FIELDS_MASTER_DATA = [
|
|||||||
"Herkunftsland",
|
"Herkunftsland",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=True,
|
required=True,
|
||||||
options=["LÄNDERLISTE NOCH ZU ERGÄNZEN"],
|
options=[("LÄNDERLISTE NOCH ZU ERGÄNZEN", None)],
|
||||||
tooltip=("* Wichtig zu erfragen aufgrund eventueller EU-Freizügigkeitsregelung"),
|
tooltip=("* Wichtig zu erfragen aufgrund eventueller EU-Freizügigkeitsregelung"),
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Staatsangehörigkeit",
|
"Staatsangehörigkeit",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=["LÄNDERLISTE NOCH ZU ERGÄNZEN"],
|
options=[("LÄNDERLISTE NOCH ZU ERGÄNZEN", None)],
|
||||||
tooltip=("* Wichtig zu erfragen aufgrund eventueller EU-Freizügigkeitsregelung"),
|
tooltip=("* Wichtig zu erfragen aufgrund eventueller EU-Freizügigkeitsregelung"),
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Rückkehrer",
|
"Rückkehrer",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=["ja", "nein"],
|
options=[("ja", None), ("nein", None)],
|
||||||
tooltip=("* Wichtig zu erfragen aufgrund eventueller EU-Freizügigkeitsregelung"),
|
tooltip=("* Wichtig zu erfragen aufgrund eventueller EU-Freizügigkeitsregelung"),
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Wo befindet sich die Person?",
|
"Wo befindet sich die Person?",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=True,
|
required=True,
|
||||||
options=["Inland", "Ausland EU/EWR", "Ausland Drittstaat"],
|
options=[("Inland", None), ("Ausland EU/EWR", None), ("Ausland Drittstaat", None)],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Straße",
|
"Straße",
|
||||||
@@ -567,7 +586,7 @@ FORM_FIELDS_MASTER_DATA = [
|
|||||||
"Bundesland",
|
"Bundesland",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=["BUNDESLÄNDER NOCH ZU ERGÄNZEN"],
|
options=[("BUNDESLÄNDER NOCH ZU ERGÄNZEN", None)],
|
||||||
tooltip=(
|
tooltip=(
|
||||||
"nur wenn Inland angegeben und die Angabe zieht es in keine Dokumente "
|
"nur wenn Inland angegeben und die Angabe zieht es in keine Dokumente "
|
||||||
"rüber! Liste Bundesländer verwenden"
|
"rüber! Liste Bundesländer verwenden"
|
||||||
@@ -603,7 +622,7 @@ FORM_FIELDS_MASTER_DATA = [
|
|||||||
"Anzahl Kinder",
|
"Anzahl Kinder",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=[str(x) for x in range(11)],
|
options=[(str(x), None) for x in range(11)],
|
||||||
tooltip="* Wichtig zu erfragen aufgrund Lebensunterhaltssicherung",
|
tooltip="* Wichtig zu erfragen aufgrund Lebensunterhaltssicherung",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@@ -613,27 +632,31 @@ FORM_FIELDS_ADDITIONAL_DATA = [
|
|||||||
"Deutsch als Kommunikationssprache",
|
"Deutsch als Kommunikationssprache",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=["nein", "ja, als Muttersprache", "ja, als Fremdsprache"],
|
options=[
|
||||||
|
("nein", None),
|
||||||
|
("ja, als Muttersprache", None),
|
||||||
|
("ja, als Fremdsprache", None),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Aufenthaltstitel",
|
"Aufenthaltstitel",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=[
|
options=[
|
||||||
"anerkannter Flüchtling §§ 22 - 26 AufenthG",
|
("anerkannter Flüchtling §§ 22 - 26 AufenthG", None),
|
||||||
"Aufenthaltsgestattung §55 AufenthG",
|
("Aufenthaltsgestattung §55 AufenthG", None),
|
||||||
"Blaue Karte EU § 18g AufenthG",
|
("Blaue Karte EU § 18g AufenthG", None),
|
||||||
"BüMA (Bescheinigung über Meldung als Asylsuchender)",
|
("BüMA (Bescheinigung über Meldung als Asylsuchender)", None),
|
||||||
"Duldung § 60 AufenthG",
|
("Duldung § 60 AufenthG", None),
|
||||||
"bisher kein Aufenthaltstitel",
|
("bisher kein Aufenthaltstitel", None),
|
||||||
"Deutscher",
|
("Deutscher", None),
|
||||||
"familiäre Gründe §§ 27 - 36 AufenthG",
|
("familiäre Gründe §§ 27 - 36 AufenthG", None),
|
||||||
"Niederlassungserlaubnis §9 AufenthG",
|
("Niederlassungserlaubnis §9 AufenthG", None),
|
||||||
"Staatsbürger EUR/EWR/CH",
|
("Staatsbürger EUR/EWR/CH", None),
|
||||||
"Aufenthalt für Ausbildung §§ 16 - 17 AufenthG",
|
("Aufenthalt für Ausbildung §§ 16 - 17 AufenthG", None),
|
||||||
"Aufenthalt für Erwerbstätigkeit §§ 18- 21 AufenthG",
|
("Aufenthalt für Erwerbstätigkeit §§ 18- 21 AufenthG", None),
|
||||||
"Chancenaufenthaltsrecht §104c AufenthG",
|
("Chancenaufenthaltsrecht §104c AufenthG", None),
|
||||||
"Sonstiges",
|
("Sonstiges", None),
|
||||||
],
|
],
|
||||||
tooltip="sofern nicht bekannt, unbedingt einfordern",
|
tooltip="sofern nicht bekannt, unbedingt einfordern",
|
||||||
),
|
),
|
||||||
@@ -647,14 +670,14 @@ FORM_FIELDS_ADDITIONAL_DATA = [
|
|||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=[
|
options=[
|
||||||
"Arbeitslos",
|
("Arbeitslos", None),
|
||||||
"Ausbildung/Qualifizierung Inland",
|
("Ausbildung/Qualifizierung Inland", None),
|
||||||
"geringfügig beschäftigt",
|
("geringfügig beschäftigt", None),
|
||||||
"in Anstellung Inland",
|
("in Anstellung Inland", None),
|
||||||
"selbstständig Inland",
|
("selbstständig Inland", None),
|
||||||
"Ausbildung/Qualifizierung Ausland",
|
("Ausbildung/Qualifizierung Ausland", None),
|
||||||
"in Anstellung Ausland",
|
("in Anstellung Ausland", None),
|
||||||
"selbstständig Ausland",
|
("selbstständig Ausland", None),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
@@ -662,13 +685,13 @@ FORM_FIELDS_ADDITIONAL_DATA = [
|
|||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=[
|
options=[
|
||||||
"bei keiner",
|
("bei keiner", None),
|
||||||
"Jobcenter mit Leistungsbezug",
|
("Jobcenter mit Leistungsbezug", None),
|
||||||
"Jobcenter ohne Leistungsbezug",
|
("Jobcenter ohne Leistungsbezug", None),
|
||||||
"Sozialamt mit Leistungsbezug",
|
("Sozialamt mit Leistungsbezug", None),
|
||||||
"Sozialamt ohne Leistungsbezug",
|
("Sozialamt ohne Leistungsbezug", None),
|
||||||
"Agentur für Arbeit mit Leistungsbezug",
|
("Agentur für Arbeit mit Leistungsbezug", None),
|
||||||
"Agentur für Arbeit ohne Leistungsbezug",
|
("Agentur für Arbeit ohne Leistungsbezug", None),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
@@ -698,7 +721,7 @@ FORM_FIELDS_SCHOOL = [
|
|||||||
"Land",
|
"Land",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=["LÄNDERLISTE ERGÄNZEN"],
|
options=[("LÄNDERLISTE ERGÄNZEN", None)],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Abschlussjahr",
|
"Abschlussjahr",
|
||||||
@@ -750,7 +773,7 @@ FORM_FIELDS_HIGHER_EDUCATION = [
|
|||||||
"Land",
|
"Land",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=["LÄNDERLISTE ERGÄNZEN"],
|
options=[("LÄNDERLISTE ERGÄNZEN", None)],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Ort",
|
"Ort",
|
||||||
@@ -775,7 +798,7 @@ FORM_FIELDS_WORK_EXPERIENCE = [
|
|||||||
"Branche",
|
"Branche",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=["DROPDOWN-LISTE AN ANDERER STELLE DEFINIERT"],
|
options=[("DROPDOWN-LISTE AN ANDERER STELLE DEFINIERT", None)],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Berufsbezeichnung/Tätigkeit",
|
"Berufsbezeichnung/Tätigkeit",
|
||||||
@@ -787,16 +810,16 @@ FORM_FIELDS_WORK_EXPERIENCE = [
|
|||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=[
|
options=[
|
||||||
"Auszubildender",
|
("Auszubildender", None),
|
||||||
"Fachkraft",
|
("Fachkraft", None),
|
||||||
"Hilfskraft",
|
("Hilfskraft", None),
|
||||||
"Akademiker",
|
("Akademiker", None),
|
||||||
"Führungskraft",
|
("Führungskraft", None),
|
||||||
"Praktikant",
|
("Praktikant", None),
|
||||||
"FSJ/BFD",
|
("FSJ/BFD", None),
|
||||||
"Elternzeit",
|
("Elternzeit", None),
|
||||||
"Sabbatical",
|
("Sabbatical", None),
|
||||||
"Sonstiges",
|
("Sonstiges", None),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
@@ -808,7 +831,7 @@ FORM_FIELDS_WORK_EXPERIENCE = [
|
|||||||
"Land",
|
"Land",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=["LÄNDERLISTE ERGÄNZEN"],
|
options=[("LÄNDERLISTE ERGÄNZEN", None)],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
"Zeitspanne (von ... bis ...)",
|
"Zeitspanne (von ... bis ...)",
|
||||||
@@ -820,9 +843,9 @@ FORM_FIELDS_WORK_EXPERIENCE = [
|
|||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=[
|
options=[
|
||||||
"Vollzeit",
|
("Vollzeit", None),
|
||||||
"Teilzeit",
|
("Teilzeit", None),
|
||||||
"Sonstiges",
|
("Sonstiges", None),
|
||||||
],
|
],
|
||||||
tooltip="Minijob, Praktikum, Wehrdienst, soziale Dienste",
|
tooltip="Minijob, Praktikum, Wehrdienst, soziale Dienste",
|
||||||
),
|
),
|
||||||
@@ -844,12 +867,12 @@ FORM_FIELDS_LANGUAGES = [
|
|||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=[
|
options=[
|
||||||
"A1",
|
("A1", None),
|
||||||
"A2",
|
("A2", None),
|
||||||
"B1",
|
("B1", None),
|
||||||
"B2",
|
("B2", None),
|
||||||
"C1",
|
("C1", None),
|
||||||
"C2",
|
("C2", None),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
@@ -857,8 +880,8 @@ FORM_FIELDS_LANGUAGES = [
|
|||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
required=False,
|
required=False,
|
||||||
options=[
|
options=[
|
||||||
"vorhanden",
|
("vorhanden", None),
|
||||||
"nicht vorhanden",
|
("nicht vorhanden", None),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
FormField(
|
FormField(
|
||||||
@@ -883,9 +906,9 @@ FORM_FIELDS = [
|
|||||||
FormField(
|
FormField(
|
||||||
"Projektrelevanz",
|
"Projektrelevanz",
|
||||||
FormFieldType.DROPDOWN,
|
FormFieldType.DROPDOWN,
|
||||||
|
key="projektrelevanz",
|
||||||
required=True,
|
required=True,
|
||||||
options=["ja", "nein"],
|
options=[("ja", None), ("nein", None)],
|
||||||
fill_value="nein",
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -1025,9 +1048,11 @@ def _build_ui_recursively(
|
|||||||
|
|
||||||
case FormFieldType.DROPDOWN:
|
case FormFieldType.DROPDOWN:
|
||||||
widget = QComboBox()
|
widget = QComboBox()
|
||||||
assert field.options
|
assert field.dropdown_options
|
||||||
widget.addItem("--- Bitte wählen ---")
|
widget.addItem(DROPDOWN_DEFAULT, None)
|
||||||
widget.addItems(field.options)
|
for option in field.dropdown_options:
|
||||||
|
widget.addItem(option.label, option.data)
|
||||||
|
|
||||||
if field.placeholder:
|
if field.placeholder:
|
||||||
widget.setPlaceholderText(field.placeholder)
|
widget.setPlaceholderText(field.placeholder)
|
||||||
if field.fill_value:
|
if field.fill_value:
|
||||||
@@ -1242,6 +1267,9 @@ class AutoForm(QWidget):
|
|||||||
elif isinstance(widget, QPlainTextEdit):
|
elif isinstance(widget, QPlainTextEdit):
|
||||||
if widget.toPlainText().strip():
|
if widget.toPlainText().strip():
|
||||||
continue
|
continue
|
||||||
|
elif isinstance(widget, QComboBox):
|
||||||
|
if widget.currentData() is not None:
|
||||||
|
continue
|
||||||
|
|
||||||
error = form_field.label.replace("*", "").replace(":", "")
|
error = form_field.label.replace("*", "").replace(":", "")
|
||||||
if form_field.parent is not None:
|
if form_field.parent is not None:
|
||||||
@@ -1286,6 +1314,8 @@ class AutoForm(QWidget):
|
|||||||
|
|
||||||
raw_data = {}
|
raw_data = {}
|
||||||
for key, registry_entry in self.widget_registry.items():
|
for key, registry_entry in self.widget_registry.items():
|
||||||
|
value: Any | None = None
|
||||||
|
|
||||||
widget = registry_entry["widget"]
|
widget = registry_entry["widget"]
|
||||||
if isinstance(widget, QLineEdit):
|
if isinstance(widget, QLineEdit):
|
||||||
value = widget.text()
|
value = widget.text()
|
||||||
@@ -1295,15 +1325,13 @@ class AutoForm(QWidget):
|
|||||||
qt_date = widget.date()
|
qt_date = widget.date()
|
||||||
value = qt_date.toPython()
|
value = qt_date.toPython()
|
||||||
elif isinstance(widget, QComboBox):
|
elif isinstance(widget, QComboBox):
|
||||||
# TODO add
|
value = widget.currentData()
|
||||||
...
|
elif isinstance(widget, DynamicListWidget):
|
||||||
# value = widget.toPlainText()
|
|
||||||
elif isinstance(widget, DynamicListWidget): # Unser Custom Widget
|
|
||||||
# TODO add method
|
# TODO add method
|
||||||
# value = widget.get_data()
|
# value = widget.get_data()
|
||||||
|
# this should be a list: each dynamic list contains a list
|
||||||
|
# of such dictionaries
|
||||||
value = "test"
|
value = "test"
|
||||||
else:
|
|
||||||
value = None
|
|
||||||
|
|
||||||
_insert_nested(raw_data, key.split("."), value)
|
_insert_nested(raw_data, key.split("."), value)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user