def beforeEditing(self): if self.value: self.preexisting_item = True record = self.parentApp.application_logic.query_item_by_uuid( self.value) self.name = record.item_uuid self.wg_last_modified.value = record.last_modified self.wg_uuid.value = record.item_uuid self.wg_description.value = record.description try: associated_box_value = self.parentApp.application_logic.query_boxids( ).index(record.in_box) except ValueError: npyscreen.notify( message= "It looks like the box this item as associated with has been deleted. " "No worries, though - the box assignment of this item has now been zeroed.", title="Data integrity error", form_color="STANDOUT") associated_box_value = "" self.wg_in_box.value = associated_box_value else: self.preexisting_item = False self.name = "New item" self.wg_uuid.value = generate_UUID("item") self.wg_description.value = "" self.wg_in_box.value = "" self.wg_last_modified.value = "Just now" self.wg_in_box.values = self.parentApp.application_logic.query_boxids()
def beforeEditing(self): if self.value: self.preexisting_item=True record = self.parentApp.application_logic.query_item_by_uuid(self.value) self.name = record.item_uuid self.wg_last_modified.value = record.last_modified self.wg_uuid.value = record.item_uuid self.wg_description.value = record.description try: associated_box_value = self.parentApp.application_logic.query_boxids().index(record.in_box) except ValueError: npyscreen.notify(message="It looks like the box this item as associated with has been deleted. " "No worries, though - the box assignment of this item has now been zeroed.", title="Data integrity error", form_color="STANDOUT") associated_box_value = "" self.wg_in_box.value = associated_box_value else: self.preexisting_item=False self.name = "New item" self.wg_uuid.value = generate_UUID("item") self.wg_description.value = "" self.wg_in_box.value = "" self.wg_last_modified.value = "Just now" self.wg_in_box.values = self.parentApp.application_logic.query_boxids()
def beforeEditing(self): if self.value: self.preexisting_item=True record = self.parentApp.application_logic.query_box_by_uuid(self.value) self.name = record.box_uuid self.wg_uuid.value = record.box_uuid self.wg_description.value = record.description self.wg_location.value = record.location self.wg_last_modified = record.last_modified else: self.preexisting_item=False self.name = "New box" self.wg_uuid.value = generate_UUID("box") self.wg_description.value = "" self.wg_location.value = "" self.wg_last_modified = "Just now"
def beforeEditing(self): if self.value: self.preexisting_item = True record = self.parentApp.application_logic.query_box_by_uuid( self.value) self.name = record.box_uuid self.wg_uuid.value = record.box_uuid self.wg_description.value = record.description self.wg_location.value = record.location self.wg_last_modified = record.last_modified else: self.preexisting_item = False self.name = "New box" self.wg_uuid.value = generate_UUID("box") self.wg_description.value = "" self.wg_location.value = "" self.wg_last_modified = "Just now"