Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better handling if users cancel file dlgs #3595

Merged
merged 5 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions _unittest_solvers/test_26_emit.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ def test_interference_scripts_no_filter(self, add_app):

# Test with no filtering
expected_interference_colors = [["white", "green", "yellow"], ["red", "green", "white"]]
expected_interference_power = [["N/A", -20.0, -20.0], [-20.0, -20.0, "N/A"]]
expected_interference_power = [["N/A", 16.64, 56.0], [60.0, 16.64, "N/A"]]
expected_protection_colors = [["white", "yellow", "yellow"], ["yellow", "yellow", "white"]]
expected_protection_power = [["N/A", -20.0, -20.0], [-20.0, -20.0, "N/A"]]

Expand Down Expand Up @@ -976,10 +976,10 @@ def test_interference_filtering(self, add_app):
[["white", "white", "yellow"], ["red", "white", "white"]],
]
all_interference_power = [
[["N/A", -20.0, -20.0], [-20.0, -20.0, "N/A"]],
[["N/A", -20.0, -20.0], [-20.0, -20.0, "N/A"]],
[["N/A", -20.0, -20.0], [-20.0, -20.0, "N/A"]],
[["N/A", "<= -200", -20.0], [-20.0, "<= -200", "N/A"]],
[["N/A", 16.64, 56.0], [-3.96, 16.64, "N/A"]],
[["N/A", 16.64, 56.0], [60.0, 16.64, "N/A"]],
[["N/A", 16.64, 2.45], [60.0, 16.64, "N/A"]],
[["N/A", "<= -200", 56.0], [60.0, "<= -200", "N/A"]],
]
interference_filters = [
"TxFundamental:In-band",
Expand Down
17 changes: 9 additions & 8 deletions examples/07-EMIT/interference_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,9 @@ def setup_widgets(self):
# with all EMIT designs in the project.

def open_file_dialog(self):
fname = QtWidgets.QFileDialog.getOpenFileName(self, "Select EMIT Project", "", "Ansys Electronics Desktop Files (*.aedt)", )
fname, _filter = QtWidgets.QFileDialog.getOpenFileName(self, "Select EMIT Project", "", "Ansys Electronics Desktop Files (*.aedt)", )
if fname:
self.file_path_box.setText(fname[0])
self.file_path_box.setText(fname)

# Close previous project and open specified one
if self.emitapp is not None:
Expand Down Expand Up @@ -385,10 +385,11 @@ def save_image(self):
else:
table = self.interference_matrix

fname = QtWidgets.QFileDialog.getSaveFileName(self, "Save Scenario Matrix", "Scenario Matrix", "png (*.png)")
image = QtGui.QImage(table.size(), QtGui.QImage.Format_ARGB32)
table.render(image)
image.save(fname[0])
fname, _filter = QtWidgets.QFileDialog.getSaveFileName(self, "Save Scenario Matrix", "Scenario Matrix", "png (*.png)")
if fname:
image = QtGui.QImage(table.size(), QtGui.QImage.Format_ARGB32)
table.render(image)
image.save(fname)

###############################################################################
# Save scenario matrix to Excel file
Expand All @@ -404,7 +405,7 @@ def save_results_excel(self):
table = self.interference_matrix
defaultName = "Interference Type Classification"

fname = QtWidgets.QFileDialog.getSaveFileName(self, "Save Scenario Matrix", defaultName, "xlsx (*.xlsx)")
fname, _filter = QtWidgets.QFileDialog.getSaveFileName(self, "Save Scenario Matrix", defaultName, "xlsx (*.xlsx)")

if fname:
workbook = openpyxl.Workbook()
Expand All @@ -421,7 +422,7 @@ def save_results_excel(self):
cell.fill = PatternFill(start_color = self.color_dict[self.all_colors[col-2][row-2]][1][1:],
end_color = self.color_dict[self.all_colors[col-2][row-2]][1][1:],
fill_type = "solid")
workbook.save(fname[0])
workbook.save(fname)

###############################################################################
# Run interference type simulation
Expand Down
8 changes: 6 additions & 2 deletions pyaedt/emit_core/results/revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,9 +500,13 @@
in_filters = True

# Save the worst case interference values
if instance.get_value(mode_power) > max_power and in_filters:
if (

Check warning on line 503 in pyaedt/emit_core/results/revision.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/emit_core/results/revision.py#L503

Added line #L503 was not covered by tests
instance.has_valid_values()
and instance.get_value(ResultType.EMI) > max_power
and in_filters
):
prob = instance.get_largest_problem_type(ResultType.EMI)
max_power = instance.get_value(mode_power)
max_power = instance.get_value(ResultType.EMI)

Check warning on line 509 in pyaedt/emit_core/results/revision.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/emit_core/results/revision.py#L509

Added line #L509 was not covered by tests
largest_rx_prob = rx_prob
largest_tx_prob = prob.replace(" ", "").split(":")

Expand Down
Loading