mirror of https://gitlab.com/pamhyr/pamhyr2
WeatherParameters: button connections in another function to clear code
parent
5dcc82d81e
commit
f2d76a0d67
|
|
@ -94,10 +94,33 @@ class WeatherParametersWindow(PamhyrWindow):
|
||||||
"AT", "SH", "GR", "RWS", "GT", "GFR", "ALB", "SC", "CCF"
|
"AT", "SH", "GR", "RWS", "GT", "GFR", "ALB", "SC", "CCF"
|
||||||
]
|
]
|
||||||
self.setup_table()
|
self.setup_table()
|
||||||
|
self.setup_connections()
|
||||||
|
|
||||||
def setup_table(self):
|
def setup_connections(self):
|
||||||
path_icons = os.path.join(self._get_ui_directory(), f"ressources")
|
path_icons = os.path.join(self._get_ui_directory(), f"ressources")
|
||||||
|
|
||||||
|
layout = self.find(QVBoxLayout, f"verticalLayout_1")
|
||||||
|
toolBar = QToolBar()
|
||||||
|
layout.addWidget(toolBar)
|
||||||
|
|
||||||
|
# Add buttons to the toolbar
|
||||||
|
action_add = QAction(self)
|
||||||
|
action_add.setIcon(QIcon(os.path.join(path_icons, f"add.png")))
|
||||||
|
|
||||||
|
if self._study.is_editable():
|
||||||
|
action_add.triggered.connect(self.add)
|
||||||
|
action_delete = QAction(self)
|
||||||
|
action_delete.setIcon(QIcon(os.path.join(path_icons, f"del.png")))
|
||||||
|
|
||||||
|
if self._study.is_editable():
|
||||||
|
action_delete.triggered.connect(self.delete)
|
||||||
|
|
||||||
|
toolBar.addAction(action_add)
|
||||||
|
toolBar.addAction(action_delete)
|
||||||
|
|
||||||
|
layout.addWidget(self.table_spec)
|
||||||
|
|
||||||
|
def setup_table(self):
|
||||||
self.table_default = self.find(QTableView, f"tableView")
|
self.table_default = self.find(QTableView, f"tableView")
|
||||||
|
|
||||||
if self._study.is_editable():
|
if self._study.is_editable():
|
||||||
|
|
@ -125,26 +148,7 @@ class WeatherParametersWindow(PamhyrWindow):
|
||||||
self.on_table_default_selection_changed
|
self.on_table_default_selection_changed
|
||||||
)
|
)
|
||||||
|
|
||||||
layout = self.find(QVBoxLayout, f"verticalLayout_1")
|
|
||||||
toolBar = QToolBar()
|
|
||||||
layout.addWidget(toolBar)
|
|
||||||
|
|
||||||
action_add = QAction(self)
|
|
||||||
action_add.setIcon(QIcon(os.path.join(path_icons, f"add.png")))
|
|
||||||
|
|
||||||
if self._study.is_editable():
|
|
||||||
action_add.triggered.connect(self.add)
|
|
||||||
action_delete = QAction(self)
|
|
||||||
action_delete.setIcon(QIcon(os.path.join(path_icons, f"del.png")))
|
|
||||||
|
|
||||||
if self._study.is_editable():
|
|
||||||
action_delete.triggered.connect(self.delete)
|
|
||||||
|
|
||||||
toolBar.addAction(action_add)
|
|
||||||
toolBar.addAction(action_delete)
|
|
||||||
|
|
||||||
self.table_spec = QTableView()
|
self.table_spec = QTableView()
|
||||||
layout.addWidget(self.table_spec)
|
|
||||||
|
|
||||||
self._delegate_reach = ComboBoxDelegate(
|
self._delegate_reach = ComboBoxDelegate(
|
||||||
trad=self._trad,
|
trad=self._trad,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue