Pydantic switchover for omni is largely complete. Will need some debugging.
This commit is contained in:
@@ -9,6 +9,7 @@ from PyQt6.QtWidgets import (
|
||||
QHBoxLayout, QScrollArea, QMainWindow,
|
||||
QToolBar
|
||||
)
|
||||
import pickle
|
||||
from PyQt6.QtGui import QAction
|
||||
from pathlib import Path
|
||||
from markdown import markdown
|
||||
@@ -238,11 +239,17 @@ class App(QMainWindow):
|
||||
|
||||
@under_development
|
||||
def manage_kits(self, *args, **kwargs):
|
||||
dlg = ManagerWindow(parent=self, object_type=KitType, extras=[], add_edit='edit', managers=set())
|
||||
from frontend.widgets.omni_manager_pydant import ManagerWindow as ManagerWindowPyd
|
||||
dlg = ManagerWindowPyd(parent=self, object_type=KitType, extras=[], add_edit='edit', managers=set())
|
||||
if dlg.exec():
|
||||
output = dlg.parse_form()
|
||||
assert isinstance(output, KitType)
|
||||
output.save()
|
||||
# assert isinstance(output, KitType)
|
||||
# output.save()
|
||||
logger.debug(f"Kit output: {pformat(output.__dict__)}")
|
||||
# output.to_sql()
|
||||
with open(f"{output.name}.obj", "wb") as f:
|
||||
pickle.dump(output, f)
|
||||
|
||||
|
||||
class AddSubForm(QWidget):
|
||||
|
||||
|
||||
@@ -211,7 +211,7 @@ class ManagerWindow(QDialog):
|
||||
else:
|
||||
value = current_value + [data]
|
||||
setattr(self.instance, name, value)
|
||||
self.instance.save()
|
||||
# self.instance.save()
|
||||
|
||||
def toggle_textedit(self, caller_child=None):
|
||||
already_exists = self.findChildren(LargeTextEdit)
|
||||
@@ -369,7 +369,7 @@ class EditRelationship(QWidget):
|
||||
new_instance = dlg.parse_form()
|
||||
# NOTE: My custom __setattr__ should take care of any list problems.
|
||||
self.parent().instance.__setattr__(self.objectName(), new_instance)
|
||||
self.parent().instance.save()
|
||||
# self.parent().instance.save()
|
||||
self.parent().update_data()
|
||||
|
||||
def add_existing(self):
|
||||
@@ -381,7 +381,7 @@ class EditRelationship(QWidget):
|
||||
instance = self.class_object.query(**row)
|
||||
# NOTE: My custom __setattr__ should take care of any list problems.
|
||||
self.parent().instance.__setattr__(self.objectName(), instance)
|
||||
self.parent().instance.save()
|
||||
# self.parent().instance.save()
|
||||
self.parent().update_data()
|
||||
|
||||
def set_data(self) -> None:
|
||||
|
||||
@@ -371,6 +371,9 @@ class SubmissionFormWidget(QWidget):
|
||||
case _:
|
||||
pass
|
||||
# NOTE: add reagents to submission object
|
||||
if base_submission is None:
|
||||
# self.app.table_widget.sub_wid.setData()
|
||||
return
|
||||
for reagent in base_submission.reagents:
|
||||
reagent.update_last_used(kit=base_submission.extraction_kit)
|
||||
save_output = base_submission.save()
|
||||
|
||||
Reference in New Issue
Block a user