コード例 #1
0
ファイル: editarea.py プロジェクト: dgirondi/hotbox_designer
    def mouseReleaseEvent(self, _):
        if self.edit_center_mode is True:
            self.clicked = False
            return

        shape = self.clicked_shape
        selection_update_conditions = (
                self.handeling is False
                or shape not in self.selection
                and self.manipulator_moved is False)
        if selection_update_conditions:
            self.selection.set([shape] if shape else None)
            self.update_selection()

        if self.selection_square.handling:
            shapes = [
                    s for s in self.shapes
                    if s.rect.intersects(self.selection_square.rect)]
            if shapes:
                self.selection.set(shapes)
                rects = [shape.rect for shape in self.selection]
                self.manipulator.set_rect(get_combined_rects(rects))
                self.selectedShapesChanged.emit()
        self.selection_square.release()

        if self.increase_undo_on_release:
            self.increaseUndoStackRequested.emit()
            self.increase_undo_on_release = False

        self.clicked = False
        self.handeling = False
        self.repaint()
コード例 #2
0
 def delete_selection(self):
     for shape in reversed(self.shape_editor.selection.shapes):
         self.shape_editor.shapes.remove(shape)
         self.shape_editor.selection.remove(shape)
     rects = [shape.rect for shape in self.shape_editor.selection]
     rect = get_combined_rects(rects)
     self.shape_editor.manipulator.set_rect(rect)
     self.shape_editor.repaint()
     self.set_data_modified()
コード例 #3
0
    def rect_modified(self, option, value):
        shapes = self.shape_editor.selection
        for shape in shapes:
            shape.options[option] = value
            if option == 'shape.height':
                shape.rect.setHeight(value)
                continue
            elif option == 'shape.width':
                shape.rect.setWidth(value)
                continue

            width = shape.rect.width()
            height = shape.rect.height()
            if option == 'shape.left':
                shape.rect.setLeft(value)
            else:
                shape.rect.setTop(value)
            shape.rect.setWidth(width)
            shape.rect.setHeight(height)

        rects = [shape.rect for shape in self.shape_editor.selection]
        rect = get_combined_rects(rects)
        self.shape_editor.manipulator.set_rect(rect)
        self.shape_editor.repaint()
コード例 #4
0
ファイル: editarea.py プロジェクト: dgirondi/hotbox_designer
 def update_selection(self):
     rects = [shape.rect for shape in self.selection]
     self.manipulator.set_rect(get_combined_rects(rects))
     self.selectedShapesChanged.emit()