From 290fb90a95aabe58a16beeeda97d2b3c2d908301 Mon Sep 17 00:00:00 2001 From: Arohan Ajit Date: Sat, 21 Sep 2024 09:22:03 +0000 Subject: [PATCH] updates --- doc/gui/wxpython/example/dialogs.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/doc/gui/wxpython/example/dialogs.py b/doc/gui/wxpython/example/dialogs.py index 425ea57a4b2..e8fac1c4750 100644 --- a/doc/gui/wxpython/example/dialogs.py +++ b/doc/gui/wxpython/example/dialogs.py @@ -14,18 +14,25 @@ @author Anna Petrasova """ -import wx - # i18n is taken care of in the grass library code. # So we need to import it before any of the GUI code. # NOTE: in this particular case, we don't really need the grass library; # NOTE: we import it just for the side effects of gettext.install() -import grass - +import os +import sys +import wx +import gettext from core import globalvar from gui_core.dialogs import SimpleDialog from gui_core import gselect +# this enables to run application standalone (> python example/frame.py ) +if __name__ == "__main__": + sys.path.append(os.path.join(os.environ["GISBASE"], "etc", "gui", "wxpython")) + +# Instead of importing grass, we directly import the gettext function +gettext.install("grasswxpy", localedir=None, unicode=True) + class ExampleMapDialog(SimpleDialog): """!Dialog for adding raster map.