Scenario: Minor changes.

This commit is contained in:
Pierre-Antoine Rouby committed 2024-09-03 11:47:46 +02:00
1 parent a412f2f18f
commit 8f0535dc5c
5 files changed
+21 -5

No files matched your search

+4 -2
View File
@@ -189,7 +189,7 @@ class Scenario(SQLSubModel):
@property @property
def name(self): def name(self):
if self._name == "": if self._name == "":
return f"Child of '{self._parent.name}'" return f"Child of '{self._parent.name}' ({self.id})"
return self._name return self._name
@@ -200,7 +200,7 @@ class Scenario(SQLSubModel):
@property @property
def description(self): def description(self):
if self._description == "": if self._description == "":
return f"Child of '{self._parent.name}'" return f"Child of '{self._parent.name}' ({self.id})"
return self._description return self._description
@@ -231,6 +231,8 @@ class Scenario(SQLSubModel):
self.description = value self.description = value
def __getitem__(self, key): def __getitem__(self, key):
if key == "id":
return self.id
if key == "name": if key == "name":
return self.name return self.name
if key == "description": if key == "description":
+3 -2
View File
@@ -353,8 +353,8 @@ class GraphWidget(QGraphicsView):
if len(selectable_items) == 0: if len(selectable_items) == 0:
if event.buttons() & Qt.LeftButton: if event.buttons() & Qt.LeftButton:
old_p = self.mapToScene( old_p = self.mapToScene(
int(self.m_origin_x), float(self.m_origin_x),
int(self.m_origin_y) float(self.m_origin_y)
) )
new_p = self.mapToScene(event.pos()) new_p = self.mapToScene(event.pos())
translation = new_p - old_p translation = new_p - old_p
@@ -372,6 +372,7 @@ class GraphWidget(QGraphicsView):
dlg = WaitingDialog( dlg = WaitingDialog(
payload_fn=fn, payload_fn=fn,
title=action_str, title=action_str,
trad=self._trad,
parent=self.parent parent=self.parent
) )
dlg.exec_() dlg.exec_()
+8
View File
@@ -39,7 +39,15 @@ class ScenariosTranslate(MainTranslate):
) )
self._sub_dict["table_headers_scenarios"] = { self._sub_dict["table_headers_scenarios"] = {
"id": self._dict['id'],
"name": self._dict['name'], "name": self._dict['name'],
"description": self._dict['description'], "description": self._dict['description'],
"parent": _translate("Scenarios", "Parent"), "parent": _translate("Scenarios", "Parent"),
} }
self._dict["new_scenario"] = _translate(
"Scenarios", "Create new scenario"
)
self._dict["select_scenario"] = _translate(
"Scenarios", "Select scenario"
)
+3
View File
@@ -27,6 +27,9 @@ class CommonWordTranslate(PamhyrTranslate):
def __init__(self): def __init__(self):
super(CommonWordTranslate, self).__init__() 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["name"] = _translate("CommonWord", "Name")
self._dict["type"] = _translate("CommonWord", "Type") self._dict["type"] = _translate("CommonWord", "Type")
self._dict["value"] = _translate("CommonWord", "Value") self._dict["value"] = _translate("CommonWord", "Value")
+3 -1
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() trad = MainTranslate()
super(WaitingDialog, self).__init__( super(WaitingDialog, self).__init__(
title=trad[title], title=trad[title],
trad=trad, trad=trad,