def particle_pen(self, index: int): pen = QPen() colors = self.settings.list_value(default_settings.particle_color) colors = [QColor(c) for c in colors] pen.setColor(colors[index % len(colors)]) pen.setStyle(Qt.SolidLine) pen.setWidth(0) return pen
def resizeEvent(self, event): bounds = self.scene.itemsBoundingRect() if bounds.width() <= 0 or bounds.height() <= 0: return # do nothing if size is zero self.view.fitInView(bounds, Qt.KeepAspectRatio) if self.rectangle is not None: self.scene.removeItem(self.rectangle) pen = QPen(Qt.green) pen.setWidth(0) pen.setStyle(Qt.DashLine) self.rectangle = self.scene.addRect( self.calculate_center_square(bounds), pen) self.view.centerOn(0, 0) self.view.raise_()
def trajectory_pen(self, index: int): if self.settings.boolean_value( default_settings.same_trajectory_color_with_particle): return self.particle_pen(index) else: pen = QPen() colors = self.settings.list_value( default_settings.trajectory_color) colors = [QColor(c) for c in colors] pen.setStyle(Qt.SolidLine) pen.setColor(colors[index % len(colors)]) pen.setWidth( self.settings.int_value(default_settings.trajectory_size)) pen.setJoinStyle(Qt.RoundJoin) pen.setCapStyle(Qt.RoundCap) return pen