Exemplo n.º 1
0
 def add_block(self, b):
     if b not in self.blocks:
         b.set_parent(self)
         self.blocks.append(b)
         BlockManager.add_block(b)
         self.block_added.emit(b)
         b.selected.connect(self.selected_block)
Exemplo n.º 2
0
 def add_block(self, b):
     if b not in self.blocks:
         b.set_parent(self)
         self.blocks.append(b)
         BlockManager.add_block(b)
         self.block_added.emit(b)
         b.selected.connect(self.selected_block)
Exemplo n.º 3
0
 def mousePressEvent(self, e: QMouseEvent):
     BlockManager.deselect_all()
     if e.button() == Qt.LeftButton:
         self.__moving = True
         self.__origin = e.pos()
         self.setCursor(Qt.DragMoveCursor)
     elif e.button() == Qt.RightButton:
         self.show_popup(e.pos())
Exemplo n.º 4
0
 def mousePressEvent(self, e: QMouseEvent):
     BlockManager.deselect_all()
     if e.button() == Qt.LeftButton:
         self.__moving = True
         self.__origin = e.pos()
         self.setCursor(Qt.DragMoveCursor)
     elif e.button() == Qt.RightButton:
         self.show_popup(e.pos())
Exemplo n.º 5
0
 def mousePressEvent(self, e):
     self.setFocus()
     BlockManager.deselect_all()
     self.deselect_all_lines()
     l = self.get_line(e.pos())
     if l is not None:
         l.selected = True
         self.repaint()
Exemplo n.º 6
0
 def mousePressEvent(self, e):
     self.setFocus()
     BlockManager.deselect_all()
     self.deselect_all_lines()
     l = self.get_line(e.pos())
     if l is not None:
         l.selected = True
         self.repaint()
Exemplo n.º 7
0
 def delete_selected_elements(self):
     bb = BlockManager.get_selected()
     for b in bb:
         self.delete_block(b)
     ll = self.get_selected_lines()
     for l in ll:
         l.remove()
Exemplo n.º 8
0
 def delete_selected_elements(self):
     bb = BlockManager.get_selected()
     for b in bb:
         self.delete_block(b)
     ll = self.get_selected_lines()
     for l in ll:
         l.remove()
Exemplo n.º 9
0
 def __init__(self, width: float, height: float, parent):
     QWidget.__init__(self, parent)
     OIDynBlock.__init__(self, width, height, parent)
     self.setMinimumSize(0.4 * Info.dpi, 0.4 * Info.dpi)
     self.__layout = QGridLayout(self)
     self.__layout.setSpacing(0)
     self.__layout.setMargin(2)
     self.setLayout(self.__layout)
     self.__toolbar = OIToolBar(self)
     self.__toolbar.setMaximumHeight(0.3 * Info.dpi)
     self.__layout.addWidget(self.__toolbar, 0, 0)
     self.__main_widget = BlockManager.get_viewer(ViewMode.Scene, self)
     pal = QPalette(self.__main_widget.palette())
     pal.setColor(self.backgroundRole(), QColor(55, 50, 47))
     self.__main_widget.setAutoFillBackground(True)
     self.__main_widget.setPalette(pal)
     self.__layout.addWidget(self.__main_widget, 1, 0)
     self.setMouseTracking(True)
Exemplo n.º 10
0
 def __init__(self, width: float, height: float, parent):
     QWidget.__init__(self, parent)
     OIDynBlock.__init__(self, width, height, parent)
     self.setMinimumSize(0.4 * Info.dpi, 0.4 * Info.dpi)
     self.__layout = QGridLayout(self)
     self.__layout.setSpacing(0)
     self.__layout.setMargin(2)
     self.setLayout(self.__layout)
     self.__toolbar = OIToolBar(self)
     self.__toolbar.setMaximumHeight(0.3 * Info.dpi)
     self.__layout.addWidget(self.__toolbar, 0, 0)
     self.__main_widget = BlockManager.get_viewer(ViewMode.Scene, self)
     pal = QPalette(self.__main_widget.palette())
     pal.setColor(self.backgroundRole(), QColor(55, 50, 47))
     self.__main_widget.setAutoFillBackground(True)
     self.__main_widget.setPalette(pal)
     self.__layout.addWidget(self.__main_widget, 1, 0)
     self.setMouseTracking(True)
Exemplo n.º 11
0
 def mouseDoubleClickEvent(self, e: QMouseEvent):
     BlockManager.deselect_all()
     if e.button() == Qt.LeftButton:
         self.__moving = False
         self.__translation = QPoint()
         self.translate(0, 0)
Exemplo n.º 12
0
 def remove_block(self, b):
     if b in self.blocks:
         self.blocks.remove(b)
         BlockManager.remove_block(b)
         b.disconnect_all()
         self.block_removed.emit(b)
Exemplo n.º 13
0
 def add_block(self, block):
     if not block in self.blocks:
         self.blocks.append(block)
         BlockManager.add_block(block)
         block.set_mode(self.__mode)
Exemplo n.º 14
0
 def delete_block(self, b):
     if b in self.blocks:
         self.blocks.remove(b)
         b.delete()
         BlockManager.remove_block(b)
         b.deleteLater()
Exemplo n.º 15
0
 def select(self, block):
     BlockManager.deselect_all()
     self.deselect_all_lines()
     if block in self.blocks:
         block.select()
Exemplo n.º 16
0
 def add_block(self, block):
     if not block in self.blocks:
         self.blocks.append(block)
         BlockManager.add_block(block)
         block.set_mode(self.__mode)
Exemplo n.º 17
0
 def remove_block(self, b):
     if b in self.blocks:
         self.blocks.remove(b)
         BlockManager.remove_block(b)
         b.disconnect_all()
         self.block_removed.emit(b)
Exemplo n.º 18
0
 def select(self, block):
     BlockManager.deselect_all()
     self.deselect_all_lines()
     if block in self.blocks:
         block.select()
Exemplo n.º 19
0
 def mouseDoubleClickEvent(self, e: QMouseEvent):
     BlockManager.deselect_all()
     if e.button() == Qt.LeftButton:
         self.__moving = False
         self.__translation = QPoint()
         self.translate(0, 0)
Exemplo n.º 20
0
 def delete_block(self, b):
     if b in self.blocks:
         self.blocks.remove(b)
         b.delete()
         BlockManager.remove_block(b)
         b.deleteLater()