示例#1
0
 def __init__(self, parent=None, ast=None):
     ast = ast or ogAST.State()
     ast.inputString = getattr(ast, 'via', None) or ast.inputString
     # Note: ast coordinates are in scene coordinates
     super(State, self).__init__(parent=parent,
                                 text=ast.inputString,
                                 x=ast.pos_x,
                                 y=ast.pos_y,
                                 hyperlink=ast.hyperlink)
     self.set_shape(ast.width, ast.height)
     self.setBrush(QBrush(QColor(255, 228, 213)))
     self.terminal_symbol = True
     if parent:
         try:
             # Map AST scene coordinates to get actual position
             self.setPos(self.pos() +
                         self.mapFromScene(ast.pos_x, ast.pos_y))
         except TypeError:
             self.update_position()
     else:
         # Use scene coordinates to position
         self.setPos(ast.pos_x, ast.pos_y)
     self.parser = ogParser
     if ast.comment:
         Comment(parent=self, ast=ast.comment)
示例#2
0
 def __init__(self, ast=None, subscene=None):
     ast = ast or ogAST.Procedure()
     super(Process, self).__init__(parent=None,
                                   text=ast.inputString,
                                   x=ast.pos_x,
                                   y=ast.pos_y,
                                   hyperlink=ast.hyperlink)
     self.set_shape(ast.width, ast.height)
     self.setBrush(QBrush(QColor(255, 255, 202)))
     self.parser = ogParser
     if ast.comment:
         Comment(parent=self, ast=ast.comment)
     self.nested_scene = subscene
示例#3
0
 def __init__(self, parent=None, ast=None):
     ast = ast or ogAST.Output(defName='')
     super(ProcedureCall, self).__init__(parent,
                                         text=ast.inputString,
                                         x=ast.pos_x,
                                         y=ast.pos_y,
                                         hyperlink=ast.hyperlink)
     self.set_shape(ast.width, ast.height)
     self.setBrush(QBrush(QColor(255, 255, 202)))
     self.terminal_symbol = False
     self.parser = ogParser
     if ast.comment:
         Comment(parent=self, ast=ast.comment)
示例#4
0
    def __init__(self, parent=None, ast=None):
        ''' Initializes the TASK symbol '''
        ast = ast or ogAST.Task()
        super(Task, self).__init__(parent,
                                   text=ast.inputString,
                                   x=ast.pos_x,
                                   y=ast.pos_y,
                                   hyperlink=ast.hyperlink)
        self.set_shape(ast.width, ast.height)

        self.setBrush(QBrush(QColor(255, 255, 202)))
        self.terminal_symbol = False
        self.parser = ogParser
        if ast.comment:
            Comment(parent=self, ast=ast.comment)
示例#5
0
 def __init__(self, parent=None, ast=None):
     ast = ast or ogAST.Decision()
     # Define the point where all branches of the decision can join again
     self.connectionPoint = QPoint(ast.width / 2, ast.height + 30)
     super(Decision, self).__init__(parent,
                                    text=ast.inputString,
                                    x=ast.pos_x,
                                    y=ast.pos_y,
                                    hyperlink=ast.hyperlink)
     self.set_shape(ast.width, ast.height)
     self.setBrush(QColor(255, 255, 202))
     self.minDistanceToSymbolAbove = 0
     self.parser = ogParser
     self.text_alignment = Qt.AlignHCenter
     if ast.comment:
         Comment(parent=self, ast=ast.comment)
示例#6
0
 def __init__(self, ast=None):
     ''' Create the START symbol '''
     ast = ast or ogAST.Start()
     self.terminal_symbol = False
     super(Start, self).__init__(parent=None,
                                 text=ast.inputString[slice(0, -6)],
                                 x=ast.pos_x,
                                 y=ast.pos_y,
                                 hyperlink=ast.hyperlink)
     self.set_shape(ast.width, ast.height)
     self.setBrush(QBrush(QColor(255, 228, 213)))
     # No hyperlink for START symbol because it has no text
     self._no_hyperlink = True
     self.parser = ogParser
     if ast.comment:
         Comment(parent=self, ast=ast.comment)
示例#7
0
 def __init__(self, ast=None, subscene=None):
     ast = ast or ogAST.Process()
     super(Process, self).__init__(parent=None,
                                   text=ast.processName,
                                   x=ast.pos_x,
                                   y=ast.pos_y,
                                   hyperlink=ast.hyperlink)
     self.set_shape(ast.width, ast.height)
     self.setBrush(QBrush(QColor(255, 255, 202)))
     self.parser = ogParser
     if ast.comment:
         Comment(parent=self, ast=ast.comment)
     self.nested_scene = subscene
     self.input_signals = ast.input_signals
     self.output_signals = ast.output_signals
     self.insert_symbol(None, self.x(), self.y())
示例#8
0
 def __init__(self, parent=None, ast=None):
     ''' Create the INPUT symbol '''
     ast = ast or ogAST.Input()
     self.branch_entrypoint = None
     if not ast.pos_y and parent:
         # Make sure the item is placed below its parent
         ast.pos_y = parent.y() + parent.boundingRect().height() + 10
     super(Input, self).__init__(parent,
                                 text=ast.inputString,
                                 x=ast.pos_x,
                                 y=ast.pos_y,
                                 hyperlink=ast.hyperlink)
     self.set_shape(ast.width, ast.height)
     gradient = QRadialGradient(50, 50, 50, 50, 50)
     gradient.setColorAt(0, QColor(255, 240, 170))
     gradient.setColorAt(1, Qt.white)
     self.setBrush(QBrush(gradient))
     self.terminal_symbol = False
     self.parser = ogParser
     if ast.comment:
         Comment(parent=self, ast=ast.comment)