Files
NAFKA-crm-gui/prototypes/tests.py

57 lines
1.1 KiB
Python

# %%
import dataclasses as dc
import enum
from PySide6.QtCore import QDate, Qt
class FormFieldType(enum.StrEnum):
TEXT = enum.auto()
LONGTEXT = enum.auto()
DATE = enum.auto()
DATETIME = enum.auto()
@dc.dataclass(slots=True)
class FormField:
key: str
label: str
type: FormFieldType
required: bool
def __post_init__(self) -> None:
self.label = self.label.strip()
if not self.label.endswith(":"):
self.label += ":"
if self.required:
self.label += "*"
# %%
t_str = "asd.yxcxc.dfgjj.aasdsdsdsd.sdsdsdsd"
splitted = t_str.split(".")
part, rest = splitted[0], splitted[1:]
part
# %%
".".join([part] + rest)
# %%
FormField("name", "Projektbeschreibung", FormFieldType.LONGTEXT, required=True)
# %%
FormField("name", "Projektbeschreibung:", FormFieldType.LONGTEXT, required=True)
# %%
FormField("name", "Projektbeschreibung", FormFieldType.LONGTEXT, required=False)
# %%
FormField("name", "Projektbeschreibung:", FormFieldType.LONGTEXT, required=False)
# %%
addr.export()
# %%
set_date = QDate.fromString("26.07.2026", "dd.MM.yyyy")
# %%
Qt.Tet