Compare commits

..

No commits in common. "e0cee0fbef4048e276ec1245a16345d9a3b24ab3" and "7774d2d7af81978409b8565515dbbb01709145ac" have entirely different histories.

9 changed files with 20 additions and 51 deletions

View File

@ -343,9 +343,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
) )
) )
) )
logger.info("Waiting ...")
proc.waitForFinished() proc.waitForFinished()
logger.info(f"Waiting ... Done (status : {proc.exitCode()})")
if proc.exitCode() != 0: if proc.exitCode() != 0:
logger.error( logger.error(
@ -354,7 +352,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
f"{logger_color_reset()}" f"{logger_color_reset()}"
) )
outputs = proc.readAllStandardOutput() outputs = proc.readAllStandardOutput()
logger.warning(outputs) logger.debug(outputs)
errors = proc.readAllStandardError() errors = proc.readAllStandardError()
logger.error( logger.error(
@ -420,9 +418,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
) )
) )
) )
logger.debug("Waiting ...")
proc.waitForFinished() proc.waitForFinished()
logger.debug(f"Waiting ... Done (status : {proc.exitCode()})")
if proc.exitCode() != 0: if proc.exitCode() != 0:
logger.error( logger.error(
@ -431,7 +427,7 @@ class MeshingWithMageMailleurTT(AMeshingTool):
f"{logger_color_reset()}" f"{logger_color_reset()}"
) )
outputs = proc.readAllStandardOutput() outputs = proc.readAllStandardOutput()
logger.warning(outputs) logger.debug(outputs)
errors = proc.readAllStandardError() errors = proc.readAllStandardError()
logger.error( logger.error(

View File

@ -16,11 +16,10 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from Model.Tools.PamhyrDB import SQLSubModel
from Model.Except import NotImplementedMethodeError from Model.Except import NotImplementedMethodeError
class Point(SQLSubModel): class Point(object):
def __init__(self, id: int = -1, name: str = "", def __init__(self, id: int = -1, name: str = "",
profile=None, status=None, profile=None, status=None,
owner_scenario=-1): owner_scenario=-1):

View File

@ -28,7 +28,7 @@ from Model.Geometry.Point import Point
logger = logging.getLogger() logger = logging.getLogger()
class PointXYZ(Point): class PointXYZ(Point, SQLSubModel):
_sub_classes = [] _sub_classes = []
def __init__(self, id: int = -1, def __init__(self, id: int = -1,
@ -302,9 +302,6 @@ class PointXYZ(Point):
self._z = float(value) self._z = float(value)
self.modified() self.modified()
def get_coordinate(self):
return (self._x, self._y, self._z)
def is_nan(self): def is_nan(self):
""" """
Returns: Returns:

View File

@ -396,12 +396,6 @@ 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]
@ -442,17 +436,12 @@ class ProfileXYZ(Profile, SQLSubModel):
Nothing. Nothing.
""" """
for point in list_points: for point in list_points:
named_args = { pt = PointXYZ(*point, profile=self, status=self._status)
"x": point[0], self.points.append(pt)
"y": point[1],
"z": point[2],
"name": point[3],
}
pt = PointXYZ(id=-1, **named_args, profile=self, status=self._status)
self._points.append(pt)
self.modified() self.modified()
self.tab_up_to_date = False
self.station_up_to_date = False
def get_point_i(self, index: int) -> PointXYZ: def get_point_i(self, index: int) -> PointXYZ:
"""Get point at index. """Get point at index.
@ -511,10 +500,12 @@ class ProfileXYZ(Profile, SQLSubModel):
Returns: Returns:
Nothing. Nothing.
""" """
point_xyz = PointXYZ(x=0., y=0., z=0., profile=self, status=self._status) point_xyz = PointXYZ(0., 0., 0., profile=self, status=self._status)
self.points.append(point_xyz) self.points.append(point_xyz)
self.modified() self.modified()
self.tab_up_to_date = False
self.station_up_to_date = False
def insert(self, index: int): def insert(self, index: int):
"""Insert a new point at index. """Insert a new point at index.
@ -525,15 +516,12 @@ class ProfileXYZ(Profile, SQLSubModel):
Returns: Returns:
The new point. The new point.
""" """
x, y, z = (0., 0., 0.) point = PointXYZ(0., 0., 0., profile=self, status=self._status)
self.points.insert(index, point)
if len(self._points) >= index:
x, y, z = self._points[index - 1].get_coordinate()
point = PointXYZ(x=x, y=y, z=z, profile=self, status=self._status)
self._points.insert(index, point)
self.modified() self.modified()
self.tab_up_to_date = False
self.station_up_to_date = False
return point return point

View File

@ -617,8 +617,6 @@ class Reach(SQLSubModel):
""" """
imported_profiles = [] imported_profiles = []
logger.info(f"import reach from {file_path_name}")
try: try:
list_profile, list_header = self.read_file_st(str(file_path_name)) list_profile, list_header = self.read_file_st(str(file_path_name))
profile_header = ["num", "code1", "code2", profile_header = ["num", "code1", "code2",
@ -631,10 +629,7 @@ class Reach(SQLSubModel):
d[profile_header[i]] = data d[profile_header[i]] = data
prof = ProfileXYZ( prof = ProfileXYZ(
id=-1, **d, reach=self, status=self._status
**d,
reach=self,
status=self._status
) )
prof.import_points(profile) prof.import_points(profile)

View File

@ -216,6 +216,7 @@ 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

View File

@ -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.replace(",", ".") value
) )
) )
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.replace(",", ".") value
) )
) )
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.replace(",", ".") value
) )
) )
elif column == 3: elif column == 3:

View File

@ -16,8 +16,6 @@
# -*- 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 (
@ -26,8 +24,6 @@ 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):
@ -111,7 +107,6 @@ 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()

View File

@ -201,13 +201,11 @@ 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):