1
0
forked from IPKM/nmreval

multi-points drawing

This commit is contained in:
Dominik Demuth 2023-04-01 18:58:16 +02:00
parent 2d42a8cd46
commit c31f52cefe
3 changed files with 14 additions and 7 deletions

View File

@ -100,9 +100,16 @@ class MultiPointWidget(QtWidgets.QWidget, Ui_multipointwidget):
return dic return dic
def set_args(self, pos: float=0.0, angle: int = None, color = None): def set_args(self, x: tuple = None, y: tuple = None, closed: bool = True, color=None):
self.pos_lineedit.setText(str(pos)) self.table_widget.clear()
self.orient_combobox.setCurrentIndex(angle%90) self.table_widget.setRowCount(0)
for row, (x_i, y_i) in enumerate(zip(x, y)):
self.new_point()
self.table_widget.cellWidget(row, 0).setText(str(x_i))
self.table_widget.cellWidget(row, 1).setText(str(y_i))
self.loop_checkbox.setChecked(closed)
self.color_box.setCurrentIndex(self.color_box.findData(color)) self.color_box.setCurrentIndex(self.color_box.findData(color))

View File

@ -85,11 +85,13 @@ class MultipointObject(BaseObject):
dic['y'] = self._y dic['y'] = self._y
return dic return dic
def set_values(self, x=None, y=None, closed=None, color=None): def set_values(self, pts: list, closed: bool = None, color=None):
if color != self.color: if color != self.color:
self.drawing.setPen(mkPen(color.rgb())) self.drawing.setPen(mkPen(color.rgb()))
x, y = zip(*pts)
self._x = x self._x = x
self._y = y self._y = y
@ -97,7 +99,7 @@ class MultipointObject(BaseObject):
self._x += (x[0],) self._x += (x[0],)
self._y += (y[0],) self._y += (y[0],)
self.drawing.setPos(self._x, self._y) self.drawing.setData(self._x, self._y)
class Rectangle(GraphicsObject): class Rectangle(GraphicsObject):

View File

@ -62,8 +62,6 @@ class DrawingsWidget(QtWidgets.QWidget, Ui_Form):
graph_id, obj = self.get_item() graph_id, obj = self.get_item()
print(dic)
if self._editmode: if self._editmode:
obj.set_values(**dic) obj.set_values(**dic)