mirror of https://gitlab.com/pamhyr/pamhyr2
pamhyr: Fixing pep8 and use RD and RG by default at update PK (if exists).
parent
2ee8420b94
commit
6c4b67d93a
|
|
@ -371,8 +371,8 @@ class MeshingWithMageMailleurTT(AMeshingTool):
|
||||||
lplan: bool = False,
|
lplan: bool = False,
|
||||||
lm: int = 3,
|
lm: int = 3,
|
||||||
linear: bool = False,
|
linear: bool = False,
|
||||||
origin_value = 0.0,
|
origin_value=0.0,
|
||||||
orientation = 0):
|
orientation=0):
|
||||||
if reach is None or len(reach.profiles) == 0:
|
if reach is None or len(reach.profiles) == 0:
|
||||||
return reach
|
return reach
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -270,8 +270,10 @@ class Study(SQLModel):
|
||||||
def _load(cls, filename):
|
def _load(cls, filename):
|
||||||
new = cls(init_new=False, filename=filename)
|
new = cls(init_new=False, filename=filename)
|
||||||
|
|
||||||
version = new.execute("SELECT value FROM info WHERE key='study_release'")[0]
|
version = new.execute(
|
||||||
new.status.version = int(version)
|
"SELECT value FROM info WHERE key='study_release'"
|
||||||
|
)
|
||||||
|
new.status.version = int(version[0])
|
||||||
|
|
||||||
# TODO: Load metadata
|
# TODO: Load metadata
|
||||||
new.name = new.execute("SELECT value FROM info WHERE key='name'")[0]
|
new.name = new.execute("SELECT value FROM info WHERE key='name'")[0]
|
||||||
|
|
@ -308,7 +310,7 @@ class Study(SQLModel):
|
||||||
progress = progress if progress is not None else lambda: None
|
progress = progress if progress is not None else lambda: None
|
||||||
|
|
||||||
self.execute(
|
self.execute(
|
||||||
"INSERT INTO info VALUES ('study_release', "+
|
"INSERT INTO info VALUES ('study_release', " +
|
||||||
f"'{self.status.version}')"
|
f"'{self.status.version}')"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,9 +50,20 @@ class UpdateKPDialog(PamhyrDialog):
|
||||||
self._init_default_values()
|
self._init_default_values()
|
||||||
|
|
||||||
def _init_default_values(self):
|
def _init_default_values(self):
|
||||||
self._orientation = 0
|
gl, _ = self._reach.compute_guidelines()
|
||||||
|
self._gl = list(gl)
|
||||||
|
|
||||||
self._begin_dir = "un"
|
self._begin_dir = "un"
|
||||||
self._end_dir = "np"
|
self._end_dir = "np"
|
||||||
|
|
||||||
|
lower_gl = list(map(str.lower, self._gl))
|
||||||
|
for i, gl in enumerate(lower_gl):
|
||||||
|
if gl == "rd":
|
||||||
|
self._begin_dir = self._gl[i]
|
||||||
|
elif gl == "rg":
|
||||||
|
self._end_dir = self._gl[i]
|
||||||
|
|
||||||
|
self._orientation = 0
|
||||||
self._origin = self._reach.profile(0)
|
self._origin = self._reach.profile(0)
|
||||||
self._origin_value = self._reach.profile(0).kp
|
self._origin_value = self._reach.profile(0).kp
|
||||||
|
|
||||||
|
|
@ -64,16 +75,18 @@ class UpdateKPDialog(PamhyrDialog):
|
||||||
|
|
||||||
self.combobox_add_items("comboBox_origin", profiles)
|
self.combobox_add_items("comboBox_origin", profiles)
|
||||||
|
|
||||||
self.find(QComboBox, "comboBox_origin").currentIndexChanged.connect(
|
self.find(QComboBox, "comboBox_origin")\
|
||||||
self.changed_profile)
|
.currentIndexChanged\
|
||||||
|
.connect(
|
||||||
|
self.changed_profile
|
||||||
|
)
|
||||||
|
|
||||||
buttonbox = self.find(QButtonGroup, "buttonGroup_orientation")
|
buttonbox = self.find(QButtonGroup, "buttonGroup_orientation")
|
||||||
|
|
||||||
i = 0
|
|
||||||
for button in buttonbox.buttons():
|
for button in buttonbox.buttons():
|
||||||
if button.objectName() == "radioButton_0": i = 0
|
name = button.objectName()
|
||||||
if button.objectName() == "radioButton_1": i = 1
|
i = int(name.split('_')[-1])
|
||||||
if button.objectName() == "radioButton_2": i = 2
|
|
||||||
buttonbox.setId(button, i)
|
buttonbox.setId(button, i)
|
||||||
|
|
||||||
def changed_profile(self):
|
def changed_profile(self):
|
||||||
|
|
@ -106,11 +119,8 @@ class UpdateKPDialog(PamhyrDialog):
|
||||||
return name
|
return name
|
||||||
|
|
||||||
def _init_default_values_guidelines(self):
|
def _init_default_values_guidelines(self):
|
||||||
gl, _ = self._reach.compute_guidelines()
|
bgl = ['un'] + self._gl + ['np']
|
||||||
gl = list(gl)
|
egl = ['un'] + self._gl + ['np']
|
||||||
|
|
||||||
bgl = ['un'] + gl + ['np']
|
|
||||||
egl = ['un'] + gl + ['np']
|
|
||||||
|
|
||||||
self.combobox_add_items("comboBox_begin_gl", bgl)
|
self.combobox_add_items("comboBox_begin_gl", bgl)
|
||||||
self.combobox_add_items("comboBox_end_gl", egl)
|
self.combobox_add_items("comboBox_end_gl", egl)
|
||||||
|
|
@ -144,7 +154,9 @@ class UpdateKPDialog(PamhyrDialog):
|
||||||
self._origin_value = self.get_double_spin_box("doubleSpinBox_origin")
|
self._origin_value = self.get_double_spin_box("doubleSpinBox_origin")
|
||||||
self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
|
self._begin_dir = self.get_combobox_text("comboBox_begin_gl")
|
||||||
self._end_dir = self.get_combobox_text("comboBox_end_gl")
|
self._end_dir = self.get_combobox_text("comboBox_end_gl")
|
||||||
self._orientation = self.get_checked_id_button_group("buttonGroup_orientation")
|
self._orientation = self.get_checked_id_button_group(
|
||||||
|
"buttonGroup_orientation"
|
||||||
|
)
|
||||||
|
|
||||||
super().accept()
|
super().accept()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue