Skip to content

Commit

Permalink
python black formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
jslane-h committed Jan 24, 2024
1 parent d86fffc commit 7e28d2c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
12 changes: 8 additions & 4 deletions constrain/app/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,11 @@ def exportFile(self):

scene = self.states_form.scene
if not scene.items():
utils.send_error("Export Error", "Workflow is empty. Add a workflow to export")
utils.send_error(
"Export Error", "Workflow is empty. Add a workflow to export"
)
return

fp, _ = QFileDialog.getSaveFileName(
self, "Save JSON File", "", "JSON Files (*.json);;All Files (*)"
)
Expand All @@ -172,9 +174,11 @@ def exportAsPng(self):

scene = self.states_form.scene
if not scene.items():
utils.send_error("Export Error", "Workflow is empty. Add a workflow to export")
utils.send_error(
"Export Error", "Workflow is empty. Add a workflow to export"
)
return

fp, _ = QFileDialog.getSaveFileName(self, "Save Image", "", "PNG Files (*.png)")

if fp:
Expand Down
5 changes: 4 additions & 1 deletion constrain/app/rect_connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

from . import utils


class Path(QtWidgets.QGraphicsPathItem):
def __init__(self, start, p2, end=None):
"""Initializes a Path from start to p2
Expand Down Expand Up @@ -249,7 +250,9 @@ def newLineErrorCheck(self, pathItem):
if rect_children_amt >= 1:
if self.parent.state["Type"] != "Choice":
# MethodCall type CustomItem can only connect to 1 CustomItem
utils.send_error("Error in Path", "This type cannot connect to more than 1 state")
utils.send_error(
"Error in Path", "This type cannot connect to more than 1 state"
)
return False
elif self.parent.state["Type"] == "Choice":
# Choice type CustomItem can connect to more than 1 CustomItem, but need to see how many are defined in the state
Expand Down
18 changes: 9 additions & 9 deletions constrain/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@


def send_error(window_title, text):
"""Displays an error message with given text
"""Displays an error message with given text
Args:
text (str): text to be displayed
"""
error_msg = QMessageBox()
error_msg.setIcon(QMessageBox.Icon.Critical)
error_msg.setWindowTitle(window_title)
error_msg.setText(text)
error_msg.exec()
Args:
text (str): text to be displayed
"""
error_msg = QMessageBox()
error_msg.setIcon(QMessageBox.Icon.Critical)
error_msg.setWindowTitle(window_title)
error_msg.setText(text)
error_msg.exec()

0 comments on commit 7e28d2c

Please sign in to comment.