Skip to content

Commit 3ebd724

Browse files
committed
feat: save state of provider combobox
1 parent d497168 commit 3ebd724

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

ORStools/gui/ORStoolsDialog.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ def __init__(self, iface: QgisInterface, parent=None) -> None:
533533
lambda: self.color_duplicate_items(self.routing_fromline_list)
534534
)
535535

536+
self.load_provider_combo_state()
537+
self.provider_combo.activated.connect(self.save_selected_provider_state)
538+
536539
self.annotation_canvas = self._iface.mapCanvas()
537540

538541
def _save_vertices_to_layer(self) -> None:
@@ -694,3 +697,20 @@ def color_duplicate_items(self, list_widget):
694697
for index in indices:
695698
item = list_widget.item(index)
696699
item.setBackground(QColor("lightsalmon"))
700+
701+
def save_selected_provider_state(self) -> None:
702+
s = QgsSettings()
703+
s.setValue(
704+
"ORSTools/gui/provider_combo", self.provider_combo.currentIndex()
705+
)
706+
707+
def load_provider_combo_state(self):
708+
s = QgsSettings()
709+
index = s.value("ORSTools/gui/provider_combo")
710+
if index:
711+
self.provider_combo.setCurrentIndex(index)
712+
713+
def show(self):
714+
"""Load the saved state when the window is shown"""
715+
super().show()
716+
self.load_provider_combo_state()

0 commit comments

Comments
 (0)