From 78420ef6da5afbb763cab5bbc2fb7bdfff3baf2f Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Wed, 22 Jan 2025 08:48:37 -0500 Subject: [PATCH 1/4] update --- gui/wxpython/vdigit/wxdisplay.py | 99 ++++++++++++++++++++++++++++---- 1 file changed, 89 insertions(+), 10 deletions(-) diff --git a/gui/wxpython/vdigit/wxdisplay.py b/gui/wxpython/vdigit/wxdisplay.py index 6679e5c5814..3b670296ecb 100644 --- a/gui/wxpython/vdigit/wxdisplay.py +++ b/gui/wxpython/vdigit/wxdisplay.py @@ -18,23 +18,102 @@ """ import locale - import os import sys -import wx +from ctypes import CFUNCTYPE, UNCHECKED, String, byref, c_double, c_int, pointer +import wx from core.debug import Debug -from core.settings import UserSettings from core.gcmd import DecodeString +from core.settings import UserSettings +from grass.lib.gis import ( + PORT_DOUBLE_MAX, + G_gisinit, + G_set_error_routine, + G_set_percent_routine, + G_unset_error_routine, + G_unset_percent_routine, +) +from grass.lib.vector import ( + GV_BOUNDARY, + GV_BUILD_NONE, + GV_CENTROID, + GV_LINE, + GV_LINES, + GV_MODE_RW, + GV_POINT, + GV_POINTS, + WITHOUT_Z, + Map_info, + Vect_append_point, + Vect_box_copy, + Vect_box_extend, + Vect_build, + Vect_build_partial, + Vect_close, + Vect_destroy_cats_struct, + Vect_destroy_line_struct, + Vect_destroy_list, + Vect_find_line_list, + Vect_get_area_box, + Vect_get_area_centroid, + Vect_get_centroid_area, + Vect_get_line_box, + Vect_get_map_box, + Vect_get_num_areas, + Vect_get_num_lines, + Vect_is_3d, + Vect_line_alive, + Vect_line_check_duplicate, + Vect_line_distance, + Vect_list_append, + Vect_new_cats_struct, + Vect_new_line_struct, + Vect_new_list, + Vect_open_old, + Vect_open_tmp_old, + Vect_open_tmp_update, + Vect_open_update, + Vect_point_in_area, + Vect_point_in_poly, + Vect_points_distance, + Vect_read_line, + Vect_select_lines_by_polygon, + Vect_set_updated, + bound_box, +) +from grass.lib.vedit import ( + DRAW_AREA, + DRAW_BOUNDARYNO, + DRAW_BOUNDARYONE, + DRAW_BOUNDARYTWO, + DRAW_CENTROIDDUP, + DRAW_CENTROIDIN, + DRAW_CENTROIDOUT, + DRAW_DIRECTION, + DRAW_LINE, + DRAW_NODEONE, + DRAW_NODETWO, + DRAW_POINT, + DRAW_VERTEX, + TYPE_AREA, + TYPE_BOUNDARYNO, + TYPE_BOUNDARYONE, + TYPE_BOUNDARYTWO, + TYPE_CENTROIDDUP, + TYPE_CENTROIDIN, + TYPE_CENTROIDOUT, + TYPE_DIRECTION, + TYPE_ISLE, + TYPE_LINE, + TYPE_NODEONE, + TYPE_NODETWO, + TYPE_POINT, + TYPE_VERTEX, + Vedit_render_map, +) from gui_core.wrap import Rect -try: - from grass.lib.gis import * - from grass.lib.vector import * - from grass.lib.vedit import * -except (ImportError, OSError, TypeError) as e: - print("wxdigit.py: {}".format(e), file=sys.stderr) - log = None progress = None last_error = "" From bf8091fee5a5c7fe06bdf9308b527d74772f21ac Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Thu, 23 Jan 2025 11:43:50 -0500 Subject: [PATCH 2/4] update --- gui/wxpython/mapdisp/main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gui/wxpython/mapdisp/main.py b/gui/wxpython/mapdisp/main.py index 6449bc35d7c..a19c79b5780 100644 --- a/gui/wxpython/mapdisp/main.py +++ b/gui/wxpython/mapdisp/main.py @@ -176,7 +176,7 @@ def GetLayersFromCmdFile(self): mapFile = line.split("=", 1)[1].strip() try: k, v = line[2:].strip().split("=", 1) - except: + except (ValueError, IndexError): pass render_env[k] = v continue From 40682bfffd2fd53f70c5684a67984ce1db5f8247 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Thu, 23 Jan 2025 11:46:52 -0500 Subject: [PATCH 3/4] flake update --- .flake8 | 3 --- 1 file changed, 3 deletions(-) diff --git a/.flake8 b/.flake8 index 99c6e425717..b308f242ff4 100644 --- a/.flake8 +++ b/.flake8 @@ -29,7 +29,6 @@ per-file-ignores = gui/wxpython/animation/g.gui.animation.py: E501 gui/wxpython/tplot/g.gui.tplot.py: E501 gui/wxpython/iclass/g.gui.iclass.py: E501 - gui/wxpython/mapdisp/main.py: E722 gui/wxpython/mapdisp/test_mapdisp.py: E501 gui/wxpython/mapswipe/g.gui.mapswipe.py: E501 gui/wxpython/mapwin/base.py: E722 @@ -42,8 +41,6 @@ per-file-ignores = python/grass/jupyter/__init__.py: E501 python/grass/pygrass/vector/__init__.py: E402 # Current benchmarks/tests are changing sys.path before import. - # Possibly, a different approach should be taken there anyway. - python/grass/pygrass/tests/benchmark.py: F821 # Configuration file for Sphinx: # Ignoring import/code mix and line length. # Files not managed by Black From 6cf28080f35fcd15650aa38468ed80ea4fb14e68 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Tue, 28 Jan 2025 10:19:06 -0800 Subject: [PATCH 4/4] Update .flake8 --- .flake8 | 1 - 1 file changed, 1 deletion(-) diff --git a/.flake8 b/.flake8 index 31e2e934cc1..717b42fdc22 100644 --- a/.flake8 +++ b/.flake8 @@ -39,7 +39,6 @@ per-file-ignores = # TODO: Is this really needed? python/grass/jupyter/__init__.py: E501 python/grass/pygrass/vector/__init__.py: E402 - # Current benchmarks/tests are changing sys.path before import. # Configuration file for Sphinx: # Ignoring import/code mix and line length. # Files not managed by Black