[Git][debian-gis-team/grass][upstream] New upstream version 7.8.2
Bas Couwenberg
gitlab at salsa.debian.org
Wed Dec 11 18:42:05 GMT 2019
Bas Couwenberg pushed to branch upstream at Debian GIS Project / grass
Commits:
01b95c60 by Bas Couwenberg at 2019-12-11T17:30:18Z
New upstream version 7.8.2
- - - - -
13 changed files:
- gui/wxpython/core/globalvar.py
- gui/wxpython/gcp/manager.py
- gui/wxpython/image2target/ii2t_manager.py
- gui/wxpython/mapwin/buffered.py
- gui/wxpython/photo2image/ip2i_manager.py
- gui/wxpython/rdigit/controller.py
- gui/wxpython/rdigit/toolbars.py
- gui/wxpython/vnet/widgets.py
- include/VERSION
- include/defs/gprojects.h
- lib/proj/datum.c
- lib/proj/get_proj.c
- raster/r.grow.distance/r.grow.distance.html
Changes:
=====================================
gui/wxpython/core/globalvar.py
=====================================
@@ -35,6 +35,42 @@ from grass.script.core import get_commands
from core.debug import Debug
+def parse_version_string(version):
+ """Parse version number, return three numbers as list
+
+ >>> parse_version_string("4.0.1")
+ [4, 0, 1]
+ >>> parse_version_string("4.0.0aX")
+ [4, 0, 0]
+ >>> parse_version_string("4.0.7.post2")
+ [4, 0, 7]
+ """
+ try:
+ # max: get only first three parts from wxPython 4.0.7.post2
+ maxsplit = 2
+ split_ver = version.split(".", maxsplit)
+ parsed_version = list(map(int, split_ver))
+ except ValueError:
+ # remove last part of wxPython 4.0.0aX
+ for i, c in enumerate(split_ver[-1]):
+ if not c.isdigit():
+ break
+ parsed_version = list(map(int, split_ver[:-1])) + [int(split_ver[-1][:i])]
+ return parsed_version
+
+
+def version_as_string(version):
+ """Return version list or tuple as text
+
+ >>> version_as_string([1, 2, 3])
+ '1.2.3'
+ >>> version_as_string((1, 2, 3, 4))
+ '1.2.3.4'
+ """
+ texts = [str(i) for i in version]
+ return ".".join(texts)
+
+
def CheckWxPhoenix():
if 'phoenix' in wx.version():
return True
@@ -44,15 +80,7 @@ def CheckWxPhoenix():
def CheckWxVersion(version):
"""Check wx version"""
ver = wx.__version__
- try:
- split_ver = ver.split('.')
- parsed_version = list(map(int, split_ver))
- except ValueError:
- # wxPython 4.0.0aX
- for i, c in enumerate(split_ver[-1]):
- if not c.isdigit():
- break
- parsed_version = list(map(int, split_ver[:-1])) + [int(split_ver[-1][:i])]
+ parsed_version = parse_version_string(ver)
if parsed_version < version:
return False
@@ -81,12 +109,11 @@ def CheckForWx(forceVersion=os.getenv('GRASS_WXVERSION', None)):
wxversion.select(forceVersion)
wxversion.ensureMinimal(str(minVersion[0]) + '.' + str(minVersion[1]))
import wx
- version = wx.__version__
+ version = parse_version_string(wx.__version__)
- if map(int, version.split('.')) < minVersion:
+ if version < minVersion:
raise ValueError(
- 'Your wxPython version is %s.%s.%s.%s' %
- tuple(version.split('.')))
+ "Your wxPython version is {}".format(wx.__version__))
except ImportError as e:
print('ERROR: wxGUI requires wxPython. %s' % str(e),
@@ -95,8 +122,9 @@ def CheckForWx(forceVersion=os.getenv('GRASS_WXVERSION', None)):
' the command line or in Python.', file=sys.stderr)
sys.exit(1)
except (ValueError, wxversion.VersionError) as e:
- print('ERROR: wxGUI requires wxPython >= %d.%d.%d.%d. ' % tuple(
- minVersion) + '%s.' % (str(e)), file=sys.stderr)
+ message = "ERROR: wxGUI requires wxPython >= {version}: {error}".format(
+ version=version_as_string(minVersion), error=e)
+ print(message, file=sys.stderr)
sys.exit(1)
except locale.Error as e:
print("Unable to set locale:", e, file=sys.stderr)
=====================================
gui/wxpython/gcp/manager.py
=====================================
@@ -79,7 +79,7 @@ maptype = 'raster'
def getSmallUpArrowImage():
stream = open(os.path.join(globalvar.IMGDIR, 'small_up_arrow.png'), 'rb')
try:
- img = wx.ImageFromStream(stream)
+ img = wx.Image(stream)
finally:
stream.close()
return img
@@ -88,7 +88,7 @@ def getSmallUpArrowImage():
def getSmallDnArrowImage():
stream = open(os.path.join(globalvar.IMGDIR, 'small_down_arrow.png'), 'rb')
try:
- img = wx.ImageFromStream(stream)
+ img = wx.Image(stream)
finally:
stream.close()
stream.close()
@@ -2174,7 +2174,7 @@ class GCPList(ListCtrl,
_('Forward error'),
_('Backward error')):
info.SetText(lbl)
- self.InsertColumnInfo(idx_col, info)
+ self.InsertColumn(idx_col, info)
idx_col += 1
def LoadData(self):
@@ -2682,11 +2682,10 @@ class GrSettingsDialog(wx.Dialog):
parent=panel, id=wx.ID_ANY,
label=_("Highlight RMS error > M + SD * factor:"))
rmslabel.SetToolTip(
- wx.ToolTip(
_(
"Highlight GCPs with an RMS error larger than \n"
"mean + standard deviation * given factor. \n"
- "Recommended values for this factor are between 1 and 2.")))
+ "Recommended values for this factor are between 1 and 2."))
rmsgridSizer.Add(
rmslabel,
flag=wx.ALIGN_CENTER_VERTICAL,
=====================================
gui/wxpython/image2target/ii2t_manager.py
=====================================
@@ -82,7 +82,7 @@ maptype = 'raster'
def getSmallUpArrowImage():
stream = open(os.path.join(globalvar.IMGDIR, 'small_up_arrow.png'), 'rb')
try:
- img = wx.ImageFromStream(stream)
+ img = wx.Image(stream)
finally:
stream.close()
return img
@@ -91,7 +91,7 @@ def getSmallUpArrowImage():
def getSmallDnArrowImage():
stream = open(os.path.join(globalvar.IMGDIR, 'small_down_arrow.png'), 'rb')
try:
- img = wx.ImageFromStream(stream)
+ img = wx.Image(stream)
finally:
stream.close()
stream.close()
=====================================
gui/wxpython/mapwin/buffered.py
=====================================
@@ -1557,19 +1557,18 @@ class BufferedMapWindow(MapWindowBase, Window):
self.digit:
self._onLeftUp(event)
- elif (self.mouse['use'] == 'pointer' and
- self.dragid and int(self.dragid) >= 0):
- # end drag of overlay decoration
-
- if self.overlays and self.dragid in self.overlays:
- self.overlays[
- self.dragid].coords = self.pdc.GetIdBounds(
- self.dragid)
- elif self.dragid in self.textdict:
- self.textdict[self.dragid]['bbox'] = self.pdc.GetIdBounds(self.dragid)
- else:
- pass
- self.dragid = None
+ elif self.mouse['use'] == 'pointer':
+ if self.dragid and int(self.dragid) >= 0:
+ # end drag of overlay decoration
+ if self.overlays and self.dragid in self.overlays:
+ self.overlays[
+ self.dragid].coords = self.pdc.GetIdBounds(
+ self.dragid)
+ elif self.dragid in self.textdict:
+ self.textdict[self.dragid]['bbox'] = self.pdc.GetIdBounds(self.dragid)
+ else:
+ pass
+ self.dragid = None
self.mouseLeftUpPointer.emit(x=coordinates[0], y=coordinates[1])
=====================================
gui/wxpython/photo2image/ip2i_manager.py
=====================================
@@ -73,7 +73,7 @@ maptype = 'raster'
def getSmallUpArrowImage():
stream = open(os.path.join(globalvar.IMGDIR, 'small_up_arrow.png'), 'rb')
try:
- img = wx.ImageFromStream(stream)
+ img = wx.Image(stream)
finally:
stream.close()
return img
@@ -82,7 +82,7 @@ def getSmallUpArrowImage():
def getSmallDnArrowImage():
stream = open(os.path.join(globalvar.IMGDIR, 'small_down_arrow.png'), 'rb')
try:
- img = wx.ImageFromStream(stream)
+ img = wx.Image(stream)
finally:
stream.close()
stream.close()
=====================================
gui/wxpython/rdigit/controller.py
=====================================
@@ -591,7 +591,7 @@ class RDigitController(wx.EvtHandler):
:return: output raster map name as a result of digitization
"""
output = 'x' + str(uuid.uuid4())[:8]
- asciiFile = tempfile.NamedTemporaryFile(delete=False)
+ asciiFile = tempfile.NamedTemporaryFile(mode='w', delete=False)
asciiFile.write('\n'.join(text))
asciiFile.close()
=====================================
gui/wxpython/rdigit/toolbars.py
=====================================
@@ -20,7 +20,7 @@ from gui_core.toolbars import BaseToolbar
from icons.icon import MetaIcon
from gui_core.widgets import FloatValidator
import wx.lib.colourselect as csel
-from gui_core.wrap import TextCtrl, StaticText
+from gui_core.wrap import TextCtrl, StaticText, ColourSelect
rdigitIcons = {'area': MetaIcon(img='polygon-create',
@@ -56,12 +56,11 @@ class RDigitToolbar(BaseToolbar):
self.InsertControl(0, self._mapSelectionCombo)
self._previousMap = self._mapSelectionCombo.GetValue()
- self._color = csel.ColourSelect(parent=self, colour=wx.GREEN,
- size=(30, 30))
+ self._color = ColourSelect(parent=self, colour=wx.GREEN, size=(30, 30))
self._color.Bind(
csel.EVT_COLOURSELECT,
lambda evt: self._changeDrawColor())
- self._color.SetToolTipString(
+ self._color.SetToolTip(
_("Set drawing color (not raster cell color)"))
self.InsertControl(4, self._color)
=====================================
gui/wxpython/vnet/widgets.py
=====================================
@@ -436,7 +436,7 @@ class PointsList(ListCtrl,
'small_up_arrow.png'),
'rb')
try:
- img = wx.ImageFromStream(stream)
+ img = wx.Image(stream)
finally:
stream.close()
return img
@@ -449,7 +449,7 @@ class PointsList(ListCtrl,
'small_down_arrow.png'),
'rb')
try:
- img = wx.ImageFromStream(stream)
+ img = wx.Image(stream)
finally:
stream.close()
return img
=====================================
include/VERSION
=====================================
@@ -1,4 +1,4 @@
7
8
-2RC2
+2
2019
=====================================
include/defs/gprojects.h
=====================================
@@ -22,7 +22,7 @@ int pj_get_string(struct pj_info *, char *);
#ifndef HAVE_PROJ_H
int GPJ_get_equivalent_latlong(struct pj_info *, struct pj_info *);
#endif
-const char *set_proj_lib(const char *);
+const char *set_proj_share(const char *);
int pj_print_proj_params(const struct pj_info *, const struct pj_info *);
/* convert.c */
=====================================
lib/proj/datum.c
=====================================
@@ -189,17 +189,16 @@ int GPJ__get_datum_params(const struct Key_Value *projinfo,
returnval = 2;
}
else if (G_find_key_value("nadgrids", projinfo) != NULL) {
- const char *projshare = getenv("GRASS_PROJSHARE");
-
- if (!projshare) {
- G_warning(_("Failed to detect nadgrids path, GRASS_PROJSHARE not defined"));
- returnval = -1;
- }
- else {
- G_asprintf(params, "nadgrids=%s%c%s", projshare, HOST_DIRSEP,
- G_find_key_value("nadgrids", projinfo));
- returnval = 2;
- }
+ /* 1. beware of '@', do not create something like
+ * /usr/share/proj/@null, correct is @null or
+ * @/usr/share/proj/null
+ * 2. do not add path to the grid, there might already be a
+ * path, and it is safer to use pj_set_finder with PROJ.4 in
+ * datum.c */
+
+ G_asprintf(params, "nadgrids=%s", G_find_key_value("nadgrids", projinfo));
+
+ returnval = 2;
}
else if (G_find_key_value("towgs84", projinfo) != NULL) {
G_asprintf(params, "towgs84=%s",
=====================================
lib/proj/get_proj.c
=====================================
@@ -23,8 +23,8 @@
#include <grass/gprojects.h>
#include <grass/glocale.h>
-/* Finder function for datum conversion lookup tables */
-#define FINDERFUNC set_proj_lib
+/* Finder function for datum transformation grids */
+#define FINDERFUNC set_proj_share
#define PERMANENT "PERMANENT"
#define MAX_PARGS 100
@@ -486,15 +486,24 @@ int GPJ_get_equivalent_latlong(struct pj_info *pjnew, struct pj_info *pjold)
}
#endif
-/* set_proj_lib()
- * 'finder function' for use with PROJ.4 pj_set_finder() function */
+/* set_proj_share()
+ * 'finder function' for use with PROJ.4 pj_set_finder() function
+ * this is used to find grids, usually in /usr/share/proj
+ * GRASS no longer provides copies of proj grids in GRIDDIR
+ * -> do not use gisbase/GRIDDIR */
-const char *set_proj_lib(const char *name)
+const char *set_proj_share(const char *name)
{
- const char *gisbase = G_gisbase();
static char *buf = NULL;
- static size_t buf_len;
- size_t len = strlen(gisbase) + sizeof(GRIDDIR) + strlen(name) + 1;
+ const char *projshare;
+ static size_t buf_len = 0;
+ size_t len;
+
+ projshare = getenv("GRASS_PROJSHARE");
+ if (!projshare)
+ return NULL;
+
+ len = strlen(projshare) + strlen(name) + 2;
if (buf_len < len) {
if (buf != NULL)
@@ -503,7 +512,7 @@ const char *set_proj_lib(const char *name)
buf = G_malloc(buf_len);
}
- sprintf(buf, "%s%s/%s", gisbase, GRIDDIR, name);
+ sprintf(buf, "%s/%s", projshare, name);
return buf;
}
=====================================
raster/r.grow.distance/r.grow.distance.html
=====================================
@@ -72,6 +72,7 @@ North Carolina sample dataset:
<div class="code"><pre>
g.region raster=streams_derived -p
r.grow.distance input=streams_derived distance=dist_from_streams
+r.colors map=dist_from_streams color=rainbow
</pre></div>
<div align="center" style="margin: 10px">
@@ -90,6 +91,7 @@ r.grow.distance input=streams_derived distance=dist_from_streams
<div class="code"><pre>
g.region raster=sea -p
r.grow.distance -m input=sea distance=dist_from_sea_geodetic metric=geodesic
+r.colors map=dist_from_sea_geodetic color=rainbow
</pre></div>
<p>
View it on GitLab: https://salsa.debian.org/debian-gis-team/grass/commit/01b95c60e15704fdc2b319c0ea0fc099fd5ede00
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/grass/commit/01b95c60e15704fdc2b319c0ea0fc099fd5ede00
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20191211/6cc1ea4b/attachment-0001.html>
More information about the Pkg-grass-devel
mailing list