Skip to content

Commit

Permalink
Made it so edit state cannot choose objects that current state created
Browse files Browse the repository at this point in the history
  • Loading branch information
jslane-h committed Jul 21, 2023
1 parent de24324 commit 217b15f
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 17 deletions.
42 changes: 42 additions & 0 deletions src/app/api_to_method.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"Verification Case": [
"case_already_in_suite",
"check_file",
"check_json_path_type",
"check_type",
"create_verification_case_suite_from_base_case",
"load_verification_cases_from_json",
"read_case",
"same_case",
"save_case_suite_to_json",
"save_verification_cases_to_json",
"validate",
"validate_verification_case_structure"
],
"Data Processing": [
"add_parameter",
"apply_function",
"check",
"concatenate",
"downsample",
"fill_missing_values",
"plot",
"slice",
"summary"
],
"Reporting": [
"report_multiple_cases"
],
"Verification Library": [
"get_applicable_library_items_by_datapoints",
"get_library_item",
"get_library_items",
"get_required_datapoints_by_library_items",
"validate_library"
],
"Verification": [
"configure",
"run",
"run_single_verification"
]
}
31 changes: 16 additions & 15 deletions src/app/popup_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@


class PopupWindow(QDialog):
def __init__(self, schema, payloads={}, edit=False, rect=None):
def __init__(self, payloads={}, edit=False, rect=None):
super().__init__()
self.schema = schema
self.edit = edit
self.rect_item = rect
self.current_payloads = None
self.current_params = None
self.current_choices = None
Expand Down Expand Up @@ -63,22 +60,19 @@ def __init__(self, schema, payloads={}, edit=False, rect=None):
self.initialize_ui()

def initialize_ui(self):
if self.edit:
self.setWindowTitle("Edit State")
else:
self.setWindowTitle("Add State")
self.setWindowTitle("Add State")

layout = QVBoxLayout()
self.setLayout(layout)

self.type_combo_box.addItems(["", "MethodCall", "Choice"])

object_types = list(self.schema.keys())
object_types = list(schema.keys())
object_types.insert(0, "")
object_types.append("Custom")

self.object_type_combo_box.addItems(object_types)
self.method_combo_box.addItems(self.schema[object_types[1]])
self.method_combo_box.addItems(schema[object_types[1]])

layout.addWidget(self.type_combo_box)
layout.addWidget(self.object_type_combo_box)
Expand All @@ -96,14 +90,21 @@ def initialize_ui(self):
lambda: self.update_form(False)
)

def edit_mode(self, payloads):
def edit_mode(self, payloads, rect):
self.setWindowTitle("Edit State")
self.payloads = payloads
if self.payloads and self.payload_combo_box:
payload_objects_created_in_popup = rect.get_objects_created()
current = self.payload_combo_box.currentText()
self.payload_combo_box.clear()
payloads_formatted = [f"{item}" for item in self.payloads]
payloads_formatted = [
f"{item}"
for item in self.payloads
if item not in payload_objects_created_in_popup
]
payloads_formatted.insert(0, "")
self.payload_combo_box.addItems(payloads_formatted)
self.payload_combo_box.setCurrentText(current)

def on_type_selected(self):
type = self.type_combo_box.currentText()
Expand Down Expand Up @@ -160,7 +161,7 @@ def on_state_selected(self):
if object_type == "Custom":
self.update_form(custom=True)
else:
methods = self.schema[object_type].keys()
methods = schema[object_type].keys()
self.method_combo_box.addItems(methods)
self.method_combo_box.show()

Expand All @@ -169,11 +170,11 @@ def update_form(self, custom=False):
object_type = self.object_type_combo_box.currentText()
method = self.method_combo_box.currentText()
try:
fields = self.schema[object_type][method]
fields = schema[object_type][method]
except KeyError:
object_type = "Verification Case"
method = "Initialize"
fields = self.schema[object_type][method]
fields = schema[object_type][method]

self.clear_form()
self.current_payloads = {}
Expand Down
4 changes: 2 additions & 2 deletions src/app/workflow_diagram.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,10 @@ def call_popup(self, rect=None, edit=False):
if self.setting == "basic":
payloads = self.scene.getObjectsCreated()
if rect:
rect.popup.edit_mode(payloads)
rect.popup.edit_mode(payloads, rect)
self.popup = rect.popup
else:
self.popup = PopupWindow(data, payloads)
self.popup = PopupWindow(payloads)
else:
self.popup = AdvancedPopup(rect, edit)

Expand Down

0 comments on commit 217b15f

Please sign in to comment.