Scenario: Minor changes.

scenarios
Pierre-Antoine Rouby 2024-09-03 11:47:46 +02:00
parent a412f2f18f
commit 8f0535dc5c
5 changed files with 22 additions and 6 deletions

View File

@ -189,7 +189,7 @@ class Scenario(SQLSubModel):
@property
def name(self):
if self._name == "":
return f"Child of '{self._parent.name}'"
return f"Child of '{self._parent.name}' ({self.id})"
return self._name
@ -200,7 +200,7 @@ class Scenario(SQLSubModel):
@property
def description(self):
if self._description == "":
return f"Child of '{self._parent.name}'"
return f"Child of '{self._parent.name}' ({self.id})"
return self._description
@ -231,6 +231,8 @@ class Scenario(SQLSubModel):
self.description = value
def __getitem__(self, key):
if key == "id":
return self.id
if key == "name":
return self.name
if key == "description":

View File

@ -353,8 +353,8 @@ class GraphWidget(QGraphicsView):
if len(selectable_items) == 0:
if event.buttons() & Qt.LeftButton:
old_p = self.mapToScene(
int(self.m_origin_x),
int(self.m_origin_y)
float(self.m_origin_x),
float(self.m_origin_y)
)
new_p = self.mapToScene(event.pos())
translation = new_p - old_p
@ -372,6 +372,7 @@ class GraphWidget(QGraphicsView):
dlg = WaitingDialog(
payload_fn=fn,
title=action_str,
trad=self._trad,
parent=self.parent
)
dlg.exec_()

View File

@ -39,7 +39,15 @@ class ScenariosTranslate(MainTranslate):
)
self._sub_dict["table_headers_scenarios"] = {
"id": self._dict['id'],
"name": self._dict['name'],
"description": self._dict['description'],
"parent": _translate("Scenarios", "Parent"),
}
self._dict["new_scenario"] = _translate(
"Scenarios", "Create new scenario"
)
self._dict["select_scenario"] = _translate(
"Scenarios", "Select scenario"
)

View File

@ -27,6 +27,9 @@ class CommonWordTranslate(PamhyrTranslate):
def __init__(self):
super(CommonWordTranslate, self).__init__()
self._dict["id"] = _translate("CommonWord", "ID")
self._dict["pamhyr_id"] = _translate("CommonWord", "Pamhyr2 ID")
self._dict["name"] = _translate("CommonWord", "Name")
self._dict["type"] = _translate("CommonWord", "Type")
self._dict["value"] = _translate("CommonWord", "Value")

View File

@ -80,8 +80,10 @@ class WaitingDialog(PamhyrDialog):
""",
]
def __init__(self, payload_fn, title, parent=None):
def __init__(self, payload_fn, title, trad=None, parent=None):
if trad is None:
trad = MainTranslate()
super(WaitingDialog, self).__init__(
title=trad[title],
trad=trad,