generated from dopt-python/py311
Dev #7
+3
-52
@@ -111,40 +111,6 @@ DATETIME_FMT: Final[str] = "%d.%m.%Y %H:%M:%S"
|
||||
DATE_FMT: Final[str] = "%d.%m.%Y"
|
||||
|
||||
|
||||
# TODO check removal
|
||||
def _save_pydantic_model_dict_db(
|
||||
model: FlatBaseModel,
|
||||
path: Path | None = None,
|
||||
) -> None:
|
||||
if path is None:
|
||||
path = Path(__file__).parent / "model.pkl"
|
||||
elif not path.is_file():
|
||||
raise ValueError("Path must point to a file")
|
||||
|
||||
export = model.to_db()
|
||||
|
||||
with open(path, "wb") as f:
|
||||
pickle.dump(export, f)
|
||||
|
||||
|
||||
# TODO check removal
|
||||
def _load_pydantic_model_dict_db(
|
||||
path: Path | None = None,
|
||||
) -> dict[str, Any]:
|
||||
if path is None:
|
||||
path = Path(__file__).parent / "model.pkl"
|
||||
elif not path.is_file():
|
||||
raise ValueError("Path must point to a file")
|
||||
|
||||
if not path.exists():
|
||||
raise FileNotFoundError(f"Provided path for model dict not found: >{path}<")
|
||||
|
||||
with open(path, "rb") as f:
|
||||
model_dict = pickle.load(f)
|
||||
|
||||
return model_dict
|
||||
|
||||
|
||||
def merge_dicts_to_lists(
|
||||
dict_iter: Iterable[dict[K, V]],
|
||||
) -> dict[K, list[V]]:
|
||||
@@ -169,7 +135,7 @@ def unmerge_dict_to_list(
|
||||
return [dict(zip(keys, row)) for row in zip(*value_lists)]
|
||||
|
||||
|
||||
# TODO check removal
|
||||
# TODO check removal or move to basics package
|
||||
def _get_leafs(data):
|
||||
if isinstance(data, dict):
|
||||
for value in data.values():
|
||||
@@ -181,7 +147,7 @@ def _get_leafs(data):
|
||||
yield data
|
||||
|
||||
|
||||
# TODO check removal
|
||||
# TODO check removal or move to basics package
|
||||
def _get_leaf_dicts(data):
|
||||
if isinstance(data, dict):
|
||||
has_inner_dicts = False
|
||||
@@ -1467,7 +1433,6 @@ class AutoForm(QWidget):
|
||||
logger_auto_form.info("Data saved successfully")
|
||||
self.update_triggered.emit()
|
||||
self._activation_delete()
|
||||
# self.reset_form() # TODO check if this behaviour is expected
|
||||
finally:
|
||||
# always re-enable save, even if error occurred
|
||||
self._enable_save()
|
||||
@@ -2425,6 +2390,7 @@ class Page_CompanyProfile(QWidget):
|
||||
back_main_requested = Signal() # back to main page
|
||||
back_requested = Signal(bool) # back to init rec (bool: reset yes/no)
|
||||
# TODO update should trigger something else
|
||||
# more like listening to 'child' ("Beratungen")
|
||||
# update_triggered = Signal() # form saved (data changed for front page)
|
||||
|
||||
def __init__(self):
|
||||
@@ -2662,7 +2628,6 @@ class Page_CompanyProfile(QWidget):
|
||||
self.current_id = id_
|
||||
return
|
||||
|
||||
# TODO retrieve and process data to load
|
||||
init_rec = backend.initrec_get_initial_recording(id_)
|
||||
ma_id = cast(ExtMaId, init_rec["Partnersuche__un_suche"])
|
||||
assert ma_id is not None, "no ma_id obtained"
|
||||
@@ -2788,9 +2753,6 @@ class MasterDataFormWidget(QWidget):
|
||||
self.form_layout.setSpacing(15)
|
||||
self.form_layout.setLabelAlignment(Qt.AlignmentFlag.AlignLeft)
|
||||
|
||||
# load data
|
||||
# self.load_data()
|
||||
|
||||
main_layout.addWidget(segment_frame)
|
||||
self.style_ui()
|
||||
self.reset()
|
||||
@@ -2800,15 +2762,6 @@ class MasterDataFormWidget(QWidget):
|
||||
data: dict[str, Any],
|
||||
) -> None:
|
||||
self.clear_current_layout()
|
||||
# daten = [
|
||||
# ("Anwendungsname", "MyQtApp Pro"),
|
||||
# ("Version", "2.4.1-beta"),
|
||||
# ("Datenbank-Pfad", "/var/lib/sqlite/data.db"),
|
||||
# ("Letzter Login", "2026-06-25 09:30"),
|
||||
# ("Benutzer-ID", "USR-88291"),
|
||||
# ("Verschlüsselung", "AES-256-GCM"),
|
||||
# ]
|
||||
# simulated_retrieved_data = {x[0]: x[1] for x in daten}
|
||||
|
||||
for feature, value in data.items():
|
||||
label_feature = QLabel(f"{feature}")
|
||||
@@ -3087,8 +3040,6 @@ class MainWindow(QMainWindow):
|
||||
self.stack.setCurrentWidget(self.new_entry_select)
|
||||
|
||||
def show_page_initrec_company(self, reset: bool):
|
||||
# TODO: allow for "back" on profile to sustain current view
|
||||
# TODO: reset if approached from "other side" by "new entry"
|
||||
if reset:
|
||||
self.initrec_company.reset_form()
|
||||
self.stack.setCurrentWidget(self.initrec_company)
|
||||
|
||||
Reference in New Issue
Block a user