Skip to content

Commit

Permalink
fix: error when using move mode with empty point list.
Browse files Browse the repository at this point in the history
  • Loading branch information
merydian committed Jan 15, 2024
1 parent b6b8999 commit e87e8e9
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions ORStools/gui/ORStoolsDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,13 +561,20 @@ def _on_linetool_init(self):
self.line_tool.doubleClicked.connect(self._on_linetool_map_doubleclick)

def _on_move_vertices_tool_init(self):
self.hide()
self.move_tool = maptools.ShiftTool(self._iface.mapCanvas())

self._iface.mapCanvas().setMapTool(self.move_tool)
self.move_tool.pointPressed.connect(lambda point: self._on_movetool_map_press(point))
self.move_tool.pointReleased.connect(lambda point: self._on_movetool_map_release(point))
self.move_tool.doubleClicked.connect(self._on_movetool_map_doubleclick)
if self.routing_fromline_list.count() > 0:
self.hide()
self.move_tool = maptools.ShiftTool(self._iface.mapCanvas())

self._iface.mapCanvas().setMapTool(self.move_tool)
self.move_tool.pointPressed.connect(lambda point: self._on_movetool_map_press(point))
self.move_tool.pointReleased.connect(lambda point: self._on_movetool_map_release(point))
self.move_tool.doubleClicked.connect(self._on_movetool_map_doubleclick)
else:
QMessageBox.warning(
self,
"Empty point list",
"""Please add points to move them.""",
)

def _on_movetool_map_press(self, pos):
click = Point(pos.x(), pos.y())
Expand Down

0 comments on commit e87e8e9

Please sign in to comment.