mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Add read only support.
parent
8afa3d1e30
commit
5cc5628956
|
|
@ -82,13 +82,18 @@ class ProfileWindow(PamhyrWindow):
|
||||||
self.setup_connections()
|
self.setup_connections()
|
||||||
|
|
||||||
def setup_table(self):
|
def setup_table(self):
|
||||||
|
if self._study.is_read_only():
|
||||||
|
editable_headers=[]
|
||||||
|
else:
|
||||||
|
editable_headers=["name", "x", "y", "z"]
|
||||||
|
|
||||||
table_headers = self._trad.get_dict("table_headers")
|
table_headers = self._trad.get_dict("table_headers")
|
||||||
|
|
||||||
table = self.find(QTableView, "tableView")
|
table = self.find(QTableView, "tableView")
|
||||||
self._tablemodel = GeometryProfileTableModel(
|
self._tablemodel = GeometryProfileTableModel(
|
||||||
table_view=table,
|
table_view=table,
|
||||||
table_headers=table_headers,
|
table_headers=table_headers,
|
||||||
editable_headers=["name", "x", "y", "z"],
|
editable_headers=editable_headers,
|
||||||
data=self._profile,
|
data=self._profile,
|
||||||
undo=self._undo_stack
|
undo=self._undo_stack
|
||||||
)
|
)
|
||||||
|
|
@ -123,16 +128,19 @@ class ProfileWindow(PamhyrWindow):
|
||||||
self._tablemodel.blockSignals(False)
|
self._tablemodel.blockSignals(False)
|
||||||
|
|
||||||
def setup_connections(self):
|
def setup_connections(self):
|
||||||
actions = {
|
if self._study.is_read_only():
|
||||||
"action_sort_asc": self.sort_X_ascending,
|
actions = {}
|
||||||
"action_sort_des": self.sort_X_descending,
|
else:
|
||||||
"action_up": self.move_up,
|
actions = {
|
||||||
"action_down": self.move_down,
|
"action_sort_asc": self.sort_X_ascending,
|
||||||
"action_add": self.add,
|
"action_sort_des": self.sort_X_descending,
|
||||||
"action_delete": self.delete,
|
"action_up": self.move_up,
|
||||||
"action_purge": self.purge,
|
"action_down": self.move_down,
|
||||||
"action_reverse": self.reverse,
|
"action_add": self.add,
|
||||||
}
|
"action_delete": self.delete,
|
||||||
|
"action_purge": self.purge,
|
||||||
|
"action_reverse": self.reverse,
|
||||||
|
}
|
||||||
|
|
||||||
for action in actions:
|
for action in actions:
|
||||||
self.find(QAction, action)\
|
self.find(QAction, action)\
|
||||||
|
|
|
||||||
|
|
@ -99,13 +99,18 @@ class GeometryWindow(PamhyrWindow):
|
||||||
self.setup_connections()
|
self.setup_connections()
|
||||||
|
|
||||||
def setup_table(self):
|
def setup_table(self):
|
||||||
|
if self._study.is_read_only():
|
||||||
|
editable_headers = []
|
||||||
|
else:
|
||||||
|
editable_headers = ["name", "rk"]
|
||||||
|
|
||||||
table_headers = self._trad.get_dict("table_headers")
|
table_headers = self._trad.get_dict("table_headers")
|
||||||
|
|
||||||
table = self.find(QTableView, "tableView")
|
table = self.find(QTableView, "tableView")
|
||||||
self._table = GeometryReachTableModel(
|
self._table = GeometryReachTableModel(
|
||||||
table_view=table,
|
table_view=table,
|
||||||
table_headers=table_headers,
|
table_headers=table_headers,
|
||||||
editable_headers=["name", "rk"],
|
editable_headers=editable_headers,
|
||||||
data=self._reach,
|
data=self._reach,
|
||||||
undo=self._undo_stack
|
undo=self._undo_stack
|
||||||
)
|
)
|
||||||
|
|
@ -181,20 +186,26 @@ class GeometryWindow(PamhyrWindow):
|
||||||
self._status_label.setText(txt)
|
self._status_label.setText(txt)
|
||||||
|
|
||||||
def setup_connections(self):
|
def setup_connections(self):
|
||||||
actions = {
|
if self._study.is_read_only():
|
||||||
"action_import": self.import_from_file,
|
actions = {
|
||||||
"action_export": self.export_to_file,
|
"action_export": self.export_to_file,
|
||||||
"action_sort_asc": self.sort_ascending,
|
"action_edit": self.edit_profile,
|
||||||
"action_sort_des": self.sort_descending,
|
}
|
||||||
"action_up": self.move_up,
|
else:
|
||||||
"action_down": self.move_down,
|
actions = {
|
||||||
"action_add": self.add,
|
"action_import": self.import_from_file,
|
||||||
"action_delete": self.delete,
|
"action_export": self.export_to_file,
|
||||||
"action_edit": self.edit_profile,
|
"action_sort_asc": self.sort_ascending,
|
||||||
"action_meshing": self.edit_meshing,
|
"action_sort_des": self.sort_descending,
|
||||||
"action_update_rk": self.update_rk,
|
"action_up": self.move_up,
|
||||||
"action_purge": self.purge,
|
"action_down": self.move_down,
|
||||||
}
|
"action_add": self.add,
|
||||||
|
"action_delete": self.delete,
|
||||||
|
"action_edit": self.edit_profile,
|
||||||
|
"action_meshing": self.edit_meshing,
|
||||||
|
"action_update_rk": self.update_rk,
|
||||||
|
"action_purge": self.purge,
|
||||||
|
}
|
||||||
|
|
||||||
for action in actions:
|
for action in actions:
|
||||||
self.find(QAction, action)\
|
self.find(QAction, action)\
|
||||||
|
|
@ -275,6 +286,7 @@ class GeometryWindow(PamhyrWindow):
|
||||||
|
|
||||||
win = ProfileWindow(
|
win = ProfileWindow(
|
||||||
profile=profile,
|
profile=profile,
|
||||||
|
study=self._study,
|
||||||
parent=self,
|
parent=self,
|
||||||
)
|
)
|
||||||
self._profile_window.append(win)
|
self._profile_window.append(win)
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ class NetworkWindow(PamhyrWindow):
|
||||||
|
|
||||||
def setup_table(self):
|
def setup_table(self):
|
||||||
# Nodes table
|
# Nodes table
|
||||||
if self._study.is_read_only:
|
if self._study.is_read_only():
|
||||||
node_editable_headers = []
|
node_editable_headers = []
|
||||||
edge_editable_headers = []
|
edge_editable_headers = []
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue