# Path: pyteltools/workflow/util.py
# class ConfigureDialog(QDialog):
#     """!
#     Configuration window for a single node/tool
#     """
#     def __init__(self, panel, label, check=None):
#         """!
#         @param panel <PyQt5.QtWidgets.QWidget>: configuration widget
#         @param label <str>: tool label for window title
#         """
#         super().__init__()
#         buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
#                                    Qt.Horizontal, self)
#         if check is None:
#             self.check = None
#             buttons.accepted.connect(self.accept)
#         else:
#             self.check = check
#             buttons.accepted.connect(self.custom_accept)
#         buttons.rejected.connect(self.reject)
# 
#         self.message_field = QPlainTextEdit()
#         self.message_field.setFixedHeight(50)
# 
#         layout = QVBoxLayout()
#         layout.addWidget(panel)
#         layout.addStretch()
#         layout.addWidget(self.message_field)
#         layout.addWidget(buttons)
#         self.setLayout(layout)
# 
#         self.setWindowTitle('Configure %s' % label)
#         self.resize(550, 400)
# 
#     def custom_accept(self):
#         value = self.check()
#         if value == 2:
#             self.accept()
#         elif value == 1:
#             return
#         else:
#             self.reject()


import math
from PyQt5.QtCore import (QLineF, QPointF, QRectF, Qt)
from PyQt5.QtGui import (QBrush, QColor, QPainterPath, QPen, QPolygonF)
from PyQt5.QtWidgets import (QAction, QApplication, QDialog, QMenu, QMessageBox,
                             QGraphicsItem, QGraphicsLineItem, QGraphicsProxyWidget, QGraphicsRectItem,
                             QProgressBar, QStyle, QWidget)
from shapely.geometry import Polygon
from .util import ConfigureDialog
        super().mouseMoveEvent(event)
        if self.x() < Port.WIDTH:
            self.setX(Port.WIDTH)
        elif self.x()+self.boundingRect().width() > self.scene().width():
            self.setX(self.scene().width()-self.boundingRect().width())

        if self.y() < Port.WIDTH:
            self.setY(Port.WIDTH)
        elif self.y()+self.boundingRect().height() > self.scene().height():
            self.setY(self.scene().height()-self.boundingRect().height())

    def itemChange(self, change, value):
        result = super().itemChange(change, value)
        if change == QGraphicsItem.ItemPositionHasChanged:
            self.update_links()
        return result

    def contextMenuEvent(self, event):
        menu = QMenu()
        menu.addAction(self.help_action)
        menu.exec_(event.screenPos())

    def get_option_panel(self):
        return QWidget()

    def ready_to_run(self):
        pass

    def configure(self, check=None):
        """Execute configure dialog and check if accepted"""

# Path: pyteltools/workflow/util.py
# class ConfigureDialog(QDialog):
#     """!
#     Configuration window for a single node/tool
#     """
#     def __init__(self, panel, label, check=None):
#         """!
#         @param panel <PyQt5.QtWidgets.QWidget>: configuration widget
#         @param label <str>: tool label for window title
#         """
#         super().__init__()
#         buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel,
#                                    Qt.Horizontal, self)
#         if check is None:
#             self.check = None
#             buttons.accepted.connect(self.accept)
#         else:
#             self.check = check
#             buttons.accepted.connect(self.custom_accept)
#         buttons.rejected.connect(self.reject)
# 
#         self.message_field = QPlainTextEdit()
#         self.message_field.setFixedHeight(50)
# 
#         layout = QVBoxLayout()
#         layout.addWidget(panel)
#         layout.addStretch()
#         layout.addWidget(self.message_field)
#         layout.addWidget(buttons)
#         self.setLayout(layout)
# 
#         self.setWindowTitle('Configure %s' % label)
#         self.resize(550, 400)
# 
#     def custom_accept(self):
#         value = self.check()
#         if value == 2:
#             self.accept()
#         elif value == 1:
#             return
#         else:
#             self.reject()


# Path: pyteltools/workflow/Node.py
import math
from PyQt5.QtCore import (QLineF, QPointF, QRectF, Qt)
from PyQt5.QtGui import (QBrush, QColor, QPainterPath, QPen, QPolygonF)
from PyQt5.QtWidgets import (QAction, QApplication, QDialog, QMenu, QMessageBox,
                             QGraphicsItem, QGraphicsLineItem, QGraphicsProxyWidget, QGraphicsRectItem,
                             QProgressBar, QStyle, QWidget)
from shapely.geometry import Polygon
from .util import ConfigureDialog

        super().mouseMoveEvent(event)
        if self.x() < Port.WIDTH:
            self.setX(Port.WIDTH)
        elif self.x()+self.boundingRect().width() > self.scene().width():
            self.setX(self.scene().width()-self.boundingRect().width())

        if self.y() < Port.WIDTH:
            self.setY(Port.WIDTH)
        elif self.y()+self.boundingRect().height() > self.scene().height():
            self.setY(self.scene().height()-self.boundingRect().height())

    def itemChange(self, change, value):
        result = super().itemChange(change, value)
        if change == QGraphicsItem.ItemPositionHasChanged:
            self.update_links()
        return result

    def contextMenuEvent(self, event):
        menu = QMenu()
        menu.addAction(self.help_action)
        menu.exec_(event.screenPos())

    def get_option_panel(self):
        return QWidget()

    def ready_to_run(self):
        pass

    def configure(self, check=None):
        """Execute configure dialog and check if accepted"""

        configure_dialog = ConfigureDialog(self.get_option_panel(), self.name(), check)