Skip to content

Commit

Permalink
Fixes for ORS checking workflow and panel navigation.
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Nov 9, 2024
1 parent 8401ce4 commit ebac931
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 192 deletions.
17 changes: 15 additions & 2 deletions geest/gui/geest_dock.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ def __init__(
# Switch to the next tab when the button is clicked
lambda: self.stacked_widget.setCurrentIndex(2)
)
self.ors_widget.switch_to_previous_tab.connect(
# Switch to the next tab when the button is clicked
lambda: self.stacked_widget.setCurrentIndex(0)
)

# Create and add the "Project" panel (SetupPanel)
self.setup_widget: SetupPanel = SetupPanel()
Expand All @@ -95,6 +99,11 @@ def __init__(
lambda: self.stacked_widget.setCurrentIndex(4)
)

self.setup_widget.switch_to_previous_tab.connect(
# Switch to the next tab when the button is clicked
lambda: self.stacked_widget.setCurrentIndex(1)
)

# Create and add the "Open Project" panel
self.open_project_widget: OpenProjectPanel = OpenProjectPanel()
open_project_panel: QWidget = QWidget()
Expand All @@ -107,6 +116,10 @@ def __init__(
# Switch to the next tab when the button is clicked
lambda: self.stacked_widget.setCurrentIndex(5)
)
self.open_project_widget.switch_to_previous_tab.connect(
# Switch to the next tab when the button is clicked
lambda: self.stacked_widget.setCurrentIndex(3)
)

# Create and add the "Create Project" panel
self.create_project_widget: CreateProjectPanel = CreateProjectPanel()
Expand Down Expand Up @@ -134,7 +147,7 @@ def __init__(
)
self.tree_widget.switch_to_previous_tab.connect(
# Switch to the previous tab when the button is clicked
lambda: self.stacked_widget.setCurrentIndex(1)
lambda: self.stacked_widget.setCurrentIndex(2)
)
# Create and add the "Help" panel (HelpPanel)
help_widget: HelpPanel = HelpPanel()
Expand Down Expand Up @@ -209,7 +222,7 @@ def qgis_project_changed(self) -> None:
)
if geest_project and os.path.exists(geest_project):
self.tree_widget.set_working_directory(geest_project)
self.stacked_widget.setCurrentIndex(2) # Tree tab
self.stacked_widget.setCurrentIndex(5) # Tree tab

