mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Fix profile modifications.
parent
7774d2d7af
commit
1457db721b
|
|
@ -396,6 +396,12 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
def modified(self):
|
||||||
|
super(ProfileXYZ, self).modified()
|
||||||
|
|
||||||
|
self.tab_up_to_date = False
|
||||||
|
self.station_up_to_date = False
|
||||||
|
|
||||||
def x(self):
|
def x(self):
|
||||||
return [point.x for point in self.points]
|
return [point.x for point in self.points]
|
||||||
|
|
||||||
|
|
@ -517,7 +523,7 @@ class ProfileXYZ(Profile, SQLSubModel):
|
||||||
The new point.
|
The new point.
|
||||||
"""
|
"""
|
||||||
point = PointXYZ(0., 0., 0., profile=self, status=self._status)
|
point = PointXYZ(0., 0., 0., profile=self, status=self._status)
|
||||||
self.points.insert(index, point)
|
self._points.insert(index, point)
|
||||||
|
|
||||||
self.modified()
|
self.modified()
|
||||||
self.tab_up_to_date = False
|
self.tab_up_to_date = False
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,6 @@ class Plot(PamhyrPlot):
|
||||||
return event.ydata
|
return event.ydata
|
||||||
|
|
||||||
def rect_select_callback(self, eclick, erelease):
|
def rect_select_callback(self, eclick, erelease):
|
||||||
|
|
||||||
hyd = self.highlight
|
hyd = self.highlight
|
||||||
x1, y1 = eclick.xdata, eclick.ydata
|
x1, y1 = eclick.xdata, eclick.ydata
|
||||||
x2, y2 = erelease.xdata, erelease.ydata
|
x2, y2 = erelease.xdata, erelease.ydata
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
||||||
SetXCommand(
|
SetXCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
self._data.point(row).x,
|
self._data.point(row).x,
|
||||||
value
|
value.replace(",", ".")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif column == 1:
|
elif column == 1:
|
||||||
|
|
@ -115,7 +115,7 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
||||||
SetYCommand(
|
SetYCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
self._data.point(row).y,
|
self._data.point(row).y,
|
||||||
value
|
value.replace(",", ".")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif column == 2:
|
elif column == 2:
|
||||||
|
|
@ -123,7 +123,7 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
||||||
SetZCommand(
|
SetZCommand(
|
||||||
self._data, row,
|
self._data, row,
|
||||||
self._data.point(row).z,
|
self._data.point(row).z,
|
||||||
value
|
value.replace(",", ".")
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif column == 3:
|
elif column == 3:
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,8 @@
|
||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from tools import trace, timer
|
from tools import trace, timer
|
||||||
|
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
|
|
@ -24,6 +26,8 @@ from PyQt5.QtWidgets import (
|
||||||
|
|
||||||
from Model.Geometry.Profile import Profile
|
from Model.Geometry.Profile import Profile
|
||||||
|
|
||||||
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
class SetDataCommand(QUndoCommand):
|
class SetDataCommand(QUndoCommand):
|
||||||
def __init__(self, profile, index, old_value, new_value):
|
def __init__(self, profile, index, old_value, new_value):
|
||||||
|
|
@ -107,6 +111,7 @@ class AddCommand(QUndoCommand):
|
||||||
self._point = self._profile.insert(self._index)
|
self._point = self._profile.insert(self._index)
|
||||||
else:
|
else:
|
||||||
self._profile.insert_point(self._index, self._point)
|
self._profile.insert_point(self._index, self._point)
|
||||||
|
|
||||||
self._profile.modified()
|
self._profile.modified()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -201,11 +201,13 @@ class ProfileWindow(PamhyrWindow):
|
||||||
|
|
||||||
def add(self):
|
def add(self):
|
||||||
table = self.find(QTableView, "tableView")
|
table = self.find(QTableView, "tableView")
|
||||||
|
|
||||||
if len(table.selectedIndexes()) == 0:
|
if len(table.selectedIndexes()) == 0:
|
||||||
self._tablemodel.insert_row(self._tablemodel.rowCount())
|
self._tablemodel.insert_row(self._tablemodel.rowCount())
|
||||||
else:
|
else:
|
||||||
row = self.index_selected_row()
|
row = self.index_selected_row()
|
||||||
self._tablemodel.insert_row(row + 1)
|
self._tablemodel.insert_row(row + 1)
|
||||||
|
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue