Skip to content

Commit

Permalink
Run pre commit
Browse files Browse the repository at this point in the history
  • Loading branch information
merydian committed Sep 27, 2023
1 parent dee4086 commit 09e7250
Show file tree
Hide file tree
Showing 2 changed files with 506 additions and 142 deletions.
27 changes: 20 additions & 7 deletions ohsomeTools/gui/OhsomeToolsDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
QgsTask,
QgsApplication,
QgsWkbTypes,
QgsVectorLayer
QgsVectorLayer,
)
from qgis.core import (
QgsProject,
Expand Down Expand Up @@ -215,7 +215,6 @@ def unload(self):
QApplication.restoreOverrideCursor()
del self.dlg


def _init_gui_control(self):
"""Slot for main plugin button. Initializes the GUI and shows it."""

Expand Down Expand Up @@ -251,8 +250,18 @@ def _init_gui_control(self):
layers = QgsProject.instance().mapLayers().values()

# Filter layers to include only polygon and point layers
geomTypes = (QgsWkbTypes.Point, QgsWkbTypes.MultiPoint, QgsWkbTypes.Polygon, QgsWkbTypes.MultiPolygon)
polygon_and_point_layers = [layer for layer in layers if isinstance(layer, QgsVectorLayer) and layer.wkbType() in geomTypes]
geomTypes = (
QgsWkbTypes.Point,
QgsWkbTypes.MultiPoint,
QgsWkbTypes.Polygon,
QgsWkbTypes.MultiPolygon,
)
polygon_and_point_layers = [
layer
for layer in layers
if isinstance(layer, QgsVectorLayer)
and layer.wkbType() in geomTypes
]

# Add the names of polygon and point layers to the combo box
for layer in polygon_and_point_layers:
Expand Down Expand Up @@ -368,7 +377,9 @@ def run_gui_control(self):
else:
globals()[task_name] = task
last_task = task
self.dlg.debug_text.append(f'> cURL: {preferences.cURL(provider)}')
self.dlg.debug_text.append(
f"> cURL: {preferences.cURL(provider)}"
)
QgsApplication.taskManager().addTask(globals()[task_name])
elif wkbType in (QgsWkbTypes.Polygon, QgsWkbTypes.MultiPolygon):
self.dlg.global_buttons.button(QDialogButtonBox.Ok).setDisabled(
Expand Down Expand Up @@ -402,7 +413,9 @@ def run_gui_control(self):
else:
globals()[task_name] = task
last_task = task
self.dlg.debug_text.append(f'> cURL: {preferences.cURL(provider)}')
self.dlg.debug_text.append(
f"> cURL: {preferences.cURL(provider)}"
)
QgsApplication.taskManager().addTask(globals()[task_name])

else:
Expand All @@ -421,7 +434,7 @@ def run_gui_control(self):
)
self.dlg.global_buttons.button(QDialogButtonBox.Ok).setEnabled(True)
except Exception as e:
msg = f'{e.__class__.__name__} {str(e)}'
msg = f"{e.__class__.__name__} {str(e)}"
logger.log("{}: {}".format(*msg), 2)
self.dlg.debug_text.append(msg)
self.iface.messageBar().pushMessage(
Expand Down
Loading

0 comments on commit 09e7250

Please sign in to comment.