def on_panel_changed(self, index: int) -> None:
"""
Expand Down
9 changes: 6 additions & 3 deletions geest/gui/panels/open_project_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

class OpenProjectPanel(FORM_CLASS, QWidget):
switch_to_next_tab = pyqtSignal() # Signal to notify the parent to switch tabs
switch_to_previous_tab = pyqtSignal() # Signal to notify the parent to switch tabs

def __init__(self):
super().__init__()
Expand Down Expand Up @@ -68,9 +69,11 @@ def initUI(self):
self.previous_project_combo.setSizeAdjustPolicy(
QComboBox.AdjustToMinimumContentsLengthWithIcon
)
self.previous_project_combo.setMinimumContentsLength(
10
) # or another length that fits your needs
self.previous_project_combo.setMinimumContentsLength(10)
self.previous_button.clicked.connect(self.on_previous_button_clicked)

def on_previous_button_clicked(self):
self.switch_to_previous_tab.emit()

def add_project_to_combo(self, project_path: str):
"""Add a project path to the combo with elided text and full path as data."""
Expand Down
4 changes: 4 additions & 0 deletions geest/gui/panels/ors_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

class OrsPanel(FORM_CLASS, QWidget):
switch_to_next_tab = pyqtSignal() # Signal to notify the parent to switch tabs
switch_to_previous_tab = pyqtSignal() # Signal to notify the parent to switch tabs

def __init__(self):
super().__init__()
Expand Down Expand Up @@ -77,3 +78,6 @@ def open_link_in_browser(self, url: str):

def on_next_button_clicked(self):
self.switch_to_next_tab.emit()

def on_previous_button_clicked(self):
self.switch_to_previous_tab.emit()
5 changes: 5 additions & 0 deletions geest/gui/panels/setup_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class SetupPanel(FORM_CLASS, QWidget):
switch_to_create_project_tab = (
pyqtSignal()
) # Signal to notify the parent to switch tabs
switch_to_previous_tab = pyqtSignal() # Signal to notify the parent to switch tabs

def __init__(self):
super().__init__()
Expand All @@ -53,9 +54,13 @@ def initUI(self):
)
self.open_existing_project_button.clicked.connect(self.load_project)
self.create_new_project_button.clicked.connect(self.create_project)
self.previous_button.clicked.connect(self.on_previous_button_clicked)

def load_project(self):
self.switch_to_load_project_tab.emit()

def create_project(self):
self.switch_to_create_project_tab.emit()

def on_previous_button_clicked(self):
self.switch_to_previous_tab.emit()
194 changes: 95 additions & 99 deletions geest/ui/geest_settings_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<string>Geest Settings</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="text">
<string># Geest Settings</string>
Expand All @@ -27,105 +27,17 @@
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QFormLayout" name="formLayout">
<item row="0" column="0">
<widget class="QLineEdit" name="ors_key_line_edit"/>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Your API Key for the Open Route Service</string>
</property>
</widget>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_thread_pool_size">
<property name="text">
<string>Concurrent Tasks</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spin_thread_pool_size"/>
</item>
</layout>
</item>
<item row="1" column="1">
<widget class="QLabel" name="thread_pool_description">
<property name="text">
<string>The maximum number of concurrent threads to allow during analysis. Setting to the same number of CPU cores you have would be a good conservative approach. If you want to produce your analysis faster, you could probably run 100 or more on a decently specced machine.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QCheckBox" name="edit_mode_checkbox">
<property name="text">
<string>Enable editing</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="debug_mode_checkbox">
<property name="text">
<string>Enable developer mode</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="verbose_mode_checkbox">
<property name="text">
<string>Verbose logging mode</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_2">
<property name="text">
<string>With this option enabled, you will see an 'Edit' check box in the dock panel that will let you create new dimensions, factors, layers and edit their properties.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="debug_mode_description">
<property name="text">
<string>This is intended for developers to attach to the plugin using a remote debugger so that they can step through the code. Do not enable it if you do not have a remote debugger set up as it will block QGIS startup until a debugger is attached to the process. In addition, debug mode will enable a log tab in the dock. Requires restart after changing.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="verbose_mode_description">
<property name="text">
<string>Adds verbose log message, useful for diagnostics.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
</layout>
<item row="1" column="0" colspan="3">
<widget class="QLineEdit" name="ors_key_line_edit"/>
</item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Your API Key for the Open Route Service</string>
</property>
</widget>
</item>
<item row="2" column="0">
<item row="3" column="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand All @@ -138,6 +50,90 @@
</property>
</spacer>
</item>
<item row="4" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_thread_pool_size">
<property name="text">
<string>Concurrent Tasks</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spin_thread_pool_size"/>
</item>
</layout>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLabel" name="thread_pool_description">
<property name="text">
<string>The maximum number of concurrent threads to allow during analysis. Setting to the same number of CPU cores you have would be a good conservative approach. If you want to produce your analysis faster, you could probably run 100 or more on a decently specced machine.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QCheckBox" name="edit_mode_checkbox">
<property name="text">
<string>Enable editing</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>With this option enabled, you will see an 'Edit' check box in the dock panel that will let you create new dimensions, factors, layers and edit their properties.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="debug_mode_checkbox">
<property name="text">
<string>Enable developer mode</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="2">
<widget class="QLabel" name="debug_mode_description">
<property name="text">
<string>This is intended for developers to attach to the plugin using a remote debugger so that they can step through the code. Do not enable it if you do not have a remote debugger set up as it will block QGIS startup until a debugger is attached to the process. In addition, debug mode will enable a log tab in the dock. Requires restart after changing.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QCheckBox" name="verbose_mode_checkbox">
<property name="text">
<string>Verbose logging mode</string>
</property>
</widget>
</item>
<item row="7" column="1" colspan="2">
<widget class="QLabel" name="verbose_mode_description">
<property name="text">
<string>Adds verbose log message, useful for diagnostics.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<tabstops>
Expand Down
Loading

0 comments on commit ebac931

Please sign in to comment.