Пример #1
0
 def __init__(self, num, x, y, color):
     QGraphicsScene.__init__(self)
     self.num = num
     self.x = x
     self.y = y
     self.color = color
     self.set_color(self.color)
Пример #2
0
 def __init__(self):
     QGraphicsScene.__init__(self)
     self.__add_squares()
     self.piece_items = []
     self.highlighted_square_items = []
     self.legal_moves = {}
     self.selected_pos = None
Пример #3
0
 def __init__(self, parent=None, window=None):
     QGraphicsScene.__init__(self, parent)
     # Set parent view area
     self.parent = parent
     # Set grand parent window
     self.window = window
     self.mode = 'cursor'
Пример #4
0
 def __init__(self):
     QGraphicsScene.__init__(self)
     self.addText("Hello, world!")
     self.counterItems = 0
     self.selectedIndex = 0
     self.paintPointer = QGraphicsEllipseItem()
     self.paintPointer.setFlag(QGraphicsItem.ItemIsSelectable, True)
     self.paintPointer.setFlag(QGraphicsItem.ItemIsMovable, True)
     self.addItem(self.paintPointer)
Пример #5
0
 def __init__(self, parent=None, view=None):
     QGraphicsScene.__init__(self, parent)
     self.undoStack = QUndoStack(self)
     # super(Scene, self).__init__(parent)
     self.view = view
     self.imgPosibleConnectH = QGraphicsPixmapItem(
         os.path.join(PATHBLOCKSIMG, "ConnectH.png"))
     super(Scene, self).addItem(self.imgPosibleConnectH)
     self.imgPosibleConnectH.setVisible(False)
     self.imgPosibleConnectV = QGraphicsPixmapItem(
         os.path.join(PATHBLOCKSIMG, "ConnectV.png"))
     super(Scene, self).addItem(self.imgPosibleConnectV)
     self.imgPosibleConnectV.setVisible(False)
     self.oldPos = None
     self.createActions()
Пример #6
0
    def __init__(self, targetGUIModel: 'TargetGuiModel'):
        """
		Construct the TGUIMScene class

		:param targetGUIModel: get the TargetGuiModel of the project
		:type targetGUIModel: TargetGuiModel
		"""
        QGraphicsScene.__init__(self)
        self._targetGuiModel = targetGUIModel
        self._dataToGraphicsMapping = {}

        # Create all component graphics
        # WARNING: We create an invisible graphics item for the root, which is a bit weird. If there's a
        # graphics-related bug, look into this.
        root = self._targetGuiModel.getRoot()
        rootGraphics = ComponentGraphics(root, (0, 0, 0, 0), None)
        self._dataToGraphicsMapping[root] = rootGraphics
        work = [(root, rootGraphics)]
        while len(work) > 0:
            data, parentGraphics = work.pop()

            # add the root's component to the scene.
            if data is self._targetGuiModel.getRoot():
                self.addItem(parentGraphics)

            for child in data.getChildren():
                graphics = self.createComponentGraphics(child, parentGraphics)
                work.append((child, graphics))

        # Create all visibility behavior graphics
        for vb in targetGUIModel.getVisibilityBehaviors():
            graphics = self.createVisibilityBehaviorGraphics(vb)
            self.addItem(graphics)

        def onNewComponent(newComponent):
            parentGraphics = self.getGraphics(newComponent.getParent())
            graphics = self.createComponentGraphics(newComponent,
                                                    parentGraphics)
            if parentGraphics is None:
                print("IS TOP LEVEL")
                self.addItem(graphics)

        def onNewBehavior(newBehavior):
            self.createVisibilityBehaviorGraphics(newBehavior)

        self._targetGuiModel.newComponent.connect(onNewComponent)
        self._targetGuiModel.newBehavior.connect(onNewBehavior)
Пример #7
0
    def __init__(self, parent=None, window=None, mode='cursor'):
        QGraphicsScene.__init__(self, parent)
        # Set parent view area
        self.parent = parent
        # Set grand parent window
        self.window = window
        # Set action mode
        self.mode = mode

        # mouse move pixels
        self.points = []

        # added line items
        self.line_items = []
        self.lines = []

        # added line's pen attribute
        self.pens = []
Пример #8
0
 def __init__(self, build_range):
     QGraphicsScene.__init__(self)
     self.from_range(build_range)