def create_shape(self, template, before=False): options = template.copy() shape = Shape(options) shape.rect.moveCenter(self.shape_editor.rect().center()) shape.synchronize_rect() if before is True: self.shape_editor.shapes.insert(0, shape) else: self.shape_editor.shapes.append(shape) self.shape_editor.repaint() self.set_data_modified()
def set_hotbox_data(self, hotbox_data, reset_stacks=False): self.options = hotbox_data['general'] self.shape_editor.options = self.options shapes = [Shape(options) for options in hotbox_data['shapes']] self.shape_editor.shapes = shapes self.shape_editor.manipulator.rect = None self.shape_editor.repaint() if reset_stacks is True: self.undo_manager.reset_stacks()
def __init__(self, hotbox_data, parent=None): super(HotboxReader, self).__init__(parent) f = (QtCore.Qt.WindowStaysOnTopHint | QtCore.Qt.FramelessWindowHint) self.setWindowFlags(f) self.setAttribute(QtCore.Qt.WA_TranslucentBackground) self.setMouseTracking(True) settings = hotbox_data['general'] self.triggering = settings['triggering'] self.aiming = settings['aiming'] self.is_submenu = settings['submenu'] self.center = QtCore.QPoint(settings['centerx'], settings['centery']) self.setFixedSize(settings['width'], settings['height']) self.shapes = [Shape(data) for data in hotbox_data['shapes']] self.close_on_leave = settings['leaveclose'] self.interactive_shapes = [ s for s in self.shapes if s.is_interactive() ] self.left_clicked = False self.right_clicked = False
def set_hotbox_data(self, hotbox_data): self.shapes = [Shape(shape) for shape in hotbox_data['shapes']] self.interactive_shapes = [ s for s in self.shapes if s.is_interactive() ] self.repaint()