diff --git a/.dockerignore b/.dockerignore index 163e37da6f4..be3612645ba 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,7 @@ docker !docker/testdata +!docker/alpine/alpine-py38-ctypes.patch +!docker/alpine/alpine-py38-gisinit.patch .git .gitignore .github diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000000..fa5d44b5c04 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,40 @@ +--- +name: Bug report +about: Create a report to help us improve +title: "[Bug]" +labels: 'bug' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: + +1. Go to '...' +2. Click on '...' +3. Compute '...' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**System description (please complete the following information):** + +- Operating System: [e.g. Windows, Linux, ..., incl. version] +- GRASS GIS version [e.g. 7.8.1] + + + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000000..fa4abd697ad --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,22 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: "[Feat]" +labels: 'enhancement' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. +Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features +you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/apt.txt b/.github/workflows/apt.txt new file mode 100644 index 00000000000..2c2186eaaeb --- /dev/null +++ b/.github/workflows/apt.txt @@ -0,0 +1,22 @@ +bison +build-essential +flex +libbz2-dev +libcairo-dev +libfftw3-dev +libgdal-dev +libgl1-mesa-dev +libglu1-mesa-dev +libnetcdf-dev +libopenblas-dev +libpng-dev +libproj-dev +libreadline-dev +libzstd-dev +python3-dateutil +python3-numpy +python3-ply +python3-six +python3-termcolor +sqlite3 +zlib1g-dev diff --git a/.github/workflows/build.sh b/.github/workflows/build.sh new file mode 100755 index 00000000000..f5d79fae86e --- /dev/null +++ b/.github/workflows/build.sh @@ -0,0 +1,46 @@ +#!/usr/bin/env bash + +# The make step requires something like: +# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PREFIX/lib" +# further steps additionally require: +# export PATH="$PATH:$PREFIX/bin" + +# fail on non-zero return code from a subprocess +set -e + +# print commands +set -x + +if [ -z "$1" ] +then + echo "Usage: $0 PREFIX" + exit 1 +fi + +# non-existent variables as an errors +set -u + +export INSTALL_PREFIX=$1 + +./configure \ + --prefix="$INSTALL_PREFIX/" \ + --enable-largefile \ + --with-cxx \ + --with-zstd \ + --with-bzlib \ + --with-blas \ + --with-lapack \ + --with-readline \ + --with-openmp \ + --with-pthread \ + --with-tiff \ + --with-freetype \ + --with-freetype-includes="/usr/include/freetype2/" \ + --with-proj-share=/usr/share/proj \ + --with-geos \ + --with-sqlite \ + --with-fftw \ + --with-netcdf + +make +make install diff --git a/.github/workflows/build_centos.sh b/.github/workflows/build_centos.sh new file mode 100755 index 00000000000..ac156197386 --- /dev/null +++ b/.github/workflows/build_centos.sh @@ -0,0 +1,42 @@ +#!/usr/bin/env bash + +# The make step requires something like: +# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$PREFIX/lib" +# further steps additionally require: +# export PATH="$PATH:$PREFIX/bin" + +# fail on non-zero return code from a subprocess +set -e + +# print commands +set -x + +if [ -z "$1" ] +then + echo "Usage: $0 PREFIX" + exit 1 +fi + +# non-existent variables as an errors +set -u + +export INSTALL_PREFIX=$1 + +./configure \ + --prefix="$INSTALL_PREFIX/" \ + --without-freetype \ + --with-sqlite \ + --with-cairo --with-cairo-ldflags=-lfontconfig \ + --with-freetype --with-freetype-includes=/usr/include/freetype2 \ + --with-proj --with-proj-share=/usr/share/proj \ + --with-gdal=/usr/bin/gdal-config \ + --without-zstd \ + --without-tiff \ + --without-ffmpeg \ + --without-mysql \ + --without-postgres \ + --without-odbc \ + --without-fftw + +make +make install diff --git a/.github/workflows/centos.yml b/.github/workflows/centos.yml new file mode 100644 index 00000000000..de537be4969 --- /dev/null +++ b/.github/workflows/centos.yml @@ -0,0 +1,58 @@ +name: CentOS + +on: +- push +- pull_request + +jobs: + build: + name: ${{ matrix.os }} build + + runs-on: ubuntu-18.04 + container: ${{ matrix.os }} + strategy: + matrix: + os: + - centos:7 + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Get dependencies + run: | + yum install -y epel-release + yum install -y wget gawk + yum install -y $(cat .github/workflows/yum.txt) + - name: Install conda + run: | + wget https://repo.anaconda.com/archive/Anaconda3-2020.02-Linux-x86_64.sh + chmod u+x Anaconda3-2020.02-Linux-x86_64.sh + ./Anaconda3-2020.02-Linux-x86_64.sh -b + - name: Set variables with conda executable and activate + run: | + echo "::set-env name=CONDA::/github/home/anaconda3/bin/conda" + echo "::set-env name=CONDA_ACTIVATE::/github/home/anaconda3/bin/activate" + - name: Get GRASS GIS runtime conda dependencies + run: | + source $CONDA_ACTIVATE + $CONDA install -y -c anaconda numpy wxpython python-dateutil ply termcolor + - name: Create installation directory + run: | + mkdir $HOME/install + - name: Set number of cores for compilation + run: | + echo "::set-env name=MAKEFLAGS::-j$(nproc)" + - name: Set LD_LIBRARY_PATH for compilation + run: | + echo "::set-env name=LD_LIBRARY_PATH::$HOME/install/lib" + - name: Build + run: | + source $CONDA_ACTIVATE + .github/workflows/build_centos.sh $HOME/install + - name: Add the bin directory to PATH + run: | + echo "::add-path::$HOME/install/bin" + - name: Test executing of the grass command + run: | + source $CONDA_ACTIVATE + .github/workflows/test_simple.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000000..963579b4cc5 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,75 @@ +name: CI + +on: +- push +- pull_request + +jobs: + build: + name: ${{ matrix.os }} build + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Get dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y wget git gawk findutils + xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \ + sudo apt-get install -y --no-install-recommends --no-install-suggests + - name: Create installation directory + run: | + mkdir $HOME/install + - name: Ensure one core for compilation + run: | + echo "::set-env name=MAKEFLAGS::-j1" + - name: Set LD_LIBRARY_PATH for compilation + run: | + echo "::set-env name=LD_LIBRARY_PATH::$HOME/install/lib" + - name: Build + run: .github/workflows/build.sh $HOME/install + + test: + name: ${{ matrix.os }} tests + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - ubuntu-16.04 + - ubuntu-18.04 + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Get dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y wget git gawk findutils + xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \ + sudo apt-get install -y --no-install-recommends --no-install-suggests + - name: Create installation directory + run: | + mkdir $HOME/install + - name: Set number of cores for compilation + run: | + echo "::set-env name=MAKEFLAGS::-j$(nproc)" + - name: Set LD_LIBRARY_PATH for compilation + run: | + echo "::set-env name=LD_LIBRARY_PATH::$HOME/install/lib" + - name: Build + run: .github/workflows/build.sh $HOME/install + - name: Add the bin directory to PATH + run: | + echo "::add-path::$HOME/install/bin" + - name: Test executing of the grass command + run: .github/workflows/test_simple.sh + - name: Run tests + run: .github/workflows/test_thorough.sh diff --git a/.github/workflows/flake8.yml b/.github/workflows/flake8.yml new file mode 100644 index 00000000000..634312c9428 --- /dev/null +++ b/.github/workflows/flake8.yml @@ -0,0 +1,83 @@ +name: Python code quality check + +on: +- push +- pull_request + +jobs: + + flake8-lib-python: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install + run: | + python -m pip install --upgrade pip + pip install flake8==3.8.0 + - name: Run Flake8 + run: | + cd lib/python + flake8 --count --statistics --show-source --jobs=$(nproc) . + + flake8-wxgui: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install + run: | + python -m pip install --upgrade pip + pip install flake8==3.8.0 + - name: Run Flake8 + run: | + cd gui/wxpython + flake8 --count --statistics --show-source --jobs=$(nproc) . + + flake8-scripts: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install + run: | + python -m pip install --upgrade pip + pip install flake8==3.8.0 + - name: Run Flake8 + run: | + cd scripts + flake8 --count --statistics --show-source --jobs=$(nproc) . + + flake8-temporal-modules: + + runs-on: ubuntu-18.04 + + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: 3.8 + - name: Install + run: | + python -m pip install --upgrade pip + pip install flake8==3.8.0 + - name: Run Flake8 + run: | + cd temporal + flake8 --count --statistics --show-source --jobs=$(nproc) . diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml new file mode 100644 index 00000000000..1e30e3e1b73 --- /dev/null +++ b/.github/workflows/gcc.yml @@ -0,0 +1,47 @@ +name: GCC C/C++ standards check + +on: +- push +- pull_request + +jobs: + build: + name: ${{ matrix.c }} & ${{ matrix.cpp }} + + runs-on: ubuntu-18.04 + strategy: + matrix: + c: + - gnu99 + - gnu11 + # - gnu17 # not available in Ubuntu 18.04 + cpp: + - c++11 + - c++14 + - c++17 + fail-fast: false + + steps: + - uses: actions/checkout@v2 + - name: Get dependencies + run: | + sudo apt-get update -y + sudo apt-get install -y wget git gawk findutils + xargs -a <(awk '! /^ *(#|$)/' ".github/workflows/apt.txt") -r -- \ + sudo apt-get install -y --no-install-recommends --no-install-suggests + - name: Create installation directory + run: | + mkdir $HOME/install + - name: Ensure one core for compilation + run: | + echo "::set-env name=MAKEFLAGS::-j1" + - name: Set LD_LIBRARY_PATH for compilation + run: | + echo "::set-env name=LD_LIBRARY_PATH::$HOME/install/lib" + - name: Build + env: + # TODO: -pedantic-errors here won't go through ./configure (with GNU C) + CFLAGS: "-std=${{ matrix.c }}" + # TODO: -pedantic-errors here won't compile + CXXFLAGS: "-std=${{ matrix.cpp }}" + run: .github/workflows/build.sh $HOME/install diff --git a/.github/workflows/test_simple.sh b/.github/workflows/test_simple.sh new file mode 100755 index 00000000000..74ed4e2eaaa --- /dev/null +++ b/.github/workflows/test_simple.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +# fail on non-zero return code from a subprocess +set -e + +grass79 --tmp-location EPSG:4326 --exec g.region res=0.1 -p diff --git a/.github/workflows/test_thorough.sh b/.github/workflows/test_thorough.sh new file mode 100755 index 00000000000..0a21e4ae0f5 --- /dev/null +++ b/.github/workflows/test_thorough.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +# fail on non-zero return code from a subprocess +set -e + +grass79 --tmp-location XY --exec \ + g.extension g.download.location +grass79 --tmp-location XY --exec \ + g.download.location url=http://fatra.cnr.ncsu.edu/data/nc_spm_full_v2alpha2.tar.gz dbase=$HOME + +grass79 --tmp-location XY --exec \ + python3 -m grass.gunittest.main \ + --grassdata $HOME --location nc_spm_full_v2alpha2 --location-type nc \ + --min-success 80 diff --git a/.github/workflows/yum.txt b/.github/workflows/yum.txt new file mode 100644 index 00000000000..c7620403dd6 --- /dev/null +++ b/.github/workflows/yum.txt @@ -0,0 +1,37 @@ +atlas-devel +bison +blas-devel +cairo-devel +fftw-devel +flex +gcc-c++ +gdal +gdal-devel +geos +geos-devel +gettext +lapack-devel +lesstif-devel +libpng-devel +libtiff-devel +libX11-devel +libxml2 +libXmu-devel +make +mesa-libGL-devel +mesa-libGLU-devel +netcdf +netcdf-devel +numpy +proj +proj-devel +proj-epsg +proj-nad +python-dateutil +python-devel +python-imaging +python-matplotlib +sqlite-devel +wxGTK-devel +wxPython +zlib-devel diff --git a/.travis.yml b/.travis.yml index 409b92c70d9..1036743caec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -37,12 +37,4 @@ after_success: - bash < (curl -s https://codecov.io/bash) notifications: - email: - recipients: - - grass-dev@lists.osgeo.org - - landa.martin@gmail.com - - wenzeslaus@gmail.com - on_success: change - on_failure: always irc: "chat.freenode.net#grass" - diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2ce534c83cf..2f1e7e1f1d0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -3,14 +3,15 @@ ## Contributions other than code There is more than one way of contributing, see full list at -https://grass.osgeo.org/get-involved/. +. In the rest of this document, we will focus on contributions centered around the GRASS GIS source code. -## Reporting issues and suggesting features and changes +## Reporting issues and suggesting features -* Get an OSGeo Services UserID (http://www.osgeo.org/osgeo_userid). -* Got to https://trac.osgeo.org/grass/#BugTracking and follow instructions there. +To report an issue or to suggest features or a change, +[open an issue](https://github.com/OSGeo/grass/issues/new/choose) +on GitHub. ## Changing code and documentation @@ -44,7 +45,8 @@ cd grass/ git remote add upstream https://github.com/OSGeo/grass ``` -* Your remotes now should be "origin" which is your fork and "upstream" which is this main GRASS GIS repository. You can confirm that using: +* Your remotes now should be "origin" which is your fork and "upstream" which + is this main GRASS GIS repository. You can confirm that using: ``` git remote -v @@ -83,7 +85,8 @@ git rebase upstream/master ### Update if you have local branches -If `rebase` fails with "error: cannot rebase: You have unstaged changes...", then move your uncommitted local changes to "stash" using: +If `rebase` fails with "error: cannot rebase: You have unstaged changes...", +then move your uncommitted local changes to "stash" using: ``` git stash @@ -123,7 +126,7 @@ git checkout -b new-feature You can use your favorite tools to change source code or other files in the local copy of the code. When make changes, please follow Submitting Guidelines at -http://trac.osgeo.org/grass/wiki/Submitting. +. ### Committing @@ -134,10 +137,10 @@ git add file1 git add file2 ``` -* Commit the change: +* Commit the change (first word is the module name): ``` -git commit -m "Added a new feature" +git commit -m "module: added a new feature" ``` ### Pushing changes to GitHub @@ -171,4 +174,4 @@ the maintainers will decide if it is more appropriate to: ### Further notes GRASS GIS maintainers use additional workflows besides the one described -above. These are detailed at https://trac.osgeo.org/grass/wiki/HowToGit +above. These are detailed at diff --git a/Dockerfile b/Dockerfile index 2a468a2426f..aaf0cfcaf86 100644 --- a/Dockerfile +++ b/Dockerfile @@ -59,6 +59,8 @@ RUN apt-get update \ python3-ply \ python3-six \ python3-wxgtk4.0 \ + python3-gdal \ + python3-matplotlib \ sqlite3 \ subversion \ unixodbc-dev \ diff --git a/INSTALL b/INSTALL index 5d9e34884ef..1a6af9a82bb 100644 --- a/INSTALL +++ b/INSTALL @@ -316,6 +316,6 @@ https://trac.osgeo.org/grass/wiki/Submitting https://grass.osgeo.org/documentation/first-time-users/ ------------------ -(C) 1999-2019 by The GRASS Development Team +(C) 1999-2020 by The GRASS Development Team Last changed: $Date$ diff --git a/README.md b/README.md index 4fa971ca713..3af8b967917 100644 --- a/README.md +++ b/README.md @@ -9,22 +9,22 @@ a Geographic Information System used for geospatial data management and analysis, image processing, graphics/map production, spatial modeling, and visualization. -## How to get write access here? +## How to get write access here In general: you don't really need write access as you can simply open a [pull request](https://github.com/OSGeo/grass/pulls) to contribute to -GRASS GIS. +GRASS GIS. See [CONTRIBUTING file](CONTRIBUTING.md) for more details. Want to become a core developer? See [Procedure for gaining Git write access](https://trac.osgeo.org/grass/wiki/HowToContribute#WriteaccesstotheGRASScorerepository) -## How to compile GRASS? +## How to compile GRASS > See INSTALL file. -Yes, you should really read INSTALL. +Yes, you should really read [INSTALL](INSTALL). -## How to generate the 'Programmer's Manual'? +## How to generate the 'Programmer's Manual' This needs doxygen () and optionally Graphviz dot (). @@ -71,17 +71,20 @@ source code): docker build -t grassgis79 . ``` -A test run (assuming you have existing GRASS GIS location; it can be downloaded from +A test run (assuming you have existing GRASS GIS location; it can be +downloaded from [here](https://grass.osgeo.org/sampledata/north_carolina/nc_basic_spm_grass7.zip)) ``` # case 1: launching in the grassdata directory in which the location is stored: -docker run -it --rm --user=$(id -u):$(id -g) --volume $(pwd):/data --env HOME=/data/ grassgis79 \ - grass --text nc_basic_spm_grass7/user1 --exec g.region -p +docker run -it --rm --user=$(id -u):$(id -g) --volume $(pwd):/data \ + --env HOME=/data/ grassgis79 grass --text nc_basic_spm_grass7/user1 \ + --exec g.region -p # case 2: launching anywhere -docker run -it --rm --user=$(id -u):$(id -g) --volume /your/test/grassdata/:/data --env HOME=/data/ grassgis79 \ - grass /data/nc_basic_spm_grass7/PERMANENT --exec g.region -p +docker run -it --rm --user=$(id -u):$(id -g) \ + --volume /your/test/grassdata/:/data --env HOME=/data/ grassgis79 \ + grass /data/nc_basic_spm_grass7/PERMANENT --exec g.region -p ``` Note that the first `grassgis79` is the name of the image while the second @@ -90,10 +93,11 @@ Note that the first `grassgis79` is the name of the image while the second To run the tests (again assuming local location): ``` -docker run -it --rm --user=$(id -u):$(id -g) --volume /your/test/grassdata/:/data --env HOME=/data/ -w /code/grass \ - grassgis79 grass /data/nc_basic_spm_grass7/PERMANENT --exec \ - python -m grass.gunittest.main \ - --location nc_basic_spm_grass7 --location-type nc +docker run -it --rm --user=$(id -u):$(id -g) \ + --volume /your/test/grassdata/:/data --env HOME=/data/ -w /code/grass \ + grassgis79 grass /data/nc_basic_spm_grass7/PERMANENT --exec \ + python -m grass.gunittest.main \ + --location nc_basic_spm_grass7 --location-type nc ``` Note: If you compiled locally before building the Docker image, you may diff --git a/REQUIREMENTS.html b/REQUIREMENTS.html index 069f81e4bcc..214a59822e2 100644 --- a/REQUIREMENTS.html +++ b/REQUIREMENTS.html @@ -233,7 +233,7 @@

Note:


-© GRASS Development Team 1997-2019 +© GRASS Development Team 1997-2020

Please report bugs here:
https://grass.osgeo.org/development/bug-tracking/ diff --git a/aclocal.m4 b/aclocal.m4 index b9f2487ee2a..1e08f34718c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -510,7 +510,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ *-apple-darwin*) SHLIB_CFLAGS="-fno-common" SHLIB_SUFFIX=".dylib" - SHLIB_LD="cc -dynamiclib -compatibility_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -current_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -install_name \${INST_DIR}/lib/lib\${LIB_NAME}\${SHLIB_SUFFIX}" + SHLIB_LD="${CC} -dynamiclib -compatibility_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -current_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -install_name \${INST_DIR}/lib/lib\${LIB_NAME}\${SHLIB_SUFFIX}" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" ;; *-sun-solaris*) @@ -561,6 +561,7 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [ SHLIB_CFLAGS="-fPIC" #SHLIB_LD="ld -Bshareable -x" SHLIB_LD="${CC} -shared" + SHLIB_LD_FLAGS="-Wl,-soname,\$(notdir \$[@])" SHLIB_SUFFIX=".so" LDFLAGS="-export-dynamic" #LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' diff --git a/configure b/configure index 2a5f8af1703..0b5f1e97c24 100755 --- a/configure +++ b/configure @@ -1311,10 +1311,14 @@ LIB_VER=`echo ${GRASS_VERSION_NUMBER} | sed 's/^\([0-9.]*\).*$/\1/'` GRASS_VERSION_GIT="exported" +# get git short hash + date of last change in GRASS headers +# (and anything else in include) +GRASS_HEADERS_GIT_HASH=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'` +GRASS_HEADERS_GIT_DATE=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'` # Extract the first word of "git", so it can be a program name with args. set dummy git; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1318: checking for $ac_word" >&5 +echo "configure:1322: checking for $ac_word" >&5 case "$GIT" in /*) @@ -1349,6 +1353,14 @@ if test "$GIT" != "no" ; then if test -z "$GRASS_VERSION_GIT"; then GRASS_VERSION_GIT="exported" fi + GRASS_HEADERS_GIT_HASH=`$GIT log -1 --pretty=format:"%h" -- "${SRCDIR}/include" 2>/dev/null` + if test -z "$GRASS_HEADERS_GIT_HASH"; then + GRASS_HEADERS_GIT_HASH=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'` + fi + GRASS_HEADERS_GIT_DATE=`date -d $($GIT log -1 --pretty=format:"%cI" -- "${SRCDIR}/include") -u +%FT%T%z | sed 's/\(..\)$/:\1/'` 2>/dev/null + if test -z "$GRASS_HEADERS_GIT_DATE"; then + GRASS_HEADERS_GIT_DATE=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'` + fi fi @@ -1361,6 +1373,8 @@ fi + + # Check for MacOSX App # Check whether --enable-macosx-app or --disable-macosx-app was given. @@ -1373,7 +1387,7 @@ fi echo $ac_n "checking for MacOSX App""... $ac_c" 1>&6 -echo "configure:1377: checking for MacOSX App" >&5 +echo "configure:1391: checking for MacOSX App" >&5 case "$enable_macosx_app" in yes) MACOSX_APP=1 ;; no) MACOSX_APP= ;; @@ -1385,7 +1399,7 @@ echo "$ac_t"""$enable_macosx_app"" 1>&6 # Check for MacOSX archs echo $ac_n "checking for MacOSX architectures""... $ac_c" 1>&6 -echo "configure:1389: checking for MacOSX architectures" >&5 +echo "configure:1403: checking for MacOSX architectures" >&5 MACOSX_ARCHS= @@ -1414,7 +1428,7 @@ fi # Check for MacOSX SDK echo $ac_n "checking for MacOSX SDK""... $ac_c" 1>&6 -echo "configure:1418: checking for MacOSX SDK" >&5 +echo "configure:1432: checking for MacOSX SDK" >&5 MACOSX_SDK= @@ -1424,7 +1438,7 @@ else ac_safe=`echo "$with_macosx_sdk/SDKSettings.plist" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $with_macosx_sdk/SDKSettings.plist""... $ac_c" 1>&6 -echo "configure:1428: checking for $with_macosx_sdk/SDKSettings.plist" >&5 +echo "configure:1442: checking for $with_macosx_sdk/SDKSettings.plist" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; } @@ -1468,7 +1482,7 @@ fi echo $ac_n "checking how to build libraries""... $ac_c" 1>&6 -echo "configure:1472: checking how to build libraries" >&5 +echo "configure:1486: checking how to build libraries" >&5 # Check whether --enable-shared or --disable-shared was given. if test "${enable_shared+set}" = set; then enableval="$enable_shared" @@ -1540,7 +1554,7 @@ ac_save_ldflags="$LDFLAGS" *-apple-darwin*) SHLIB_CFLAGS="-fno-common" SHLIB_SUFFIX=".dylib" - SHLIB_LD="cc -dynamiclib -compatibility_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -current_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -install_name \${INST_DIR}/lib/lib\${LIB_NAME}\${SHLIB_SUFFIX}" + SHLIB_LD="${CC} -dynamiclib -compatibility_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -current_version \${GRASS_VERSION_MAJOR}.\${GRASS_VERSION_MINOR} -install_name \${INST_DIR}/lib/lib\${LIB_NAME}\${SHLIB_SUFFIX}" LD_LIBRARY_PATH_VAR="DYLD_LIBRARY_PATH" ;; *-sun-solaris*) @@ -1603,6 +1617,7 @@ EOF SHLIB_CFLAGS="-fPIC" #SHLIB_LD="ld -Bshareable -x" SHLIB_LD="${CC} -shared" + SHLIB_LD_FLAGS="-Wl,-soname,\$(notdir \$@)" SHLIB_SUFFIX=".so" LDFLAGS="-export-dynamic" #LD_SEARCH_FLAGS='-rpath ${LIB_RUNTIME_DIR}' @@ -2401,7 +2416,7 @@ fi # Done checking fortran echo $ac_n "checking for additional include dirs""... $ac_c" 1>&6 -echo "configure:2405: checking for additional include dirs" >&5 +echo "configure:2420: checking for additional include dirs" >&5 case "$with_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to list --with-includes." 1>&2; exit 1; } @@ -2424,7 +2439,7 @@ fi # With libs option echo $ac_n "checking for additional library dirs""... $ac_c" 1>&6 -echo "configure:2428: checking for additional library dirs" >&5 +echo "configure:2443: checking for additional library dirs" >&5 case "$with_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory list to --with-libs." 1>&2; exit 1; } @@ -2458,7 +2473,7 @@ fi # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:2462: checking for a BSD compatible install" >&5 +echo "configure:2477: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" @@ -2511,7 +2526,7 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' # Extract the first word of "flex", so it can be a program name with args. set dummy flex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2515: checking for $ac_word" >&5 +echo "configure:2530: checking for $ac_word" >&5 if test -n "$LEX"; then ac_cv_prog_LEX="$LEX" # Let the user override the test. @@ -2542,13 +2557,13 @@ then *) ac_lib=l ;; esac echo $ac_n "checking for yywrap in -l$ac_lib""... $ac_c" 1>&6 -echo "configure:2546: checking for yywrap in -l$ac_lib" >&5 +echo "configure:2561: checking for yywrap in -l$ac_lib" >&5 ac_lib_var=`echo $ac_lib'_'yywrap | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-l$ac_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2584,7 +2599,7 @@ if test "$LEX" = "lex"; then # Extract the first word of "lex", so it can be a program name with args. set dummy lex; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2588: checking for $ac_word" >&5 +echo "configure:2603: checking for $ac_word" >&5 case "$LEXPATH" in /*) @@ -2624,7 +2639,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2628: checking for $ac_word" >&5 +echo "configure:2643: checking for $ac_word" >&5 if test -n "$YACC"; then ac_cv_prog_YACC="$YACC" # Let the user override the test. @@ -2655,7 +2670,7 @@ if test "$YACC" = "yacc"; then # Extract the first word of "yacc", so it can be a program name with args. set dummy yacc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2659: checking for $ac_word" >&5 +echo "configure:2674: checking for $ac_word" >&5 case "$YACCPATH" in /*) @@ -2693,7 +2708,7 @@ fi # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2697: checking for $ac_word" >&5 +echo "configure:2712: checking for $ac_word" >&5 if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. @@ -2722,7 +2737,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2726: checking for $ac_word" >&5 +echo "configure:2741: checking for $ac_word" >&5 if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. @@ -2753,7 +2768,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2757: checking for $ac_word" >&5 +echo "configure:2772: checking for $ac_word" >&5 if test -n "$ENV"; then ac_cv_prog_ENV="$ENV" # Let the user override the test. @@ -2782,7 +2797,7 @@ done # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:2786: checking for $ac_word" >&5 +echo "configure:2801: checking for $ac_word" >&5 case "$PERL" in /*) @@ -2813,7 +2828,7 @@ else fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:2817: checking how to run the C preprocessor" >&5 +echo "configure:2832: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -2826,13 +2841,13 @@ if test -z "$CPP"; then # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2851: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2843,13 +2858,13 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2853: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2868: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2860,13 +2875,13 @@ else rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2870: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2885: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -2890,10 +2905,10 @@ fi echo "$ac_t""$CPP" 1>&6 echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:2894: checking for ANSI C header files" >&5 +echo "configure:2909: checking for ANSI C header files" >&5 cat > conftest.$ac_ext < #include @@ -2901,7 +2916,7 @@ cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:2905: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:2920: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -2918,7 +2933,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2936,7 +2951,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -2957,7 +2972,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -2968,7 +2983,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:2972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2987: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -2995,15 +3010,15 @@ for ac_hdr in limits.h termio.h termios.h unistd.h values.h f2c.h g2c.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:2999: checking for $ac_hdr" >&5 +echo "configure:3014: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3007: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3022: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3032,15 +3047,15 @@ for ac_hdr in sys/ioctl.h sys/mtio.h sys/resource.h sys/time.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3036: checking for $ac_hdr" >&5 +echo "configure:3051: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3044: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3059: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3069,15 +3084,15 @@ for ac_hdr in sys/timeb.h sys/types.h sys/utsname.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3073: checking for $ac_hdr" >&5 +echo "configure:3088: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3096: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3106,15 +3121,15 @@ for ac_hdr in libintl.h iconv.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3110: checking for $ac_hdr" >&5 +echo "configure:3125: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3118: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3133: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3143,15 +3158,15 @@ for ac_hdr in langinfo.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3147: checking for $ac_hdr" >&5 +echo "configure:3162: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3155: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3170: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3177,10 +3192,10 @@ fi done echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3181: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:3196: checking whether time.h and sys/time.h may both be included" >&5 cat > conftest.$ac_ext < #include @@ -3189,7 +3204,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3193: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3208: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3209,10 +3224,10 @@ EOF fi echo $ac_n "checking for off_t""... $ac_c" 1>&6 -echo "configure:3213: checking for off_t" >&5 +echo "configure:3228: checking for off_t" >&5 cat > conftest.$ac_ext < #if STDC_HEADERS @@ -3239,10 +3254,10 @@ EOF fi echo $ac_n "checking for uid_t in sys/types.h""... $ac_c" 1>&6 -echo "configure:3243: checking for uid_t in sys/types.h" >&5 +echo "configure:3258: checking for uid_t in sys/types.h" >&5 cat > conftest.$ac_ext < EOF @@ -3270,10 +3285,10 @@ EOF fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3274: checking return type of signal handlers" >&5 +echo "configure:3289: checking return type of signal handlers" >&5 cat > conftest.$ac_ext < #include @@ -3290,7 +3305,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3294: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3309: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3308,10 +3323,10 @@ EOF echo $ac_n "checking for Cygwin environment""... $ac_c" 1>&6 -echo "configure:3312: checking for Cygwin environment" >&5 +echo "configure:3327: checking for Cygwin environment" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3341: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_cygwin=yes else @@ -3340,10 +3355,10 @@ test "$ac_cv_cygwin" = yes && CYGWIN=yes for ac_func in ftime gethostname gettimeofday lseek nice time uname do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3344: checking for $ac_func" >&5 +echo "configure:3359: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3392,10 +3407,10 @@ done for ac_func in seteuid setpriority setreuid setruid do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3396: checking for $ac_func" >&5 +echo "configure:3411: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3437: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3444,10 +3459,10 @@ done for ac_func in drand48 do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3448: checking for $ac_func" >&5 +echo "configure:3463: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3496,10 +3511,10 @@ done for ac_func in putenv setenv do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3500: checking for $ac_func" >&5 +echo "configure:3515: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3541: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3548,10 +3563,10 @@ done for ac_func in nanosleep do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3552: checking for $ac_func" >&5 +echo "configure:3567: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3599,13 +3614,13 @@ done if test "$cross_compiling" != "yes" ; then echo $ac_n "checking whether setpgrp takes no argument""... $ac_c" 1>&6 -echo "configure:3603: checking whether setpgrp takes no argument" >&5 +echo "configure:3618: checking whether setpgrp takes no argument" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: cannot check setpgrp if cross compiling" 1>&2; exit 1; } else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3644: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then ac_cv_func_setpgrp_void=no else @@ -3653,16 +3668,16 @@ CROSS_COMPILING=1 fi echo $ac_n "checking for long long int""... $ac_c" 1>&6 -echo "configure:3657: checking for long long int" >&5 +echo "configure:3672: checking for long long int" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3681: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -3682,16 +3697,16 @@ fi rm -f conftest* echo $ac_n "checking for int64_t""... $ac_c" 1>&6 -echo "configure:3686: checking for int64_t" >&5 +echo "configure:3701: checking for int64_t" >&5 cat > conftest.$ac_ext < int main() { int64_t x; ; return 0; } EOF -if { (eval echo configure:3695: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3710: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* echo "$ac_t""yes" 1>&6 @@ -3711,7 +3726,7 @@ fi rm -f conftest* echo $ac_n "checking for W11""... $ac_c" 1>&6 -echo "configure:3715: checking for W11" >&5 +echo "configure:3730: checking for W11" >&5 case "$enable_w11" in yes|no) echo "$ac_t"""$enable_w11"" 1>&6 ;; *) { echo "configure: error: *** You must answer yes or no." 1>&2; exit 1; } ;; @@ -3739,7 +3754,7 @@ else # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:3743: checking for X" >&5 +echo "configure:3758: checking for X" >&5 # Check whether --with-x or --without-x was given. if test "${with_x+set}" = set; then @@ -3799,12 +3814,12 @@ if test "$ac_x_includes" = NO; then # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3808: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3823: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3873,14 +3888,14 @@ if test "$ac_x_libraries" = NO; then ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -3985,17 +4000,17 @@ else case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:3989: checking whether -R must be followed by a space" >&5 +echo "configure:4004: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4014: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -4011,14 +4026,14 @@ rm -f conftest* else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -4050,13 +4065,13 @@ rm -f conftest* # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:4054: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:4069: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4086: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4088,13 +4103,13 @@ fi if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:4092: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:4107: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4124: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4133,10 +4148,10 @@ fi # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:4137: checking for gethostbyname" >&5 +echo "configure:4152: checking for gethostbyname" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4178: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -4179,13 +4194,13 @@ fi if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:4183: checking for gethostbyname in -lnsl" >&5 +echo "configure:4198: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4215: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4225,10 +4240,10 @@ fi # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:4229: checking for connect" >&5 +echo "configure:4244: checking for connect" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4270: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -4271,13 +4286,13 @@ fi if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:4275: checking for connect in -lsocket" >&5 +echo "configure:4290: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4307: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4311,10 +4326,10 @@ fi # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:4315: checking for remove" >&5 +echo "configure:4330: checking for remove" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -4357,13 +4372,13 @@ fi if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:4361: checking for remove in -lposix" >&5 +echo "configure:4376: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4397,10 +4412,10 @@ fi # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:4401: checking for shmat" >&5 +echo "configure:4416: checking for shmat" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4442: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -4443,13 +4458,13 @@ fi if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:4447: checking for shmat in -lipc" >&5 +echo "configure:4462: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4479: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4492,13 +4507,13 @@ fi # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:4496: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:4511: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4528: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4549,12 +4564,12 @@ ac_save_libs="$LIBS" LIBS="" echo $ac_n "checking for library containing cuserid""... $ac_c" 1>&6 -echo "configure:4553: checking for library containing cuserid" >&5 +echo "configure:4568: checking for library containing cuserid" >&5 ac_func_search_save_LIBS="$LIBS" ac_cv_search_cuserid="no" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4584: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_cuserid="none required" else @@ -4576,7 +4591,7 @@ rm -f conftest* test "$ac_cv_search_cuserid" = "no" && for i in compat; do LIBS="-l$i $ac_func_search_save_LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4606: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_search_cuserid="-l$i" break @@ -4613,10 +4628,10 @@ LIBS="$ac_save_libs" for ac_func in asprintf do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4617: checking for $ac_func" >&5 +echo "configure:4632: checking for $ac_func" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4666,10 +4681,10 @@ done # Test if mathlib needs -lm flag or is included with libc echo $ac_n "checking for atan""... $ac_c" 1>&6 -echo "configure:4670: checking for atan" >&5 +echo "configure:4685: checking for atan" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4711: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_atan=yes" else @@ -4710,13 +4725,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for atan in -lm""... $ac_c" 1>&6 -echo "configure:4714: checking for atan in -lm" >&5 +echo "configure:4729: checking for atan in -lm" >&5 ac_lib_var=`echo m'_'atan | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4746: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4754,10 +4769,10 @@ fi echo $ac_n "checking for dlsym""... $ac_c" 1>&6 -echo "configure:4758: checking for dlsym" >&5 +echo "configure:4773: checking for dlsym" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dlsym=yes" else @@ -4798,13 +4813,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dlsym in -ldl""... $ac_c" 1>&6 -echo "configure:4802: checking for dlsym in -ldl" >&5 +echo "configure:4817: checking for dlsym in -ldl" >&5 ac_lib_var=`echo dl'_'dlsym | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ldl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4834: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4842,10 +4857,10 @@ fi echo $ac_n "checking for iconv""... $ac_c" 1>&6 -echo "configure:4846: checking for iconv" >&5 +echo "configure:4861: checking for iconv" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4887: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_iconv=yes" else @@ -4886,13 +4901,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for iconv in -liconv""... $ac_c" 1>&6 -echo "configure:4890: checking for iconv in -liconv" >&5 +echo "configure:4905: checking for iconv in -liconv" >&5 ac_lib_var=`echo iconv'_'iconv | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-liconv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4922: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4922,13 +4937,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for iconv in -lgiconv""... $ac_c" 1>&6 -echo "configure:4926: checking for iconv in -lgiconv" >&5 +echo "configure:4941: checking for iconv in -lgiconv" >&5 ac_lib_var=`echo giconv'_'iconv | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lgiconv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4958,10 +4973,10 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for libiconv""... $ac_c" 1>&6 -echo "configure:4962: checking for libiconv" >&5 +echo "configure:4977: checking for libiconv" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5003: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_libiconv=yes" else @@ -5002,13 +5017,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for libiconv in -liconv""... $ac_c" 1>&6 -echo "configure:5006: checking for libiconv in -liconv" >&5 +echo "configure:5021: checking for libiconv in -liconv" >&5 ac_lib_var=`echo iconv'_'libiconv | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-liconv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5038,13 +5053,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for libiconv in -lgiconv""... $ac_c" 1>&6 -echo "configure:5042: checking for libiconv in -lgiconv" >&5 +echo "configure:5057: checking for libiconv in -lgiconv" >&5 ac_lib_var=`echo giconv'_'libiconv | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lgiconv $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5092,10 +5107,10 @@ fi have_socket=1 echo $ac_n "checking for socket""... $ac_c" 1>&6 -echo "configure:5096: checking for socket" >&5 +echo "configure:5111: checking for socket" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5137: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_socket=yes" else @@ -5136,13 +5151,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:5140: checking for socket in -lsocket" >&5 +echo "configure:5155: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5201,7 +5216,7 @@ ZLIB= echo $ac_n "checking for location of zlib includes""... $ac_c" 1>&6 -echo "configure:5205: checking for location of zlib includes" >&5 +echo "configure:5220: checking for location of zlib includes" >&5 case "$with_zlib_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-zlib-includes." 1>&2; exit 1; } @@ -5227,15 +5242,15 @@ for ac_hdr in zlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5231: checking for $ac_hdr" >&5 +echo "configure:5246: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5239: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5254: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5269,7 +5284,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of zlib library""... $ac_c" 1>&6 -echo "configure:5273: checking for location of zlib library" >&5 +echo "configure:5288: checking for location of zlib library" >&5 case "$with_zlib_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-zlib-libs." 1>&2; exit 1; } @@ -5294,13 +5309,13 @@ LDFLAGS="$ZLIBLIBPATH $LDFLAGS" echo $ac_n "checking for deflate in -lz""... $ac_c" 1>&6 -echo "configure:5298: checking for deflate in -lz" >&5 +echo "configure:5313: checking for deflate in -lz" >&5 ac_lib_var=`echo z'_'deflate | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lz $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5330: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5357,7 +5372,7 @@ BZIP2LIB= echo $ac_n "checking whether to use bzlib""... $ac_c" 1>&6 -echo "configure:5361: checking whether to use bzlib" >&5 +echo "configure:5376: checking whether to use bzlib" >&5 echo "$ac_t"""$with_bzlib"" 1>&6 case "$with_bzlib" in "no") USE_BZIP2= ;; @@ -5373,7 +5388,7 @@ if test -n "$USE_BZIP2"; then echo $ac_n "checking for location of bzlib includes""... $ac_c" 1>&6 -echo "configure:5377: checking for location of bzlib includes" >&5 +echo "configure:5392: checking for location of bzlib includes" >&5 case "$with_bzlib_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-bzlib-includes." 1>&2; exit 1; } @@ -5399,15 +5414,15 @@ for ac_hdr in bzlib.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5403: checking for $ac_hdr" >&5 +echo "configure:5418: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5411: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5426: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5441,7 +5456,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of bzlib library""... $ac_c" 1>&6 -echo "configure:5445: checking for location of bzlib library" >&5 +echo "configure:5460: checking for location of bzlib library" >&5 case "$with_bzlib_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-bzlib-libs." 1>&2; exit 1; } @@ -5466,13 +5481,13 @@ LDFLAGS="$BZIP2LIBPATH $LDFLAGS" echo $ac_n "checking for BZ2_bzBuffToBuffCompress in -lbz2""... $ac_c" 1>&6 -echo "configure:5470: checking for BZ2_bzBuffToBuffCompress in -lbz2" >&5 +echo "configure:5485: checking for BZ2_bzBuffToBuffCompress in -lbz2" >&5 ac_lib_var=`echo bz2'_'BZ2_bzBuffToBuffCompress | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lbz2 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5502: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5531,7 +5546,7 @@ ZSTDLIB= echo $ac_n "checking whether to use zstd""... $ac_c" 1>&6 -echo "configure:5535: checking whether to use zstd" >&5 +echo "configure:5550: checking whether to use zstd" >&5 echo "$ac_t"""$with_zstd"" 1>&6 case "$with_zstd" in "no") USE_ZSTD= ;; @@ -5547,7 +5562,7 @@ if test -n "$USE_ZSTD"; then echo $ac_n "checking for location of zstd includes""... $ac_c" 1>&6 -echo "configure:5551: checking for location of zstd includes" >&5 +echo "configure:5566: checking for location of zstd includes" >&5 case "$with_zstd_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-zstd-includes." 1>&2; exit 1; } @@ -5572,15 +5587,15 @@ for ac_hdr in zstd.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5576: checking for $ac_hdr" >&5 +echo "configure:5591: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5584: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5599: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5614,7 +5629,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of zstd library""... $ac_c" 1>&6 -echo "configure:5618: checking for location of zstd library" >&5 +echo "configure:5633: checking for location of zstd library" >&5 case "$with_zstd_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-zstd-libs." 1>&2; exit 1; } @@ -5639,13 +5654,13 @@ LDFLAGS="$ZSTDLIBPATH $LDFLAGS" echo $ac_n "checking for ZSTD_compress in -lzstd""... $ac_c" 1>&6 -echo "configure:5643: checking for ZSTD_compress in -lzstd" >&5 +echo "configure:5658: checking for ZSTD_compress in -lzstd" >&5 ac_lib_var=`echo zstd'_'ZSTD_compress | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lzstd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5675: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -5708,7 +5723,7 @@ PROJMAJOR=4 echo $ac_n "checking for location of External PROJ includes""... $ac_c" 1>&6 -echo "configure:5712: checking for location of External PROJ includes" >&5 +echo "configure:5727: checking for location of External PROJ includes" >&5 case "$with_proj_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-proj-includes." 1>&2; exit 1; } @@ -5735,15 +5750,15 @@ for ac_hdr in proj.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:5739: checking for $ac_hdr" >&5 +echo "configure:5754: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:5747: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:5762: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -5775,7 +5790,7 @@ CPPFLAGS=$ac_save_cppflags if test $PROJ4API = 0 ; then echo $ac_n "checking External PROJ major version""... $ac_c" 1>&6 -echo "configure:5779: checking External PROJ major version" >&5 +echo "configure:5794: checking External PROJ major version" >&5 ac_save_cppflags="$CPPFLAGS" CPPFLAGS="$PROJINC $CPPFLAGS" if test "$cross_compiling" = yes; then @@ -5783,7 +5798,7 @@ if test "$cross_compiling" = yes; then echo "$ac_t""unknown (cross-compiling)" 1>&6 else cat > conftest.$ac_ext < @@ -5795,7 +5810,7 @@ int main(void) { } EOF -if { (eval echo configure:5799: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5814: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then proj_ver_major=`cat conftestdata` echo "$ac_t""$proj_ver_major" 1>&6 @@ -5812,7 +5827,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking External PROJ minor version""... $ac_c" 1>&6 -echo "configure:5816: checking External PROJ minor version" >&5 +echo "configure:5831: checking External PROJ minor version" >&5 ac_save_cppflags="$CPPFLAGS" CPPFLAGS="$PROJINC $CPPFLAGS" if test "$cross_compiling" = yes; then @@ -5820,7 +5835,7 @@ if test "$cross_compiling" = yes; then echo "$ac_t""unknown (cross-compiling)" 1>&6 else cat > conftest.$ac_ext < @@ -5832,7 +5847,7 @@ int main(void) { } EOF -if { (eval echo configure:5836: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5851: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then proj_ver_minor=`cat conftestdata` echo "$ac_t""$proj_ver_minor" 1>&6 @@ -5849,7 +5864,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking External PROJ patch version""... $ac_c" 1>&6 -echo "configure:5853: checking External PROJ patch version" >&5 +echo "configure:5868: checking External PROJ patch version" >&5 ac_save_cppflags="$CPPFLAGS" CPPFLAGS="$PROJINC $CPPFLAGS" if test "$cross_compiling" = yes; then @@ -5857,7 +5872,7 @@ if test "$cross_compiling" = yes; then echo "$ac_t""unknown (cross-compiling)" 1>&6 else cat > conftest.$ac_ext < @@ -5869,7 +5884,7 @@ int main(void) { } EOF -if { (eval echo configure:5873: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then proj_ver_patch=`cat conftestdata` echo "$ac_t""$proj_ver_patch" 1>&6 @@ -5894,7 +5909,7 @@ CPPFLAGS=$ac_save_cppflags else echo $ac_n "checking External PROJ.4 version""... $ac_c" 1>&6 -echo "configure:5898: checking External PROJ.4 version" >&5 +echo "configure:5913: checking External PROJ.4 version" >&5 ac_save_cppflags="$CPPFLAGS" CPPFLAGS="$PROJINC $CPPFLAGS" if test "$cross_compiling" = yes; then @@ -5902,7 +5917,7 @@ if test "$cross_compiling" = yes; then echo "$ac_t""unknown (cross-compiling)" 1>&6 else cat > conftest.$ac_ext < @@ -5914,7 +5929,7 @@ int main(void) { } EOF -if { (eval echo configure:5918: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:5933: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then proj_ver=`cat conftestdata` echo "$ac_t""$proj_ver" 1>&6 @@ -5946,7 +5961,7 @@ if test $PROJ4API = 0 ; then echo $ac_n "checking for location of External PROJ library""... $ac_c" 1>&6 -echo "configure:5950: checking for location of External PROJ library" >&5 +echo "configure:5965: checking for location of External PROJ library" >&5 case "$with_proj_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-proj-libs." 1>&2; exit 1; } @@ -5970,13 +5985,13 @@ LDFLAGS="$PROJLIB $LDFLAGS" echo $ac_n "checking for proj_pj_info in -lproj""... $ac_c" 1>&6 -echo "configure:5974: checking for proj_pj_info in -lproj" >&5 +echo "configure:5989: checking for proj_pj_info in -lproj" >&5 ac_lib_var=`echo proj'_'proj_pj_info | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lproj $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6030,15 +6045,15 @@ for ac_hdr in proj_api.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6034: checking for $ac_hdr" >&5 +echo "configure:6049: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6042: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6057: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6074,7 +6089,7 @@ CPPFLAGS=$ac_save_cppflags else echo $ac_n "checking External PROJ.4 version""... $ac_c" 1>&6 -echo "configure:6078: checking External PROJ.4 version" >&5 +echo "configure:6093: checking External PROJ.4 version" >&5 ac_save_cppflags="$CPPFLAGS" CPPFLAGS="$PROJINC $CPPFLAGS" if test "$cross_compiling" = yes; then @@ -6082,7 +6097,7 @@ if test "$cross_compiling" = yes; then echo "$ac_t""unknown (cross-compiling)" 1>&6 else cat > conftest.$ac_ext < @@ -6094,7 +6109,7 @@ int main(void) { } EOF -if { (eval echo configure:6098: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:6113: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then proj_ver=`cat conftestdata` echo "$ac_t""$proj_ver" 1>&6 @@ -6119,7 +6134,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of External PROJ.4 library""... $ac_c" 1>&6 -echo "configure:6123: checking for location of External PROJ.4 library" >&5 +echo "configure:6138: checking for location of External PROJ.4 library" >&5 case "$with_proj_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-proj-libs." 1>&2; exit 1; } @@ -6143,13 +6158,13 @@ LDFLAGS="$PROJLIB $LDFLAGS" echo $ac_n "checking for pj_get_def in -lproj""... $ac_c" 1>&6 -echo "configure:6147: checking for pj_get_def in -lproj" >&5 +echo "configure:6162: checking for pj_get_def in -lproj" >&5 ac_lib_var=`echo proj'_'pj_get_def | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lproj $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6179: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6195,7 +6210,7 @@ fi echo $ac_n "checking for location of External PROJ data files""... $ac_c" 1>&6 -echo "configure:6199: checking for location of External PROJ data files" >&5 +echo "configure:6214: checking for location of External PROJ data files" >&5 case "$with_proj_share" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-proj-share." 1>&2; exit 1; } @@ -6221,14 +6236,14 @@ if test `expr ${PROJMAJOR} \< 6` = 1 ; then # LOC_CHECK_SHARE does not work when cross compiling if test "$cross_compiling" = "yes" ; then echo $ac_n "checking for epsg""... $ac_c" 1>&6 -echo "configure:6225: checking for epsg" >&5 +echo "configure:6240: checking for epsg" >&5 echo "$ac_t""unknown (cross-compiling)" 1>&6 else ac_safe=`echo "$PROJSHARE/epsg" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $PROJSHARE/epsg""... $ac_c" 1>&6 -echo "configure:6232: checking for $PROJSHARE/epsg" >&5 +echo "configure:6247: checking for $PROJSHARE/epsg" >&5 if test "$cross_compiling" = yes; then { echo "configure: error: Cannot check for file existence when cross compiling" 1>&2; exit 1; } @@ -6262,7 +6277,7 @@ fi echo $ac_n "checking whether to use regex""... $ac_c" 1>&6 -echo "configure:6266: checking whether to use regex" >&5 +echo "configure:6281: checking whether to use regex" >&5 echo "$ac_t"""$with_regex"" 1>&6 case "$with_regex" in "no") USE_REGEX= ;; @@ -6282,7 +6297,7 @@ if test -n "$USE_REGEX"; then echo $ac_n "checking for location of regex includes""... $ac_c" 1>&6 -echo "configure:6286: checking for location of regex includes" >&5 +echo "configure:6301: checking for location of regex includes" >&5 case "$with_regex_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-regex-includes." 1>&2; exit 1; } @@ -6308,15 +6323,15 @@ for ac_hdr in regex.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6312: checking for $ac_hdr" >&5 +echo "configure:6327: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6320: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6335: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6350,7 +6365,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of regex library""... $ac_c" 1>&6 -echo "configure:6354: checking for location of regex library" >&5 +echo "configure:6369: checking for location of regex library" >&5 case "$with_regex_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-regex-libs." 1>&2; exit 1; } @@ -6375,10 +6390,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for regcomp""... $ac_c" 1>&6 -echo "configure:6379: checking for regcomp" >&5 +echo "configure:6394: checking for regcomp" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6420: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_regcomp=yes" else @@ -6428,13 +6443,13 @@ LDFLAGS="$REGEXLIBPATH $LDFLAGS" echo $ac_n "checking for regcomp in -lregex""... $ac_c" 1>&6 -echo "configure:6432: checking for regcomp in -lregex" >&5 +echo "configure:6447: checking for regcomp in -lregex" >&5 ac_lib_var=`echo regex'_'regcomp | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lregex $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6464: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6495,7 +6510,7 @@ fi # $USE_REGEX echo $ac_n "checking whether to use Readline""... $ac_c" 1>&6 -echo "configure:6499: checking whether to use Readline" >&5 +echo "configure:6514: checking whether to use Readline" >&5 echo "$ac_t"""$with_readline"" 1>&6 case "$with_readline" in "no") USE_READLINE= ;; @@ -6516,7 +6531,7 @@ if test -n "$USE_READLINE"; then echo $ac_n "checking for location of Readline includes""... $ac_c" 1>&6 -echo "configure:6520: checking for location of Readline includes" >&5 +echo "configure:6535: checking for location of Readline includes" >&5 case "$with_readline_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-readline-includes." 1>&2; exit 1; } @@ -6542,15 +6557,15 @@ for ac_hdr in readline/readline.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6546: checking for $ac_hdr" >&5 +echo "configure:6561: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6554: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6569: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6586,15 +6601,15 @@ for ac_hdr in readline/history.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6590: checking for $ac_hdr" >&5 +echo "configure:6605: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6598: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6613: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6628,7 +6643,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of Readline library""... $ac_c" 1>&6 -echo "configure:6632: checking for location of Readline library" >&5 +echo "configure:6647: checking for location of Readline library" >&5 case "$with_readline_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-readline-libs." 1>&2; exit 1; } @@ -6653,13 +6668,13 @@ LDFLAGS="$READLINELIBPATH $LDFLAGS" echo $ac_n "checking for readline in -lreadline""... $ac_c" 1>&6 -echo "configure:6657: checking for readline in -lreadline" >&5 +echo "configure:6672: checking for readline in -lreadline" >&5 ac_lib_var=`echo readline'_'readline | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lreadline $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6689: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6705,13 +6720,13 @@ LDFLAGS="$READLINELIBPATH $LDFLAGS" echo $ac_n "checking for add_history in -lhistory""... $ac_c" 1>&6 -echo "configure:6709: checking for add_history in -lhistory" >&5 +echo "configure:6724: checking for add_history in -lhistory" >&5 ac_lib_var=`echo history'_'add_history | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lhistory $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -6764,7 +6779,7 @@ fi # $USE_READLINE # GDAL option echo $ac_n "checking whether to use GDAL""... $ac_c" 1>&6 -echo "configure:6768: checking whether to use GDAL" >&5 +echo "configure:6783: checking whether to use GDAL" >&5 GDAL_LIBS= GDAL_CFLAGS= @@ -6782,7 +6797,7 @@ else # Extract the first word of "gdal-config", so it can be a program name with args. set dummy gdal-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6786: checking for $ac_word" >&5 +echo "configure:6801: checking for $ac_word" >&5 case "$GDAL_CONFIG" in /*) @@ -6837,14 +6852,14 @@ EOF LIBS="$LIBS $GDAL_LIBS" CFLAGS="$CFLAGS $GDAL_CFLAGS" cat > conftest.$ac_ext < int main() { GDALOpen("foo", GA_ReadOnly); ; return 0; } EOF -if { (eval echo configure:6848: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -6853,14 +6868,14 @@ else LIBS="$LIBS $GDAL_DEP_LIBS" cat > conftest.$ac_ext < int main() { GDALOpen("foo", GA_ReadOnly); ; return 0; } EOF -if { (eval echo configure:6864: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:6879: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* GDAL_LIBS="$GDAL_LIBS $GDAL_DEP_LIBS" else @@ -6892,7 +6907,7 @@ fi # libLAS option echo $ac_n "checking whether to use libLAS""... $ac_c" 1>&6 -echo "configure:6896: checking whether to use libLAS" >&5 +echo "configure:6911: checking whether to use libLAS" >&5 LIBLAS_LIBS= LIBLAS_CFLAGS= @@ -6909,7 +6924,7 @@ else # Extract the first word of "liblas-config", so it can be a program name with args. set dummy liblas-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:6913: checking for $ac_word" >&5 +echo "configure:6928: checking for $ac_word" >&5 case "$LIBLAS_CONFIG" in /*) @@ -6962,15 +6977,15 @@ fi do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:6966: checking for $ac_hdr" >&5 +echo "configure:6981: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:6974: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:6989: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -6996,14 +7011,14 @@ fi done cat > conftest.$ac_ext < int main() { LASReader_Create("foo"); ; return 0; } EOF -if { (eval echo configure:7007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -7011,14 +7026,14 @@ else rm -rf conftest* cat > conftest.$ac_ext < int main() { LASReader_Create("foo"); ; return 0; } EOF -if { (eval echo configure:7022: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7037: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LAS_LIBS="$LAS_LIBS" else @@ -7051,7 +7066,7 @@ fi # PDAL option echo $ac_n "checking whether to use PDAL""... $ac_c" 1>&6 -echo "configure:7055: checking whether to use PDAL" >&5 +echo "configure:7070: checking whether to use PDAL" >&5 # new and currently used way to switch language to C++ # AC_LANG_PUSH(C++) @@ -7079,7 +7094,7 @@ else # Extract the first word of "pdal-config", so it can be a program name with args. set dummy pdal-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7083: checking for $ac_word" >&5 +echo "configure:7098: checking for $ac_word" >&5 case "$PDAL_CONFIG" in /*) @@ -7129,14 +7144,14 @@ fi CFLAGS="$CFLAGS $PDAL_CFLAGS" CPPFLAGS="$CPPFLAGS $PDAL_CPPFLAGS $PDAL_INC" cat > conftest.$ac_ext < int main() { pdal::PointTable table; ; return 0; } EOF -if { (eval echo configure:7140: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -7144,14 +7159,14 @@ else rm -rf conftest* cat > conftest.$ac_ext < int main() { pdal::PointTable table; ; return 0; } EOF -if { (eval echo configure:7155: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* PDAL_LIBS="$PDAL_LIBS" else @@ -7201,7 +7216,7 @@ cross_compiling=$ac_cv_prog_cc_cross # NetCDF option echo $ac_n "checking whether to use NetCDF""... $ac_c" 1>&6 -echo "configure:7205: checking whether to use NetCDF" >&5 +echo "configure:7220: checking whether to use NetCDF" >&5 NETCDF_LIBS= NETCDF_CFLAGS= @@ -7218,7 +7233,7 @@ else # Extract the first word of "nc-config", so it can be a program name with args. set dummy nc-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7222: checking for $ac_word" >&5 +echo "configure:7237: checking for $ac_word" >&5 case "$NETCDF_CONFIG" in /*) @@ -7265,14 +7280,14 @@ fi LIBS="$LIBS $NETCDF_LIBS" CFLAGS="$CFLAGS $NETCDF_CFLAGS" cat > conftest.$ac_ext < int main() { nc_create("foo", NC_CLOBBER, NULL); ; return 0; } EOF -if { (eval echo configure:7276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then : else echo "configure: failed program was:" >&5 @@ -7280,14 +7295,14 @@ else rm -rf conftest* cat > conftest.$ac_ext < int main() { nc_create("foo", NC_CLOBBER, NULL); ; return 0; } EOF -if { (eval echo configure:7291: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7306: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* NETCDF_LIBS="$NETCDF_LIBS" else @@ -7318,7 +7333,7 @@ fi # GEOS option echo $ac_n "checking whether to use GEOS""... $ac_c" 1>&6 -echo "configure:7322: checking whether to use GEOS" >&5 +echo "configure:7337: checking whether to use GEOS" >&5 GEOS_LIBS= GEOS_CFLAGS= @@ -7336,7 +7351,7 @@ else # Extract the first word of "geos-config", so it can be a program name with args. set dummy geos-config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:7340: checking for $ac_word" >&5 +echo "configure:7355: checking for $ac_word" >&5 case "$GEOS_CONFIG" in /*) @@ -7384,15 +7399,15 @@ for ac_hdr in geos_c.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7388: checking for $ac_hdr" >&5 +echo "configure:7403: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7396: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7411: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7431,13 +7446,13 @@ LDFLAGS="$GEOS_LIBS $LDFLAGS" echo $ac_n "checking for initGEOS in -lgeos_c""... $ac_c" 1>&6 -echo "configure:7435: checking for initGEOS in -lgeos_c" >&5 +echo "configure:7450: checking for initGEOS in -lgeos_c" >&5 ac_lib_var=`echo geos_c'_'initGEOS | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lgeos_c $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7492,7 +7507,7 @@ fi echo $ac_n "checking whether to use TIFF""... $ac_c" 1>&6 -echo "configure:7496: checking whether to use TIFF" >&5 +echo "configure:7511: checking whether to use TIFF" >&5 echo "$ac_t"""$with_tiff"" 1>&6 case "$with_tiff" in "no") USE_TIFF= ;; @@ -7512,7 +7527,7 @@ if test -n "$USE_TIFF"; then echo $ac_n "checking for location of TIFF includes""... $ac_c" 1>&6 -echo "configure:7516: checking for location of TIFF includes" >&5 +echo "configure:7531: checking for location of TIFF includes" >&5 case "$with_tiff_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-tiff-includes." 1>&2; exit 1; } @@ -7538,15 +7553,15 @@ for ac_hdr in tiffio.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:7542: checking for $ac_hdr" >&5 +echo "configure:7557: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:7550: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:7565: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -7580,7 +7595,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of TIFF library""... $ac_c" 1>&6 -echo "configure:7584: checking for location of TIFF library" >&5 +echo "configure:7599: checking for location of TIFF library" >&5 case "$with_tiff_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-tiff-libs." 1>&2; exit 1; } @@ -7611,13 +7626,13 @@ LDFLAGS="$TIFF_LIBRARY_DIRS $LDFLAGS" echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:7615: checking for TIFFOpen in -ltiff" >&5 +echo "configure:7630: checking for TIFFOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ltiff $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7647: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7647,13 +7662,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:7651: checking for TIFFOpen in -ltiff" >&5 +echo "configure:7666: checking for TIFFOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ltiff $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7683: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7683,13 +7698,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:7687: checking for TIFFOpen in -ltiff" >&5 +echo "configure:7702: checking for TIFFOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ltiff $ZLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7719: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7719,13 +7734,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:7723: checking for TIFFOpen in -ltiff" >&5 +echo "configure:7738: checking for TIFFOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ltiff $ZLIB $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7755: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7755,13 +7770,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:7759: checking for TIFFOpen in -ltiff" >&5 +echo "configure:7774: checking for TIFFOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ltiff -ljpeg $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7791: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7791,13 +7806,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:7795: checking for TIFFOpen in -ltiff" >&5 +echo "configure:7810: checking for TIFFOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ltiff -ljpeg $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7827: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7827,13 +7842,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:7831: checking for TIFFOpen in -ltiff" >&5 +echo "configure:7846: checking for TIFFOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ltiff -ljpeg $ZLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7863: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7863,13 +7878,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for TIFFOpen in -ltiff""... $ac_c" 1>&6 -echo "configure:7867: checking for TIFFOpen in -ltiff" >&5 +echo "configure:7882: checking for TIFFOpen in -ltiff" >&5 ac_lib_var=`echo tiff'_'TIFFOpen | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ltiff -ljpeg $ZLIB $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:7899: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -7978,7 +7993,7 @@ fi # $USE_TIFF echo $ac_n "checking whether to use PNG""... $ac_c" 1>&6 -echo "configure:7982: checking whether to use PNG" >&5 +echo "configure:7997: checking whether to use PNG" >&5 echo "$ac_t"""$with_png"" 1>&6 case "$with_png" in "no") USE_PNG= ;; @@ -7997,7 +8012,7 @@ if test -n "$USE_PNG"; then echo $ac_n "checking for location of PNG includes""... $ac_c" 1>&6 -echo "configure:8001: checking for location of PNG includes" >&5 +echo "configure:8016: checking for location of PNG includes" >&5 case "$with_png_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-png-includes." 1>&2; exit 1; } @@ -8023,15 +8038,15 @@ for ac_hdr in png.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8027: checking for $ac_hdr" >&5 +echo "configure:8042: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8035: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8050: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8065,7 +8080,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of PNG library""... $ac_c" 1>&6 -echo "configure:8069: checking for location of PNG library" >&5 +echo "configure:8084: checking for location of PNG library" >&5 case "$with_png_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-png-libs." 1>&2; exit 1; } @@ -8090,13 +8105,13 @@ LDFLAGS="$PNGLIB $LDFLAGS" echo $ac_n "checking for png_read_image in -lpng""... $ac_c" 1>&6 -echo "configure:8094: checking for png_read_image in -lpng" >&5 +echo "configure:8109: checking for png_read_image in -lpng" >&5 ac_lib_var=`echo png'_'png_read_image | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lpng $ZLIB $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8149,7 +8164,7 @@ fi # $USE_PNG echo $ac_n "checking whether to use PostgreSQL""... $ac_c" 1>&6 -echo "configure:8153: checking whether to use PostgreSQL" >&5 +echo "configure:8168: checking whether to use PostgreSQL" >&5 echo "$ac_t"""$with_postgres"" 1>&6 case "$with_postgres" in "no") USE_POSTGRES= ;; @@ -8176,7 +8191,7 @@ if test -n "$USE_POSTGRES"; then echo $ac_n "checking for location of PostgreSQL includes""... $ac_c" 1>&6 -echo "configure:8180: checking for location of PostgreSQL includes" >&5 +echo "configure:8195: checking for location of PostgreSQL includes" >&5 case "$with_postgres_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-postgres-includes." 1>&2; exit 1; } @@ -8202,15 +8217,15 @@ for ac_hdr in libpq-fe.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8206: checking for $ac_hdr" >&5 +echo "configure:8221: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8214: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8229: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8248,7 +8263,7 @@ if test -n "$USE_POSTGRES"; then echo $ac_n "checking for location of PostgreSQL library""... $ac_c" 1>&6 -echo "configure:8252: checking for location of PostgreSQL library" >&5 +echo "configure:8267: checking for location of PostgreSQL library" >&5 case "$with_postgres_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-postgres-libs." 1>&2; exit 1; } @@ -8277,13 +8292,13 @@ LDFLAGS="$PQLIBPATH $LDFLAGS" echo $ac_n "checking for PQsetdbLogin in -lpq""... $ac_c" 1>&6 -echo "configure:8281: checking for PQsetdbLogin in -lpq" >&5 +echo "configure:8296: checking for PQsetdbLogin in -lpq" >&5 ac_lib_var=`echo pq'_'PQsetdbLogin | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lpq $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8313: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8313,13 +8328,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for PQsetdbLogin in -lpq""... $ac_c" 1>&6 -echo "configure:8317: checking for PQsetdbLogin in -lpq" >&5 +echo "configure:8332: checking for PQsetdbLogin in -lpq" >&5 ac_lib_var=`echo pq'_'PQsetdbLogin | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lpq -lssl -lcrypto $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8349: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8349,13 +8364,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for PQsetdbLogin in -lpq""... $ac_c" 1>&6 -echo "configure:8353: checking for PQsetdbLogin in -lpq" >&5 +echo "configure:8368: checking for PQsetdbLogin in -lpq" >&5 ac_lib_var=`echo pq'_'PQsetdbLogin | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lpq -lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8385: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8385,13 +8400,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for PQsetdbLogin in -lpq""... $ac_c" 1>&6 -echo "configure:8389: checking for PQsetdbLogin in -lpq" >&5 +echo "configure:8404: checking for PQsetdbLogin in -lpq" >&5 ac_lib_var=`echo pq'_'PQsetdbLogin | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lpq -lcrypt -lssl -lcrypto $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8421: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8459,13 +8474,13 @@ LDFLAGS=${ac_save_ldflags} ac_save_ldflags="$LDFLAGS" LDFLAGS="$LDFLAGS $PQLIBPATH" echo $ac_n "checking for PQcmdTuples in -lpq""... $ac_c" 1>&6 -echo "configure:8463: checking for PQcmdTuples in -lpq" >&5 +echo "configure:8478: checking for PQcmdTuples in -lpq" >&5 ac_lib_var=`echo pq'_'PQcmdTuples | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lpq $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8498,13 +8513,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for PQcmdTuples in -lpq""... $ac_c" 1>&6 -echo "configure:8502: checking for PQcmdTuples in -lpq" >&5 +echo "configure:8517: checking for PQcmdTuples in -lpq" >&5 ac_lib_var=`echo pq'_'PQcmdTuples | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lpq -lcrypt $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8534: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8558,7 +8573,7 @@ fi # $USE_POSTGRES echo $ac_n "checking whether to use MySQL""... $ac_c" 1>&6 -echo "configure:8562: checking whether to use MySQL" >&5 +echo "configure:8577: checking whether to use MySQL" >&5 echo "$ac_t"""$with_mysql"" 1>&6 case "$with_mysql" in "no") USE_MYSQL= ;; @@ -8578,7 +8593,7 @@ if test -n "$USE_MYSQL"; then echo $ac_n "checking for location of MySQL includes""... $ac_c" 1>&6 -echo "configure:8582: checking for location of MySQL includes" >&5 +echo "configure:8597: checking for location of MySQL includes" >&5 case "$with_mysql_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-mysql-includes." 1>&2; exit 1; } @@ -8604,15 +8619,15 @@ for ac_hdr in mysql.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:8608: checking for $ac_hdr" >&5 +echo "configure:8623: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:8616: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:8631: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -8649,7 +8664,7 @@ if test -n "$USE_MYSQL"; then echo $ac_n "checking for location of MySQL library""... $ac_c" 1>&6 -echo "configure:8653: checking for location of MySQL library" >&5 +echo "configure:8668: checking for location of MySQL library" >&5 case "$with_mysql_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-mysql-libs." 1>&2; exit 1; } @@ -8680,13 +8695,13 @@ LDFLAGS="$MYSQLLIBPATH $LDFLAGS" echo $ac_n "checking for mysql_query in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:8684: checking for mysql_query in -lmysqlclient" >&5 +echo "configure:8699: checking for mysql_query in -lmysqlclient" >&5 ac_lib_var=`echo mysqlclient'_'mysql_query | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lmysqlclient $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8716,13 +8731,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for mysql_query in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:8720: checking for mysql_query in -lmysqlclient" >&5 +echo "configure:8735: checking for mysql_query in -lmysqlclient" >&5 ac_lib_var=`echo mysqlclient'_'mysql_query | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lmysqlclient $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8752: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8752,13 +8767,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for mysql_query in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:8756: checking for mysql_query in -lmysqlclient" >&5 +echo "configure:8771: checking for mysql_query in -lmysqlclient" >&5 ac_lib_var=`echo mysqlclient'_'mysql_query | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lmysqlclient $SOCKLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8788: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8788,13 +8803,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for mysql_query in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:8792: checking for mysql_query in -lmysqlclient" >&5 +echo "configure:8807: checking for mysql_query in -lmysqlclient" >&5 ac_lib_var=`echo mysqlclient'_'mysql_query | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lmysqlclient $SOCKLIB $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8824: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8824,13 +8839,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for mysql_query in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:8828: checking for mysql_query in -lmysqlclient" >&5 +echo "configure:8843: checking for mysql_query in -lmysqlclient" >&5 ac_lib_var=`echo mysqlclient'_'mysql_query | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lmysqlclient $ZLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8860,13 +8875,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for mysql_query in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:8864: checking for mysql_query in -lmysqlclient" >&5 +echo "configure:8879: checking for mysql_query in -lmysqlclient" >&5 ac_lib_var=`echo mysqlclient'_'mysql_query | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lmysqlclient $ZLIB $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8896,13 +8911,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for mysql_query in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:8900: checking for mysql_query in -lmysqlclient" >&5 +echo "configure:8915: checking for mysql_query in -lmysqlclient" >&5 ac_lib_var=`echo mysqlclient'_'mysql_query | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lmysqlclient $ZLIB $SOCKLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8932: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -8932,13 +8947,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for mysql_query in -lmysqlclient""... $ac_c" 1>&6 -echo "configure:8936: checking for mysql_query in -lmysqlclient" >&5 +echo "configure:8951: checking for mysql_query in -lmysqlclient" >&5 ac_lib_var=`echo mysqlclient'_'mysql_query | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lmysqlclient $ZLIB $SOCKLIB $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:8968: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9039,7 +9054,7 @@ LDFLAGS=${ac_save_ldflags} # Extract the first word of "mysql_config", so it can be a program name with args. set dummy mysql_config; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:9043: checking for $ac_word" >&5 +echo "configure:9058: checking for $ac_word" >&5 case "$MYSQLD_CONFIG" in /*) @@ -9088,10 +9103,10 @@ cross_compiling=$ac_cv_prog_cxx_cross LIBS="$MYSQLDLIB $LIBS" echo $ac_n "checking for mysql_server_init""... $ac_c" 1>&6 -echo "configure:9092: checking for mysql_server_init" >&5 +echo "configure:9107: checking for mysql_server_init" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9136: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_mysql_server_init=yes" else @@ -9169,7 +9184,7 @@ fi # $USE_MYSQL echo $ac_n "checking whether to use SQLite""... $ac_c" 1>&6 -echo "configure:9173: checking whether to use SQLite" >&5 +echo "configure:9188: checking whether to use SQLite" >&5 echo "$ac_t"""$with_sqlite"" 1>&6 case "$with_sqlite" in "no") USE_SQLITE= ;; @@ -9189,7 +9204,7 @@ if test -n "$USE_SQLITE"; then echo $ac_n "checking for location of SQLite includes""... $ac_c" 1>&6 -echo "configure:9193: checking for location of SQLite includes" >&5 +echo "configure:9208: checking for location of SQLite includes" >&5 case "$with_sqlite_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-sqlite-includes." 1>&2; exit 1; } @@ -9215,15 +9230,15 @@ for ac_hdr in sqlite3.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:9219: checking for $ac_hdr" >&5 +echo "configure:9234: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9266,7 +9281,7 @@ if test -n "$USE_SQLITE"; then echo $ac_n "checking for location of SQLite library""... $ac_c" 1>&6 -echo "configure:9270: checking for location of SQLite library" >&5 +echo "configure:9285: checking for location of SQLite library" >&5 case "$with_sqlite_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-sqlite-libs." 1>&2; exit 1; } @@ -9295,13 +9310,13 @@ LDFLAGS="$SQLITELIBPATH $LDFLAGS" echo $ac_n "checking for sqlite3_open in -lsqlite3""... $ac_c" 1>&6 -echo "configure:9299: checking for sqlite3_open in -lsqlite3" >&5 +echo "configure:9314: checking for sqlite3_open in -lsqlite3" >&5 ac_lib_var=`echo sqlite3'_'sqlite3_open | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsqlite3 $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9331,13 +9346,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sqlite3_open in -lsqlite3""... $ac_c" 1>&6 -echo "configure:9335: checking for sqlite3_open in -lsqlite3" >&5 +echo "configure:9350: checking for sqlite3_open in -lsqlite3" >&5 ac_lib_var=`echo sqlite3'_'sqlite3_open | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsqlite3 $DLLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9367: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9367,13 +9382,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sqlite3_open in -lsqlite3""... $ac_c" 1>&6 -echo "configure:9371: checking for sqlite3_open in -lsqlite3" >&5 +echo "configure:9386: checking for sqlite3_open in -lsqlite3" >&5 ac_lib_var=`echo sqlite3'_'sqlite3_open | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsqlite3 $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9403: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9403,13 +9418,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for sqlite3_open in -lsqlite3""... $ac_c" 1>&6 -echo "configure:9407: checking for sqlite3_open in -lsqlite3" >&5 +echo "configure:9422: checking for sqlite3_open in -lsqlite3" >&5 ac_lib_var=`echo sqlite3'_'sqlite3_open | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsqlite3 $MATHLIB $DLLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9439: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9495,7 +9510,7 @@ OPENGL_AQUA= OPENGL_WINDOWS= echo $ac_n "checking whether to use OpenGL""... $ac_c" 1>&6 -echo "configure:9499: checking whether to use OpenGL" >&5 +echo "configure:9514: checking whether to use OpenGL" >&5 echo "$ac_t"""$with_opengl"" 1>&6 case "$with_opengl" in n|no) @@ -9529,7 +9544,7 @@ if test "$OPENGL_X11" = 1 ; then echo $ac_n "checking for location of OpenGL includes""... $ac_c" 1>&6 -echo "configure:9533: checking for location of OpenGL includes" >&5 +echo "configure:9548: checking for location of OpenGL includes" >&5 case "$with_opengl_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opengl-includes." 1>&2; exit 1; } @@ -9555,15 +9570,15 @@ for ac_hdr in GL/gl.h GL/glu.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:9559: checking for $ac_hdr" >&5 +echo "configure:9574: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:9567: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:9582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -9597,7 +9612,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of OpenGL library""... $ac_c" 1>&6 -echo "configure:9601: checking for location of OpenGL library" >&5 +echo "configure:9616: checking for location of OpenGL library" >&5 case "$with_opengl_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opengl-libs." 1>&2; exit 1; } @@ -9626,13 +9641,13 @@ LDFLAGS="$OPENGL_LIB_PATH $LDFLAGS" echo $ac_n "checking for glBegin in -lGL""... $ac_c" 1>&6 -echo "configure:9630: checking for glBegin in -lGL" >&5 +echo "configure:9645: checking for glBegin in -lGL" >&5 ac_lib_var=`echo GL'_'glBegin | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lGL $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9662: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9662,13 +9677,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for glBegin in -lGL""... $ac_c" 1>&6 -echo "configure:9666: checking for glBegin in -lGL" >&5 +echo "configure:9681: checking for glBegin in -lGL" >&5 ac_lib_var=`echo GL'_'glBegin | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lGL $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB -lXext $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9698,13 +9713,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for glBegin in -lGL""... $ac_c" 1>&6 -echo "configure:9702: checking for glBegin in -lGL" >&5 +echo "configure:9717: checking for glBegin in -lGL" >&5 ac_lib_var=`echo GL'_'glBegin | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lGL $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB -lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9734,13 +9749,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for glBegin in -lGL""... $ac_c" 1>&6 -echo "configure:9738: checking for glBegin in -lGL" >&5 +echo "configure:9753: checking for glBegin in -lGL" >&5 ac_lib_var=`echo GL'_'glBegin | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lGL $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB -lpthread -lXext $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9770: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9813,13 +9828,13 @@ LDFLAGS="$OPENGL_LIB_PATH $LDFLAGS" echo $ac_n "checking for gluBeginCurve in -lGLU""... $ac_c" 1>&6 -echo "configure:9817: checking for gluBeginCurve in -lGLU" >&5 +echo "configure:9832: checking for gluBeginCurve in -lGLU" >&5 ac_lib_var=`echo GLU'_'gluBeginCurve | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lGLU $OPENGLLIB $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9849: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9849,13 +9864,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gluBeginCurve in -lGLU""... $ac_c" 1>&6 -echo "configure:9853: checking for gluBeginCurve in -lGLU" >&5 +echo "configure:9868: checking for gluBeginCurve in -lGLU" >&5 ac_lib_var=`echo GLU'_'gluBeginCurve | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lGLU $OPENGLLIB $X_LIBS $X_PRE_LIBS -lX11 $X_EXTRA_LIBS $MATHLIB -lstdc++ $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -9913,10 +9928,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $OPENGLLIB $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for glXCreatePbuffer""... $ac_c" 1>&6 -echo "configure:9917: checking for glXCreatePbuffer" >&5 +echo "configure:9932: checking for glXCreatePbuffer" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:9958: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_glXCreatePbuffer=yes" else @@ -9976,10 +9991,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $OPENGLLIB $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for glXCreateGLXPixmap""... $ac_c" 1>&6 -echo "configure:9980: checking for glXCreateGLXPixmap" >&5 +echo "configure:9995: checking for glXCreateGLXPixmap" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_glXCreateGLXPixmap=yes" else @@ -10045,7 +10060,7 @@ if test "$OPENGL_AQUA" = 1 ; then echo $ac_n "checking for location of OpenGL framework""... $ac_c" 1>&6 -echo "configure:10049: checking for location of OpenGL framework" >&5 +echo "configure:10064: checking for location of OpenGL framework" >&5 case "$with_opengl_framework" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opengl-framework." 1>&2; exit 1; } @@ -10069,15 +10084,15 @@ for ac_hdr in OpenGL/gl.h OpenGL/glu.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:10073: checking for $ac_hdr" >&5 +echo "configure:10088: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10081: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10096: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10113,10 +10128,10 @@ ac_save_ldflags="$LDFLAGS" LIBS="-framework OpenGL -framework AGL -framework ApplicationServices $LIBS" LDFLAGS="$OPENGLPATH $LDFLAGS" echo $ac_n "checking for glBegin""... $ac_c" 1>&6 -echo "configure:10117: checking for glBegin" >&5 +echo "configure:10132: checking for glBegin" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10158: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_glBegin=yes" else @@ -10176,10 +10191,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $OPENGLLIB $LIBS" LDFLAGS="$OPENGLPATH $LDFLAGS" echo $ac_n "checking for gluBeginCurve""... $ac_c" 1>&6 -echo "configure:10180: checking for gluBeginCurve" >&5 +echo "configure:10195: checking for gluBeginCurve" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10221: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gluBeginCurve=yes" else @@ -10250,7 +10265,7 @@ if test "$OPENGL_WINDOWS" = 1 ; then echo $ac_n "checking for location of OpenGL includes""... $ac_c" 1>&6 -echo "configure:10254: checking for location of OpenGL includes" >&5 +echo "configure:10269: checking for location of OpenGL includes" >&5 case "$with_opengl_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opengl-includes." 1>&2; exit 1; } @@ -10276,15 +10291,15 @@ for ac_hdr in GL/gl.h GL/glu.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:10280: checking for $ac_hdr" >&5 +echo "configure:10295: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10288: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10318,7 +10333,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of OpenGL library""... $ac_c" 1>&6 -echo "configure:10322: checking for location of OpenGL library" >&5 +echo "configure:10337: checking for location of OpenGL library" >&5 case "$with_opengl_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opengl-libs." 1>&2; exit 1; } @@ -10343,18 +10358,18 @@ CFLAGS="$CFLAGS $OPENGLINC" ac_save_ldflags="$LDFLAGS" ac_save_libs="$LIBS" echo $ac_n "checking for OpenGL library""... $ac_c" 1>&6 -echo "configure:10347: checking for OpenGL library" >&5 +echo "configure:10362: checking for OpenGL library" >&5 LDFLAGS="$OPENGL_LIB_PATH $LDFLAGS" LIBS="-lopengl32 " cat > conftest.$ac_ext < int main() { glEnd(); ; return 0; } EOF -if { (eval echo configure:10358: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10373: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""found" 1>&6 @@ -10378,18 +10393,18 @@ LDFLAGS=${ac_save_ldflags} ac_save_ldflags="$LDFLAGS" ac_save_libs="$LIBS" echo $ac_n "checking for GLU library""... $ac_c" 1>&6 -echo "configure:10382: checking for GLU library" >&5 +echo "configure:10397: checking for GLU library" >&5 LDFLAGS="$OPENGL_LIB_PATH $LDFLAGS" LIBS="-lglu32 $OPENGLLIB " cat > conftest.$ac_ext < int main() { gluNewQuadric(); ; return 0; } EOF -if { (eval echo configure:10393: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10408: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""found" 1>&6 @@ -10438,7 +10453,7 @@ fi # $USE_OPENGL echo $ac_n "checking whether to use ODBC""... $ac_c" 1>&6 -echo "configure:10442: checking whether to use ODBC" >&5 +echo "configure:10457: checking whether to use ODBC" >&5 echo "$ac_t"""$with_odbc"" 1>&6 case "$with_odbc" in "no") USE_ODBC= ;; @@ -10457,7 +10472,7 @@ if test -n "$USE_ODBC"; then echo $ac_n "checking for location of ODBC includes""... $ac_c" 1>&6 -echo "configure:10461: checking for location of ODBC includes" >&5 +echo "configure:10476: checking for location of ODBC includes" >&5 case "$with_odbc_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-odbc-includes." 1>&2; exit 1; } @@ -10483,15 +10498,15 @@ for ac_hdr in sql.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:10487: checking for $ac_hdr" >&5 +echo "configure:10502: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10495: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10510: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10525,7 +10540,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of ODBC library""... $ac_c" 1>&6 -echo "configure:10529: checking for location of ODBC library" >&5 +echo "configure:10544: checking for location of ODBC library" >&5 case "$with_odbc_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-odbc-libs." 1>&2; exit 1; } @@ -10550,13 +10565,13 @@ LDFLAGS="$ODBCLIB $LDFLAGS" echo $ac_n "checking for SQLConnect in -lodbc""... $ac_c" 1>&6 -echo "configure:10554: checking for SQLConnect in -lodbc" >&5 +echo "configure:10569: checking for SQLConnect in -lodbc" >&5 ac_lib_var=`echo odbc'_'SQLConnect | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lodbc $ICONVLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10586: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10592,13 +10607,13 @@ LDFLAGS="$ODBCLIB $LDFLAGS" echo $ac_n "checking for SQLConnect in -liodbc""... $ac_c" 1>&6 -echo "configure:10596: checking for SQLConnect in -liodbc" >&5 +echo "configure:10611: checking for SQLConnect in -liodbc" >&5 ac_lib_var=`echo iodbc'_'SQLConnect | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-liodbc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10634,11 +10649,11 @@ CFLAGS="$CFLAGS $ODBCINC" ac_save_ldflags="$LDFLAGS" ac_save_libs="$LIBS" echo $ac_n "checking for ODBC library""... $ac_c" 1>&6 -echo "configure:10638: checking for ODBC library" >&5 +echo "configure:10653: checking for ODBC library" >&5 LDFLAGS="$ODBCLIB $LDFLAGS" LIBS="-lodbc32 " cat > conftest.$ac_ext < #include @@ -10646,7 +10661,7 @@ int main() { SQLAllocEnv((SQLHENV *)0); ; return 0; } EOF -if { (eval echo configure:10650: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10665: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""found" 1>&6 @@ -10695,7 +10710,7 @@ fi # $USE_ODBC echo $ac_n "checking whether to use FFTW""... $ac_c" 1>&6 -echo "configure:10699: checking whether to use FFTW" >&5 +echo "configure:10714: checking whether to use FFTW" >&5 echo "$ac_t"""$with_fftw"" 1>&6 case "$with_fftw" in "no") USE_FFTW= ;; @@ -10714,7 +10729,7 @@ if test -n "$USE_FFTW"; then echo $ac_n "checking for location of FFTW includes""... $ac_c" 1>&6 -echo "configure:10718: checking for location of FFTW includes" >&5 +echo "configure:10733: checking for location of FFTW includes" >&5 case "$with_fftw_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-fftw-includes." 1>&2; exit 1; } @@ -10740,15 +10755,15 @@ for ac_hdr in fftw3.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:10744: checking for $ac_hdr" >&5 +echo "configure:10759: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10752: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10767: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10776,15 +10791,15 @@ for ac_hdr in fftw.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:10780: checking for $ac_hdr" >&5 +echo "configure:10795: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10788: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10803: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10812,15 +10827,15 @@ for ac_hdr in dfftw.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:10816: checking for $ac_hdr" >&5 +echo "configure:10831: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:10824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:10839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -10866,7 +10881,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of FFTW library""... $ac_c" 1>&6 -echo "configure:10870: checking for location of FFTW library" >&5 +echo "configure:10885: checking for location of FFTW library" >&5 case "$with_fftw_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-fftw-libs." 1>&2; exit 1; } @@ -10891,13 +10906,13 @@ LDFLAGS="$FFTWLIB $LDFLAGS" echo $ac_n "checking for fftw_execute in -lfftw3""... $ac_c" 1>&6 -echo "configure:10895: checking for fftw_execute in -lfftw3" >&5 +echo "configure:10910: checking for fftw_execute in -lfftw3" >&5 ac_lib_var=`echo fftw3'_'fftw_execute | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lfftw3 $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10933,13 +10948,13 @@ LDFLAGS="$FFTWLIB $LDFLAGS" echo $ac_n "checking for fftwnd_one in -lfftw""... $ac_c" 1>&6 -echo "configure:10937: checking for fftwnd_one in -lfftw" >&5 +echo "configure:10952: checking for fftwnd_one in -lfftw" >&5 ac_lib_var=`echo fftw'_'fftwnd_one | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lfftw $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:10969: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -10975,13 +10990,13 @@ LDFLAGS="$FFTWLIB $LDFLAGS" echo $ac_n "checking for fftwnd_one in -ldfftw""... $ac_c" 1>&6 -echo "configure:10979: checking for fftwnd_one in -ldfftw" >&5 +echo "configure:10994: checking for fftwnd_one in -ldfftw" >&5 ac_lib_var=`echo dfftw'_'fftwnd_one | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ldfftw $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11049,7 +11064,7 @@ fi # $USE_FFTW echo $ac_n "checking whether to use BLAS""... $ac_c" 1>&6 -echo "configure:11053: checking whether to use BLAS" >&5 +echo "configure:11068: checking whether to use BLAS" >&5 echo "$ac_t"""$with_blas"" 1>&6 case "$with_blas" in "no") USE_BLAS= ;; @@ -11070,7 +11085,7 @@ if test -n "$USE_BLAS"; then echo $ac_n "checking for location of BLAS includes""... $ac_c" 1>&6 -echo "configure:11074: checking for location of BLAS includes" >&5 +echo "configure:11089: checking for location of BLAS includes" >&5 case "$with_blas_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-blas-includes." 1>&2; exit 1; } @@ -11090,7 +11105,7 @@ fi echo $ac_n "checking for location of BLAS library""... $ac_c" 1>&6 -echo "configure:11094: checking for location of BLAS library" >&5 +echo "configure:11109: checking for location of BLAS library" >&5 case "$with_blas_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-blas-libs." 1>&2; exit 1; } @@ -11116,15 +11131,15 @@ for ac_hdr in cblas.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11120: checking for $ac_hdr" >&5 +echo "configure:11135: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11128: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11143: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11159,13 +11174,13 @@ LDFLAGS="$BLASLIB $LDFLAGS" echo $ac_n "checking for dnrm2_ in -lblas""... $ac_c" 1>&6 -echo "configure:11163: checking for dnrm2_ in -lblas" >&5 +echo "configure:11178: checking for dnrm2_ in -lblas" >&5 ac_lib_var=`echo blas'_'dnrm2_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lblas $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11195,13 +11210,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dnrm2_ in -lblas""... $ac_c" 1>&6 -echo "configure:11199: checking for dnrm2_ in -lblas" >&5 +echo "configure:11214: checking for dnrm2_ in -lblas" >&5 ac_lib_var=`echo blas'_'dnrm2_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lblas $MATHLIB -lg2c $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11231: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11256,13 +11271,13 @@ blas_ok=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$BLASLIB $LDFLAGS" echo $ac_n "checking for ATL_xerbla in -latlas""... $ac_c" 1>&6 -echo "configure:11260: checking for ATL_xerbla in -latlas" >&5 +echo "configure:11275: checking for ATL_xerbla in -latlas" >&5 ac_lib_var=`echo atlas'_'ATL_xerbla | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-latlas $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11292: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11288,13 +11303,13 @@ LIBS="$ac_save_LIBS" if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for sgemm_ in -lf77blas""... $ac_c" 1>&6 -echo "configure:11292: checking for sgemm_ in -lf77blas" >&5 +echo "configure:11307: checking for sgemm_ in -lf77blas" >&5 ac_lib_var=`echo f77blas'_'sgemm_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lf77blas -latlas $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11324: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11320,13 +11335,13 @@ LIBS="$ac_save_LIBS" if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for cblas_dgemm in -lcblas""... $ac_c" 1>&6 -echo "configure:11324: checking for cblas_dgemm in -lcblas" >&5 +echo "configure:11339: checking for cblas_dgemm in -lcblas" >&5 ac_lib_var=`echo cblas'_'cblas_dgemm | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lcblas -lf77blas -latlas $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11356: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11383,16 +11398,16 @@ if test $blas_ok = no; then save_LIBS="$LIBS" LIBS="$vlib_flags $LIBS" echo $ac_n "checking for sgemm in $vlib_flags""... $ac_c" 1>&6 -echo "configure:11387: checking for sgemm in $vlib_flags" >&5 +echo "configure:11402: checking for sgemm in $vlib_flags" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11411: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* blas_ok=yes; BLASLIB="$vlib_flags" else @@ -11410,13 +11425,13 @@ fi # BLAS in PhiPACK libraries? (requires generic BLAS, too) if test $blas_ok = no; then echo $ac_n "checking for sgemm_ in -lblas""... $ac_c" 1>&6 -echo "configure:11414: checking for sgemm_ in -lblas" >&5 +echo "configure:11429: checking for sgemm_ in -lblas" >&5 ac_lib_var=`echo blas'_'sgemm_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lblas $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11442,13 +11457,13 @@ LIBS="$ac_save_LIBS" if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for dgemm_ in -ldgemm""... $ac_c" 1>&6 -echo "configure:11446: checking for dgemm_ in -ldgemm" >&5 +echo "configure:11461: checking for dgemm_ in -ldgemm" >&5 ac_lib_var=`echo dgemm'_'dgemm_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-ldgemm -lblas $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11478: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11474,13 +11489,13 @@ LIBS="$ac_save_LIBS" if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for sgemm_ in -lsgemm""... $ac_c" 1>&6 -echo "configure:11478: checking for sgemm_ in -lsgemm" >&5 +echo "configure:11493: checking for sgemm_ in -lsgemm" >&5 ac_lib_var=`echo sgemm'_'sgemm_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsgemm -lblas $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11510: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11525,13 +11540,13 @@ fi if test $blas_ok = no; then if test "x$GCC" != xyes; then # only works with Sun CC echo $ac_n "checking for acosp in -lsunmath""... $ac_c" 1>&6 -echo "configure:11529: checking for acosp in -lsunmath" >&5 +echo "configure:11544: checking for acosp in -lsunmath" >&5 ac_lib_var=`echo sunmath'_'acosp | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsunmath $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11561: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11557,13 +11572,13 @@ LIBS="$ac_save_LIBS" if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for sgemm_ in -lsunperf""... $ac_c" 1>&6 -echo "configure:11561: checking for sgemm_ in -lsunperf" >&5 +echo "configure:11576: checking for sgemm_ in -lsunperf" >&5 ac_lib_var=`echo sunperf'_'sgemm_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lsunperf -lsunmath $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11593: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11604,13 +11619,13 @@ fi # Generic BLAS library if test $blas_ok = no; then echo $ac_n "checking for sgemm_ in -lblas""... $ac_c" 1>&6 -echo "configure:11608: checking for sgemm_ in -lblas" >&5 +echo "configure:11623: checking for sgemm_ in -lblas" >&5 ac_lib_var=`echo blas'_'sgemm_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lblas $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11660,7 +11675,7 @@ fi # $USE_BLAS echo $ac_n "checking whether to use LAPACK""... $ac_c" 1>&6 -echo "configure:11664: checking whether to use LAPACK" >&5 +echo "configure:11679: checking whether to use LAPACK" >&5 echo "$ac_t"""$with_lapack"" 1>&6 case "$with_lapack" in "no") USE_LAPACK= ;; @@ -11685,7 +11700,7 @@ lapack_ok=no echo $ac_n "checking for location of LAPACK includes""... $ac_c" 1>&6 -echo "configure:11689: checking for location of LAPACK includes" >&5 +echo "configure:11704: checking for location of LAPACK includes" >&5 case "$with_lapack_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-lapack-includes." 1>&2; exit 1; } @@ -11705,7 +11720,7 @@ fi echo $ac_n "checking for location of LAPACK library""... $ac_c" 1>&6 -echo "configure:11709: checking for location of LAPACK library" >&5 +echo "configure:11724: checking for location of LAPACK library" >&5 case "$with_lapack_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-lapack-libs." 1>&2; exit 1; } @@ -11731,15 +11746,15 @@ for ac_hdr in clapack.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:11735: checking for $ac_hdr" >&5 +echo "configure:11750: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:11743: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:11758: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -11771,10 +11786,10 @@ if test lapack_ok=no; then save_LIBS="$LIBS"; LIBS="$LIBS $BLASLIB $MATHLIB $FLIBS" save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LAPACKLIB $LDFLAGS" echo $ac_n "checking for dsegv_""... $ac_c" 1>&6 -echo "configure:11775: checking for dsegv_" >&5 +echo "configure:11790: checking for dsegv_" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11816: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_dsegv_=yes" else @@ -11824,13 +11839,13 @@ if test $lapack_ok = no; then save_libs="$LIBS"; LIBS="$BLASLIB $MATHLIB $LIBS" save_LDFLAGS="$LDFLAGS"; LDFLAGS="$LAPACKLIB $LDFLAGS" echo $ac_n "checking for desgv_ in -llapack""... $ac_c" 1>&6 -echo "configure:11828: checking for desgv_ in -llapack" >&5 +echo "configure:11843: checking for desgv_ in -llapack" >&5 ac_lib_var=`echo lapack'_'desgv_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-llapack $FLIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11860: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11873,13 +11888,13 @@ LDFLAGS="$LAPACKLIB $LDFLAGS" echo $ac_n "checking for dgesv_ in -llapack""... $ac_c" 1>&6 -echo "configure:11877: checking for dgesv_ in -llapack" >&5 +echo "configure:11892: checking for dgesv_ in -llapack" >&5 ac_lib_var=`echo lapack'_'dgesv_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-llapack $BLASLIB $MATHLIB $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11909: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11909,13 +11924,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for dgesv_ in -llapack""... $ac_c" 1>&6 -echo "configure:11913: checking for dgesv_ in -llapack" >&5 +echo "configure:11928: checking for dgesv_ in -llapack" >&5 ac_lib_var=`echo lapack'_'dgesv_ | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-llapack $BLASLIB $MATHLIB -lg2c $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:11945: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -11982,7 +11997,7 @@ fi # $USE_BLAS echo $ac_n "checking whether to use Cairo""... $ac_c" 1>&6 -echo "configure:11986: checking whether to use Cairo" >&5 +echo "configure:12001: checking whether to use Cairo" >&5 echo "$ac_t"""$with_cairo"" 1>&6 case "$with_cairo" in "no") USE_CAIRO= ;; @@ -12014,7 +12029,7 @@ CAIROINC=`$PKG_CONFIG --cflags $cairo` echo $ac_n "checking for location of cairo includes""... $ac_c" 1>&6 -echo "configure:12018: checking for location of cairo includes" >&5 +echo "configure:12033: checking for location of cairo includes" >&5 case "$with_cairo_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-cairo-includes." 1>&2; exit 1; } @@ -12040,15 +12055,15 @@ for ac_hdr in cairo.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:12044: checking for $ac_hdr" >&5 +echo "configure:12059: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12052: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12067: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12084,7 +12099,7 @@ CAIROLIB=`$PKG_CONFIG --libs $cairo` echo $ac_n "checking for location of cairo library""... $ac_c" 1>&6 -echo "configure:12088: checking for location of cairo library" >&5 +echo "configure:12103: checking for location of cairo library" >&5 case "$with_cairo_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-cairo-libs." 1>&2; exit 1; } @@ -12104,7 +12119,7 @@ fi echo $ac_n "checking for cairo linking flags""... $ac_c" 1>&6 -echo "configure:12108: checking for cairo linking flags" >&5 +echo "configure:12123: checking for cairo linking flags" >&5 case "$with_cairo_ldflags" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-cairo-ldflags." 1>&2; exit 1; } @@ -12120,10 +12135,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $CAIROLIB $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for cairo_create""... $ac_c" 1>&6 -echo "configure:12124: checking for cairo_create" >&5 +echo "configure:12139: checking for cairo_create" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_cairo_create=yes" else @@ -12180,10 +12195,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $CAIROLIB $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for cairo_xlib_surface_create_with_xrender_format""... $ac_c" 1>&6 -echo "configure:12184: checking for cairo_xlib_surface_create_with_xrender_format" >&5 +echo "configure:12199: checking for cairo_xlib_surface_create_with_xrender_format" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12225: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_cairo_xlib_surface_create_with_xrender_format=yes" else @@ -12239,10 +12254,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $CAIROLIB $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for cairo_xlib_surface_get_xrender_format""... $ac_c" 1>&6 -echo "configure:12243: checking for cairo_xlib_surface_get_xrender_format" >&5 +echo "configure:12258: checking for cairo_xlib_surface_get_xrender_format" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12284: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_cairo_xlib_surface_get_xrender_format=yes" else @@ -12307,7 +12322,7 @@ fi # $USE_CAIRO echo $ac_n "checking whether to use FreeType""... $ac_c" 1>&6 -echo "configure:12311: checking whether to use FreeType" >&5 +echo "configure:12326: checking whether to use FreeType" >&5 echo "$ac_t"""$with_freetype"" 1>&6 case "$with_freetype" in "no") USE_FREETYPE= ;; @@ -12326,7 +12341,7 @@ if test -n "$USE_FREETYPE"; then echo $ac_n "checking for location of FreeType includes""... $ac_c" 1>&6 -echo "configure:12330: checking for location of FreeType includes" >&5 +echo "configure:12345: checking for location of FreeType includes" >&5 case "$with_freetype_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-freetype-includes." 1>&2; exit 1; } @@ -12352,15 +12367,15 @@ for ac_hdr in ft2build.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:12356: checking for $ac_hdr" >&5 +echo "configure:12371: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12364: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12379: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12394,7 +12409,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of FreeType library""... $ac_c" 1>&6 -echo "configure:12398: checking for location of FreeType library" >&5 +echo "configure:12413: checking for location of FreeType library" >&5 case "$with_freetype_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-freetype-libs." 1>&2; exit 1; } @@ -12419,13 +12434,13 @@ LDFLAGS="$FTLIB $LDFLAGS" echo $ac_n "checking for FT_Init_FreeType in -lfreetype""... $ac_c" 1>&6 -echo "configure:12423: checking for FT_Init_FreeType in -lfreetype" >&5 +echo "configure:12438: checking for FT_Init_FreeType in -lfreetype" >&5 ac_lib_var=`echo freetype'_'FT_Init_FreeType | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lfreetype $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12455: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12477,7 +12492,7 @@ fi # $USE_FREETYPE echo $ac_n "checking whether to use NLS""... $ac_c" 1>&6 -echo "configure:12481: checking whether to use NLS" >&5 +echo "configure:12496: checking whether to use NLS" >&5 echo "$ac_t"""$with_nls"" 1>&6 case "$with_nls" in "no") USE_NLS= ;; @@ -12497,10 +12512,10 @@ EOF echo $ac_n "checking for gettext""... $ac_c" 1>&6 -echo "configure:12501: checking for gettext" >&5 +echo "configure:12516: checking for gettext" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12542: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gettext=yes" else @@ -12541,13 +12556,13 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for gettext in -lintl""... $ac_c" 1>&6 -echo "configure:12545: checking for gettext in -lintl" >&5 +echo "configure:12560: checking for gettext in -lintl" >&5 ac_lib_var=`echo intl'_'gettext | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lintl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12577: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -12593,7 +12608,7 @@ fi echo $ac_n "checking whether to use C++""... $ac_c" 1>&6 -echo "configure:12597: checking whether to use C++" >&5 +echo "configure:12612: checking whether to use C++" >&5 echo "$ac_t"""$with_cxx"" 1>&6 case "$with_cxx" in "no") USE_CXX= ;; @@ -12609,7 +12624,7 @@ do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:12613: checking for $ac_word" >&5 +echo "configure:12628: checking for $ac_word" >&5 if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. @@ -12638,7 +12653,7 @@ test -n "$CXX" || CXX="gcc" echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:12642: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 +echo "configure:12657: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5 ac_ext=C # CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -12649,12 +12664,12 @@ cross_compiling=$ac_cv_prog_cxx_cross cat > conftest.$ac_ext << EOF -#line 12653 "configure" +#line 12668 "configure" #include "confdefs.h" int main(){return(0);} EOF -if { (eval echo configure:12658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:12673: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cxx_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -12680,19 +12695,19 @@ if test $ac_cv_prog_cxx_works = no; then { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:12684: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:12699: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6 cross_compiling=$ac_cv_prog_cxx_cross echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6 -echo "configure:12689: checking whether we are using GNU C++" >&5 +echo "configure:12704: checking whether we are using GNU C++" >&5 cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CXX-g++} -E conftest.C'; { (eval echo configure:12711: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gxx=yes else ac_cv_prog_gxx=no @@ -12710,7 +12725,7 @@ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" CXXFLAGS= echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6 -echo "configure:12714: checking whether ${CXX-g++} accepts -g" >&5 +echo "configure:12729: checking whether ${CXX-g++} accepts -g" >&5 echo 'void f(){}' > conftest.cc if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then @@ -12751,7 +12766,7 @@ fi echo $ac_n "checking whether to use openDWG""... $ac_c" 1>&6 -echo "configure:12755: checking whether to use openDWG" >&5 +echo "configure:12770: checking whether to use openDWG" >&5 echo "$ac_t"""$with_opendwg"" 1>&6 case "$with_opendwg" in "no") USE_OPENDWG= ;; @@ -12771,7 +12786,7 @@ if test -n "${USE_OPENDWG}"; then echo $ac_n "checking for location of openDGW includes""... $ac_c" 1>&6 -echo "configure:12775: checking for location of openDGW includes" >&5 +echo "configure:12790: checking for location of openDGW includes" >&5 case "$with_opendwg_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opendwg-includes." 1>&2; exit 1; } @@ -12797,15 +12812,15 @@ for ac_hdr in ad2.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:12801: checking for $ac_hdr" >&5 +echo "configure:12816: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12809: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12824: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12839,7 +12854,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of openDWG library""... $ac_c" 1>&6 -echo "configure:12843: checking for location of openDWG library" >&5 +echo "configure:12858: checking for location of openDWG library" >&5 case "$with_opendwg_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opendwg-libs." 1>&2; exit 1; } @@ -12880,7 +12895,7 @@ fi # $USE_OPENDWG echo $ac_n "checking whether to use POSIX threads""... $ac_c" 1>&6 -echo "configure:12884: checking whether to use POSIX threads" >&5 +echo "configure:12899: checking whether to use POSIX threads" >&5 echo "$ac_t"""$with_pthread"" 1>&6 case "$with_pthread" in "no") USE_PTHREAD= ;; @@ -12900,7 +12915,7 @@ if test -n "$USE_PTHREAD"; then echo $ac_n "checking for location of POSIX threads includes""... $ac_c" 1>&6 -echo "configure:12904: checking for location of POSIX threads includes" >&5 +echo "configure:12919: checking for location of POSIX threads includes" >&5 case "$with_pthread_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-pthread-includes." 1>&2; exit 1; } @@ -12926,15 +12941,15 @@ for ac_hdr in pthread.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:12930: checking for $ac_hdr" >&5 +echo "configure:12945: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:12938: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:12953: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -12968,7 +12983,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of POSIX threads library""... $ac_c" 1>&6 -echo "configure:12972: checking for location of POSIX threads library" >&5 +echo "configure:12987: checking for location of POSIX threads library" >&5 case "$with_pthread_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-pthread-libs." 1>&2; exit 1; } @@ -12993,10 +13008,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for pthread_create""... $ac_c" 1>&6 -echo "configure:12997: checking for pthread_create" >&5 +echo "configure:13012: checking for pthread_create" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13038: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_pthread_create=yes" else @@ -13046,13 +13061,13 @@ LDFLAGS="$PTHREADLIBPATH $LDFLAGS" echo $ac_n "checking for pthread_create in -lpthread""... $ac_c" 1>&6 -echo "configure:13050: checking for pthread_create in -lpthread" >&5 +echo "configure:13065: checking for pthread_create in -lpthread" >&5 ac_lib_var=`echo pthread'_'pthread_create | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lpthread $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13082: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13113,7 +13128,7 @@ fi # $USE_PTHREAD echo $ac_n "checking whether to use OpenMP""... $ac_c" 1>&6 -echo "configure:13117: checking whether to use OpenMP" >&5 +echo "configure:13132: checking whether to use OpenMP" >&5 echo "$ac_t"""$with_openmp"" 1>&6 case "$with_openmp" in "no") USE_OPENMP= ;; @@ -13134,7 +13149,7 @@ if test -n "$USE_OPENMP"; then echo $ac_n "checking for location of OpenMP includes""... $ac_c" 1>&6 -echo "configure:13138: checking for location of OpenMP includes" >&5 +echo "configure:13153: checking for location of OpenMP includes" >&5 case "$with_openmp_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-openmp-includes." 1>&2; exit 1; } @@ -13160,15 +13175,15 @@ for ac_hdr in omp.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:13164: checking for $ac_hdr" >&5 +echo "configure:13179: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13172: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13187: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13206,7 +13221,7 @@ CPPFLAGS=$ac_save_cppflags echo $ac_n "checking for location of OpenMP library""... $ac_c" 1>&6 -echo "configure:13210: checking for location of OpenMP library" >&5 +echo "configure:13225: checking for location of OpenMP library" >&5 case "$with_openmp_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-openmp-libs." 1>&2; exit 1; } @@ -13231,10 +13246,10 @@ ac_save_ldflags="$LDFLAGS" LIBS=" $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for GOMP_parallel_start""... $ac_c" 1>&6 -echo "configure:13235: checking for GOMP_parallel_start" >&5 +echo "configure:13250: checking for GOMP_parallel_start" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_GOMP_parallel_start=yes" else @@ -13284,13 +13299,13 @@ LDFLAGS="$OMPLIBPATH $LDFLAGS" echo $ac_n "checking for GOMP_parallel_start in -lgomp""... $ac_c" 1>&6 -echo "configure:13288: checking for GOMP_parallel_start in -lgomp" >&5 +echo "configure:13303: checking for GOMP_parallel_start in -lgomp" >&5 ac_lib_var=`echo gomp'_'GOMP_parallel_start | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lgomp $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13320: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13374,7 +13389,7 @@ fi # $USE_OPENMP echo $ac_n "checking whether to use OpenCL""... $ac_c" 1>&6 -echo "configure:13378: checking whether to use OpenCL" >&5 +echo "configure:13393: checking whether to use OpenCL" >&5 echo "$ac_t"""$with_opencl"" 1>&6 case "$with_opencl" in "no") USE_OPENCL= ;; @@ -13394,7 +13409,7 @@ if test -n "$USE_OPENCL"; then echo $ac_n "checking for location of OpenCL includes""... $ac_c" 1>&6 -echo "configure:13398: checking for location of OpenCL includes" >&5 +echo "configure:13413: checking for location of OpenCL includes" >&5 case "$with_opencl_includes" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opencl-includes." 1>&2; exit 1; } @@ -13421,15 +13436,15 @@ for ac_hdr in OpenCL/opencl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:13425: checking for $ac_hdr" >&5 +echo "configure:13440: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13433: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13448: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13469,10 +13484,10 @@ ac_save_ldflags="$LDFLAGS" LIBS="-framework OpenCL $LIBS" LDFLAGS=" $LDFLAGS" echo $ac_n "checking for clGetPlatformInfo""... $ac_c" 1>&6 -echo "configure:13473: checking for clGetPlatformInfo" >&5 +echo "configure:13488: checking for clGetPlatformInfo" >&5 cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13514: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_clGetPlatformInfo=yes" else @@ -13534,15 +13549,15 @@ for ac_hdr in CL/cl.h do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:13538: checking for $ac_hdr" >&5 +echo "configure:13553: checking for $ac_hdr" >&5 cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:13546: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:13561: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -13575,7 +13590,7 @@ CPPFLAGS=$ac_save_cppflags # With OpenCL library directory echo $ac_n "checking for location of OpenCL library""... $ac_c" 1>&6 -echo "configure:13579: checking for location of OpenCL library" >&5 +echo "configure:13594: checking for location of OpenCL library" >&5 case "$with_opencl_libs" in y | ye | yes | n | no) { echo "configure: error: *** You must supply a directory to --with-opencl-libs." 1>&2; exit 1; } @@ -13599,13 +13614,13 @@ LDFLAGS="$OCLLIBPATH $LDFLAGS" echo $ac_n "checking for clGetPlatformInfo in -lOpenCL""... $ac_c" 1>&6 -echo "configure:13603: checking for clGetPlatformInfo in -lOpenCL" >&5 +echo "configure:13618: checking for clGetPlatformInfo in -lOpenCL" >&5 ac_lib_var=`echo OpenCL'_'clGetPlatformInfo | sed 'y%./+-%__p_%'` ac_save_LIBS="$LIBS" LIBS="-lOpenCL $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:13635: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -13676,7 +13691,7 @@ fi fi echo $ac_n "checking for special C compiler options needed for large files""... $ac_c" 1>&6 -echo "configure:13680: checking for special C compiler options needed for large files" >&5 +echo "configure:13695: checking for special C compiler options needed for large files" >&5 ac_cv_sys_largefile_CC=no largefile_cc_opt="" @@ -13684,7 +13699,7 @@ ac_cv_sys_largefile_CC=no # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat > conftest.$ac_ext < /* Check that off_t can represent 2**63 - 1 correctly. @@ -13700,7 +13715,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13719: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -13709,7 +13724,7 @@ else ac_save_CC="${CC-cc}" CC="$CC -n32" cat > conftest.$ac_ext < /* Check that off_t can represent 2**63 - 1 correctly. @@ -13725,7 +13740,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13729: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13744: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_largefile_CC=' -n32' else @@ -13752,11 +13767,11 @@ echo "$ac_t""$ac_cv_sys_largefile_CC" 1>&6 fi echo $ac_n "checking for _FILE_OFFSET_BITS value needed for large files""... $ac_c" 1>&6 -echo "configure:13756: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo "configure:13771: checking for _FILE_OFFSET_BITS value needed for large files" >&5 ac_cv_sys_file_offset_bits=no cat > conftest.$ac_ext < /* Check that off_t can represent 2**63 - 1 correctly. @@ -13772,14 +13787,14 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13776: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13791: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -13797,7 +13812,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13801: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13816: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_file_offset_bits=64 else @@ -13823,11 +13838,11 @@ EOF fi echo $ac_n "checking for _LARGE_FILES value needed for large files""... $ac_c" 1>&6 -echo "configure:13827: checking for _LARGE_FILES value needed for large files" >&5 +echo "configure:13842: checking for _LARGE_FILES value needed for large files" >&5 ac_cv_sys_large_files=no cat > conftest.$ac_ext < /* Check that off_t can represent 2**63 - 1 correctly. @@ -13843,14 +13858,14 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13847: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13862: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -13868,7 +13883,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:13872: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13887: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_large_files=1 else @@ -13894,25 +13909,25 @@ EOF fi echo $ac_n "checking for _LARGEFILE_SOURCE value needed for large files""... $ac_c" 1>&6 -echo "configure:13898: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +echo "configure:13913: checking for _LARGEFILE_SOURCE value needed for large files" >&5 ac_cv_sys_largefile_source=no cat > conftest.$ac_ext < int main() { return !fseeko; ; return 0; } EOF -if { (eval echo configure:13909: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13924: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -13921,7 +13936,7 @@ int main() { return !fseeko; ; return 0; } EOF -if { (eval echo configure:13925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13940: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_largefile_source=1 else @@ -13953,25 +13968,25 @@ EOF ac_save_cflags=${CFLAGS} CFLAGS="$LFS_CFLAGS ${ac_save_cflags}" echo $ac_n "checking for _LARGEFILE_SOURCE value needed for large files""... $ac_c" 1>&6 -echo "configure:13957: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +echo "configure:13972: checking for _LARGEFILE_SOURCE value needed for large files" >&5 ac_cv_sys_largefile_source=no cat > conftest.$ac_ext < int main() { return !fseeko; ; return 0; } EOF -if { (eval echo configure:13968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13983: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -13980,7 +13995,7 @@ int main() { return !fseeko; ; return 0; } EOF -if { (eval echo configure:13984: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:13999: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_sys_largefile_source=1 else @@ -14010,18 +14025,18 @@ EOF # If you want fseeko and ftello with glibc, upgrade to a fixed glibc. echo $ac_n "checking for fseeko""... $ac_c" 1>&6 -echo "configure:14014: checking for fseeko" >&5 +echo "configure:14029: checking for fseeko" >&5 ac_cv_func_fseeko=no cat > conftest.$ac_ext < int main() { return fseeko && fseeko (stdin, 0, 0); ; return 0; } EOF -if { (eval echo configure:14025: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:14040: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_cv_func_fseeko=yes else @@ -14038,10 +14053,10 @@ EOF fi echo $ac_n "checking if system supports Large Files at all""... $ac_c" 1>&6 -echo "configure:14042: checking if system supports Large Files at all" >&5 +echo "configure:14057: checking if system supports Large Files at all" >&5 cat > conftest.$ac_ext < #include @@ -14073,7 +14088,7 @@ return !ftello; #endif ; return 0; } EOF -if { (eval echo configure:14077: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:14092: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_largefiles=yes else @@ -14221,6 +14236,8 @@ s%@GRASS_VERSION_RELEASE@%$GRASS_VERSION_RELEASE%g s%@GRASS_VERSION_NUMBER@%$GRASS_VERSION_NUMBER%g s%@GRASS_VERSION_DATE@%$GRASS_VERSION_DATE%g s%@GRASS_VERSION_GIT@%$GRASS_VERSION_GIT%g +s%@GRASS_HEADERS_GIT_HASH@%$GRASS_HEADERS_GIT_HASH%g +s%@GRASS_HEADERS_GIT_DATE@%$GRASS_HEADERS_GIT_DATE%g s%@NAME_VER@%$NAME_VER%g s%@LIB_VER@%$LIB_VER%g s%@MACOSX_APP@%$MACOSX_APP%g diff --git a/configure.in b/configure.in index e71b7ae44bf..0beae19767f 100644 --- a/configure.in +++ b/configure.in @@ -140,12 +140,24 @@ LIB_VER=`echo ${GRASS_VERSION_NUMBER} | sed 's/^\([0-9.]*\).*$/\1/'` changequote([,]) GRASS_VERSION_GIT="exported" +# get git short hash + date of last change in GRASS headers +# (and anything else in include) +GRASS_HEADERS_GIT_HASH=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'` +GRASS_HEADERS_GIT_DATE=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'` AC_PATH_PROG(GIT, git, no) if test "$GIT" != "no" ; then GRASS_VERSION_GIT=`$GIT rev-parse --short HEAD 2>/dev/null` if test -z "$GRASS_VERSION_GIT"; then GRASS_VERSION_GIT="exported" fi + GRASS_HEADERS_GIT_HASH=`$GIT log -1 --pretty=format:"%h" -- "${SRCDIR}/include" 2>/dev/null` + if test -z "$GRASS_HEADERS_GIT_HASH"; then + GRASS_HEADERS_GIT_HASH=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'` + fi + GRASS_HEADERS_GIT_DATE=`date -d $($GIT log -1 --pretty=format:"%cI" -- "${SRCDIR}/include") -u +%FT%T%z | sed 's/\(..\)$/:\1/'` 2>/dev/null + if test -z "$GRASS_HEADERS_GIT_DATE"; then + GRASS_HEADERS_GIT_DATE=`date -u +%FT%T%z | sed 's/\(..\)$/:\1/'` + fi fi AC_SUBST(GRASS_VERSION_FILE) @@ -155,6 +167,8 @@ AC_SUBST(GRASS_VERSION_RELEASE) AC_SUBST(GRASS_VERSION_NUMBER) AC_SUBST(GRASS_VERSION_DATE) AC_SUBST(GRASS_VERSION_GIT) +AC_SUBST(GRASS_HEADERS_GIT_HASH) +AC_SUBST(GRASS_HEADERS_GIT_DATE) AC_SUBST(NAME_VER) AC_SUBST(LIB_VER) diff --git a/db/databaseintro.html b/db/databaseintro.html index 141febaba9f..3657d7dfdbb 100644 --- a/db/databaseintro.html +++ b/db/databaseintro.html @@ -42,7 +42,7 @@

Attribute data import and export

SQL commands

-GRASS supports to main SQL operations, execution of an SQL statement +GRASS supports two main SQL operations, execution of an SQL statement (db.execute) and selection of data from a table (db.select). See the SQL help page for examples. diff --git a/db/drivers/postgres/describe.c b/db/drivers/postgres/describe.c index 86878eaa2c7..558d3d4c97f 100644 --- a/db/drivers/postgres/describe.c +++ b/db/drivers/postgres/describe.c @@ -207,6 +207,7 @@ int get_column_info(PGresult * res, int col, int *pgtype, int *gpgtype, case PG_TYPE_TEXT: *sqltype = DB_SQL_TYPE_TEXT; + *size = 1000; break; case PG_TYPE_FLOAT4: diff --git a/doc/howto_release.md b/doc/howto_release.md index 54bbe550564..4213bcd594a 100644 --- a/doc/howto_release.md +++ b/doc/howto_release.md @@ -1,6 +1,7 @@ # How to release GRASS GIS binaries and source code -*Note: Some steps in this text are to be done by the development coordinator (currently Markus Neteler, PSC Chair) due to needed logins.* +*Note: Some steps in this text are to be done by the development coordinator +(currently Markus Neteler, PSC Chair) due to needed logins.* ## HOWTO create a release @@ -20,9 +21,11 @@ tools/fix_typos.sh ``` ### i18N: sync from Transifex -See https://www.transifex.com/grass-gis/grass7/dashboard/ -Exception Latvian as Latvian is directly edited in git and then sync'ed from master .po files +See + +Exception Latvian as Latvian is directly edited in git and then sync'ed from +master .po files ```bash cd locale @@ -42,6 +45,7 @@ make verify *Only allowed in RC cycle, not for final release!* Check that autoconf scripts are up-to-date: + ```bash rm -f config.guess config.sub wget http://git.savannah.gnu.org/cgit/config.git/plain/config.guess @@ -49,9 +53,11 @@ wget http://git.savannah.gnu.org/cgit/config.git/plain/config.sub git diff config.guess config.sub autoconf-2.13 ``` + Now check if configure still works. If yes, submit to git: + ```bash git add config.guess config.sub configure git checkout -b config_sub_update_r78 @@ -78,11 +84,13 @@ find . -name '*.o' | xargs rm find . -name '*.pyc' | xargs rm find . -name 'OBJ.*' | xargs rm -r find . -name '__pycache__' | xargs rm -r -rm -f gui/wxpython/menustrings.py gui/wxpython/build_ext.pyc gui/wxpython/xml/menudata.xml gui/wxpython/xml/module_tree_menudata.xml +rm -f gui/wxpython/menustrings.py gui/wxpython/build_ext.pyc \ + gui/wxpython/xml/menudata.xml gui/wxpython/xml/module_tree_menudata.xml chmod -R a+r * ``` Double check: + ```bash git status ``` @@ -95,7 +103,7 @@ git status Directly edit VERSION file in GH interface: -https://github.com/OSGeo/grass/blob/releasebranch_7_8/include/VERSION + Example: @@ -113,7 +121,7 @@ Example: ### Create release tag -(see https://help.github.com/en/articles/creating-releases) +(see ) Preparation: @@ -148,43 +156,25 @@ echo "$VERSION" To be done in GH interface: -https://github.com/OSGeo/grass/releases/new + Tag version | target (examples): 7.8.1RC1 | releasebranch_7_8 -Add release desciption (re-use existing texts as possible) +Add release desciption (re-use existing texts as possible, from +) If RC, then check [x] This is a pre-release ### Packaging of source code tarball -TODO: add checkout of code via release tag (?) - ```bash -# update again from GH to fetch tag -# assumptions: -# - own fork as "origin" -# - remote repo as "upstream" -git fetch --all --prune && git checkout releasebranch_7_8 && \ - git merge upstream/releasebranch_7_8 && git push origin releasebranch_7_8 - -# create source package (in the source directory): -echo grass-${VERSION} - -mkdir grass-${VERSION} -mv * grass-${VERSION}/ -# create the package: -tar cvfzh grass-${VERSION}.tar.gz --exclude-vcs grass-${VERSION}/* -# restore src code location: -mv ./grass-${VERSION}/* . -rmdir ./grass-${VERSION} -# Calculating MD5 sum: +# fetch tarball from GitHub +wget https://github.com/OSGeo/grass/archive/${VERSION}.tar.gz -O grass-${VERSION}.tar.gz md5sum grass-${VERSION}.tar.gz > grass-${VERSION}.md5sum ``` - Create Changelog file on release branch: ```bash @@ -194,11 +184,11 @@ head ChangeLog_$VERSION gzip ChangeLog_$VERSION ``` -### Reset include/VERSION file to git version: +### Reset include/VERSION file to git version Directly edit VERSION file in GH interface: -https://github.com/OSGeo/grass/blob/releasebranch_7_8/include/VERSION + Example: @@ -212,6 +202,7 @@ Example: Commit as "back to dev" Reset local copy to GH: + ```bash # update from GH # assumptions: @@ -243,6 +234,8 @@ scp -p grass-$VERSION.* AUTHORS COPYING ChangeLog_$VERSION.gz \ # generate link to "latest" source code ssh neteler@$SERVER1 "cd $SERVER1DIR ; rm -f grass-$MAJOR.$MINOR-latest.tar.gz" ssh neteler@$SERVER1 "cd $SERVER1DIR ; ln -s grass-$VERSION.tar.gz grass-$MAJOR.$MINOR-latest.tar.gz" +ssh neteler@$SERVER1 "cd $SERVER1DIR ; rm -f grass-$MAJOR.$MINOR-latest.md5sum" +ssh neteler@$SERVER1 "cd $SERVER1DIR ; ln -s grass-$VERSION.tar.gz grass-$MAJOR.$MINOR-latest.md5sum" # verify echo "https://$SERVER1/grass$MAJOR$MINOR/source/" @@ -266,65 +259,84 @@ Release is done. #### Update CMS web site to show new version - News section -- https://grass.osgeo.org/download/software/ -- https://grass.osgeo.org/download/software/sources/ -- https://grass.osgeo.org/download/software/linux/ -- https://grass.osgeo.org/home/history/releases/ +- +- +- +- TODO: git tags -- https://grass.osgeo.org/development/svn/svn-tags/ (add tag): echo $RELEASETAG + +- (add tag): echo $RELEASETAG #### Write announcement and publish it + - store in trac: - - https://trac.osgeo.org/grass/wiki/Release/7.8.x-News - - https://trac.osgeo.org/grass/wiki/Grass7/NewFeatures78 <- add content of major changes only -- update version in https://grasswiki.osgeo.org/wiki/GRASS-Wiki -- ~~store in Web as announces/announce_grass$MAJOR$MINOR$RELEASE.html <- how? with protected PHP upload page?~~ (dropped since CMS) + - + - <- add content + of major changes only +- update version in +- ~~store in Web as announces/announce_grass$MAJOR$MINOR$RELEASE.html <- how? + with protected PHP upload page?~~ (dropped since CMS) #### Only when new major release -- update cronjob 'cron_grass_HEAD_src_snapshot.sh' on grass.osgeo.org to next but one release tag for the differences + +- update cronjob 'cron_grass_HEAD_src_snapshot.sh' on grass.osgeo.org to next + but one release tag for the differences - wiki updates, only when new major release: - - {{cmd|xxxx}} macro: https://grasswiki.osgeo.org/wiki/Template:Cmd + - {{cmd|xxxx}} macro: - update last version on main page - trac updates, only when new major release: - - Set "complete" flag in https://trac.osgeo.org/grass/milestone/7.8.x --> Edit Milestone + - Set "complete" flag in --> + Edit Milestone - also: Retarget associated open tickets to milestone 7.8.x - - Batch modify tickets, set to next milestone (update this query accordingly: two entries to change): - - https://trac.osgeo.org/grass/query?status=assigned&status=new&status=reopened&milestone=7.8.0&milestone=7.8.1&group=status&col=id&col=summary&col=owner&col=type&col=priority&col=component&col=version&order=priority - - Set max items to 1000, then select all shown tickets via Status: assigned/new/reopened sections - - Scroll down to "Batch modify": under the "Comment" section, add Field "Milestone" and set to next version - - then use "Change ticket" button, done. - - Only in case of new release branch being created: + - Batch modify tickets, set to next milestone (update this query + accordingly: two entries to change): + - + - Set max items to 1000, then select all shown tickets via Status: + assigned/new/reopened sections + - Scroll down to "Batch modify": under the "Comment" section, add Field + "Milestone" and set to next version + - then use "Change ticket" button, done. + - Only in case of new release branch being created: - Add Wiki Macro definitions for manual pages G7X:modulename - - Edit: https://trac.osgeo.org/grass/wiki/InterMapTxt + - Edit: #### WinGRASS notes + - Update grass_packager_release.bat, eg. + ``` set MAJOR=7 set MINOR=8 set PATCH=0RC1 ``` + - Update addons (grass_addons.sh) rules, eg. + ``` compile $GIT_PATH/grass7 $GISBASE_PATH/grass780RC1 $ADDON_PATH/grass780RC1/addons ``` + - Modify grass_copy_wwwroot.sh accordingly, eg. + ``` copy_addon 781RC1 7.8.1RC1 ``` -#### Launchpad notes: -- Create milestone and release: https://launchpad.net/grass/+series +#### Launchpad notes + +- Create milestone and release: - Upload tarball for created release -- Update daily recipe contents: https://code.launchpad.net/~grass/+recipe/grass-trunk +- Update daily recipe contents: + +#### Packaging notes -#### Packaging notes: -- https://trac.osgeo.org/grass/wiki/BuildHints - - https://trac.osgeo.org/grass/wiki/DebianUbuntuPackaging - - https://trac.osgeo.org/grass/wiki/CompileOnWindows +- + - + - + +#### Marketing - tell others about release -#### Marketing - tell others about release: - Notify all packagers (MN has email list) - If release candidate: - @@ -334,32 +346,34 @@ TODO: git tags - Our GRASS web site: /announces/ - Note: DON'T use relative links there - Our main mailing lists: - - http://lists.osgeo.org/mailman/listinfo/grass-announce | - - http://lists.osgeo.org/mailman/listinfo/grass-dev | - - http://lists.osgeo.org/mailman/listinfo/grass-user | -- DebianGIS: - send only small note -- FreeGIS: -- Geowanking: -- OSGeo.org: + - | + - | + - | +- DebianGIS: - send only small note +- FreeGIS: +- Geowanking: +- OSGeo.org: Via Email: + - info@osgeo.org -- http://www.gis-news.de/ (franz-josef.behr@gismngt.de) -- http://spatialnews.geocomm.com/submitnews.html (not free any more, convince editor@geocomm.com) +- (franz-josef.behr@gismngt.de) - mfeilner@linuxnewmedia.de - info@harzer.de - editor-geo@geoconnexion.com Via Web: -- https://plus.google.com/u/0/communities/111147786674687562495 (G+ GRASS GIS community) -- http://linuxtoday.com/contribute.php3 -- https://joinup.ec.europa.eu/software/grassgis/home (submit news, MN) -- http://www.macnn.com/contact/newstips/1 -- http://www10.giscafe.com/submit_material/submit_options.php#Press (MN) --> Press releases -- http://www.directionsmag.com/pressreleases/ (News -> Submit Press Release) -- http://directory.fsf.org/wiki/GRASS_%28Geographic_Resources_Analysis_Support_System%29 -- https://www.linux-apps.com/p/1128004/edit/ (MN) -- https://news.eoportal.org/web/eoportal/share-your-news (MN) -> Share your news with the EO community -- https://www.heise.de/download/product/grass-gis-7105 (update, MN) -- See also: https://grass.osgeo.org/wiki/Contact_Databases + +- +- (submit news, MN) +- +- (MN) --> + Press releases +- (News -> Submit Press Release) +- +- (MN) +- (MN) -> Share your + news with the EO community +- (update, MN) +- See also: - ... anywhere else? Please add here. diff --git a/doc/infrastructure.txt b/doc/infrastructure.txt index 2128d13e8f4..602d7004e3b 100644 --- a/doc/infrastructure.txt +++ b/doc/infrastructure.txt @@ -1,12 +1,13 @@ How the GRASS Webserver and related infrastructure works written by M. Neteler -Last changed: Oct 2019 +Last changed: May 2020 Related Wiki documents: * https://grass.osgeo.org/wiki/GRASS_Migration_to_OSGeo (historical document) + == GRASS Source code repository == Maintainer: Markus Neteler, Martin Landa, OSGeo-SAC, http://wiki.osgeo.org/wiki/SAC @@ -36,13 +37,15 @@ downloadable_paths = /grass-addons/grass7/*/*,/sandbox/*/* Statistics: https://trac.osgeo.org/grass/stats/code + == GRASS Web server == Maintainer: M. Neteler -* https://grass.osgeo.org +* https://grass.osgeo.org (to be replaced in 2020, see https://staging.grass.osgeo.org/) ** Shared virtual OSGeo machine (osgeo6) hosted at Oregon State University Open Source Lab (server: osgeo6.osgeo.osuosl.org) +** new server 2020: LXD container on osgeo7 ** OSGeo SAC page: http://wiki.osgeo.org/wiki/SAC_Service_Status http://wiki.osgeo.org/index.php/SAC ** Login: via OSGeo LDAP, there is a "grass" LDAP group @@ -53,10 +56,11 @@ Maintainer: M. Neteler * Backup: ** VERIFY 2010: grass.osgeo.org is backup'ed by OSGeo SAC: http://wiki.osgeo.org/wiki/SAC:Backups ** Wiki backup, via rsync to http://josef.fsv.cvut.cz/WIKI/grass-osgeo/index.php/Main_Page +** new server 2020: LXD container on osgeo7 backup'ed * Web pages: -** CMSMS: https://grass.osgeo.org/home/imprint/ -** mirrored from Wroclav university via httrack (tier-1), +** CMSMS: https://grass.osgeo.org/home/imprint/ (to be phased out in 2020 with hugo solution) +** OLD mirrored from Wroclav university via httrack (tier-1), then offered as rsync mirror (tier-2) to other mirror sites ** RSS feed: offered by CMSMS @@ -105,6 +109,12 @@ Maintainer: M. Neteler Summary: The system should run almost autonomously. + +== WinGRASS maintenance scripts == + +* https://github.com/landam/wingrass-maintenance-scripts + + == GRASS Mailing lists == Maintainer: Markus Neteler @@ -154,6 +164,7 @@ Summary: The system should run almost autonomous. An eye must be Macro for manual pages: https://grasswiki.osgeo.org/wiki/Template:Cmd + == GRASS IRC == Channel: irc://irc.freenode.net/grass @@ -169,16 +180,15 @@ Web based client: See http://grasswiki.osgeo.org/wiki/IRC == GRASS Bugtracker == -Future bugtracker - * https://github.com/OSGeo/grass +Current bugtracker (Jan 2020 - today): + * https://github.com/OSGeo/grass/issues -Current bugtracker (Jan 2008 - today): +Current bugtracker (Jan 2008 - Jan 2020): * https://trac.osgeo.org/grass/report - * Trac * posts new bugs and comments to grass-dev list * Settings: -tracsvn (OSGeo server) (Dec 2007 - 2019) +Old tracsvn (OSGeo server) (Dec 2007 - Mai 2019) /var/www/trac/env/grass/conf/trac.ini downloadable_paths = /grass-addons/grass7/*/*,/sandbox/*/* path = /var/www/grass/htdocs @@ -191,13 +201,13 @@ tracsvn (OSGeo server) (Dec 2007 - 2019) base_url = https://trac.osgeo.org/grass/ database = postgres://postgres@/trac_grass -Old bugtracker (Jan 2007 - Dec 2008): +Very old bugtracker (Jan 2007 - Dec 2008): * http://wald.intevation.org/tracker/?group_id=21 * gforce, sponsored by Intevation GmbH, Germany * spamassasin spamfilter locally, bogofilter at grass-dev list * needs 'noreply*wald.intevation.org' to be enabled as alias in Mailman -Very old bugtracker (Dec 2000 - Dec 2006): +Very very old bugtracker (Dec 2000 - Dec 2006): * https://intevation.de/rt/webrt?q_queue=grass * webRT, sponsored by Intevation GmbH, Germany * spamassasin spamfilter locally, bogofilter at grass-dev list @@ -215,13 +225,16 @@ Details: Installed with g.extension Manuals: https://grass.osgeo.org/grass7/manuals/addons/ -The redirect to the latest directory is defined on grass.osgeo.org: +The redirect to the latest grass7x directory is defined on grass.osgeo.org: /etc/apache2/includes/grass.osgeo.org.inc Procedure building of binaries (Windows): Addons module are compiled on build server, currently at the CTU in Prague) and publishing their manual pages on publishing server, i.e. grass.osgeo.org. A new compilation is triggered everytime when a commit is done in the Addons-SVN. + Logs: + * Linux log files: https://grass.osgeo.org/addons/grass7/logs + * Windows log files: http://wingrass.fsv.cvut.cz/grass78/x86_64/addons/latest/logs/ Procedure of granting write access to Addons repo: * Request procedure: https://trac.osgeo.org/grass/wiki/HowToContribute#WriteaccesstotheGRASS-Addons-SVNrepository @@ -252,6 +265,26 @@ Maintenance script: The github update is run as a cronjob on server "geo102" (CTU, CZ). + +== GRASS CI: GitHub Actions == + +Started Apr. 2020 + +Maintainer: Vaclav Petras + +* https://github.com/OSGeo/grass/actions +* Details: https://github.com/OSGeo/grass/pull/525 + +- CI workflow with: + - A build job which is not parallelized and is meant for clear & relatively fast check of compilation and building in general. (Duplicating what is running on Travis) + - A test job which of course needs to build, but the main focus is to run tests, so the compilation is parallelized (depending on nproc) and thus potentially less readable. This runs the whole test suite. (You need to run it locally to see the actual error, but you can see which tests are failing.) +- Static code analysis/Code quality check using Flake8 with separate tests for lib/python, gui/wxpython, scripts and temporal directories. + - lib/python uses configuration which ignores code in testsuite directories and ignores a lot of errors. + - The other directories use the default settings and the failure is ignored. (Neither is an ideal solution, but we can see and change it based on whatever is more advantageous for getting it fixed.) + +Helper files placed to .github/workflows + + == GRASS Coverity Scan == Maintainer: Markus Neteler diff --git a/doc/projectionintro.html b/doc/projectionintro.html index f9b889a8e8c..77a79562630 100644 --- a/doc/projectionintro.html +++ b/doc/projectionintro.html @@ -58,8 +58,9 @@

Vector map transformation

References

diff --git a/doc/python/m.distance.py b/doc/python/m.distance.py index 298f03b01d2..7680149745d 100755 --- a/doc/python/m.distance.py +++ b/doc/python/m.distance.py @@ -119,11 +119,11 @@ def main(): segment_distance = G_distance(x[i-1], y[i-1], x[i], y[i]) overall_distance += segment_distance - print "segment %d distance is %.2f meters" % (i, segment_distance) + print("segment %d distance is %.2f meters" % (i, segment_distance)) # add to the area array - print "\ntotal distance is %.2f meters\n" % overall_distance + print("\ntotal distance is %.2f meters\n" % overall_distance) # calc area if len(coords) < 3: @@ -136,7 +136,7 @@ def main(): # do not need to close polygon (but it doesn't hurt if you do) area = G_area_of_polygon(x, y, len(coords)) - print "area is %.2f square meters\n" % area + print("area is %.2f square meters\n" % area) # we don't need this, but just to have a look if proj_type == 1: diff --git a/doc/python/raster_example_ctypes.py b/doc/python/raster_example_ctypes.py index 1b28e6e191d..d56c33384c0 100644 --- a/doc/python/raster_example_ctypes.py +++ b/doc/python/raster_example_ctypes.py @@ -52,7 +52,7 @@ ptype = POINTER(c_double) type_name = 'DCELL' -print "Raster map <%s> contains data type %s." % (input, type_name) +print("Raster map <%s> contains data type %s." % (input, type_name)) in_fd = Rast_open_old(input, mapset) in_rast = Rast_allocate_buf(data_type) @@ -60,14 +60,14 @@ rows = Rast_window_rows() cols = Rast_window_cols() -print "Current region is %d rows x %d columns" % (rows, cols) +print("Current region is %d rows x %d columns" % (rows, cols)) # iterate through map rows -print "Map data:" +print("Map data:") for row_n in range(rows): # read a row of raster data into memory, then print it Rast_get_row(in_fd, in_rast, row_n, data_type) - print row_n, in_rast[0:cols] + print(row_n, in_rast[0:cols]) # TODO check for NULL # closed map and cleanup memory allocation diff --git a/doc/python/vector_example_ctypes.py b/doc/python/vector_example_ctypes.py index 5f67b09ccd6..7d57e045e88 100644 --- a/doc/python/vector_example_ctypes.py +++ b/doc/python/vector_example_ctypes.py @@ -36,10 +36,10 @@ Vect_open_old(map_info, input, mapset) # query -print 'Vector map :', Vect_get_full_name(map_info) -print 'Vector is 3D :', Vect_is_3d(map_info) -print 'Vector DB links :', Vect_get_num_dblinks(map_info) -print 'Map Scale : 1:%d' % Vect_get_scale(map_info) +print('Vector map :', Vect_get_full_name(map_info)) +print('Vector is 3D :', Vect_is_3d(map_info)) +print('Vector DB links :', Vect_get_num_dblinks(map_info)) +print('Map Scale : 1:%d' % Vect_get_scale(map_info)) # vector box tests box = bound_box() @@ -48,13 +48,13 @@ c_easting2 = 4599505.0 Vect_get_map_box(map_info, byref(box)) -print 'Position 1 in box ?', Vect_point_in_box(c_easting1, c_northing, 0, byref(box)) -print 'Position 2 in box ?', Vect_point_in_box(c_easting2, c_northing, 0, byref(box)) +print('Position 1 in box ?', Vect_point_in_box(c_easting1, c_northing, 0, byref(box))) +print('Position 2 in box ?', Vect_point_in_box(c_easting2, c_northing, 0, byref(box))) -print 'Number of features:', Vect_get_num_lines(map_info) -print 'Number of points :', Vect_get_num_primitives(map_info, GV_POINT) -print 'Number of lines :', Vect_get_num_primitives(map_info, GV_LINE) -print 'Number of areas :', Vect_get_num_areas(map_info) +print('Number of features:', Vect_get_num_lines(map_info)) +print('Number of points :', Vect_get_num_primitives(map_info, GV_POINT)) +print('Number of lines :', Vect_get_num_primitives(map_info, GV_LINE)) +print('Number of areas :', Vect_get_num_areas(map_info)) # close map Vect_close(map_info) diff --git a/docker/README.md b/docker/README.md new file mode 100644 index 00000000000..2ee2d9e3b28 --- /dev/null +++ b/docker/README.md @@ -0,0 +1,27 @@ +# GRASS GIS docker matrix + +| Base image | Docker tag | GRASS GIS | PROJ | GDAL | PDAL | Image size | +|--------------|-----------------|------------|-------|-------|-------|------------| +| Ubuntu 18.04 | latest-ubuntu | 7.9.dev | 4.9.3 | 2.2.3 | 1.8.0 | 1.04 GB | +| Ubuntu 19.10 | latest-ubuntu19 | 7.9.dev | 5.2.0 | 2.4.2 | 1.9.1 | 850 MB | +| Debian 10.1 | latest-debian | 7.9.dev | 5.2.0 | 2.4.0 | 1.8.0 | 1.14 GB | +| Alpine 3.11 | latest-alpine | 7.9.dev | 6.2.1 | 3.0.3 | 1.8.0 | 385 MB | +|--------------|-----------------|------------|-------|-------|-------|------------| +| Ubuntu 18.04 | stable-ubuntu | 7.8 branch | 4.9.3 | 2.2.3 | 1.8.0 | 1.04 GB | +| Ubuntu 19.10 | stable-ubuntu19 | 7.8 branch | 5.2.0 | 2.4.2 | 1.9.1 | 850 MB | +| Debian 10.1 | stable-debian | 7.8 branch | 5.2.0 | 2.4.0 | 1.8.0 | 1.14 GB | +| Alpine 3.11 | stable-alpine | 7.8 branch | 6.2.1 | 3.0.3 | 1.8.0 | 385 MB | + +Latest update: 10 May 2020 + +# Requirements + + * docker or podman + +# Installation + +To install a docker image, run (replace `` with the desired Docker tag from the table above): + +``` +docker pull mundialis/grass-py3-pdal: +``` diff --git a/docker/alpine/Dockerfile_alpine b/docker/alpine/Dockerfile_alpine index 8192795df63..c7ddca15668 100644 --- a/docker/alpine/Dockerfile_alpine +++ b/docker/alpine/Dockerfile_alpine @@ -1,4 +1,5 @@ -FROM alpine:edge +FROM mundialis/docker-pdal:1.8.0 as pdal +FROM alpine:3.11 as common # Based on: # https://github.com/mundialis/docker-grass-gis/blob/master/Dockerfile @@ -8,6 +9,78 @@ LABEL maintainer="peter.zamb@gmail.com,neteler@osgeo.org" # PACKAGES VERSIONS ARG PYTHON_VERSION=3 +# List of packages to be installed +ENV PACKAGES="\ + attr \ + bash \ + bison \ + bzip2 \ + cairo \ + curl \ + fftw \ + flex \ + freetype \ + gdal \ + gettext \ + geos \ + gnutls \ + jsoncpp \ + libbz2 \ + libexecinfo \ + libjpeg-turbo \ + libpng \ + libunwind \ + musl \ + musl-utils \ + ncurses \ + openjpeg \ + openblas \ + py3-numpy \ + py3-pillow \ + py3-six \ + postgresql \ + proj-datumgrid \ + proj-util \ + sqlite \ + sqlite-libs \ + subversion \ + tiff \ + zstd \ + zstd-libs \ + " +# ==================== +# INSTALL DEPENDENCIES +# ==================== + +WORKDIR /src + +ENV PYTHONBIN=python$PYTHON_VERSION + +RUN echo "Install Python";\ + apk add --no-cache $PYTHONBIN && \ + $PYTHONBIN -m ensurepip && \ + rm -r /usr/lib/python*/ensurepip && \ + pip$PYTHON_VERSION install --upgrade pip setuptools && \ + if [ ! -e /usr/bin/pip ]; then ln -s pip$PYTHON_VERSION /usr/bin/pip ; fi && \ + if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/$PYTHONBIN /usr/bin/python; fi && \ + rm -r /root/.cache + +# Add the packages +RUN echo "Install main packages";\ + apk update; \ + apk add --no-cache $PACKAGES + +COPY --from=pdal /usr/bin/pdal* /usr/bin/ +COPY --from=pdal /usr/lib/pdal /usr/lib/pdal +COPY --from=pdal /usr/lib/libpdal* /usr/lib/ +COPY --from=pdal /usr/lib/pkgconfig/pdal.pc /usr/lib/pkgconfig/pdal.pc +COPY --from=pdal /usr/include/pdal /usr/include/pdal +COPY --from=pdal /usr/local/lib/liblaszip* /usr/local/lib/ +COPY --from=pdal /usr/local/include/laszip /usr/local/include/laszip + + +FROM common as build + # ================ # CONFIG VARIABLES # ================ @@ -47,46 +120,8 @@ ENV MYCFLAGS="-O2 -std=gnu99 -m64" \ CXXFLAGS="$MYCXXFLAGS" \ NUMTHREADS=2 - -# List of packages to be installed -ENV PACKAGES="\ - attr \ - bash \ - bison \ - bzip2 \ - cairo \ - fftw \ - flex \ - freetype \ - gdal \ - gettext \ - geos \ - gnutls \ - laszip \ - libbz2 \ - libjpeg-turbo \ - libpng \ - musl \ - musl-utils \ - ncurses \ - openjpeg \ - openblas \ - pdal \ - py3-numpy \ - py3-pillow \ - py3-six \ - postgresql \ - proj-datumgrid \ - proj-util \ - sqlite \ - sqlite-libs \ - subversion \ - tiff \ - zstd \ - zstd-libs \ - " \ - # These packages are required to compile GRASS GIS. - GRASS_BUILD_PACKAGES="\ +# These packages are required to compile GRASS GIS. +ENV GRASS_BUILD_PACKAGES="\ build-base \ bzip2-dev \ cairo-dev \ @@ -97,14 +132,12 @@ ENV PACKAGES="\ gdal-dev \ geos-dev \ gnutls-dev \ - laszip-dev \ libc6-compat \ libjpeg-turbo-dev \ libpng-dev \ make \ openjpeg-dev \ openblas-dev \ - pdal-dev \ postgresql-dev \ proj-dev \ python3-dev \ @@ -119,121 +152,85 @@ ENV PACKAGES="\ zstd-dev \ " -# ==================== -# INSTALL DEPENDENCIES -# ==================== - -WORKDIR /src - -ENV PYTHONBIN=python$PYTHON_VERSION - -RUN echo "Install Python";\ - apk add --no-cache $PYTHONBIN && \ - $PYTHONBIN -m ensurepip && \ - rm -r /usr/lib/python*/ensurepip && \ - pip$PYTHON_VERSION install --upgrade pip setuptools && \ - if [ ! -e /usr/bin/pip ]; then ln -s pip$PYTHON_VERSION /usr/bin/pip ; fi && \ - if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/$PYTHONBIN /usr/bin/python; fi && \ - rm -r /root/.cache - # Add the packages RUN echo "Install main packages";\ - apk update; \ - apk add --no-cache \ - --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \ - $PACKAGES; \ # Add packages just for the GRASS build process - apk add --no-cache \ - --repository http://dl-cdn.alpinelinux.org/alpine/edge/testing \ - --repository http://dl-cdn.alpinelinux.org/alpine/edge/main \ - --virtual .build-deps $GRASS_BUILD_PACKAGES; \ + apk add --no-cache --virtual .build-deps $GRASS_BUILD_PACKAGES # echo LANG="en_US.UTF-8" > /etc/default/locale; - # - # Checkout and install GRASS GIS - # - echo "Install GRASS GIS";\ - echo " => Downloading grass" +# Copy and install GRASS GIS COPY . /src/grass_build/ +WORKDIR /src/grass_build/ # Configure compile and install GRASS GIS -RUN echo " => Configure and compile grass";\ - cd /src/grass_build && \ +RUN echo " => Configure and compile grass" && \ /src/grass_build/configure $GRASS_CONFIG && \ make -j $NUMTHREADS && \ make install && \ - ldconfig /etc/ld.so.conf.d; \ - # - # enable simple grass command regardless of version number - # - ln -s `find /usr/local/bin -name "grass*"` /usr/local/bin/grass; \ - # - # Reduce the image size - # - rm -rf /src/*; \ - # remove build dependencies and any leftover apk cache - apk del --no-cache --purge .build-deps; \ - rm -rf /var/cache/apk/*; \ - rm -rf /root/.cache; \ - # Remove unnecessary grass files + ldconfig /etc/ld.so.conf.d + +# enable simple grass command regardless of version number +# also important for COPY cmd later +RUN ln -s `find /usr/local/bin -name "grass*"` /usr/local/bin/grass + +# Reduce the image size - Remove unnecessary grass files +RUN cp /usr/local/grass79/gui/wxpython/xml/module_items.xml module_items.xml; \ rm -rf /usr/local/grass79/demolocation; \ rm -rf /usr/local/grass79/fonts; \ rm -rf /usr/local/grass79/gui; \ - rm -rf /usr/local/grass79/share; - - -# Unset environmental variables to avoid later compilation issues -ENV INTEL="" \ - MYCFLAGS="" \ - MYLDFLAGS="" \ - MYCXXFLAGS="" \ - LD_LIBRARY_PATH="" \ - LDFLAGS="" \ - CFLAGS="" \ - CXXFLAGS="" \ - # set SHELL var to avoid /bin/sh fallback in interactive GRASS GIS sessions in docker - SHELL="/bin/bash" + rm -rf /usr/local/grass79/share; \ + mkdir -p /usr/local/grass79/gui/wxpython/xml/; \ + mv module_items.xml /usr/local/grass79/gui/wxpython/xml/module_items.xml; + +FROM common as grass -# ===================== -# INSTALL GRASS-SESSION -# ===================== +ENV LC_ALL="en_US.UTF-8" -# install external Python API -RUN pip install grass-session +# Copy GRASS GIS from build image +COPY --from=build /usr/local/bin/grass /usr/local/bin/grass +COPY --from=build /usr/local/grass* /usr/local/grass/ +# pip 20.0.0 fix +RUN apk add curl && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && python3 get-pip.py pip==20.0.2 && rm get-pip.py +RUN pip3 install --upgrade pip six grass-session -# set GRASSBIN -ENV GRASSBIN="/usr/local/bin/grass" +RUN ln -s /usr/local/grass /usr/local/grass7 +RUN ln -s /usr/local/grass `grass --config path` +RUN grass --tmp-location EPSG:4326 --exec g.version -rge && \ + pdal --version && \ + python3 --version -# =========================== -# TEST grass-session and PDAL -# =========================== -WORKDIR /tmp -COPY docker/testdata/simple.laz . -WORKDIR /scripts -COPY docker/testdata/test_grass_session.py . -## just scan the LAZ file -# TODO: fix test -#RUN /usr/bin/python3 /scripts/test_grass_session.py +FROM grass as test -# ======== -# FINALIZE -# ======== +RUN apk add make gcc -# Data workdir -WORKDIR /grassdb -VOLUME /grassdb +## run simple LAZ test +COPY docker/testdata/simple.laz /tmp/simple.laz +COPY docker/testdata/test_grass_session.py /scripts/test_grass_session.py +ENV GRASSBIN=grass +RUN grass --tmp-location EPSG:4326 --exec g.extension extension=r.in.pdal +RUN /usr/bin/python3 /scripts/test_grass_session.py + +# Test addon installation +RUN grass --tmp-location EPSG:4326 --exec g.extension extension=r.learn.ml + + +FROM grass as final # GRASS GIS specific # allow work with MAPSETs that are not owned by current user -ENV GRASS_SKIP_MAPSET_OWNER_CHECK=1 \ - LC_ALL="en_US.UTF-8" +ENV GRASSBIN="/usr/local/bin/grass" \ + GRASS_SKIP_MAPSET_OWNER_CHECK=1 \ + SHELL="/bin/bash" # show installed version RUN grass --tmp-location EPSG:4326 --exec g.version -rge && \ pdal --version && \ python3 --version -CMD [$GRASSBIN, "--version"] +# Data workdir +WORKDIR /grassdb +VOLUME /grassdb + +CMD $GRASSBIN --version diff --git a/docker/alpine/Dockerfile_alpine_latest b/docker/alpine/Dockerfile_alpine_latest new file mode 100644 index 00000000000..947f54f9c24 --- /dev/null +++ b/docker/alpine/Dockerfile_alpine_latest @@ -0,0 +1,229 @@ +FROM alpine:latest + +# Based on: +# https://github.com/mundialis/docker-grass-gis/blob/master/Dockerfile +LABEL authors="Pietro Zambelli,Markus Neteler" +LABEL maintainer="peter.zamb@gmail.com,neteler@osgeo.org" + +# PACKAGES VERSIONS +ARG PYTHON_VERSION=3 + +# ================ +# CONFIG VARIABLES +# ================ + +# set configuration options, without wxGUI +ENV GRASS_CONFIG="\ + --enable-largefile \ + --with-cxx \ + --with-proj --with-proj-share=/usr/share/proj \ + --with-gdal \ + --with-python \ + --with-geos \ + --with-sqlite \ + --with-bzlib \ + --with-zstd \ + --with-cairo --with-cairo-ldflags=-lfontconfig \ + --with-fftw \ + --with-postgres --with-postgres-includes='/usr/include/postgresql' \ + --without-freetype \ + --without-pdal \ + --without-openmp \ + --without-opengl \ + --without-nls \ + --without-mysql \ + --without-odbc \ + --without-openmp \ + --without-ffmpeg \ + " + +# Set environmental variables for GRASS GIS compilation, without debug symbols +ENV MYCFLAGS="-O2 -std=gnu99 -m64" \ + MYLDFLAGS="-s -Wl,--no-undefined -lblas" \ + # CXX stuff: + LD_LIBRARY_PATH="/usr/local/lib" \ + LDFLAGS="$MYLDFLAGS" \ + CFLAGS="$MYCFLAGS" \ + CXXFLAGS="$MYCXXFLAGS" \ + NUMTHREADS=2 + + +# List of packages to be installed +ENV PACKAGES="\ + attr \ + bash \ + bison \ + bzip2 \ + cairo \ + fftw \ + flex \ + freetype \ + gdal \ + gettext \ + geos \ + gnutls \ + libbz2 \ + libjpeg-turbo \ + libpng \ + musl \ + musl-utils \ + ncurses \ + openjpeg \ + openblas \ + py3-numpy \ + py3-pillow \ + py3-six \ + postgresql \ + proj-datumgrid \ + proj-util \ + sqlite \ + sqlite-libs \ + subversion \ + tiff \ + zstd \ + zstd-libs \ + " \ + # These packages are required to compile GRASS GIS. + GRASS_BUILD_PACKAGES="\ + build-base \ + bzip2-dev \ + cairo-dev \ + fftw-dev \ + freetype-dev \ + g++ \ + gcc \ + gdal-dev \ + geos-dev \ + gnutls-dev \ + libc6-compat \ + libjpeg-turbo-dev \ + libpng-dev \ + make \ + openjpeg-dev \ + openblas-dev \ + postgresql-dev \ + proj-dev \ + python3-dev \ + py3-numpy-dev \ + sqlite-dev \ + tar \ + tiff-dev \ + unzip \ + vim \ + wget \ + zip \ + zstd-dev \ + " + +# ==================== +# INSTALL DEPENDENCIES +# ==================== + +WORKDIR /src + +ENV PYTHONBIN=python$PYTHON_VERSION + +RUN echo "Install Python";\ + apk add --no-cache $PYTHONBIN && \ + $PYTHONBIN -m ensurepip && \ + rm -r /usr/lib/python*/ensurepip && \ + pip$PYTHON_VERSION install --upgrade pip setuptools && \ + if [ ! -e /usr/bin/pip ]; then ln -s pip$PYTHON_VERSION /usr/bin/pip ; fi && \ + if [[ ! -e /usr/bin/python ]]; then ln -sf /usr/bin/$PYTHONBIN /usr/bin/python; fi && \ + rm -r /root/.cache + +# Add the packages +RUN echo "Install main packages";\ + apk update; \ + apk add --no-cache \ + --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/main \ + $PACKAGES; \ + # Add packages just for the GRASS build process + apk add --no-cache \ + --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/main \ + --virtual .build-deps $GRASS_BUILD_PACKAGES; \ + # echo LANG="en_US.UTF-8" > /etc/default/locale; + # + # Checkout and install GRASS GIS + # + echo "Install GRASS GIS";\ + echo " => Downloading grass" + +COPY . /src/grass_build/ + +# Configure compile and install GRASS GIS +RUN echo " => Configure and compile grass";\ + cd /src/grass_build && \ + /src/grass_build/configure $GRASS_CONFIG && \ + make -j $NUMTHREADS && \ + make install && \ + ldconfig /etc/ld.so.conf.d; \ + # + # enable simple grass command regardless of version number + # + ln -s `find /usr/local/bin -name "grass*"` /usr/local/bin/grass; \ + # + # Reduce the image size + # + rm -rf /src/*; \ + # remove build dependencies and any leftover apk cache + apk del --no-cache --purge .build-deps; \ + rm -rf /var/cache/apk/*; \ + rm -rf /root/.cache; \ + # Remove unnecessary grass files + rm -rf /usr/local/grass79/demolocation; \ + rm -rf /usr/local/grass79/fonts; \ + rm -rf /usr/local/grass79/gui; \ + rm -rf /usr/local/grass79/share; + + +# Unset environmental variables to avoid later compilation issues +ENV INTEL="" \ + MYCFLAGS="" \ + MYLDFLAGS="" \ + MYCXXFLAGS="" \ + LD_LIBRARY_PATH="" \ + LDFLAGS="" \ + CFLAGS="" \ + CXXFLAGS="" \ + # set SHELL var to avoid /bin/sh fallback in interactive GRASS GIS sessions in docker + SHELL="/bin/bash" + + +# ===================== +# INSTALL GRASS-SESSION +# ===================== + +# install external Python API +RUN pip install grass-session + +# set GRASSBIN +ENV GRASSBIN="/usr/local/bin/grass" + +# ================== +# TEST grass-session +# ================== + +WORKDIR /scripts +COPY docker/testdata/test_grass_session.py . +# TODO: fix test +#RUN /usr/bin/python3 /scripts/test_grass_session.py + +# ======== +# FINALIZE +# ======== + +# Data workdir +WORKDIR /grassdb +VOLUME /grassdb + +# GRASS GIS specific +# allow work with MAPSETs that are not owned by current user +ENV GRASS_SKIP_MAPSET_OWNER_CHECK=1 \ + LC_ALL="en_US.UTF-8" + +# show installed version +RUN grass --tmp-location EPSG:4326 --exec g.version -rge && \ + python3 --version + +CMD [$GRASSBIN, "--version"] diff --git a/docker/alpine/Dockerfile_alpine_wxgui b/docker/alpine/Dockerfile_alpine_wxgui index 87157c7de2f..bddc93ab7af 100644 --- a/docker/alpine/Dockerfile_alpine_wxgui +++ b/docker/alpine/Dockerfile_alpine_wxgui @@ -18,7 +18,6 @@ ENV GRASS_CONFIG="\ --with-cxx \ --with-proj --with-proj-share=/usr/share/proj \ --with-gdal \ - --with-pdal \ --with-python \ --with-geos \ --with-sqlite \ @@ -29,6 +28,7 @@ ENV GRASS_CONFIG="\ --with-wxwidgets \ --with-postgres --with-postgres-includes='/usr/include/postgresql' \ --without-freetype \ + --without-pdal \ --without-openmp \ --without-opengl \ --without-nls \ @@ -64,7 +64,6 @@ ENV PACKAGES="\ geos \ gnutls \ gtk+3.0 \ - laszip \ libbz2 \ libjpeg-turbo \ libpng \ @@ -73,7 +72,6 @@ ENV PACKAGES="\ ncurses \ openjpeg \ openblas \ - pdal \ py3-numpy \ py3-pillow \ py3-six \ @@ -102,14 +100,12 @@ ENV PACKAGES="\ geos-dev \ gnutls-dev \ gtk+3.0-dev \ - laszip-dev \ libc6-compat \ libjpeg-turbo-dev \ libpng-dev \ make \ openjpeg-dev \ openblas-dev \ - pdal-dev \ postgresql-dev \ proj-dev \ python3-dev \ @@ -216,15 +212,12 @@ RUN pip install grass-session # set GRASSBIN ENV GRASSBIN="/usr/local/bin/grass" -# =========================== -# TEST grass-session and PDAL -# =========================== +# ================== +# TEST grass-session +# ================== -WORKDIR /tmp -COPY docker/testdata/simple.laz . WORKDIR /scripts COPY docker/testdata/test_grass_session.py . -## just scan the LAZ file # TODO: fix test #RUN /usr/bin/python3 /scripts/test_grass_session.py @@ -243,7 +236,6 @@ ENV GRASS_SKIP_MAPSET_OWNER_CHECK=1 \ # show installed version RUN grass --tmp-location EPSG:4326 --exec g.version -rge && \ - pdal --version && \ python3 --version CMD [$GRASSBIN, "--version"] diff --git a/docker/alpine/README_alpine.md b/docker/alpine/README_alpine.md index 3d936ca5523..ff42a2ca7bc 100644 --- a/docker/alpine/README_alpine.md +++ b/docker/alpine/README_alpine.md @@ -1,25 +1,28 @@ # Docker GRASS GIS (alpine linux) -Dockerfile with an [Alpine Linux](https://www.alpinelinux.org/) image with [GRASS GIS](https://grass.osgeo.org/), [PDAL](https://pdal.io) support and [grass-session](https://github.com/zarch/grass-session/). +Dockerfile with an [Alpine Linux](https://www.alpinelinux.org/) image with +[GRASS GIS](https://grass.osgeo.org/), [PDAL](https://pdal.io) support and +[grass-session](https://github.com/zarch/grass-session/). Download size of this image is only approximately 80 MB. Clone this repository and change directory: ```bash -$ git clone https://github.com/OSGeo/grass.git -$ cd grass +git clone https://github.com/OSGeo/grass.git +cd grass ``` __Build the docker with__: ```bash -$ docker build \ +docker build \ --file docker/alpine/Dockerfile_alpine \ --tag grass-py3-pdal:latest-alpine . ``` -View the images available using `sudo docker images` and open a bash terminal with: +View the images available using `sudo docker images` and open a bash terminal +with: ```bash $ docker run -it grass-py3-pdal:latest-alpine /bin/bash @@ -29,8 +32,9 @@ bash-5.0# __To build a stable version__: change to the releasebranch or tag you want to build: + ```bash -$ git checkout remotes/origin/releasebranch_7_8 +git checkout remotes/origin/releasebranch_7_8 ``` and build and enter with: diff --git a/docker/debian/README_debian.md b/docker/debian/README_debian.md index 14521aefde5..0e7af60ca6d 100644 --- a/docker/debian/README_debian.md +++ b/docker/debian/README_debian.md @@ -1,20 +1,22 @@ # Docker GRASS GIS (Debian Linux) -Dockerfile with an [Debian Linux](https://www.debian.org/) image with [GRASS GIS](https://grass.osgeo.org/), [PDAL](https://pdal.io) support and [grass-session](https://github.com/zarch/grass-session/). +Dockerfile with an [Debian Linux](https://www.debian.org/) image with +[GRASS GIS](https://grass.osgeo.org/), [PDAL](https://pdal.io) support and +[grass-session](https://github.com/zarch/grass-session/). Download size of this image is of approximately 2.6 GB. Clone this repository and change directory: ```bash -$ git clone https://github.com/OSGeo/grass.git -$ cd grass +git clone https://github.com/OSGeo/grass.git +cd grass ``` __Build the docker with__: ```bash -$ docker build \ +docker build \ --file docker/debian/Dockerfile_debian_pdal \ --tag grass-py3-pdal:latest-debian . ``` @@ -29,8 +31,9 @@ bash-5.0# __To build a stable version__: change to the releasebranch or tag you want to build: + ```bash -$ git checkout remotes/origin/releasebranch_7_8 +git checkout remotes/origin/releasebranch_7_8 ``` and build and enter with: diff --git a/docker/testdata/README.md b/docker/testdata/README.md index a8d1d0e8b5d..1b9e9dca3ea 100644 --- a/docker/testdata/README.md +++ b/docker/testdata/README.md @@ -1 +1 @@ -Data source: https://github.com/PDAL/PDAL/tree/master/test/data/laz/ +Data source: diff --git a/docker/ubuntu/README_ubuntu.md b/docker/ubuntu/README_ubuntu.md index f53ecf03461..f63a8d5b3e0 100644 --- a/docker/ubuntu/README_ubuntu.md +++ b/docker/ubuntu/README_ubuntu.md @@ -1,14 +1,16 @@ # Docker GRASS GIS (Ubuntu Linux) -Dockerfile with an [Ubuntu Linux](https://ubuntu.com/) image with [GRASS GIS](https://grass.osgeo.org/), [PDAL](https://pdal.io) support and [grass-session](https://github.com/zarch/grass-session/). +Dockerfile with an [Ubuntu Linux](https://ubuntu.com/) image with +[GRASS GIS](https://grass.osgeo.org/), [PDAL](https://pdal.io) support and +[grass-session](https://github.com/zarch/grass-session/). Download size of this image is of approximately 2.6 GB. Clone this repository and change directory: ```bash -$ git clone https://github.com/OSGeo/grass.git -$ cd grass +git clone https://github.com/OSGeo/grass.git +cd grass ``` ## Ubuntu stable @@ -16,12 +18,13 @@ $ cd grass __Build the docker with__: ```bash -$ docker build \ +docker build \ --file docker/ubuntu/Dockerfile_ubuntu_pdal \ --tag grass-py3-pdal:stable-ubuntu . ``` -View the images available using `sudo docker images` and open a bash terminal with: +View the images available using `sudo docker images` and open a bash terminal +with: ```bash $ docker run -it grass-py3-pdal:stable-ubuntu /bin/bash @@ -31,8 +34,9 @@ bash-5.0# __To build a stable version__: change to the releasebranch or tag you want to build: + ```bash -$ git checkout remotes/origin/releasebranch_7_8 +git checkout remotes/origin/releasebranch_7_8 ``` and build and enter with: @@ -46,7 +50,6 @@ $ docker run -it grass-py3-pdal:stable-ubuntu /bin/bash bash-5.0# ``` - ## Ubuntu latest __Build the docker with__: @@ -57,7 +60,8 @@ $ docker build \ --tag grass-py3-pdal:latest-ubuntu . ``` -View the images available using `sudo docker images` and open a bash terminal with: +View the images available using `sudo docker images` and open a bash terminal +with: ```bash $ docker run -it grass-py3-pdal:latest-ubuntu /bin/bash @@ -67,8 +71,9 @@ bash-5.0# __To build a latest version__: change to the releasebranch or tag you want to build: + ```bash -$ git checkout remotes/origin/releasebranch_7_8 +git checkout remotes/origin/releasebranch_7_8 ``` and build and enter with: diff --git a/general/g.proj/g.proj.html b/general/g.proj/g.proj.html index 475d00a9690..606cec70ec8 100644 --- a/general/g.proj/g.proj.html +++ b/general/g.proj/g.proj.html @@ -2,11 +2,11 @@

DESCRIPTION

g.proj provides a means of converting a co-ordinate system description (i.e. projection information) between various formats. -If compiled without OGR present, the +If compiled without OGR present, the functionality is limited to:

  • Reporting the projection information for the current location, -either in conventional GRASS (-p flag) or PROJ.4 (-j flag) format
  • +either in conventional GRASS (-p flag) or PROJ (-j flag) format
  • Changing the datum, or reporting and modifying the datum transformation parameters, for the current location
@@ -33,9 +33,9 @@

DESCRIPTION

proj4=description or -
description should be a projection description in -PROJ.4 format, enclosed in +PROJ format, enclosed in quotation marks if there are any spaces. If - is given for -description, the PROJ.4 description will be read from stdin rather +description, the PROJ description will be read from stdin rather than as a directly-supplied command-line parameter.
epsg=number
@@ -48,7 +48,7 @@

DESCRIPTION

If datum information is incorrect or missing in the input -co-ordinate system definition (e.g. PROJ.4 descriptions have very limited +co-ordinate system definition (e.g. PROJ descriptions have very limited support for specifying datum names), a GRASS datum abbreviation can instead be supplied using the datum parameter. This will override any datum contained in the input co-ordinate system, and discard @@ -105,7 +105,7 @@

NOTES

WKT format shows the false eastings and northings in the projected unit (e.g. meters, feet) but in PROJ format it should always be given in meters. -

The maximum size of input WKT or PROJ.4 projection descriptions is +

The maximum size of input WKT or PROJ projection descriptions is limited to 8000 bytes.

EXAMPLES

@@ -135,14 +135,14 @@

Create projection (PRJ) file

Read projection from file

-Read the projection information from a GeoTIFF file and print it in PROJ.4 +Read the projection information from a GeoTIFF file and print it in PROJ format:
 g.proj -jf georef=ASTER_DEM20020508161837.tif
 
-

Convert the PROJ.4 projection description contained in a text file to WKT +

Convert the PROJ projection description contained in a text file to WKT format:

@@ -189,7 +189,7 @@ 

Create new location

g.proj -c wkt=irish_grid.prj location=irish_grid
-

Create a new location from a PROJ.4 description, explicitly +

Create a new location from a PROJ description, explicitly specifying a datum and using the default datum transformation parameters:
@@ -216,15 +216,15 @@

Using g.proj output for GDAL/OGR tools

REFERENCES

-PROJ 4: Projection/datum support library
-GDAL raster library and toolset
-OGR vector library and toolset +PROJ: Projection/datum support library
+GDAL raster library and toolset
+OGR vector library and toolset

Further reading

SEE ALSO

diff --git a/general/g.proj/input.c b/general/g.proj/input.c index 3f2f6895f9e..3cb5ccc1a6a 100644 --- a/general/g.proj/input.c +++ b/general/g.proj/input.c @@ -247,6 +247,7 @@ int input_georef(char *geofile) G_debug(1, "Trying to open <%s> with OGR...", geofile); OGRRegisterAll(); + ogr_ds = NULL; hSRS = NULL; if ((ogr_ds = OGROpen(geofile, FALSE, NULL)) && (OGR_DS_GetLayerCount(ogr_ds) > 0)) { @@ -258,8 +259,6 @@ int input_georef(char *geofile) hSRS = OGR_L_GetSpatialRef(ogr_layer); ret = GPJ_osr_to_grass(&cellhd, &projinfo, &projunits, hSRS, 0); set_default_region(); - - OGR_DS_Destroy(ogr_ds); } else { /* Try opening with GDAL */ @@ -322,6 +321,8 @@ int input_georef(char *geofile) } } } + if (ogr_ds) + OGR_DS_Destroy(ogr_ds); return ret; diff --git a/general/g.setproj/g.setproj.html b/general/g.setproj/g.setproj.html index 434ac4afb87..faf7b350c56 100644 --- a/general/g.setproj/g.setproj.html +++ b/general/g.setproj/g.setproj.html @@ -67,14 +67,14 @@

SEE ALSO

m.proj, r.proj, v.proj, -PROJ.4 +PROJ site

Further reading

AUTHORS

diff --git a/general/g.version/local_proto.h b/general/g.version/local_proto.h index efe95b28f5e..b90312dfb90 100644 --- a/general/g.version/local_proto.h +++ b/general/g.version/local_proto.h @@ -5,9 +5,9 @@ #define YEAR ((((__DATE__ [7]-'0')*10+(__DATE__[8]-'0'))*10+\ (__DATE__ [9]-'0'))*10+(__DATE__ [10]-'0')) -/* month: 0 - 11 */ +/* month: 1 - 12 */ #define MONTH (__DATE__ [2] == 'n' ? (__DATE__ [1] == 'a' ? 1 : 6) \ - : __DATE__ [2] == 'b' ? 1 \ + : __DATE__ [2] == 'b' ? 2 \ : __DATE__ [2] == 'r' ? (__DATE__ [0] == 'M' ? 3 : 4) \ : __DATE__ [2] == 'y' ? 5 \ : __DATE__ [2] == 'l' ? 7 \ diff --git a/general/g.version/main.c b/general/g.version/main.c index 23ce69d06b9..b6a2ed307e6 100644 --- a/general/g.version/main.c +++ b/general/g.version/main.c @@ -92,6 +92,10 @@ int main(int argc, char *argv[]) gish_rev = G_define_flag(); gish_rev->key = 'r'; + /* this was never the library revision number and date + * it was the revision number and date of gis.h + * now it is the git hash and date of all GRASS headers + * (and anything else in include) */ gish_rev->description = _("Print also the GIS library revision number and date"); gish_rev->guisection = _("Additional info"); @@ -140,26 +144,18 @@ int main(int argc, char *argv[]) } if (gish_rev->answer) { - char **rev_ver = G_tokenize(GIS_H_VERSION, "$"); - char **rev_time = G_tokenize(GIS_H_DATE, "$"); - const int tokens_expected = 3; + char *rev_ver = GIS_H_VERSION; + char *rev_time = GIS_H_DATE; int no_libgis = FALSE; - /* if number of tokes is right, print it */ - if (G_number_of_tokens(rev_ver) == tokens_expected && - G_number_of_tokens(rev_time) == tokens_expected) { + if (*rev_ver && *rev_time) { if (shell->answer) { - const char *p; - p = strstr(rev_ver[1], " "); - fprintf(stdout, "libgis_revision=%s\n", - p ? p + 1 : "00000"); - p = strstr(rev_time[1], " "); - fprintf(stdout, "libgis_date=\"%s\"\n", - p ? p + 1 : "?"); + fprintf(stdout, "libgis_revision=%s\n", rev_ver); + fprintf(stdout, "libgis_date=%s\n", rev_time); } else { - fprintf(stdout, "libgis %s\nlibgis %s\n", rev_ver[1], - rev_time[1]); + fprintf(stdout, "libgis revision: %s\n", rev_ver); + fprintf(stdout, "libgis date: %s\n", rev_time); } } else { @@ -185,8 +181,6 @@ int main(int argc, char *argv[]) G_debug(1, _("GIS_H_VERSION=\"%s\""), GIS_H_VERSION); G_debug(1, _("GIS_H_DATE=\"%s\""), GIS_H_DATE); } - G_free_tokens(rev_ver); - G_free_tokens(rev_time); } if (extended->answer) { diff --git a/grasslib.dox b/grasslib.dox index 3d5d9c84f39..2969a9c5df5 100644 --- a/grasslib.dox +++ b/grasslib.dox @@ -23,7 +23,7 @@ Team, an international team of programmers, GRASS module authors are cited within their module's source code and the contributed manual pages. -© 2000-2019 by the GRASS Development Team +© 2000-2020 by the GRASS Development Team This manual is published under GNU Free Documentation diff --git a/gui/wxpython/.flake8 b/gui/wxpython/.flake8 new file mode 100644 index 00000000000..ca397f6c262 --- /dev/null +++ b/gui/wxpython/.flake8 @@ -0,0 +1,59 @@ +[flake8] +ignore = + W605, # invalid escape sequence '\.' + E265, # block comment should start with '# ' + E266, # too many leading '#' for block comment + E402, # module level import not at top of file + E722, # do not use bare 'except' + E731, # do not assign a lambda expression, use a def + E741, # ambiguous variable name 'l' + F401, # 'animation.utils.getCpuCount' imported but unused + F403, # 'from gmodeler.model import *' used; unable to detect undefined names + F405, # '_' may be undefined, or defined from star imports: gmodeler.model + F821, # undefined name '_' + F841, # local variable 'dc' is assigned to but never used + E117, # over-indented + E122, # continuation line missing indentation or outdented + E123, # closing bracket does not match indentation of opening bracket's line + E124, # closing bracket does not match visual indentation + E125, # continuation line with same indent as next logical line + E126, # continuation line over-indented for hanging indent + E127, # continuation line over-indented for visual indent + E128, # continuation line under-indented for visual indent + E131, # continuation line unaligned for hanging indent + E202, # whitespace before '}' + E203, # whitespace before ':' + E211, # whitespace before '(' + E222, # multiple spaces after operator + E225, # missing whitespace around operator + E226, # missing whitespace around arithmetic operator + E231, # missing whitespace after ',' + E241, # multiple spaces after ',' + E261, # at least two spaces before inline comment + E271, # multiple spaces after keyword + E272, # multiple spaces before keyword + E301, # expected 1 blank line, found 0 + E302, # expected 2 blank lines, found 1 + E303, # too many blank lines (3) + E305, # expected 2 blank lines after class or function definition, found 1 + E306, # expected 1 blank line before a nested definition, found 0 + E501, # line too long (96 > 79 characters) + W291, # trailing whitespace + W293, # blank line contains whitespace + W503, # line break before binary operator + W504, # line break after binary operator + +max-line-length = 88 +exclude = + .git, + __pycache__, + .env, + .venv, + env, + venv, + ENV, + env.bak, + venv.bak, + ctypes, + pydispatch, + testsuite, diff --git a/gui/wxpython/animation/controller.py b/gui/wxpython/animation/controller.py index 62354f7a12d..48021071852 100644 --- a/gui/wxpython/animation/controller.py +++ b/gui/wxpython/animation/controller.py @@ -231,7 +231,7 @@ def AddAnimation(self): if not found: GMessage( parent=self.frame, - message=_("Maximum number of animations is %s.") % + message=_("Maximum number of animations is %d.") % len(self.animations)) return @@ -355,8 +355,7 @@ def _updateAnimations(self, activeIndices, mapNamesDict=None): continue anim = [anim for anim in self.animationData if anim.windowIndex == i][0] - w, h = self.mapwindows[i].GetClientSize() - regions = anim.GetRegions(w, h) + regions = anim.GetRegions() self.animations[i].SetFrames( [HashCmds(cmdList, region) for cmdList, region in zip(anim.cmdMatrix, regions)]) @@ -368,8 +367,7 @@ def _updateAnimations(self, activeIndices, mapNamesDict=None): continue anim = [anim for anim in self.animationData if anim.windowIndex == i][0] - w, h = self.mapwindows[i].GetClientSize() - regions = anim.GetRegions(w, h) + regions = anim.GetRegions() identifiers = sampleCmdMatrixAndCreateNames( anim.cmdMatrix, mapNamesDict[ anim.firstStdsNameType[0]], regions) @@ -413,8 +411,8 @@ def _set2DData(self, animationData): opacities = [ layer.opacity for layer in animationData.layerList if layer.active] - w, h = self.mapwindows[animationData.GetWindowIndex()].GetClientSize() - regions = animationData.GetRegions(w, h) + #w, h = self.mapwindows[animationData.GetWindowIndex()].GetClientSize() + regions = animationData.GetRegions() self.bitmapProvider.SetCmds( animationData.cmdMatrix, opacities, regions) diff --git a/gui/wxpython/animation/data.py b/gui/wxpython/animation/data.py index a76248fd48d..e4cd4d4a550 100644 --- a/gui/wxpython/animation/data.py +++ b/gui/wxpython/animation/data.py @@ -213,33 +213,35 @@ def GetZoomRegionValue(self): fset=SetZoomRegionValue, fget=GetZoomRegionValue) - def GetRegions(self, width, height): - self._computeRegions(width, height, self._mapCount, self._startRegion, + def GetRegions(self): + self._computeRegions(self._mapCount, self._startRegion, self._endRegion, self._zoomRegionValue) return self._regions def _computeRegions( - self, width, height, count, startRegion, endRegion=None, + self, count, startRegion, endRegion=None, zoomValue=None): """Computes regions based on start region and end region or zoom value for each of the animation frames.""" - currRegion = dict( - gcore.region()) # cast to dict, otherwise deepcopy error - del currRegion['cells'] - del currRegion['cols'] - del currRegion['rows'] - if 'projection' in currRegion: - del currRegion['projection'] - if 'zone' in currRegion: - del currRegion['zone'] + region = dict(gcore.region()) # cast to dict, otherwise deepcopy error + if startRegion: + region = dict(parse_key_val(gcore.read_command('g.region', + flags='gu', + region=startRegion), + val_type=float)) + + del region['cells'] + del region['cols'] + del region['rows'] + if 'projection' in region: + del region['projection'] + if 'zone' in region: + del region['zone'] regions = [] for i in range(self._mapCount): - if endRegion or zoomValue: - regions.append(copy.copy(currRegion)) - else: - regions.append(None) - if not startRegion: - self._regions = regions + regions.append(copy.copy(region)) + self._regions = regions + if not (endRegion or zoomValue): return startRegionDict = parse_key_val( @@ -255,7 +257,7 @@ def _computeRegions( flags='gu', region=endRegion), val_type=float) - for key in ('n', 's', 'e', 'w'): + for key in ('n', 's', 'e', 'w', 'nsres', 'ewres'): values = interpolate( startRegionDict[key], endRegionDict[key], @@ -275,12 +277,6 @@ def _computeRegions( regions[i]['e'] < regions[i]['w']: regions[i] = regions[i - 1] - for region in regions: - mapwidth = abs(region['e'] - region['w']) - mapheight = abs(region['n'] - region['s']) - region['nsres'] = mapheight / height - region['ewres'] = mapwidth / width - self._regions = regions def __repr__(self): diff --git a/gui/wxpython/animation/dialogs.py b/gui/wxpython/animation/dialogs.py index 3e921da1f91..382d121b7e6 100644 --- a/gui/wxpython/animation/dialogs.py +++ b/gui/wxpython/animation/dialogs.py @@ -204,7 +204,7 @@ def _layout(self): btnStdSizer.Realize() mainSizer.Add(btnStdSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) mainSizer.Fit(self) @@ -367,7 +367,7 @@ def _layout(self): btnStdSizer.Realize() sizer.Add(btnStdSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(sizer) sizer.Fit(self) @@ -528,7 +528,7 @@ def _create3DPanel(self, parent): hbox.Add( self.fileSelector, proportion=1, - flag=wx.EXPAND | wx.ALIGN_CENTER) + flag=wx.EXPAND) dataBoxSizer.Add( hbox, proportion=0, @@ -558,11 +558,12 @@ def _createAdvancedPage(self, parent): mainSizer = wx.BoxSizer(wx.VERTICAL) box = StaticBox( parent=panel, label=" %s " % - _("Animate region change (2D view only)")) + _("Set spatial extent in 2D view")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridSizer = wx.GridBagSizer(hgap=3, vgap=3) - gridSizer.Add(StaticText(panel, label=_("Start region:")), + self.stRegionLabel = StaticText(panel, label=_("Use saved region:")) + gridSizer.Add(self.stRegionLabel, pos=(0, 0), flag=wx.ALIGN_CENTER_VERTICAL) self.stRegion = Select(parent=panel, type='region', size=(200, -1)) if self.animationData.startRegion: @@ -571,17 +572,22 @@ def _createAdvancedPage(self, parent): self.stRegion, pos=(0, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) + self.animateRegionCheckbox = CheckBox(panel, label=_("Animate region change")) + self.animateRegionCheckbox.SetValue(False) + gridSizer.Add(self.animateRegionCheckbox, pos=(1, 0), span=(1, 2), flag=wx.EXPAND) + self.animateRegionCheckbox.Bind(wx.EVT_CHECKBOX, lambda evt: self._onAnimateExtent()) + self.endRegRadio = RadioButton( panel, label=_("End region:"), style=wx.RB_GROUP) - gridSizer.Add(self.endRegRadio, pos=(1, 0), flag=wx.EXPAND) + gridSizer.Add(self.endRegRadio, pos=(2, 0), border=10, flag=wx.EXPAND | wx.LEFT) self.endRegion = Select(parent=panel, type='region', size=(200, -1)) gridSizer.Add( - self.endRegion, pos=(1, 1), + self.endRegion, pos=(2, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) self.zoomRadio = RadioButton(panel, label=_("Zoom value:")) self.zoomRadio.SetToolTip(_("N-S/E-W distances in map units used to " "gradually reduce region.")) - gridSizer.Add(self.zoomRadio, pos=(2, 0), flag=wx.EXPAND) + gridSizer.Add(self.zoomRadio, pos=(3, 0), border=10, flag=wx.EXPAND | wx.LEFT) zoomSizer = wx.BoxSizer(wx.HORIZONTAL) self.zoomNS = TextCtrl(panel, validator=FloatValidator()) @@ -593,13 +599,15 @@ def _createAdvancedPage(self, parent): flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=3) zoomSizer.Add(self.zoomEW, proportion=1, flag=wx.LEFT, border=3) gridSizer.Add( - zoomSizer, pos=(2, 1), + zoomSizer, pos=(3, 1), flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) if self.animationData.endRegion: + self.animateRegionCheckbox.SetValue(True) self.endRegRadio.SetValue(True) self.zoomRadio.SetValue(False) self.endRegion.SetValue(self.animationData.endRegion) if self.animationData.zoomRegionValue: + self.animateRegionCheckbox.SetValue(True) self.endRegRadio.SetValue(False) self.zoomRadio.SetValue(True) zoom = self.animationData.zoomRegionValue @@ -612,7 +620,7 @@ def _createAdvancedPage(self, parent): self.zoomRadio.Bind( wx.EVT_RADIOBUTTON, lambda evt: self._enableRegionWidgets()) - self._enableRegionWidgets() + self._onAnimateExtent() gridSizer.AddGrowableCol(1) sizer.Add(gridSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=3) @@ -623,6 +631,16 @@ def _createAdvancedPage(self, parent): return panel + def _onAnimateExtent(self): + checked = self.animateRegionCheckbox.IsChecked() + self.endRegion.Enable(checked) + self.zoomNS.Enable(checked) + self.zoomEW.Enable(checked) + self.zoomRadio.Enable(checked) + self.endRegRadio.Enable(checked) + if checked: + self._enableRegionWidgets() + def _enableRegionWidgets(self): """Enables/disables region widgets according to which radiobutton is active.""" @@ -645,7 +663,8 @@ def OnViewMode(self, event): child_.GetWindow().Enable(mode != 1) elif child.IsWindow(): child.GetWindow().Enable(mode != 1) - self._enableRegionWidgets() + if mode == 0: + self._onAnimateExtent() # update layout sizer = self.threeDPanel.GetContainingSizer() @@ -721,23 +740,29 @@ def _update(self): isEnd = self.endRegRadio.GetValue() and self.endRegion.GetValue() isZoom = self.zoomRadio.GetValue() and self.zoomNS.GetValue() and self.zoomEW.GetValue() isStart = self.stRegion.GetValue() - condition = bool(isStart) + bool(isZoom) + bool(isEnd) - if condition == 1: - raise GException(_("Region information is not complete")) - elif condition == 2: - self.animationData.startRegion = isStart + useAnim = self.animateRegionCheckbox.GetValue() + + self.animationData.startRegion = None + self.animationData.endRegion = None + self.animationData.zoomRegionValue = None + if not useAnim: + if isStart: + self.animationData.startRegion = isStart + else: + if isStart: + self.animationData.startRegion = isStart + else: + raise GException(_("Region information is not complete")) if isEnd: self.animationData.endRegion = self.endRegion.GetValue() self.animationData.zoomRegionValue = None - else: + elif isZoom: self.animationData.zoomRegionValue = ( float(self.zoomNS.GetValue()), float(self.zoomEW.GetValue())) self.animationData.endRegion = None - else: - self.animationData.startRegion = None - self.animationData.endRegion = None - self.animationData.zoomRegionValue = None + else: + raise GException(_("Region information is not complete")) def UnInit(self): self.simpleLmgr.UnInit() @@ -821,7 +846,7 @@ def _layout(self): btnStdSizer.Realize() mainSizer.Add(btnStdSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) mainSizer.Fit(self) @@ -941,7 +966,7 @@ def _layout(self): page=self._createDecorationsPanel(notebook), text=_("Decorations")) mainSizer.Add(notebook, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.btnExport = Button(self, wx.ID_OK) self.btnExport.SetLabel(_("Export")) @@ -957,7 +982,7 @@ def _layout(self): btnStdSizer.Realize() mainSizer.Add(btnStdSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) # set the longest option to fit @@ -1179,7 +1204,7 @@ def _createExportFormatPanel(self, notebook): hSizer.Add( self.formatChoice, proportion=1, - flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.ALL, + flag=wx.EXPAND | wx.ALL, border=2) borderSizer.Add( hSizer, @@ -1357,7 +1382,7 @@ def _createExportFormatPanel(self, notebook): borderSizer.Add( fpsSizer, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALL, border=5) panel.SetSizer(borderSizer) diff --git a/gui/wxpython/animation/frame.py b/gui/wxpython/animation/frame.py index c08734a2116..c2507540c34 100644 --- a/gui/wxpython/animation/frame.py +++ b/gui/wxpython/animation/frame.py @@ -112,12 +112,7 @@ def __init__(self, parent, giface, title=_("GRASS GIS Animation tool"), # toolbars self.toolbars = {} - tb = ['miscToolbar', 'animationToolbar', 'mainToolbar'] - if sys.platform == 'win32': - tb.reverse() - for toolb in tb: - self._addToolbar(toolb) - + self._addToolbars() self._addPanes() self._mgr.Update() @@ -146,46 +141,45 @@ def _addPanes(self): slider.GetBestSize()). DestroyOnClose(True).CloseButton(False).Bottom()) self._mgr.GetPane('slider_' + name).Hide() - def _addToolbar(self, name): - """Add defined toolbar to the window + def _addToolbars(self): + """Add toolbars to the window Currently known toolbars are: - 'mainToolbar' - data management - 'animationToolbar' - animation controls - 'miscToolbar' - help, close """ - if name == "mainToolbar": - self.toolbars[name] = MainToolbar(self) - self._mgr.AddPane(self.toolbars[name], - wx.aui.AuiPaneInfo(). - Name('mainToolbar').Caption(_("Main Toolbar")). - ToolbarPane().Top(). - LeftDockable(False).RightDockable(False). - BottomDockable(True).TopDockable(True). - CloseButton(False).Layer(2).Row(1). - BestSize((self.toolbars['mainToolbar'].GetBestSize()))) - elif name == 'animationToolbar': - self.toolbars[name] = AnimationToolbar(self) - self._mgr.AddPane(self.toolbars[name], - wx.aui.AuiPaneInfo(). - Name('animationToolbar').Caption(_("Animation Toolbar")). - ToolbarPane().Top(). - LeftDockable(False).RightDockable(False). - BottomDockable(True).TopDockable(True). - CloseButton(False).Layer(2).Row(1). - BestSize((self.toolbars['animationToolbar'].GetBestSize()))) - self.controller.SetAnimationToolbar( - self.toolbars['animationToolbar']) - elif name == 'miscToolbar': - self.toolbars[name] = MiscToolbar(self) - self._mgr.AddPane(self.toolbars[name], - wx.aui.AuiPaneInfo(). - Name('miscToolbar').Caption(_("Misc Toolbar")). - ToolbarPane().Top(). - LeftDockable(False).RightDockable(False). - BottomDockable(True).TopDockable(True). - CloseButton(False).Layer(2).Row(1). - BestSize((self.toolbars['miscToolbar'].GetBestSize()))) + self.toolbars["mainToolbar"] = MainToolbar(self) + self._mgr.AddPane(self.toolbars["mainToolbar"], + wx.aui.AuiPaneInfo(). + Name('mainToolbar').Caption(_("Main Toolbar")). + ToolbarPane().Top(). + LeftDockable(False).RightDockable(False). + BottomDockable(True).TopDockable(True). + CloseButton(False).Layer(2).Row(1).Position(0). + BestSize((self.toolbars['mainToolbar'].GetBestSize()))) + + self.toolbars['animationToolbar'] = AnimationToolbar(self) + self._mgr.AddPane(self.toolbars['animationToolbar'], + wx.aui.AuiPaneInfo(). + Name('animationToolbar').Caption(_("Animation Toolbar")). + ToolbarPane().Top(). + LeftDockable(False).RightDockable(False). + BottomDockable(True).TopDockable(True). + CloseButton(False).Layer(2).Row(1).Position(1). + BestSize((self.toolbars['animationToolbar'].GetBestSize()))) + self.controller.SetAnimationToolbar( + self.toolbars['animationToolbar']) + + self.toolbars['miscToolbar'] = MiscToolbar(self) + self._mgr.AddPane(self.toolbars['miscToolbar'], + wx.aui.AuiPaneInfo(). + Name('miscToolbar').Caption(_("Misc Toolbar")). + ToolbarPane().Top(). + LeftDockable(False).RightDockable(False). + BottomDockable(True).TopDockable(True). + CloseButton(False).Layer(2).Row(1).Position(2). + BestSize((self.toolbars['miscToolbar'].GetBestSize()))) def SetAnimations(self, layerLists): """Set animation data @@ -487,7 +481,7 @@ def _doLayout(self): hbox.Add( self.slider, proportion=1, - flag=wx.ALIGN_CENTER | wx.EXPAND, + flag=wx.EXPAND, border=0) self.SetSizerAndFit(hbox) @@ -541,7 +535,7 @@ def _doLayout(self): hbox.Add( self.slider, proportion=1, - flag=wx.ALIGN_CENTER | wx.EXPAND, + flag=wx.EXPAND, border=0) vbox.Add(hbox, proportion=0, flag=wx.EXPAND, border=0) diff --git a/gui/wxpython/animation/mapwindow.py b/gui/wxpython/animation/mapwindow.py index ef894d0e4f6..719e5ba0a59 100644 --- a/gui/wxpython/animation/mapwindow.py +++ b/gui/wxpython/animation/mapwindow.py @@ -71,7 +71,9 @@ def OnSize(self, event): # Make new offscreen bitmap: this bitmap will always have the # current drawing in it, so it can be used to save the image to # a file, or whatever. - self._Buffer = EmptyBitmap(*size) + w = max(size[0], 20) + h = max(size[1], 20) + self._Buffer = EmptyBitmap(w, h) self.UpdateDrawing() # event.Skip() diff --git a/gui/wxpython/animation/nviztask.py b/gui/wxpython/animation/nviztask.py index 858c532ac2c..be5b2c98c30 100644 --- a/gui/wxpython/animation/nviztask.py +++ b/gui/wxpython/animation/nviztask.py @@ -297,7 +297,7 @@ def GetCommandSeries(self, layerList, paramName): self.task.set_param(paramName, value) # FIXME: we assume we want always default color map if paramName == 'elevation_map': - self.task.set_param('color_map', '') + self.task.set_param('color_map', self.task.get_param(paramName)['value']) if paramName == 'volume': self.task.set_param('isosurf_color_map', '') self.task.set_flag('overwrite', True) diff --git a/gui/wxpython/animation/provider.py b/gui/wxpython/animation/provider.py index 2bb0f781eca..f4425d0eb47 100644 --- a/gui/wxpython/animation/provider.py +++ b/gui/wxpython/animation/provider.py @@ -26,7 +26,7 @@ import tempfile from multiprocessing import Process, Queue -from core.gcmd import RunCommand, GException +from core.gcmd import RunCommand, GException, DecodeString from core.settings import UserSettings from core.debug import Debug from core.utils import autoCropImageFromFile @@ -821,7 +821,7 @@ def read2_command(*args, **kwargs): kwargs['stderr'] = gcore.PIPE ps = gcore.start_command(*args, **kwargs) stdout, stderr = ps.communicate() - return ps.returncode, stdout, stderr + return ps.returncode, DecodeString(stdout), DecodeString(stderr) def test(): diff --git a/gui/wxpython/animation/utils.py b/gui/wxpython/animation/utils.py index 39f94b5f870..b904d757851 100644 --- a/gui/wxpython/animation/utils.py +++ b/gui/wxpython/animation/utils.py @@ -384,9 +384,12 @@ def interpolate(start, end, count): while start < end: values.append(start) start += step - else: + elif end < start: while end < start: values.append(start) start += step + else: + values = [start] * (count - 1) values.append(end) + return values diff --git a/gui/wxpython/core/gcmd.py b/gui/wxpython/core/gcmd.py index 57ca2109059..4e65124e68e 100644 --- a/gui/wxpython/core/gcmd.py +++ b/gui/wxpython/core/gcmd.py @@ -183,7 +183,7 @@ def __init__(self, args, **kwargs): # If there are spaces, the argument was already # esscaped with double quotes, so don't escape it # again. - if c in v and not " " in v: + if c in v and " " not in v: # Here, we escape each ^ in ^^^ with ^^ and a # with ^ + , # so we need 7 carets. diff --git a/gui/wxpython/core/gconsole.py b/gui/wxpython/core/gconsole.py index fa3c4f989c3..56a5ec78a10 100644 --- a/gui/wxpython/core/gconsole.py +++ b/gui/wxpython/core/gconsole.py @@ -538,7 +538,10 @@ def RunCmd(self, command, compReg=True, env=None, skipInterface=False, command[0]) pymodule = imp.load_source( command[0].replace('.', '_'), pyPath) - pymain = inspect.getargspec(pymodule.main) + try: # PY3 + pymain = inspect.getfullargspec(pymodule.main) + except AttributeError: + pymain = inspect.getargspec(pymodule.main) if pymain and 'giface' in pymain.args: pymodule.main(self._giface) return diff --git a/gui/wxpython/core/globalvar.py b/gui/wxpython/core/globalvar.py index 62b7b72aedc..c02b31dc8f2 100644 --- a/gui/wxpython/core/globalvar.py +++ b/gui/wxpython/core/globalvar.py @@ -108,7 +108,7 @@ def CheckForWx(forceVersion=os.getenv('GRASS_WXVERSION', None)): if forceVersion: wxversion.select(forceVersion) wxversion.ensureMinimal(str(minVersion[0]) + '.' + str(minVersion[1])) - import wx + import wx # noqa: F811 version = parse_version_string(wx.__version__) if version < minVersion: diff --git a/gui/wxpython/core/menutree.py b/gui/wxpython/core/menutree.py index 1fd09144816..8d985d255e4 100644 --- a/gui/wxpython/core/menutree.py +++ b/gui/wxpython/core/menutree.py @@ -171,7 +171,7 @@ def PrintStrings(self, fh): :param fh: file descriptor """ - className = str(self.__class__).split('.', 1)[1] + className = self.__class__.__name__ fh.write('menustrings_%s = [\n' % className) for child in self.model.root.children: printStrings(child, fh) diff --git a/gui/wxpython/core/render.py b/gui/wxpython/core/render.py index 092dd4c19de..681191639d3 100644 --- a/gui/wxpython/core/render.py +++ b/gui/wxpython/core/render.py @@ -121,6 +121,7 @@ def __init__(self, ltype, cmd, Map, name=None, active=True, self.opacity = opacity self.forceRender = render + self.renderedSize = None Debug.msg(3, "Layer.__init__(): type=%s, cmd='%s', name=%s, " "active=%d, opacity=%d, hidden=%d" % @@ -249,6 +250,10 @@ def GetName(self, fullyQualified=True): return {'name': self.name, 'mapset': ''} + def GetRenderedSize(self): + """Get currently rendered size of layer as tuple, None if not rendered""" + return self.renderedSize + def IsActive(self): """Check if layer is activated for rendering""" return self.active @@ -425,14 +430,14 @@ def Render(self, cmd, env): self._startTime = time.time() self.thread.Run(callable=self._render, cmd=cmd_render, env=env_cmd, - ondone=self.OnRenderDone, userdata={'cmd': cmd}) + ondone=self.OnRenderDone, userdata={'cmd': cmd, 'env': env}) self.layer.forceRender = False def _render(self, cmd, env): p = grass.start_command(cmd[0], env=env, stderr=grass.PIPE, **cmd[1]) stdout, stderr = p.communicate() if p.returncode: - return stderr + return grass.decode(stderr) else: return None @@ -465,8 +470,13 @@ def OnRenderDone(self, event): # don't remove layer if overlay, we need to keep the old one if self.layer.type != 'overlay': try_remove(self.layer.mapfile) + self.layer.renderedSize = None + else: + env = event.userdata['env'] + self.layer.renderedSize = (env['GRASS_RENDER_WIDTH'], + env['GRASS_RENDER_HEIGHT']) - self.updateProgress.emit(layer=self.layer) + self.updateProgress.emit(env=event.userdata['env'], layer=self.layer) class RenderMapMgr(wx.EvtHandler): @@ -498,20 +508,28 @@ def __init__(self, Map): self._rendering = False self._old_legend = [] - def _init(self, env=None): - """Init render manager - - :param env: environmental variables or None - """ + def _init(self): + """Init render manager""" self._startTime = time.time() self.progressInfo = None - self._env = env self.layers = [] # re-render from scratch if os.path.exists(self.Map.mapfile): os.remove(self.Map.mapfile) + def _checkRenderedSizes(self, env, layers): + """Check if rendering size in current env differs from size of + already rendered layers, if so, set forceRender to rerender them.""" + w = env['GRASS_RENDER_WIDTH'] + h = env['GRASS_RENDER_HEIGHT'] + for layer in layers: + size = layer.GetRenderedSize() + if size: + # is rendered but its size differes from current env + if not layer.forceRender and (size[0] != w or size[1] != h): + layer.forceRender = True + def UpdateRenderEnv(self, env): self._render_env.update(env) @@ -531,7 +549,12 @@ def _renderLayers(self, env, force=False, overlaysOnly=False): except_ltype=True) # reset progress - self.ReportProgress() + self.ReportProgress(env=env) + + # check all already rendered layers have the same size + # otherwise force rerendering the layer + if not force: + self._checkRenderedSizes(env=env, layers=self.layers) # render map layers if forced nlayers = 0 @@ -540,7 +563,7 @@ def _renderLayers(self, env, force=False, overlaysOnly=False): nlayers += 1 layer.Render(env) else: - layer.GetRenderMgr().updateProgress.emit(layer=layer) + layer.GetRenderMgr().updateProgress.emit(env=env, layer=layer) Debug.msg(1, "RenderMapMgr.Render(): %d layers to be rendered " "(force=%d, all active layers -> %d)" % (nlayers, force, @@ -580,10 +603,10 @@ def RenderOverlays(self, force=False): self._rendering = True env = self.GetRenderEnv() - self._init(env) + self._init() # no layer composition afterwards if self._renderLayers(env, force, overlaysOnly=True) == 0: - self.renderDone.emit() + self.renderDone.emit(env=env) def Render(self, force=False, windres=False): """Render map composition @@ -600,12 +623,12 @@ def Render(self, force=False, windres=False): self._rendering = True env = self.GetRenderEnv(windres) - self._init(env) + self._init() if self._renderLayers(env, force) == 0: - self.renderDone.emit() + self.renderDone.emit(env=env) - def OnRenderDone(self): + def OnRenderDone(self, env): """Rendering process done Make image composiotion, emits updateMap event. @@ -639,10 +662,10 @@ def OnRenderDone(self): mask='%s' % ",".join(masks), opacity='%s' % ",".join(opacities), bgcolor=bgcolor, - width=self._env['GRASS_RENDER_WIDTH'], - height=self._env['GRASS_RENDER_HEIGHT'], + width=env['GRASS_RENDER_WIDTH'], + height=env['GRASS_RENDER_HEIGHT'], output=self.Map.mapfile, - env=self._env) + env=env) if ret != 0: self._rendering = False if wx.IsBusy(): @@ -673,12 +696,16 @@ def OnRenderDone(self): # if legend file changed, rerender vector legend if new_legend != self._old_legend: self._old_legend = new_legend + found = False for layer in self.layers: if layer.GetType() == 'overlay' and layer.GetName() == 'vectleg': layer.forceRender = True - self.Render() - else: - self.updateMap.emit() + found = True + if found: + self.Render() + return + + self.updateMap.emit() def Abort(self): """Abort all rendering processes""" @@ -691,7 +718,7 @@ def Abort(self): wx.EndBusyCursor() self.updateProgress.emit(range=0, value=0, text=_("Rendering aborted")) - def ReportProgress(self, layer=None): + def ReportProgress(self, env, layer=None): """Calculates progress in rendering/downloading and emits signal to inform progress bar about progress. @@ -740,7 +767,7 @@ def ReportProgress(self, layer=None): if layer and self.progressInfo[ 'progresVal'] == self.progressInfo['range']: - self.renderDone.emit() + self.renderDone.emit(env=env) def RenderingFailed(self, cmd, error): self.renderingFailed.emit(cmd=cmd, error=error) diff --git a/gui/wxpython/core/settings.py b/gui/wxpython/core/settings.py index 90b6db6f35b..268aa33a581 100644 --- a/gui/wxpython/core/settings.py +++ b/gui/wxpython/core/settings.py @@ -24,6 +24,7 @@ import os import sys import copy +import wx from core import globalvar from core.gcmd import GException, GError @@ -496,6 +497,10 @@ def _defaultSettings(self): 'titleSize': 12, 'axisSize': 11, 'legendSize': 10, + 'defaultSize': 11, + 'family': wx.FONTFAMILY_SWISS, + 'style': wx.FONTSTYLE_NORMAL, + 'weight': wx.FONTWEIGHT_NORMAL, }, 'marker': { 'color': (0, 0, 0, 255), @@ -535,6 +540,10 @@ def _defaultSettings(self): 'titleSize': 12, 'axisSize': 11, 'legendSize': 10, + 'defaultSize': 11, + 'family': wx.FONTFAMILY_SWISS, + 'style': wx.FONTSTYLE_NORMAL, + 'weight': wx.FONTWEIGHT_NORMAL, }, 'grid': { 'color': (200, 200, 200, 255), @@ -576,6 +585,10 @@ def _defaultSettings(self): 'titleSize': 12, 'axisSize': 11, 'legendSize': 10, + 'defaultSize': 11, + 'family': wx.FONTFAMILY_SWISS, + 'style': wx.FONTSTYLE_NORMAL, + 'weight': wx.FONTWEIGHT_NORMAL, }, 'grid': { 'color': (200, 200, 200, 255), @@ -1029,6 +1042,7 @@ def SaveToFile(self, settings=None): return try: + newline = '\n' file = open(self.filePath, "w") for group in list(settings.keys()): for key in list(settings[group].keys()): @@ -1040,7 +1054,7 @@ def SaveToFile(self, settings=None): if idx > 0: file.write( '%s%s%s%s%s' % - (os.linesep, group, self.sep, key, self.sep)) + (newline, group, self.sep, key, self.sep)) file.write('%s%s' % (subkeys[idx], self.sep)) kvalues = list(settings[group][key][subkeys[idx]].keys()) srange = range(len(kvalues)) @@ -1059,7 +1073,7 @@ def SaveToFile(self, settings=None): dict): file.write( '%s%s%s%s%s' % - (os.linesep, group, self.sep, key, self.sep)) + (newline, group, self.sep, key, self.sep)) value = self._parseValue( settings[group][key][subkeys[idx]]) file.write( @@ -1069,7 +1083,7 @@ def SaveToFile(self, settings=None): settings[group][key][subkeys[idx + 1]], dict): file.write('%s' % self.sep) - file.write(os.linesep) + file.write(newline) except IOError as e: raise GException(e) except Exception as e: diff --git a/gui/wxpython/core/utils.py b/gui/wxpython/core/utils.py index 8b62062bf60..e9be3e42e9c 100644 --- a/gui/wxpython/core/utils.py +++ b/gui/wxpython/core/utils.py @@ -15,7 +15,6 @@ import os import sys import platform -import string import glob import shlex import re diff --git a/gui/wxpython/core/ws.py b/gui/wxpython/core/ws.py index 072ff0be07e..1d05e674475 100644 --- a/gui/wxpython/core/ws.py +++ b/gui/wxpython/core/ws.py @@ -135,14 +135,16 @@ def Render(self, cmd, env): self._startTime = time.time() self.thread.Run(callable=self._render, cmd=cmd_render, env=env, - ondone=self.OnRenderDone) + ondone=self.OnRenderDone, userdata={'env': env}) self.layer.forceRender = False - self.updateProgress.emit(layer=self.layer) + self.updateProgress.emit(env=env, layer=self.layer) def _render(self, cmd, env): try: - return grass.run_command(cmd[0], env=env, **cmd[1]) + # TODO: use errors=status when working + grass.run_command(cmd[0], env=env, **cmd[1]) + return 0 except CalledModuleError as e: grass.error(e) return 1 @@ -154,7 +156,7 @@ def OnRenderDone(self, event): return self.downloading = False if not self.updateMap: - self.updateProgress.emit(layer=self.layer) + self.updateProgress.emit(env=event.userdata['env'], layer=self.layer) self.renderedRegion = None self.fetched_data_cmd = None return @@ -168,14 +170,21 @@ def OnRenderDone(self, event): self.mapMerger.AddRasterBands(self.tempMap, {1: 1, 2: 2, 3: 3}) del self.mapMerger + add_alpha_channel = True + mask_fill_value = 0 + if self.fetching_cmd[1]['format'] == 'jpeg': + mask_fill_value = 255 # white color, g.pnmcomp doesn't apply mask (alpha channel) + add_alpha_channel = False + self.maskMerger = GDALRasterMerger( targetFile=self.layer.maskfile, region=self.renderedRegion, bandsNum=1, gdalDriver='PNM', - fillValue=0) - #{4 : 1} alpha channel (4) to first and only channel (1) in mask - self.maskMerger.AddRasterBands(self.tempMap, {4: 1}) + fillValue=mask_fill_value) + if add_alpha_channel: + #{4 : 1} alpha channel (4) to first and only channel (1) in mask + self.maskMerger.AddRasterBands(self.tempMap, {4: 1}) del self.maskMerger self.fetched_data_cmd = self.fetching_cmd @@ -183,7 +192,7 @@ def OnRenderDone(self, event): Debug.msg(1, "RenderWMSMgr.OnRenderDone(%s): ret=%d time=%f" % (self.layer, event.ret, time.time() - self._startTime)) - self.dataFetched.emit(layer=self.layer) + self.dataFetched.emit(env=event.userdata['env'], layer=self.layer) def _getRegionDict(self, env): """Parse string from GRASS_REGION env variable into dict. diff --git a/gui/wxpython/datacatalog/frame.py b/gui/wxpython/datacatalog/frame.py index bba00774313..fa5de40767d 100644 --- a/gui/wxpython/datacatalog/frame.py +++ b/gui/wxpython/datacatalog/frame.py @@ -81,7 +81,7 @@ def _layout(self): btnSizer.Add(self.btnClose) sizer.Add(btnSizer, proportion=0, - flag=wx.ALL | wx.ALIGN_RIGHT | wx.EXPAND, + flag=wx.ALL | wx.EXPAND, border=5) self.panel.SetSizer(sizer) diff --git a/gui/wxpython/dbmgr/base.py b/gui/wxpython/dbmgr/base.py index 800652f8c0f..b822ed7b5f0 100644 --- a/gui/wxpython/dbmgr/base.py +++ b/gui/wxpython/dbmgr/base.py @@ -34,7 +34,6 @@ import locale import tempfile import copy -import types import math import functools @@ -58,12 +57,12 @@ from core.gcmd import RunCommand, GException, GError, GMessage, GWarning from core.utils import ListOfCatsToRange from gui_core.dialogs import CreateNewVector -from dbmgr.vinfo import VectorDBInfo, GetUnicodeValue, CreateDbInfoDesc +from dbmgr.vinfo import VectorDBInfo, GetUnicodeValue, CreateDbInfoDesc, GetDbEncoding from core.debug import Debug from dbmgr.dialogs import ModifyTableRecord, AddColumnDialog from core.settings import UserSettings -from gui_core.wrap import SpinCtrl, Button, TextCtrl, ListCtrl, CheckBox, \ - StaticText, StaticBox, Menu, NewId +from gui_core.wrap import Button, CheckBox, ComboBox, ListCtrl, Menu, \ + NewId, SpinCtrl, StaticBox, StaticText, TextCtrl from core.utils import cmp if sys.version_info.major >= 3: @@ -269,13 +268,23 @@ def LoadData(self, layer, columns=None, where=None, sql=None): i = 0 outFile.seek(0) + enc = GetDbEncoding() + first_wrong_encoding = True while True: # os.linesep doesn't work here (MSYS) # not sure what the replace is for? # but we need strip to get rid of the ending newline # which on windows leaves \r in a last empty attribute table cell # and causes error - record = decode(outFile.readline().strip()).replace('\n', '') + try: + record = decode(outFile.readline(), encoding=enc).strip().replace('\n', '') + except UnicodeDecodeError as e: + record = outFile.readline().decode(encoding=enc, errors="replace").strip().replace('\n', '') + if first_wrong_encoding: + first_wrong_encoding = False + GWarning(parent=self, + message=_("Incorrect encoding {enc} used. Set encoding in GUI Settings" + " or set GRASS_DB_ENCODING variable.").format(enc=enc)) if not record: break @@ -425,7 +434,7 @@ def OnGetItemText(self, item, col): """Get item text""" index = self.itemIndexMap[item] s = self.itemDataMap[index][col] - return s + return str(s) def OnGetItemAttr(self, item): """Get item attributes""" @@ -456,22 +465,22 @@ def OnColumnMenu(self, event): 'calculator': NewId(), 'stats': NewId()} - popupMenu.Append(self.popupId['sortAsc'], text=_("Sort ascending")) - popupMenu.Append(self.popupId['sortDesc'], text=_("Sort descending")) + popupMenu.Append(self.popupId['sortAsc'], _("Sort ascending")) + popupMenu.Append(self.popupId['sortDesc'], _("Sort descending")) popupMenu.AppendSeparator() subMenu = Menu() popupMenu.AppendMenu(self.popupId['calculate'], _( "Calculate (only numeric columns)"), subMenu) popupMenu.Append( self.popupId['calculator'], - text=_("Field calculator")) + _("Field calculator")) popupMenu.AppendSeparator() - popupMenu.Append(self.popupId['stats'], text=_("Statistics")) + popupMenu.Append(self.popupId['stats'], _("Statistics")) if not self.pages['manageTable']: popupMenu.AppendSeparator() self.popupId['addCol'] = NewId() - popupMenu.Append(self.popupId['addCol'], text=_("Add column")) + popupMenu.Append(self.popupId['addCol'], _("Add column")) if not self.dbMgrData['editable']: popupMenu.Enable(self.popupId['addCol'], False) @@ -480,26 +489,26 @@ def OnColumnMenu(self, event): if not self.dbMgrData['editable'] or self.columns[ self.GetColumn(self._col).GetText()]['ctype'] not in ( - types.IntType, types.FloatType): + int, float): popupMenu.Enable(self.popupId['calculate'], False) - subMenu.Append(self.popupId['area'], text=_("Area size")) - subMenu.Append(self.popupId['length'], text=_("Line length")) + subMenu.Append(self.popupId['area'], _("Area size")) + subMenu.Append(self.popupId['length'], _("Line length")) subMenu.Append( self.popupId['compact'], - text=_("Compactness of an area")) - subMenu.Append(self.popupId['fractal'], text=_( + _("Compactness of an area")) + subMenu.Append(self.popupId['fractal'], _( "Fractal dimension of boundary defining a polygon")) subMenu.Append( self.popupId['perimeter'], - text=_("Perimeter length of an area")) - subMenu.Append(self.popupId['ncats'], text=_( + _("Perimeter length of an area")) + subMenu.Append(self.popupId['ncats'], _( "Number of features for each category")) subMenu.Append( self.popupId['slope'], - text=_("Slope steepness of 3D line")) - subMenu.Append(self.popupId['lsin'], text=_("Line sinuousity")) - subMenu.Append(self.popupId['lazimuth'], text=_("Line azimuth")) + _("Slope steepness of 3D line")) + subMenu.Append(self.popupId['lsin'], _("Line sinuousity")) + subMenu.Append(self.popupId['lazimuth'], _("Line azimuth")) self.Bind( wx.EVT_MENU, @@ -969,19 +978,12 @@ def ApplyCommands(self, listOfCommands, listOfSQLStatements): # perform SQL non-select statements (e.g. 'delete from table where # cat=1') if len(listOfSQLStatements) > 0: + enc = GetDbEncoding() fd, sqlFilePath = tempfile.mkstemp(text=True) - sqlFile = open(sqlFilePath, 'w') - for sql in listOfSQLStatements: - enc = UserSettings.Get( - group='atm', key='encoding', subkey='value') - if not enc and 'GRASS_DB_ENCODING' in os.environ: - enc = os.environ['GRASS_DB_ENCODING'] - if enc: - sqlFile.write(sql.encode(enc) + ';') - else: - sqlFile.write(sql.encode('utf-8') + ';') - sqlFile.write(os.linesep) - sqlFile.close() + with open(sqlFilePath, 'w', encoding=enc) as sqlFile: + for sql in listOfSQLStatements: + sqlFile.write(sql + ';') + sqlFile.write('\n') driver = self.dbMgrData['mapDBInfo'].layers[ self.selLayer]["driver"] @@ -1206,9 +1208,9 @@ def AddLayer(self, layer, pos=-1): parent=simpleSqlPanel, id=wx.ID_ANY, name='wherePanel') - sqlWhereColumn = wx.ComboBox( + sqlWhereColumn = ComboBox( parent=whereSimpleSqlPanel, id=wx.ID_ANY, size=(150, -1), - style=wx.CB_SIMPLE | wx.CB_READONLY, + style=wx.CB_READONLY, choices=self.dbMgrData['mapDBInfo'].GetColumns( self.dbMgrData['mapDBInfo'].layers[layer]['table'])) sqlWhereColumn.SetSelection(0) @@ -1260,16 +1262,16 @@ def AddLayer(self, layer, pos=-1): sqlSimpleWhereSizer.Add( sqlWhereColumn, - flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, + flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=3) sqlSimpleWhereSizer.Add( sqlWhereCond, - flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, + flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=3) sqlSimpleWhereSizer.Add( sqlWhereValue, proportion=1, - flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.LEFT, + flag=wx.ALIGN_CENTER_VERTICAL | wx.LEFT, border=3) whereSimpleSqlPanel.SetSizer(sqlSimpleWhereSizer) simpleSqlSizer.Add(sqlLabel, border=5, pos=(0, 0), @@ -1523,7 +1525,7 @@ def OnDataItemEdit(self, event): else: idx = i - if column['ctype'] != types.StringType: + if column['ctype'] != str: tlist.itemDataMap[item][ idx] = column['ctype'](values[i]) else: # -> string @@ -1533,7 +1535,7 @@ def OnDataItemEdit(self, event): {'value': str(values[i]), 'type': column['type']}) - if column['ctype'] == types.StringType: + if column['ctype'] == str: if "'" in values[i]: # replace "'" -> "''" values[i] = values[i].replace("'", "''") updateList.append( @@ -2374,7 +2376,7 @@ def AddLayer(self, layer, pos=-1): btnAddCol.Bind(wx.EVT_BUTTON, self.OnTableItemAdd) btnAddCol.Enable(False) self.layerPage[layer]['addColButton'] = btnAddCol.GetId() - addSizer.Add(btnAddCol, flag=wx.ALL | wx.ALIGN_RIGHT | wx.EXPAND, + addSizer.Add(btnAddCol, flag=wx.ALL | wx.EXPAND, border=3) # manage columns (rename) @@ -2382,9 +2384,9 @@ def AddLayer(self, layer, pos=-1): label=" %s " % _("Rename column")) renameSizer = wx.StaticBoxSizer(renameBox, wx.HORIZONTAL) - columnFrom = wx.ComboBox( + columnFrom = ComboBox( parent=panel, id=wx.ID_ANY, size=(150, -1), - style=wx.CB_SIMPLE | wx.CB_READONLY, + style=wx.CB_READONLY, choices=self.dbMgrData['mapDBInfo'].GetColumns(table)) columnFrom.SetSelection(0) self.layerPage[layer]['renameCol'] = columnFrom.GetId() @@ -2424,7 +2426,7 @@ def AddLayer(self, layer, pos=-1): self.layerPage[layer]['renameColButton'] = btnRenameCol.GetId() renameSizer.Add( btnRenameCol, - flag=wx.ALL | wx.ALIGN_RIGHT | wx.EXPAND, + flag=wx.ALL | wx.EXPAND, border=3) tableSizer.Add(tlist, @@ -3219,7 +3221,7 @@ def _createAddPage(self): btnSizer.Add(btnLayer, proportion=0, - flag=wx.ALL | wx.ALIGN_RIGHT, + flag=wx.ALL, border=5) layerSizer.Add(btnSizer, @@ -3244,7 +3246,7 @@ def _createAddPage(self): tableSizer.Add(btnTable, proportion=0, - flag=wx.ALL | wx.ALIGN_BOTTOM | wx.ALIGN_RIGHT, + flag=wx.ALL | wx.ALIGN_RIGHT, border=5) pageSizer.Add(layerSizer, @@ -3256,11 +3258,7 @@ def _createAddPage(self): proportion=2, flag=wx.TOP | wx.BOTTOM | wx.RIGHT | wx.EXPAND, border=3) - - # SetVirtualSizeHints is deprecated and is - # exactly the same as FitInside() in wxWidgets 2.9 and later - getattr(layerSizer, 'FitInside', - layerSizer.SetVirtualSizeHints)(self.addPanel) + layerSizer.FitInside(self.addPanel) self.addPanel.SetAutoLayout(True) self.addPanel.SetSizer(pageSizer) @@ -3274,9 +3272,9 @@ def _createDeletePage(self): label = StaticText(parent=self.deletePanel, id=wx.ID_ANY, label='%s:' % _("Layer to remove")) - self.deleteLayer = wx.ComboBox( + self.deleteLayer = ComboBox( parent=self.deletePanel, id=wx.ID_ANY, size=(100, -1), - style=wx.CB_SIMPLE | wx.CB_READONLY, + style=wx.CB_READONLY, choices=list(map(str, self.mapDBInfo.layers.keys()))) self.deleteLayer.SetSelection(0) self.deleteLayer.Bind(wx.EVT_COMBOBOX, self.OnChangeLayer) @@ -3349,9 +3347,9 @@ def _createModifyPage(self): self.modifyLayerWidgets = {'layer': (StaticText(parent=self.modifyPanel, id=wx.ID_ANY, label='%s:' % _("Layer")), - wx.ComboBox(parent=self.modifyPanel, id=wx.ID_ANY, + ComboBox(parent=self.modifyPanel, id=wx.ID_ANY, size=(100, -1), - style=wx.CB_SIMPLE | wx.CB_READONLY, + style=wx.CB_READONLY, choices=list(map(str, self.mapDBInfo.layers.keys())))), 'driver': @@ -3879,11 +3877,11 @@ def Update(self, driver, database, table, column): if fn == 'null': sqlFile.write( 'select count(*) from %s where %s is null;%s' % - (table, column, os.linesep)) + (table, column, '\n')) else: sqlFile.write( 'select %s(%s) from %s;%s' % - (fn, column, table, os.linesep)) + (fn, column, table, '\n')) sqlFile.close() dataStr = RunCommand('db.select', diff --git a/gui/wxpython/dbmgr/dialogs.py b/gui/wxpython/dbmgr/dialogs.py index e7541df810e..d661bcf3596 100644 --- a/gui/wxpython/dbmgr/dialogs.py +++ b/gui/wxpython/dbmgr/dialogs.py @@ -28,7 +28,7 @@ from core.gcmd import RunCommand, GError from core.debug import Debug from core.settings import UserSettings -from dbmgr.vinfo import VectorDBInfo, GetUnicodeValue +from dbmgr.vinfo import VectorDBInfo, GetUnicodeValue, GetDbEncoding from gui_core.widgets import IntegerValidator, FloatValidator from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \ TextCtrl @@ -162,7 +162,7 @@ def __init__(self, parent, map, flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5) mainSizer.Add(btnSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) # bindigs btnReset.Bind(wx.EVT_BUTTON, self.OnReset) @@ -248,7 +248,7 @@ def GetSQLString(self, updateValues=False): if newvalue != value: updatedColumns.append(name) - if not newvalue: + if newvalue == '': updatedValues.append('NULL') else: if ctype != str: @@ -333,18 +333,13 @@ def OnSubmit(self, event): """Submit records""" layer = 1 close = True - enc = UserSettings.Get(group='atm', key='encoding', subkey='value') - if not enc and 'GRASS_DB_ENCODING' in os.environ: - enc = os.environ['GRASS_DB_ENCODING'] + enc = GetDbEncoding() for sql in self.GetSQLString(updateValues=True): if not sql: close = False continue - if enc: - sql = sql.encode(enc) - else: - sql = sql.encode('utf-8') + sql = sql.encode(enc) driver, database = self.mapDBInfo.GetDbSettings(layer) Debug.msg(1, "SQL: %s" % sql) @@ -426,9 +421,9 @@ def UpdateDialog(self, map=None, query=None, cats=None, fid=-1, tfid = int(data['Id'][idx]) else: tfid = 0 # Area / Volume - if not tfid in self.cats: + if tfid not in self.cats: self.cats[tfid] = {} - if not layer in self.cats[tfid]: + if layer not in self.cats[tfid]: self.cats[tfid][layer] = [] cat = int(data['Category'][idx]) self.cats[tfid][layer].append(cat) diff --git a/gui/wxpython/dbmgr/manager.py b/gui/wxpython/dbmgr/manager.py index 62310495d47..c460fac7a91 100644 --- a/gui/wxpython/dbmgr/manager.py +++ b/gui/wxpython/dbmgr/manager.py @@ -169,11 +169,11 @@ def _layout(self): # buttons btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(self.btnReset, proportion=1, - flag=wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.ALL, border=5) btnSizer.Add(self.btnReload, proportion=1, - flag=wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.ALL, border=5) btnSizer.Add(self.btnClose, proportion=1, - flag=wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.ALL, border=5) mainSizer.Add(self.notebook, proportion=1, flag=wx.EXPAND) mainSizer.Add(btnSizer, flag=wx.ALIGN_RIGHT | wx.ALL, border=5) diff --git a/gui/wxpython/dbmgr/sqlbuilder.py b/gui/wxpython/dbmgr/sqlbuilder.py index e6496b823ae..ebe8501db90 100644 --- a/gui/wxpython/dbmgr/sqlbuilder.py +++ b/gui/wxpython/dbmgr/sqlbuilder.py @@ -58,7 +58,7 @@ def __init__(self, parent, title, vectmap, modeChoices=[], id=wx.ID_ANY, # variables self.vectmap = vectmap # fullname - if not "@" in self.vectmap: + if "@" not in self.vectmap: self.vectmap = grass.find_file( self.vectmap, element='vector')['fullname'] if not self.vectmap: @@ -69,7 +69,7 @@ def __init__(self, parent, title, vectmap, modeChoices=[], id=wx.ID_ANY, self.layer = layer self.dbInfo = VectorDBInfo(self.vectmap) self.tablename = self.dbInfo.GetTable(self.layer) - + self.driver, self.database = self.dbInfo.GetDbSettings(self.layer) self.colvalues = [] # array with unique values in selected column @@ -107,7 +107,7 @@ def _doLayout(self, modeChoices, showDbInfo=False): proportion=1, flag=wx.EXPAND | wx.ALL, border=3) - + # # text areas # @@ -233,16 +233,16 @@ def _doLayout(self, modeChoices, showDbInfo=False): if modeChoices: modesizer = wx.BoxSizer(wx.VERTICAL) - + self.mode = wx.RadioBox(parent=self.panel, id=wx.ID_ANY, label=" %s " % _("Interactive insertion"), choices=modeChoices, style=wx.RA_SPECIFY_COLS, majorDimension=1) - + self.mode.SetSelection(1) # default 'values' modesizer.Add(self.mode, proportion=1, - flag=wx.ALIGN_CENTER_HORIZONTAL | wx.EXPAND, border=5) + flag=wx.EXPAND, border=5) # self.list_columns.SetMinSize((-1,130)) # self.list_values.SetMinSize((-1,100)) @@ -271,9 +271,8 @@ def _doLayout(self, modeChoices, showDbInfo=False): buttonsizer3 = wx.BoxSizer(wx.HORIZONTAL) buttonsizer3.Add(self.btn_uniquesample, proportion=0, - flag=wx.ALIGN_CENTER_HORIZONTAL | wx.RIGHT, border=5) - buttonsizer3.Add(self.btn_unique, proportion=0, - flag=wx.ALIGN_CENTER_HORIZONTAL) + flag=wx.RIGHT, border=5) + buttonsizer3.Add(self.btn_unique, proportion=0) valuesizer.Add(buttonsizer3, proportion=0, flag=wx.TOP, border=5) @@ -380,7 +379,7 @@ def OnUniqueValues(self, event, justsample=False): i = 0 items = [] - for item in data: #sorted(set(map(lambda x: desc['ctype'](x[0]), data))): + for item in data: # sorted(set(map(lambda x: desc['ctype'](x[0]), data))): if desc['type'] not in ('character', 'text'): items.append(str(item[0])) else: @@ -388,7 +387,7 @@ def OnUniqueValues(self, event, justsample=False): i += 1 self.list_values.AppendItems(items) - + def OnSampleValues(self, event): """Get sample values""" self.OnUniqueValues(None, True) @@ -704,7 +703,7 @@ def _doLayout(self, modeChoices): label=" %s " % _("Functions")) funcsizer = wx.StaticBoxSizer(funcsbox, wx.VERTICAL) self.list_func = wx.ListBox(parent=self.funcpanel, id=wx.ID_ANY, - choices=self.sqlFuncs['sqlite'].keys(), + choices=list(self.sqlFuncs['sqlite'].keys()), style=wx.LB_SORT) funcsizer.Add(self.list_func, proportion=1, @@ -856,12 +855,12 @@ def __init__(self, parent, vectmap, id=wx.ID_ANY, {'type': "WHERE", 'map': vectmap} super(SQLBuilderWhere, self).__init__( - parent, title, vectmap, id=wx.ID_ANY, + parent, title, vectmap, id=wx.ID_ANY, layer=layer) - + def OnClear(self, event): self.text_sql.SetValue('') - + def OnApply(self, event): self.parent.SetValue(self.text_sql.GetValue()) @@ -884,14 +883,14 @@ def _add(self, element, value): newsqlstr += value if inspoint < len(sqlstr): newsqlstr += ' ' if sqlstr[inspoint] != ' ' else '' - + if newsqlstr: self.text_sql.SetValue(sqlstr[:inspoint] + newsqlstr + sqlstr[inspoint:]) self.text_sql.SetInsertionPoint(inspoint + len(newsqlstr)) - + wx.CallAfter(self.text_sql.SetFocus) - + if __name__ == "__main__": if len(sys.argv) not in [3, 4]: print(__doc__, file=sys.stderr) diff --git a/gui/wxpython/dbmgr/vinfo.py b/gui/wxpython/dbmgr/vinfo.py index 013d2a88d03..ba30ac906e5 100644 --- a/gui/wxpython/dbmgr/vinfo.py +++ b/gui/wxpython/dbmgr/vinfo.py @@ -15,7 +15,6 @@ """ import os -import types import sys import six @@ -29,24 +28,43 @@ if sys.version_info.major >= 3: unicode = str + def GetUnicodeValue(value): + """Get unicode value -def GetUnicodeValue(value): - """Get unicode value + :param value: value to be recoded - :param value: value to be recoded + :return: unicode value + """ + if isinstance(value, unicode): + return value + if isinstance(value, bytes): + enc = GetDbEncoding() + return str(value, enc, errors='replace') + else: + return str(value) +else: + def GetUnicodeValue(value): + """Get unicode value + + :param value: value to be recoded + + :return: unicode value + """ + if isinstance(value, unicode): + return value + enc = GetDbEncoding() + return unicode(str(value), enc, errors='replace') - :return: unicode value - """ - if isinstance(value, unicode): - return value +def GetDbEncoding(): + """Checks if user set DB encoding (first user settings, + then env variable), if not assumes unicode.""" enc = UserSettings.Get(group='atm', key='encoding', subkey='value') if not enc and 'GRASS_DB_ENCODING' in os.environ: enc = os.environ['GRASS_DB_ENCODING'] else: enc = 'utf-8' # assuming UTF-8 - - return unicode(str(value), enc, errors='replace') + return enc def CreateDbInfoDesc(panel, mapDBInfo, layer): @@ -131,7 +149,7 @@ def SelectByPoint(self, queryCoords, qdist): ret[key] = list() for record in data: - if not 'Table' in record: + if 'Table' not in record: continue table = record['Table'] @@ -139,7 +157,7 @@ def SelectByPoint(self, queryCoords, qdist): if len(value) < 1: value = None else: - if self.tables[table][key]['ctype'] != types.StringType: + if self.tables[table][key]['ctype'] != str: value = self.tables[table][key]['ctype'](value) else: value = GetUnicodeValue(value) diff --git a/gui/wxpython/gcp/manager.py b/gui/wxpython/gcp/manager.py index 81a2a7217e6..a88e336e1f9 100644 --- a/gui/wxpython/gcp/manager.py +++ b/gui/wxpython/gcp/manager.py @@ -35,7 +35,7 @@ from copy import copy import wx -from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, ListCtrlAutoWidthMixin +from wx.lib.mixins.listctrl import ColumnSorterMixin, ListCtrlAutoWidthMixin import wx.lib.colourselect as csel from core import globalvar @@ -58,7 +58,7 @@ from gcp.mapdisplay import MapFrame from core.giface import Notification from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \ - CheckListBox, TextCtrl, Menu, ListCtrl, BitmapFromImage + CheckListBox, TextCtrl, Menu, ListCtrl, BitmapFromImage, CheckListCtrlMixin from location_wizard.wizard import TitledPage as TitledPage @@ -180,7 +180,7 @@ def __init__(self, parent, giface): # if self.wizard.RunWizard(self.startpage): success = self.OnWizFinished() - if success == False: + if not success: GMessage(parent=self.parent, message=_("Georectifying setup canceled.")) self.Cleanup() @@ -192,7 +192,7 @@ def __init__(self, parent, giface): # # start GCP display # - if success != False: + if success: # instance of render.Map to be associated with display self.SwitchEnv('source') self.SrcMap = Map(gisrc=self.source_gisrc) @@ -1295,7 +1295,7 @@ def SetGCPSatus(self, item, itemIndex): # changed itemIndex += 1 - if not self.list.IsChecked(key - 1): + if not self.list.IsItemChecked(key - 1): wxPen = "unused" if not self.show_unused: item.SetPropertyVal('hide', True) @@ -1304,7 +1304,7 @@ def SetGCPSatus(self, item, itemIndex): else: item.SetPropertyVal('hide', False) - if self.highest_only == True: + if self.highest_only: if itemIndex == self.highest_key: wxPen = "highest" else: @@ -1395,7 +1395,7 @@ def SaveGCPs(self, event): "#----------------------- ----------------------- ---------------\n") for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index) == True: + if self.list.IsItemChecked(index): check = "1" self.GCPcount += 1 else: @@ -1585,7 +1585,7 @@ def OnGeorect(self, event): global maptype self.SaveGCPs(None) - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): return if maptype == 'raster': @@ -1696,11 +1696,11 @@ def UpdateColours(self, srcrender=False, srcrenderVector=False, highest_idx = 0 for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): key = self.list.GetItemData(index) fwd_err = self.mapcoordlist[key][5] - if self.highest_only == True: + if self.highest_only: self.list.SetItemTextColour(index, wx.BLACK) if highest_fwd_err < fwd_err: highest_fwd_err = fwd_err @@ -1747,6 +1747,7 @@ def OnQuit(self, event): self.TgtMap.Clean() self.grwiz.Cleanup() + self._mgr.UnInit() self.Destroy() @@ -1790,7 +1791,7 @@ def RMSError(self, xygroup, order): self.SaveGCPs(None) # self.SetStatusText('') - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): return # get list of forward and reverse rms error values for each point @@ -1828,7 +1829,7 @@ def RMSError(self, xygroup, order): for index in range(self.list.GetItemCount()): key = self.list.GetItemData(index) - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): fwd_err, bkw_err = errlist[GCPcount].split() self.list.SetItem(index, 5, fwd_err) self.list.SetItem(index, 6, bkw_err) @@ -1866,7 +1867,7 @@ def RMSError(self, xygroup, order): self.list.SetItemTextColour(highest_idx, wx.RED) elif GCPcount > 0 and self.rmsthresh > 0 and not self.highest_only: for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): key = self.list.GetItemData(index) if (self.mapcoordlist[key][5] > self.rmsthresh): self.list.SetItemTextColour(index, wx.RED) @@ -1900,7 +1901,7 @@ def GetNewExtent(self, region, map=None): order = self.gr_order self.gr_order = 1 - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): self.gr_order = order return @@ -2696,7 +2697,7 @@ def __CreateSymbologyPage(self, notebook): self.rmsWin = TextCtrl(parent=panel, id=wx.ID_ANY, size=(70, -1), style=wx.TE_NOHIDESEL) self.rmsWin.SetValue("%s" % str(sdfactor)) - if (self.parent.highest_only == True): + if (self.parent.highest_only): self.rmsWin.Disable() self.symbol['sdfactor'] = self.rmsWin.GetId() @@ -2882,12 +2883,12 @@ def __CreateSymbologyPage(self, notebook): id=wx.ID_ANY, label=_('Select source map to display:')), proportion=0, - flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALL, border=5) sizer.Add( self.srcselection, proportion=0, - flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALL, border=5) self.srcselection.SetValue(src_map) sizer.Add( @@ -2896,12 +2897,12 @@ def __CreateSymbologyPage(self, notebook): id=wx.ID_ANY, label=_('Select target raster map to display:')), proportion=0, - flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALL, border=5) sizer.Add( self.tgtrastselection, proportion=0, - flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALL, border=5) self.tgtrastselection.SetValue(tgt_map['raster']) sizer.Add( @@ -2910,12 +2911,12 @@ def __CreateSymbologyPage(self, notebook): id=wx.ID_ANY, label=_('Select target vector map to display:')), proportion=0, - flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALL, border=5) sizer.Add( self.tgtvectselection, proportion=0, - flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALL, border=5) self.tgtvectselection.SetValue(tgt_map['vector']) @@ -2987,7 +2988,7 @@ def __CreateRectificationPage(self, notebook): id=wx.ID_ANY, label=_('Extension for output maps:')), proportion=0, - flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALL, border=5) self.ext_txt = TextCtrl( parent=panel, id=wx.ID_ANY, value="", size=( @@ -2996,7 +2997,7 @@ def __CreateRectificationPage(self, notebook): sizer.Add( self.ext_txt, proportion=0, - flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALL, border=5) # bindings @@ -3180,7 +3181,7 @@ def UpdateSettings(self): tgtrenderVector = True if tgt_map['raster'] == '' and tgt_map['vector'] == '': - if self.parent.show_target == True: + if self.parent.show_target: self.parent.show_target = False self.parent._mgr.GetPane("target").Hide() self.parent._mgr.Update() @@ -3188,7 +3189,7 @@ def UpdateSettings(self): self.parent.activemap.Enable(False) self.parent.GetMapToolbar().Enable('zoommenu', enable=False) else: - if self.parent.show_target == False: + if not self.parent.show_target: self.parent.show_target = True self.parent._mgr.GetPane("target").Show() self.parent._mgr.Update() diff --git a/gui/wxpython/gcp/mapdisplay.py b/gui/wxpython/gcp/mapdisplay.py index 678406b7352..d2ab90806f7 100644 --- a/gui/wxpython/gcp/mapdisplay.py +++ b/gui/wxpython/gcp/mapdisplay.py @@ -278,7 +278,7 @@ def AddToolbar(self, name): BottomDockable(False).TopDockable(True). CloseButton(False).Layer(2)) - if self.show_target == False: + if not self.show_target: self.toolbars['gcpdisp'].Enable('zoommenu', enable=False) self.toolbars['gcpman'] = GCPManToolbar(self) diff --git a/gui/wxpython/gis_set.py b/gui/wxpython/gis_set.py index 44de9560a94..5bc78ba5d75 100644 --- a/gui/wxpython/gis_set.py +++ b/gui/wxpython/gis_set.py @@ -119,7 +119,7 @@ def __init__(self, parent=None, id=wx.ID_ANY, parent=self.panel, id=wx.ID_ANY, label=" %s " % _("3. Select GRASS Mapset")) - self.lmessage = StaticText(parent=self.panel) + self.lmessage = StaticWrapText(parent=self.panel) # It is not clear if all wx versions supports color, so try-except. # The color itself may not be correct for all platforms/system settings # but in http://xoomer.virgilio.it/infinity77/wxPython/Widgets/wx.SystemSettings.html @@ -372,7 +372,7 @@ def layout_list_box(box, panel, list_box, buttons, description): flag=wx.EXPAND | wx.ALL, border=1) main_sizer.Add(buttons_sizer, proportion=0, - flag=wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, + flag=wx.ALL, border=1) for button in buttons: buttons_sizer.Add(button, proportion=0, @@ -438,15 +438,13 @@ def layout_list_box(box, panel, list_box, buttons, description): wx.ALL, border=3) # image sizer.Add(gisdbase_boxsizer, proportion=0, - flag=wx.ALIGN_CENTER_HORIZONTAL | - wx.RIGHT | wx.LEFT | wx.TOP | wx.EXPAND, + flag=wx.RIGHT | wx.LEFT | wx.TOP | wx.EXPAND, border=3) # GISDBASE setting # warning/error message sizer.Add(self.lmessage, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL | - wx.ALIGN_LEFT | wx.ALL | wx.EXPAND, border=5) + flag=wx.ALIGN_LEFT | wx.ALL | wx.EXPAND, border=5) sizer.Add(location_mapset_sizer, proportion=1, flag=wx.RIGHT | wx.LEFT | wx.EXPAND, border=1) @@ -473,7 +471,6 @@ def _showWarning(self, text): you know that there is everything correct now. """ self.lmessage.SetLabel(text) - self.lmessage.Wrap(self.GetClientSize()[0]) self.sizer.Layout() def _showError(self, text): @@ -487,7 +484,6 @@ def _showError(self, text): you know that there is everything correct now. """ self.lmessage.SetLabel(_("Error: {text}").format(text=text)) - self.lmessage.Wrap(self.GetClientSize()[0]) self.sizer.Layout() def _hideMessage(self): diff --git a/gui/wxpython/gmodeler/dialogs.py b/gui/wxpython/gmodeler/dialogs.py index dccd105b0f3..963c71e6e96 100644 --- a/gui/wxpython/gmodeler/dialogs.py +++ b/gui/wxpython/gmodeler/dialogs.py @@ -40,7 +40,7 @@ from gmodeler.model import * from lmgr.menudata import LayerManagerMenuData from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \ - Menu, ListCtrl, NewId + Menu, ListCtrl, NewId, CheckListCtrlMixin from grass.script import task as gtask @@ -258,7 +258,7 @@ def _layout(self): mainSizer.Add(labelSizer, proportion=1, flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, border=3) mainSizer.Add(btnSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.panel.SetSizer(mainSizer) mainSizer.Fit(self) @@ -1067,7 +1067,7 @@ def MoveItems(self, items, up): wx.LIST_STATE_SELECTED | wx.LIST_STATE_FOCUSED) -class ItemCheckListCtrl(ItemListCtrl, listmix.CheckListCtrlMixin): +class ItemCheckListCtrl(ItemListCtrl, CheckListCtrlMixin): def __init__(self, parent, shape, columns, frame, **kwargs): self.parent = parent @@ -1075,7 +1075,7 @@ def __init__(self, parent, shape, columns, frame, **kwargs): ItemListCtrl.__init__(self, parent, columns, frame, disablePopup=True, **kwargs) - listmix.CheckListCtrlMixin.__init__(self) + CheckListCtrlMixin.__init__(self) self.SetColumnWidth(0, 100) self.shape = shape @@ -1099,7 +1099,7 @@ def GetItems(self): # action ids start at 1 for i in range(self.GetItemCount()): - if self.IsChecked(i): + if self.IsItemChecked(i): ids['checked'].append(self.itemIdMap[i]) else: ids['unchecked'].append(self.itemIdMap[i]) diff --git a/gui/wxpython/gmodeler/frame.py b/gui/wxpython/gmodeler/frame.py index 2f58fc9cc8f..1dc2c357616 100644 --- a/gui/wxpython/gmodeler/frame.py +++ b/gui/wxpython/gmodeler/frame.py @@ -41,7 +41,7 @@ else: import wx.lib.flatnotebook as FN from wx.lib.newevent import NewEvent - + from gui_core.widgets import GNotebook from core.gconsole import GConsole, \ EVT_CMD_RUN, EVT_CMD_DONE, EVT_CMD_PREPARE @@ -63,8 +63,10 @@ from gmodeler.giface import GraphicalModelerGrassInterface from gmodeler.model import * from gmodeler.dialogs import * -from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, \ - Menu, StockCursor, EmptyBitmap, NewId +from gui_core.wrap import ( + Button, EmptyBitmap, ImageFromBitmap, Menu, NewId, StaticBox, + StaticText, StockCursor, TextCtrl, +) from gui_core.wrap import TextEntryDialog as wxTextEntryDialog wxModelDone, EVT_MODEL_DONE = NewEvent() @@ -158,7 +160,7 @@ def __init__(self, parent, giface, id=wx.ID_ANY, self._gconsole.Bind(EVT_CMD_DONE, self.OnCmdDone) self.Bind(EVT_CMD_PREPARE, self.OnCmdPrepare) self.Bind(EVT_MODEL_DONE, self.OnModelDone) - + self.notebook.AddPage(page=self.canvas, text=_('Model'), name='model') self.notebook.AddPage( page=self.itemPanel, @@ -312,8 +314,8 @@ def time_elapsed(etime): stime = _("unknown") return stime - - self.goutput.GetProgressBar().SetValue(0) + + self.goutput.GetProgressBar().SetValue(0) self.goutput.WriteCmdLog('({}) {} ({})'.format( str(time.ctime()), _("Command finished"), time_elapsed(event.time)), notification=event.notification) @@ -328,7 +330,7 @@ def time_elapsed(etime): notification=event.notification) event = wxModelDone() wx.PostEvent(self, event) - + except IndexError: pass @@ -405,7 +407,7 @@ def _deleteIntermediateData(self): if vect: self._gconsole.RunCmd(['g.remove', '-f', 'type=vector', 'name=%s' % ','.join(vect)]) - + self.SetStatusText(_("%d intermediate maps deleted from current mapset") % int(len(rast) + len(rast3d) + len(vect))) @@ -624,7 +626,7 @@ def OnModelDone(self, event): """Computation finished """ self.SetStatusText('', 0) - + # restore original files if hasattr(self.model, "fileInput"): for finput in self.model.fileInput: @@ -652,7 +654,7 @@ def OnModelDone(self, event): if layers: for layer in layers: self._giface.GetLayerList().DeleteLayer(layer) - + # add new map layer self._giface.GetLayerList().AddLayer( ltype=data.GetPrompt(), name=data.GetValue(), checked=True, @@ -706,7 +708,7 @@ def OnExportImage(self, event): int(ymaxImg - yminImg) + 50) bitmap = EmptyBitmap(width=size.width, height=size.height) - filetype, ltype = GetImageHandlers(wx.ImageFromBitmap(bitmap)) + filetype, ltype = GetImageHandlers(ImageFromBitmap(bitmap)) dlg = wx.FileDialog( parent=self, @@ -1500,17 +1502,17 @@ def OnRightClick(self, x, y, keys=0, attachment=0): self._onSelectShape(shape) popupMenu = Menu() - popupMenu.Append(self.popupID['remove'], text=_('Remove')) + popupMenu.Append(self.popupID['remove'], _('Remove')) self.frame.Bind(wx.EVT_MENU, self.OnRemove, id=self.popupID['remove']) if isinstance(shape, ModelAction) or isinstance(shape, ModelLoop): if shape.IsEnabled(): - popupMenu.Append(self.popupID['enable'], text=_('Disable')) + popupMenu.Append(self.popupID['enable'], _('Disable')) self.frame.Bind( wx.EVT_MENU, self.OnDisable, id=self.popupID['enable']) else: - popupMenu.Append(self.popupID['enable'], text=_('Enable')) + popupMenu.Append(self.popupID['enable'], _('Enable')) self.frame.Bind( wx.EVT_MENU, self.OnEnable, @@ -1518,13 +1520,13 @@ def OnRightClick(self, x, y, keys=0, attachment=0): if isinstance(shape, ModelAction) or isinstance(shape, ModelComment): popupMenu.AppendSeparator() if isinstance(shape, ModelAction): - popupMenu.Append(self.popupID['label'], text=_('Set label')) + popupMenu.Append(self.popupID['label'], _('Set label')) self.frame.Bind( wx.EVT_MENU, self.OnSetLabel, id=self.popupID['label']) if isinstance(shape, ModelAction) or isinstance(shape, ModelComment): - popupMenu.Append(self.popupID['comment'], text=_('Set comment')) + popupMenu.Append(self.popupID['comment'], _('Set comment')) self.frame.Bind( wx.EVT_MENU, self.OnSetComment, @@ -1534,14 +1536,14 @@ def OnRightClick(self, x, y, keys=0, attachment=0): popupMenu.AppendSeparator() popupMenu.Append( self.popupID['addPoint'], - text=_('Add control point')) + _('Add control point')) self.frame.Bind( wx.EVT_MENU, self.OnAddPoint, id=self.popupID['addPoint']) popupMenu.Append( self.popupID['delPoint'], - text=_('Remove control point')) + _('Remove control point')) self.frame.Bind( wx.EVT_MENU, self.OnRemovePoint, @@ -1555,7 +1557,7 @@ def OnRightClick(self, x, y, keys=0, attachment=0): len(self.GetShape().GetRelations('from')) > 0: popupMenu.Append( self.popupID['intermediate'], - text=_('Intermediate'), + _('Intermediate'), kind=wx.ITEM_CHECK) if self.GetShape().IsIntermediate(): popupMenu.Check(self.popupID['intermediate'], True) @@ -1568,7 +1570,7 @@ def OnRightClick(self, x, y, keys=0, attachment=0): if self.frame._giface.GetMapDisplay(): popupMenu.Append( self.popupID['display'], - text=_('Display'), + _('Display'), kind=wx.ITEM_CHECK) if self.GetShape().HasDisplay(): popupMenu.Check(self.popupID['display'], True) @@ -1585,7 +1587,7 @@ def OnRightClick(self, x, y, keys=0, attachment=0): isinstance(shape, ModelAction) or \ isinstance(shape, ModelLoop): popupMenu.AppendSeparator() - popupMenu.Append(self.popupID['props'], text=_('Properties')) + popupMenu.Append(self.popupID['props'], _('Properties')) self.frame.Bind( wx.EVT_MENU, self.OnProperties, @@ -1703,7 +1705,7 @@ def OnHasDisplay(self, event): layers = self.frame._giface.GetLayerList().GetLayersByName(shape.GetValue()) for layer in layers: self.frame._giface.GetLayerList().DeleteLayer(layer) - + except GException as e: GError(parent=self, message='{}'.format(e)) @@ -1813,9 +1815,9 @@ def _layout(self): mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(listSizer, proportion=1, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) mainSizer.Add(addSizer, proportion=0, - flag=wx.EXPAND | wx.ALIGN_CENTER | + flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5) self.SetSizer(mainSizer) @@ -1922,9 +1924,9 @@ def _layout(self): mainSizer = wx.BoxSizer(wx.HORIZONTAL) mainSizer.Add(listSizer, proportion=1, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=3) + flag=wx.EXPAND | wx.ALL, border=3) mainSizer.Add(manageSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=3) + flag=wx.EXPAND | wx.ALL, border=3) self.SetSizer(mainSizer) mainSizer.Fit(self) @@ -2009,9 +2011,9 @@ def _layout(self): flag=wx.LEFT | wx.RIGHT, border=5) btnSizer.AddStretchSpacer() btnSizer.Add(self.btnSaveAs, proportion=0, - flag=wx.RIGHT | wx.ALIGN_RIGHT, border=5) + flag=wx.RIGHT, border=5) btnSizer.Add(self.btnRun, proportion=0, - flag=wx.RIGHT | wx.ALIGN_RIGHT, border=5) + flag=wx.RIGHT, border=5) sizer.Add(bodySizer, proportion=1, flag=wx.EXPAND | wx.ALL, border=3) diff --git a/gui/wxpython/gmodeler/model.py b/gui/wxpython/gmodeler/model.py index fdeb6500f30..a23e49519eb 100644 --- a/gui/wxpython/gmodeler/model.py +++ b/gui/wxpython/gmodeler/model.py @@ -313,7 +313,7 @@ def LoadModel(self, filename): try: gxmXml = ProcessModelFile(etree.parse(filename)) except Exception as e: - raise GException(unicode(e)) + raise GException('{}'.format(e)) if self.canvas: win = self.canvas.parent @@ -653,7 +653,7 @@ def Run(self, log, onDone, parent=None): delInterData = dlg.DeleteIntermediateData() dlg.Destroy() if err: - GError(parent=parent, message=unicode('\n'.join(err))) + GError(parent=parent, message='\n'.join(err)) return err = list() @@ -669,14 +669,13 @@ def Run(self, log, onDone, parent=None): parent=parent, message=_("Variables below not defined:") + "\n\n" + - unicode( - '\n'.join( - map( - lambda x: "%s: %s (%s)" % - (x[0], - x[1], - x[2]), - err)))) + '\n'.join( + map( + lambda x: "%s: %s (%s)" % + (x[0], + x[1], + x[2]), + err))) return log.cmdThread.SetId(-1) @@ -2047,7 +2046,7 @@ def _processData(self): intermediate = False if data.find('intermediate') is None else True display = False if data.find('display') is None else True - + rels = list() for rel in data.findall('relation'): defrel = {'id': int(rel.get('id', -1)), @@ -2333,7 +2332,7 @@ def _action(self, action): for f in val: if f.get('value', False) or f.get('parameterized', False): if f.get('parameterized', False): - if f.get('value', False) == False: + if f.get('value', False) is False: self.fd.write( '%s\n' % (' ' * @@ -2659,7 +2658,7 @@ def getParameterizedFlags(paramFlags, itemFlags): fl = '' """) - self.fd.write(""" for i in [key for key, value in paramFlags.iteritems() if value == 'True']: + self.fd.write(""" for i in [key for key, value in paramFlags.items() if value == 'True']: if i in itemFlags: fl += i[-1] @@ -2677,7 +2676,7 @@ def getParameterizedFlags(paramFlags, itemFlags): if properties.get('overwrite'): self.fd.write(' os.environ["GRASS_OVERWRITE"] = "1"\n') - self.fd.write(' sys.exit(main())\n') + self.fd.write(' sys.exit(main(options, flags))\n') def _writePythonItem(self, item, ignoreBlock=True, variables={}): """Write model object to Python file""" @@ -2927,7 +2926,7 @@ def _layout(self): flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5) mainSizer.Add(btnSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) mainSizer.Fit(self) diff --git a/gui/wxpython/gmodeler/preferences.py b/gui/wxpython/gmodeler/preferences.py index 79b9ad6ed66..0fa3408bfcd 100644 --- a/gui/wxpython/gmodeler/preferences.py +++ b/gui/wxpython/gmodeler/preferences.py @@ -751,7 +751,7 @@ def _layout(self): flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5) mainSizer.Add(btnStdSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) mainSizer.Fit(self) diff --git a/gui/wxpython/gui_core/dialogs.py b/gui/wxpython/gui_core/dialogs.py index fe19804d882..50803401582 100644 --- a/gui/wxpython/gui_core/dialogs.py +++ b/gui/wxpython/gui_core/dialogs.py @@ -35,11 +35,6 @@ import wx -try: - from wx.adv import HyperlinkCtrl -except ImportError: - from wx import HyperlinkCtrl - from grass.script import core as grass from grass.script.utils import natural_sort, try_remove @@ -49,11 +44,12 @@ from core.gcmd import GError, RunCommand, GMessage from gui_core.gselect import LocationSelect, MapsetSelect, Select, \ OgrTypeSelect, SubGroupSelect -from gui_core.widgets import SingleSymbolPanel, GListCtrl, SimpleValidator, MapValidator +from gui_core.widgets import SingleSymbolPanel, GListCtrl, SimpleValidator, \ + MapValidator from core.settings import UserSettings from core.debug import Debug -from gui_core.wrap import SpinCtrl, TextCtrl, Button, CheckListBox, \ - StaticText, StaticBox, Menu, NewId +from gui_core.wrap import Button, CheckListBox, EmptyBitmap, HyperlinkCtrl, \ + Menu, NewId, SpinCtrl, StaticBox, StaticText, TextCtrl class SimpleDialog(wx.Dialog): @@ -91,7 +87,7 @@ def __layout(self): btnSizer.Realize() self.sizer.Add(self.dataSizer, proportion=1, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) # self.sizer.Add(item = self.informLabel, proportion = 0, flag = wx.ALL, border = 5) self.sizer.Add(btnSizer, proportion=0, @@ -228,18 +224,21 @@ def __init__(self, parent, title=_("Select vector map"), layerTree=None): """ SimpleDialog.__init__(self, parent, title) - self.element = Select( - parent=self.panel, - id=wx.ID_ANY, - size=globalvar.DIALOG_GSELECT_SIZE, - type='vector', - layerTree=layerTree, - validator=MapValidator()) + self.element = self._selection_widget(layerTree) self.element.SetFocus() self.warning = _("Name of vector map is missing.") wx.CallAfter(self._layout) + def _selection_widget(self, layerTree): + return Select(parent=self.panel, + id=wx.ID_ANY, + size=globalvar.DIALOG_GSELECT_SIZE, + type='vector', + layerTree=layerTree, + fullyQualified=True + ) + def _layout(self): """Do layout""" self.dataSizer.Add(StaticText(parent=self.panel, id=wx.ID_ANY, @@ -326,6 +325,16 @@ def __init__(self, parent, title=_("Create new vector map"), self.warning = _("Name of new vector map is missing.") + def _selection_widget(self, layerTree): + return Select(parent=self.panel, + id=wx.ID_ANY, + size=globalvar.DIALOG_GSELECT_SIZE, + type='vector', + layerTree=layerTree, + fullyQualified=False, + validator=MapValidator() + ) + def OnTable(self, event): if self.keycol: self.keycol.Enable(event.IsChecked()) @@ -725,7 +734,7 @@ def _createDialogBody(self): bodySizer.Add(StaticText(parent=self, id=wx.ID_ANY, label=_("Select existing group or " "enter name of new group:")), - flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP, border=10) + flag=wx.TOP, border=10) self.groupSelect = Select(parent=self, type='group', mapsets=[grass.gisenv()['MAPSET']], size=globalvar.DIALOG_GSELECT_SIZE, @@ -737,7 +746,7 @@ def _createDialogBody(self): label=_("Edit/create subgroup")) bodySizer.Add(self.subg_chbox, - flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP, border=10) + flag=wx.TOP, border=10) self.subg_panel = wx.Panel(self) subg_sizer = wx.BoxSizer(wx.VERTICAL) @@ -748,8 +757,7 @@ def _createDialogBody(self): id=wx.ID_ANY, label=_( "Select existing subgroup or " - "enter name of new subgroup:")), - flag=wx.ALIGN_CENTER_VERTICAL) + "enter name of new subgroup:"))) self.subGroupSelect = SubGroupSelect(parent=self.subg_panel) @@ -889,7 +897,7 @@ def _createDialogBody(self): self.infoLabel = StaticText(parent=self, id=wx.ID_ANY) bodySizer.Add( self.infoLabel, - flag=wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, + flag=wx.TOP | wx.BOTTOM, border=5) # bindings @@ -1293,7 +1301,7 @@ def ShowResult(self, group, returnCode, create): label = _("Changing of group <%s> failed.") % group self.infoLabel.SetLabel(label) - wx.FutureCall(4000, self.ClearNotification) + wx.CallLater(4000, self.ClearNotification) def GetSelectedGroup(self): """Return currently selected group (without mapset)""" @@ -1321,7 +1329,8 @@ def GetGroupLayers(self, group, subgroup=None): def ClearNotification(self): """Clear notification string""" - self.infoLabel.SetLabel("") + if self.infoLabel: + self.infoLabel.SetLabel("") def ApplyChanges(self): """Create or edit group""" @@ -1415,7 +1424,7 @@ def __init__(self, parent, title, self.btnSizer.Realize() self.mainSizer.Add(self.btnSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(self.mainSizer) self.mainSizer.Fit(self) @@ -1791,12 +1800,12 @@ def __init__(self, parent, id=wx.ID_ANY, title=_("Set Map Layer Opacity"), pos=(1, 1)) sizer.Add(box, proportion=0, - flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5) + flag=wx.EXPAND | wx.ALL, border=5) line = wx.StaticLine(parent=panel, id=wx.ID_ANY, style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, - flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5) + flag=wx.EXPAND | wx.ALL, border=5) # buttons btnsizer = wx.StdDialogButtonSizer() @@ -1814,7 +1823,7 @@ def __init__(self, parent, id=wx.ID_ANY, title=_("Set Map Layer Opacity"), btnsizer.Realize() sizer.Add(btnsizer, proportion=0, - flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5) + flag=wx.EXPAND | wx.ALL, border=5) panel.SetSizer(sizer) sizer.Fit(panel) @@ -2314,7 +2323,7 @@ def __init__(self, parent, title, message, hyperlink, hyperlinkLabel = hyperlinkLabel if hyperlinkLabel else hyperlink hyperlinkCtrl = HyperlinkCtrl( self, id=wx.ID_ANY, label=hyperlinkLabel, url=hyperlink, - style=wx.HL_ALIGN_LEFT | wx.HL_CONTEXTMENU) + style=HyperlinkCtrl.HL_ALIGN_LEFT | HyperlinkCtrl.HL_CONTEXTMENU) sizer.Add( hyperlinkCtrl, proportion=0, @@ -2445,7 +2454,7 @@ def __init__(self, parent, title, id=wx.ID_ANY, gridSizer.Add(self.fontlb, flag=wx.EXPAND, pos=(1, 0)) - self.renderfont = wx.StaticBitmap(panel, -1, wx.EmptyBitmapRGBA(100, 50, 255, 255, 255)) + self.renderfont = wx.StaticBitmap(panel, -1, wx.Bitmap.FromRGBA(100, 50, 255, 255, 255)) gridSizer.Add(self.renderfont, flag=wx.EXPAND, pos=(2, 0)) @@ -2594,10 +2603,11 @@ def RenderText(self, font, text, size): env['GRASS_RENDER_WIDTH'] = str(size[0]) env['GRASS_RENDER_HEIGHT'] = str(size[1]) env['GRASS_RENDER_FILE'] = self.tmp_file - ret = RunCommand('d.text', text=text, font=font, align='cc', at='50,50', + env['GRASS_REGION'] = grass.region_env(s=0, n=size[1], w=0, e=size[0]) + ret = RunCommand('d.text', text=text, font=font, align='cc', at='50,60', size=80, color='black', env=env) if ret == 0: self.renderfont.SetBitmap(wx.Bitmap(self.tmp_file)) else: - self.renderfont.SetBitmap(wx.EmptyBitmapRGBA(size[0], size[1])) + self.renderfont.SetBitmap(EmptyBitmap(size[0], size[1])) try_remove(self.tmp_file) diff --git a/gui/wxpython/gui_core/forms.py b/gui/wxpython/gui_core/forms.py index 77384dcf9e4..afb986c40d9 100644 --- a/gui/wxpython/gui_core/forms.py +++ b/gui/wxpython/gui_core/forms.py @@ -159,7 +159,7 @@ def run(self): # get widget id if not self.eventId: for p in self.task.params: - if p.get('gisprompt', False) == False: + if p.get('gisprompt', False) is False: continue prompt = p.get('element', '') if prompt == 'vector': @@ -535,7 +535,7 @@ def __init__(self, parent, giface, task_description, id=wx.ID_ANY, self.description = StaticWrapText(parent=self.panel, label=module_desc) topsizer.Add(self.description, proportion=1, border=5, - flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) + flag=wx.ALL | wx.EXPAND) guisizer.Add(topsizer, proportion=0, flag=wx.EXPAND) @@ -793,7 +793,7 @@ def OnDone(self, event): self.closebox.IsChecked() and \ (event.returncode == 0): # was closed also when aborted but better is leave it open - wx.FutureCall(2000, self.Close) + wx.CallLater(2000, self.Close) def OnMapCreated(self, name, ltype): """Map created or changed @@ -918,11 +918,11 @@ def OnCancel(self, event): # happens when closing dialog of a new layer which was # removed from tree pass - self.Destroy() + self._Destroy() else: Debug.msg(1, "TaskFrame.OnCancel(): no parent") # cancel for non-display commands - self.Destroy() + self._Destroy() def OnHelp(self, event): """Show manual page (switch to the 'Manual' notebook page)""" @@ -938,6 +938,12 @@ def createCmd(self, ignoreErrors=False, ignoreRequired=False): return self.notebookpanel.createCmd(ignoreErrors=ignoreErrors, ignoreRequired=ignoreRequired) + def _Destroy(self): + """Destroy Frame""" + self.notebookpanel.notebook.Unbind(wx.EVT_NOTEBOOK_PAGE_CHANGED) + self.notebookpanel.notebook.widget.Unbind(wx.EVT_NOTEBOOK_PAGE_CHANGED) + self.Destroy() + class CmdPanel(wx.Panel): """A panel containing a notebook dividing in tabs the different @@ -965,7 +971,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, p for p in self.task.params + self.task.flags if not p.get( 'hidden', - False) == True] + False) is True] self.label_id = [] # wrap titles on resize @@ -1033,7 +1039,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, # visible_flags = [ f for f in self.task.flags if not f.get( - 'hidden', False) == True] + 'hidden', False) is True] for f in visible_flags: # we don't want another help (checkbox appeared in r58783) if f['name'] == 'help': @@ -1061,7 +1067,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, title_sizer.Add(chk, proportion=1, flag=wx.EXPAND) title_sizer.Add(rtitle_txt, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL) + flag=wx.ALIGN_CENTER_VERTICAL) which_sizer.Add( title_sizer, proportion=0, @@ -1104,7 +1110,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, # visible_params = [ p for p in self.task.params if not p.get( - 'hidden', False) == True] + 'hidden', False) is True] try: first_param = visible_params[0] @@ -1128,7 +1134,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, # title sizer (description, name, type) if (len(p.get('values', [])) > 0) and \ p.get('multiple', False) and \ - p.get('gisprompt', False) == False and \ + p.get('gisprompt', False) is False and \ p.get('type', '') == 'string': title_txt = StaticBox(parent=which_panel, id=wx.ID_ANY) else: @@ -1155,7 +1161,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, title_sizer.Add( rtitle_txt, proportion=0, - flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.TOP, + flag=wx.RIGHT | wx.TOP, border=5) which_sizer.Add(title_sizer, proportion=0, flag=wx.EXPAND) @@ -1172,7 +1178,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, valuelist_desc = list(map(unicode, p.get('values_desc', []))) required_text = "*" if p.get('required', False) else "" if p.get('multiple', False) and \ - p.get('gisprompt', False) == False and \ + p.get('gisprompt', False) is False and \ p.get('type', '') == 'string': title_txt.SetLabel( " %s:%s (%s=%s) " % @@ -1311,7 +1317,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, # text entry if (p.get('type', 'string') in ('string', 'integer', 'float') and len(p.get('values', [])) == 0 - and p.get('gisprompt', False) == False + and p.get('gisprompt', False) is False and p.get('prompt', '') != 'color'): title_txt.SetLabel(title + ':') @@ -1338,7 +1344,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, flag=style, border=5) font_sizer.Add(font_btn, proportion=0, flag=style, border=5) - + which_sizer.Add(font_sizer, proportion=0, flag=style, border=5) p['wxId'].append(font_btn.GetId()) @@ -1530,7 +1536,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, which_sizer.Add( selection, proportion=0, - flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, border=5) elif prompt == 'group': win = self.FindWindowById(p['wxId'][0]) @@ -1539,7 +1545,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, which_sizer.Add( selection, proportion=0, - flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, border=5) else: if prompt in ('stds', 'strds', 'stvds', 'str3ds'): @@ -1570,19 +1576,19 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, hSizer.Add( selection, proportion=0, - flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, border=5) hSizer.Add( bb, proportion=0, - flag=wx.EXPAND | wx.BOTTOM | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.EXPAND | wx.BOTTOM | wx.RIGHT | wx.TOP, border=5) which_sizer.Add(hSizer) else: which_sizer.Add( selection, proportion=0, - flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, border=5) # subgroup @@ -1594,7 +1600,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, which_sizer.Add( selection, proportion=0, - flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, border=5) # sigrature file @@ -1607,7 +1613,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, which_sizer.Add( selection, proportion=0, - flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, border=5) # separator @@ -1621,7 +1627,7 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, which_sizer.Add( win, proportion=0, - flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP, border=5) # layer, dbdriver, dbname, dbcolumn, dbtable entry @@ -1706,7 +1712,9 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, win = gselect.LocationSelect(parent=which_panel, value=value) win.Bind(wx.EVT_TEXT, self.OnUpdateSelection) + win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection) win.Bind(wx.EVT_TEXT, self.OnSetValue) + win.Bind(wx.EVT_COMBOBOX, self.OnSetValue) elif prompt == 'mapset': if p.get('age', 'old') == 'old': @@ -1718,7 +1726,9 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, parent=which_panel, value=value, new=new, multiple=p.get('multiple', False)) win.Bind(wx.EVT_TEXT, self.OnUpdateSelection) + win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection) win.Bind(wx.EVT_TEXT, self.OnSetValue) + win.Bind(wx.EVT_COMBOBOX, self.OnSetValue) elif prompt == 'dbase': win = gselect.DbaseSelect( @@ -1898,9 +1908,8 @@ def __init__(self, parent, giface, task, id=wx.ID_ANY, border=5) btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(btnLoad, proportion=0, - flag=wx.ALIGN_RIGHT | wx.RIGHT, border=10) - btnSizer.Add(btnSave, proportion=0, - flag=wx.ALIGN_RIGHT) + flag=wx.RIGHT, border=10) + btnSizer.Add(btnSave, proportion=0) which_sizer.Add( btnSizer, proportion=0, @@ -2072,7 +2081,7 @@ def OnCheckItem(index, flag): self.OnUpdateValues() # TODO: replace by signal self.win1.OnCheckItem = OnCheckItem - + elif prompt == 'sql_query': win = gselect.SqlWhereSelect( parent=which_panel, param=p) @@ -2151,7 +2160,7 @@ def OnCheckItem(index, flag): p['wxId-bind'] = list() p['wxId-bind'] += pOpt['wxId'] continue - if p.get('gisprompt', False) == False: + if p.get('gisprompt', False) is False: continue prompt = p.get('prompt', '') @@ -2197,7 +2206,7 @@ def OnCheckItem(index, flag): pSqlWhereIds = [] for p in pSqlWhere: pSqlWhereIds += p['wxId'] - + # set wxId-bindings if pMap: pMap['wxId-bind'] = [] @@ -2243,7 +2252,7 @@ def OnCheckItem(index, flag): maxsizes = (0, 0) for section in sections: tab[section].SetSizer(tabsizer[section]) - tabsizer[section].Fit(tab[section]) + tab[section].SetupScrolling(True, True, 10, 10) tab[section].Layout() minsecsizes = tabsizer[section].GetSize() maxsizes = list(map(lambda x: max(maxsizes[x], minsecsizes[x]), (0, 1))) diff --git a/gui/wxpython/gui_core/ghelp.py b/gui/wxpython/gui_core/ghelp.py index 512fb678133..bacd3c0d2f5 100644 --- a/gui/wxpython/gui_core/ghelp.py +++ b/gui/wxpython/gui_core/ghelp.py @@ -36,6 +36,12 @@ from wx.lib.agw.hyperlink import HyperLinkCtrl except ImportError: from wx.lib.hyperlink import HyperLinkCtrl +try: + from wx.adv import AboutDialogInfo + from wx.adv import AboutBox +except ImportError: + from wx import AboutDialogInfo + from wx import AboutBox import grass.script as grass @@ -819,7 +825,7 @@ def _layout(self): flag=wx.ALL, border=5) btnSizer.Add(wx.Size(1, 1), proportion=1) btnSizer.Add(self.btnNext, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, border=5) + flag=wx.ALL, border=5) sizer.Add(self.content, proportion=1, flag=wx.EXPAND) @@ -894,7 +900,7 @@ def ShowAboutDialog(prgName, startYear): :param prgName: name of the program :param startYear: the first year of existence of the program """ - info = wx.AboutDialogInfo() + info = AboutDialogInfo() info.SetIcon( wx.Icon( @@ -913,7 +919,7 @@ def ShowAboutDialog(prgName, startYear): '(>=v2). Read the file COPYING that comes with GRASS for details.', 75))) - wx.AboutBox(info) + AboutBox(info) def _grassDevTeam(start): diff --git a/gui/wxpython/gui_core/goutput.py b/gui/wxpython/gui_core/goutput.py index a144bd13f4e..cc03564d21c 100644 --- a/gui/wxpython/gui_core/goutput.py +++ b/gui/wxpython/gui_core/goutput.py @@ -230,7 +230,7 @@ def _layout(self): border=5) outBtnSizer.Add(self.btnOutputSave, proportion=proportion, - flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, border=5) + flag=wx.RIGHT | wx.BOTTOM, border=5) cmdBtnSizer.Add( self.btnCmdProtocol, @@ -265,11 +265,7 @@ def _layout(self): self.outputSizer.Fit(self) self.outputSizer.SetSizeHints(self) self.panelOutput.SetSizer(self.outputSizer) - # eliminate gtk_widget_size_allocate() warnings - # avoid to use a deprecated method in wxPython >= 2.9 - getattr(self.outputSizer, 'FitInside', - self.outputSizer.SetVirtualSizeHints)(self.panelOutput) - + self.outputSizer.FitInside(self.panelOutput) if self._gcstyle & GC_PROMPT: promptSizer.Fit(self) promptSizer.SetSizeHints(self) @@ -364,7 +360,11 @@ def WriteLog(self, text, style=None, wrap=None, p2 = self.cmdOutput.GetCurrentPos() - self.cmdOutput.StartStyling(p1, 0xff) + # between wxWidgets 3.0 and 3.1 they dropped mask param + try: + self.cmdOutput.StartStyling(p1) + except TypeError: + self.cmdOutput.StartStyling(p1, 0xff) self.cmdOutput.SetStyling(p2 - p1, style) self.cmdOutput.EnsureCaretVisible() @@ -490,9 +490,9 @@ def CmdProtocolSave(self): try: with open(self.cmdFileProtocol, "a") as output: cmds = self.cmdPrompt.GetCommands() - output.write(os.linesep.join(cmds)) + output.write('\n'.join(cmds)) if len(cmds) > 0: - output.write(os.linesep) + output.write('\n') except IOError as e: GError(_("Unable to write file '{filePath}'.\n\nDetails: {error}").format( filePath=self.cmdFileProtocol, error=e)) @@ -708,6 +708,7 @@ def AddTextWrapped(self, txt, wrap=None): try: self.AddText(txt) except UnicodeDecodeError: + # TODO: this might be dead code for Py3, txt is already unicode? enc = UserSettings.Get( group='atm', key='encoding', subkey='value') if enc: @@ -772,7 +773,10 @@ def AddStyledMessage(self, message, style=None): p2 = self.GetCurrentPos() if p2 >= p1: - self.StartStyling(p1, 0xff) + try: + self.StartStyling(p1) + except TypeError: + self.StartStyling(p1, 0xff) if style == 'error': self.SetStyling(p2 - p1, self.StyleError) diff --git a/gui/wxpython/gui_core/gselect.py b/gui/wxpython/gui_core/gselect.py index 2dd36830253..48c0515517c 100644 --- a/gui/wxpython/gui_core/gselect.py +++ b/gui/wxpython/gui_core/gselect.py @@ -1515,7 +1515,7 @@ def __init__(self, parent, panel, ogr=False, link=False, dest=False, browse.GetChildren()[1].SetName('GdalSelectDataSource') self.dirWidgets['browse'] = browse - formatSelect = wx.Choice(parent=self.dirPanel, size=(300, -1)) + formatSelect = wx.Choice(parent=self.dirPanel) self.dirWidgets['format'] = formatSelect fileFormats = GetFormats(writableOnly=dest)[fType]['file'] formatSelect.SetItems(sorted(list(fileFormats))) @@ -1656,23 +1656,25 @@ def _postInit(self, sourceType, data): self.SetSourceType(sourceType) self.source.SetSelection(self.sourceMap[sourceType]) - dsn = os.path.expandvars(dsn) # v.external.out uses $HOME - # fill in default values - if sourceType == 'dir': - self.dirWidgets['format'].SetStringSelection(format) - self.dirWidgets['browse'].SetValue(dsn) - self.dirWidgets['options'].SetValue(options) - elif sourceType == 'db': - self.dbWidgets['format'].SetStringSelection(format) - self.dbWidgets['options'].SetValue(options) - name = self._getCurrentDbWidgetName() - if name == 'choice': - if dsn in self.dbWidgets[name].GetItems(): - self.dbWidgets[name].SetStringSelection(dsn) - if 'topology' in data.keys(): - self.dbWidgets['featType'].SetSelection(1) - else: - self.dbWidgets[name].SetValue(dsn) + # v.external.out does not return dsn for the native format + if dsn: + dsn = os.path.expandvars(dsn) # v.external.out uses $HOME + # fill in default values + if sourceType == 'dir': + self.dirWidgets['format'].SetStringSelection(format) + self.dirWidgets['browse'].SetValue(dsn) + self.dirWidgets['options'].SetValue(options) + elif sourceType == 'db': + self.dbWidgets['format'].SetStringSelection(format) + self.dbWidgets['options'].SetValue(options) + name = self._getCurrentDbWidgetName() + if name == 'choice': + if dsn in self.dbWidgets[name].GetItems(): + self.dbWidgets[name].SetStringSelection(dsn) + if 'topology' in data.keys(): + self.dbWidgets['featType'].SetSelection(1) + else: + self.dbWidgets[name].SetValue(dsn) def _layout(self): """Layout""" @@ -1684,8 +1686,8 @@ def _layout(self): paddingSizer = wx.BoxSizer(wx.VERTICAL) sizer = wx.GridBagSizer(vgap=5, hgap=10) paddingSizer.Add(self.fileWidgets['browse'], - flag=wx.BOTTOM | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, - border=30) + flag=wx.BOTTOM | wx.EXPAND, + border=35) sizer.Add(paddingSizer, flag=wx.EXPAND, pos=(0, 0), span=(1, 2)) sizer.AddGrowableCol(0) if self.dest: @@ -1826,7 +1828,7 @@ def _layout(self): sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(StaticText(parent=self.nativePanel, label=_("No settings available")), - flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, border=5) + flag=wx.ALL | wx.EXPAND, border=5) self.nativePanel.SetSizer(sizer) for panel in (self.nativePanel, self.filePanel, @@ -1891,7 +1893,7 @@ def OnSettingsChanged(self, data): # data list: [type, dsn, format, options] if len(data) == 3: data.append('') - elif len < 3: + elif len(data) < 3: return self.source.SetSelection(self.sourceMap[data[0]]) @@ -2416,9 +2418,9 @@ def _onClick(self, event): if self.buttonInsCoords.GetToggle() and self.mapWin: switcher = self._giface.GetMapDisplay().GetToolSwitcher() switcher.ToolChanged(self.buttonInsCoords.GetId()) - if self.mapWin.RegisterMouseEventHandler(wx.EVT_LEFT_DOWN, - self._onMapClickHandler, - 'cross') == False: + if not self.mapWin.RegisterMouseEventHandler(wx.EVT_LEFT_DOWN, + self._onMapClickHandler, + 'cross'): return self.registered = True @@ -2589,8 +2591,8 @@ def _onClick(self, evt=None): self._vectorSelect = VectorSelectBase( self.mapdisp, self.giface) - if self.mapdisp.GetWindow().RegisterMouseEventHandler( - wx.EVT_LEFT_DOWN, self._onMapClickHandler, 'cross') == False: + if not self.mapdisp.GetWindow().RegisterMouseEventHandler( + wx.EVT_LEFT_DOWN, self._onMapClickHandler, 'cross'): return self.registered = True self.mapdisp.Raise() @@ -2747,7 +2749,7 @@ def _onClick(self, event): win.Show() except GException as e: GMessage(parent=self.parent, message='{}'.format(e)) - + def SetData(self, vector, layer): self.vector_map = vector self.vector_layer = int(layer) # TODO: support layer names diff --git a/gui/wxpython/gui_core/menu.py b/gui/wxpython/gui_core/menu.py index ff0e0df6adb..9e2c1a1c654 100644 --- a/gui/wxpython/gui_core/menu.py +++ b/gui/wxpython/gui_core/menu.py @@ -123,7 +123,6 @@ def OnMenuHighlight(self, event): id = event.GetMenuId() item = self.FindItemById(id) if item: - text = item.GetText() help = item.GetHelp() # but in this case just call Skip so the default is done diff --git a/gui/wxpython/gui_core/preferences.py b/gui/wxpython/gui_core/preferences.py index 291aa44773a..270896418bc 100644 --- a/gui/wxpython/gui_core/preferences.py +++ b/gui/wxpython/gui_core/preferences.py @@ -52,7 +52,7 @@ from gui_core.widgets import IntegerValidator, ColorTablesComboBox from core.debug import Debug from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \ - StaticBox, TextCtrl, ListCtrl + StaticBox, TextCtrl, ListCtrl, CheckListCtrlMixin class PreferencesBaseDialog(wx.Dialog): @@ -127,7 +127,7 @@ def _layout(self): mainSizer.Add(btnSizer, proportion=0, flag=wx.EXPAND, border=0) mainSizer.Add(btnStdSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_RIGHT, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) mainSizer.Fit(self) @@ -981,7 +981,7 @@ def _createDisplayPage(self, notebook): gridSizer.Add(showCompExtent, pos=(row, 0), span=(1, 2)) - + # # mouse wheel zoom # @@ -1418,7 +1418,7 @@ def _createLayersPage(self, notebook): hlWidth, pos=(row, col + 1), span=(1, 2), flag=wx.ALIGN_RIGHT) - + # random colors row +=1 randomColors = wx.CheckBox(parent=panel, id=wx.ID_ANY, label=_( @@ -1926,7 +1926,7 @@ def OnLoadEpsgCodes(self, event): wx.EndBusyCursor() return - choices = map(str, sorted(self.epsgCodeDict.keys())) + choices = list(map(str, sorted(self.epsgCodeDict.keys()))) epsgCombo.SetItems(choices) wx.EndBusyCursor() @@ -2144,7 +2144,7 @@ def __init__(self, parent, id=wx.ID_ANY, line = wx.StaticLine(parent=self, id=wx.ID_ANY, style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, - flag=wx.EXPAND | wx.ALIGN_CENTRE | wx.ALL, border=5) + flag=wx.EXPAND | wx.ALL, border=5) btnsizer = wx.StdDialogButtonSizer() okbtn = Button(self, wx.ID_OK) @@ -2156,7 +2156,7 @@ def __init__(self, parent, id=wx.ID_ANY, btnsizer.Realize() sizer.Add(btnsizer, proportion=0, - flag=wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL, border=5) + flag=wx.EXPAND | wx.ALL, border=5) # do layout self.Layout() @@ -2170,7 +2170,7 @@ def GetMapsets(self): ms = [] i = 0 for mset in self.all_mapsets_ordered: - if self.mapsetlb.IsChecked(i): + if self.mapsetlb.IsItemChecked(i): ms.append(mset) i += 1 @@ -2178,7 +2178,7 @@ def GetMapsets(self): class CheckListMapset( - ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin): + ListCtrl, listmix.ListCtrlAutoWidthMixin, CheckListCtrlMixin): """List of mapset/owner/group""" def __init__(self, parent, log=None): @@ -2186,7 +2186,7 @@ def __init__(self, parent, log=None): ListCtrl.__init__(self, parent, wx.ID_ANY, style=wx.LC_REPORT) - listmix.CheckListCtrlMixin.__init__(self) + CheckListCtrlMixin.__init__(self) self.log = log # setup mixins diff --git a/gui/wxpython/gui_core/prompt.py b/gui/wxpython/gui_core/prompt.py index cb64d0c4b25..df6ed8c5cad 100644 --- a/gui/wxpython/gui_core/prompt.py +++ b/gui/wxpython/gui_core/prompt.py @@ -384,9 +384,7 @@ def ShowList(self): """Show sorted auto-completion list if it is not empty""" if len(self.autoCompList) > 0: self.autoCompList.sort() - self.AutoCompShow( - lenEntered=0, itemList=' '.join( - self.autoCompList)) + self.AutoCompShow(0, itemList=' '.join(self.autoCompList)) def OnKeyPressed(self, event): """Key pressed capture special treatment for tabulator to show help""" diff --git a/gui/wxpython/gui_core/pyedit.py b/gui/wxpython/gui_core/pyedit.py index e2ac420aac2..74b4706ced2 100644 --- a/gui/wxpython/gui_core/pyedit.py +++ b/gui/wxpython/gui_core/pyedit.py @@ -379,7 +379,7 @@ def Open(self): message=_("Open file"), defaultDir=os.getcwd(), wildcard=_("Python script (*.py)|*.py"), - style=wx.OPEN) + style=wx.FD_OPEN) if dlg.ShowModal() == wx.ID_OK: filename = dlg.GetPath() diff --git a/gui/wxpython/gui_core/pystc.py b/gui/wxpython/gui_core/pystc.py index 727542115a6..6f783a2fdd1 100644 --- a/gui/wxpython/gui_core/pystc.py +++ b/gui/wxpython/gui_core/pystc.py @@ -70,6 +70,11 @@ def __init__(self, parent, id=wx.ID_ANY, statusbar=None): self.SetEdgeMode(stc.STC_EDGE_BACKGROUND) self.SetEdgeColumn(78) + # show line numbers + self.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER) + # supporting only 2 or 3 digit line numbers + self.SetMarginWidth(1, 3 * self.faces["size2"]) + # setup a margin to hold fold markers self.SetMarginType(2, stc.STC_MARGIN_SYMBOL) self.SetMarginMask(2, stc.STC_MASK_FOLDERS) diff --git a/gui/wxpython/gui_core/query.py b/gui/wxpython/gui_core/query.py index 5204c661742..09ac7490c14 100644 --- a/gui/wxpython/gui_core/query.py +++ b/gui/wxpython/gui_core/query.py @@ -57,6 +57,7 @@ def __init__(self, parent, data=None): self.tree.SetColumnWidth(0, 220) self.tree.SetColumnWidth(1, 1000) self.tree.ExpandAll(self._model.root) + self.tree.RefreshItems() self.tree.contextMenu.connect(self.ShowContextMenu) self.mainSizer.Add( self.tree, diff --git a/gui/wxpython/gui_core/toolbars.py b/gui/wxpython/gui_core/toolbars.py index 6d7695ef127..a3310612112 100644 --- a/gui/wxpython/gui_core/toolbars.py +++ b/gui/wxpython/gui_core/toolbars.py @@ -309,7 +309,7 @@ def RemoveCustomToolFromGroup(self, tool): :param tool: id of the button """ - if not tool in self._toolsGroups: + if tool not in self._toolsGroups: return for group in self._toolsGroups[tool]: self._groups[group]['custom'] = \ diff --git a/gui/wxpython/gui_core/treeview.py b/gui/wxpython/gui_core/treeview.py index 0aa7cd64377..4a33fe71c86 100644 --- a/gui/wxpython/gui_core/treeview.py +++ b/gui/wxpython/gui_core/treeview.py @@ -263,7 +263,7 @@ def __init__(self, model=None): szr.SetSizeHints(self) def OnSelChanged(self): - print('selected items: ' + \ + print('selected items: ' + str([node.label for node in self.tree.GetSelected()])) def OnItemActivated(self, node): diff --git a/gui/wxpython/gui_core/widgets.py b/gui/wxpython/gui_core/widgets.py index b6e015707f0..cf85a5ac78a 100644 --- a/gui/wxpython/gui_core/widgets.py +++ b/gui/wxpython/gui_core/widgets.py @@ -90,7 +90,7 @@ from core.gcmd import GMessage, GError from core.debug import Debug from gui_core.wrap import Button, SearchCtrl, StaticText, StaticBox, \ - TextCtrl, Menu, Rect, EmptyBitmap, ListCtrl, NewId + TextCtrl, Menu, Rect, EmptyBitmap, ListCtrl, NewId, CheckListCtrlMixin class NotebookController: @@ -935,7 +935,7 @@ def Select(self): class GListCtrl(ListCtrl, listmix.ListCtrlAutoWidthMixin, - listmix.CheckListCtrlMixin): + CheckListCtrlMixin): """Generic ListCtrl with popup menu to select/deselect all items""" @@ -944,7 +944,7 @@ def __init__(self, parent): ListCtrl.__init__(self, parent, id=wx.ID_ANY, style=wx.LC_REPORT) - listmix.CheckListCtrlMixin.__init__(self) + CheckListCtrlMixin.__init__(self) # setup mixins listmix.ListCtrlAutoWidthMixin.__init__(self) @@ -1009,7 +1009,7 @@ def GetData(self, checked=None): if item == -1: break - isChecked = self.IsChecked(item) + isChecked = self.IsItemChecked(item) if checked is not None and checked != isChecked: continue @@ -1106,18 +1106,18 @@ def _layout(self): boxSizer = wx.BoxSizer(wx.VERTICAL) boxSizer.Add(self._search, - flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.BOTTOM, + flag=wx.EXPAND | wx.BOTTOM, border=5) if self._showChoice: hSizer = wx.BoxSizer(wx.HORIZONTAL) hSizer.Add(self._searchChoice, - flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND | wx.BOTTOM, + flag=wx.EXPAND | wx.BOTTOM, border=5) hSizer.AddStretchSpacer() boxSizer.Add(hSizer, flag=wx.EXPAND) if self._showTip: boxSizer.Add(self._searchTip, - flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND) + flag=wx.EXPAND) sizer.Add(boxSizer, proportion=1) @@ -1352,7 +1352,7 @@ def AddSettings(self, settings): :param settings: - dict with all settigs {nameofsetting : settingdata, ....} """ - self._settings = dict(self._settings.items() + settings.items()) + self._settings.update(settings) self._saveSettings() def OnSettingsDelete(self, event): diff --git a/gui/wxpython/gui_core/wrap.py b/gui/wxpython/gui_core/wrap.py index 17636c29e71..2db19a62b7e 100644 --- a/gui/wxpython/gui_core/wrap.py +++ b/gui/wxpython/gui_core/wrap.py @@ -1,7 +1,7 @@ """ @package gui_core.wrap -@brief Core wrapped wxpython widgets +@brief Core wrapped wxpython widgets Classes: - wrap::GSpinCtrl @@ -16,22 +16,35 @@ """ import wx -import wx.lib.buttons as buttons +import wx.lib.agw.floatspin as fs import wx.lib.colourselect as csel +import wx.lib.filebrowsebutton as filebrowse +import wx.lib.scrolledpanel as scrolled +from wx.lib import expando +from wx.lib import buttons try: import wx.lib.agw.customtreectrl as CT except ImportError: import wx.lib.customtreectrl as CT -from core.globalvar import gtk3, wxPythonPhoenix, CheckWxVersion -if wxPythonPhoenix: - import wx.adv +from core.globalvar import CheckWxVersion, gtk3, wxPythonPhoenix if wxPythonPhoenix: + import wx.adv + from wx.adv import OwnerDrawnComboBox as OwnerDrawnComboBox_ + from wx.adv import ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED + from wx.adv import BitmapComboBox as BitmapComboBox_ + from wx.adv import HyperlinkCtrl as HyperlinkCtrl_ + from wx.adv import HL_ALIGN_LEFT, HL_CONTEXTMENU ComboPopup = wx.ComboPopup wxComboCtrl = wx.ComboCtrl else: import wx.combo + from wx.combo import OwnerDrawnComboBox as OwnerDrawnComboBox_ + from wx.combo import ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED + from wx.combo import BitmapComboBox as BitmapComboBox_ + from wx import HyperlinkCtrl as HyperlinkCtrl_ + from wx import HL_ALIGN_LEFT, HL_CONTEXTMENU ComboPopup = wx.combo.ComboPopup wxComboCtrl = wx.combo.ComboCtrl @@ -47,12 +60,14 @@ def BitmapFromImage(image, depth=-1): else: return wx.BitmapFromImage(image, depth=depth) + def ImageFromBitmap(bitmap): if wxPythonPhoenix: return bitmap.ConvertToImage() else: return wx.ImageFromBitmap(bitmap) + def EmptyBitmap(width, height, depth=-1): if wxPythonPhoenix: return wx.Bitmap(width=width, height=height, depth=depth) @@ -121,6 +136,34 @@ def __init__(self, *args, **kwargs): wx.SpinCtrl.__init__(self, *args, **kwargs) + def SetToolTip(self, tip): + if wxPythonPhoenix: + wx.SpinCtrl.SetToolTip(self, tipString=tip) + else: + wx.SpinCtrl.SetToolTipString(self, tip) + + +class FloatSpin(fs.FloatSpin): + """Wrapper around fs.FloatSpin to have more control + over the widget on different platforms""" + + gtk3MinSize = 130 + + def __init__(self, *args, **kwargs): + if gtk3: + if 'size' in kwargs: + kwargs['size'] = wx.Size(max(self.gtk3MinSize, kwargs['size'][0]), kwargs['size'][1]) + else: + kwargs['size'] = wx.Size(self.gtk3MinSize, -1) + + fs.FloatSpin.__init__(self, *args, **kwargs) + + def SetToolTip(self, tip): + if wxPythonPhoenix: + fs.FloatSpin.SetToolTip(self, tipString=tip) + else: + fs.FloatSpin.SetToolTipString(self, tip) + class Button(wx.Button): """Wrapper around wx.Button to have more control @@ -270,6 +313,35 @@ def SetItem(self, index, column, label, imageId=-1): else: return wx.ListCtrl.SetStringItem(self, index=index, col=column, label=label, imageId=imageId) + def CheckItem(self, item, check=True): + """Uses either deprecated listmix.CheckListCtrlMixin + or new checkbox implementation in wx.ListCtrl since 4.1.0""" + if hasattr(self, 'HasCheckBoxes'): + wx.ListCtrl.CheckItem(self, item, check) + else: + super(ListCtrl, self).CheckItem(item, check) + + def IsItemChecked(self, item): + if hasattr(self, 'HasCheckBoxes'): + return wx.ListCtrl.IsItemChecked(self, item) + else: + return super(ListCtrl, self).IsChecked(item) + + +if CheckWxVersion([4, 1, 0]): + class CheckListCtrlMixin(): + """This class pretends to be deprecated CheckListCtrlMixin mixin and + only enables checkboxes in new versions of ListCtrl""" + def __init__(self): + self.EnableCheckBoxes(True) + self.AssignImageList(wx.ImageList(16, 16), wx.IMAGE_LIST_SMALL) +else: + import wx.lib.mixins.listctrl as listmix + class CheckListCtrlMixin(listmix.CheckListCtrlMixin): + """Wrapper for deprecated mixin""" + def __init__(self): + listmix.CheckListCtrlMixin.__init__(self) + class TreeCtrl(wx.TreeCtrl): """Wrapper around wx.TreeCtrl to have more control @@ -472,6 +544,7 @@ def SetToolTip(self, tip): else: csel.ColourSelect.SetToolTipString(self, tip) + class ComboCtrl(wxComboCtrl): def __init__(self, *args, **kwargs): wxComboCtrl.__init__(self, *args, **kwargs) @@ -481,3 +554,134 @@ def SetToolTip(self, tip): wxComboCtrl.SetToolTip(self, tipString=tip) else: wxComboCtrl.SetToolTipString(self, tip) + + +class Dialog(wx.Dialog): + """Wrapper around wx.Dialog to have more control + over the widget on different platforms/wxpython versions""" + def __init__(self, *args, **kwargs): + wx.Dialog.__init__(self, *args, **kwargs) + + +class Notebook(wx.Notebook): + """Wrapper around NoteBook to have more control + over the widget on different platforms/wxpython versions""" + def __init__(self, *args, **kwargs): + wx.Notebook.__init__(self, *args, **kwargs) + + +class OwnerDrawnComboBox(OwnerDrawnComboBox_): + """Wrapper around OwnerDrawnComboBox to have more control + over the widget on different platforms/wxpython versions""" + ODCB_PAINTING_CONTROL = ODCB_PAINTING_CONTROL + ODCB_PAINTING_SELECTED = ODCB_PAINTING_SELECTED + + def __init__(self, *args, **kwargs): + OwnerDrawnComboBox_.__init__(self, *args, **kwargs) + + def SetToolTip(self, tip): + if wxPythonPhoenix: + OwnerDrawnComboBox_.SetToolTip(self, tipString=tip) + else: + OwnerDrawnComboBox_.SetToolTipString(self, tip) + + +class BitmapComboBox(BitmapComboBox_): + """Wrapper around BitmapComboBox to have more control + over the widget on different platforms/wxpython versions""" + def __init__(self, *args, **kwargs): + BitmapComboBox_.__init__(self, *args, **kwargs) + + def SetToolTip(self, tip): + if wxPythonPhoenix: + BitmapComboBox_.SetToolTip(self, tipString=tip) + else: + BitmapComboBox_.SetToolTipString(self, tip) + + +class ScrolledPanel(scrolled.ScrolledPanel): + """Wrapper around scrolled.ScrolledPanel to have more control + over the widget on different platforms/wxpython versions""" + def __init__(self, *args, **kwargs): + scrolled.ScrolledPanel.__init__(self, *args, **kwargs) + + def SetToolTip(self, tip): + if wxPythonPhoenix: + scrolled.ScrolledPanel.SetToolTip(self, tipString=tip) + else: + scrolled.ScrolledPanel.SetToolTipString(self, tip) + + +class FileBrowseButton(filebrowse.FileBrowseButton): + """Wrapper around filebrowse.FileBrowseButton to have more control + over the widget on different platforms/wxpython versions""" + def __init__(self, *args, **kwargs): + filebrowse.FileBrowseButton.__init__(self, *args, **kwargs) + + +class DirBrowseButton(filebrowse.DirBrowseButton): + """Wrapper around filebrowse.DirBrowseButton to have more control + over the widget on different platforms/wxpython versions""" + def __init__(self, *args, **kwargs): + filebrowse.DirBrowseButton.__init__(self, *args, **kwargs) + + +class ExpandoTextCtrl(expando.ExpandoTextCtrl): + """Wrapper around expando.ExpandoTextCtrl to have more control + over the widget on different platforms/wxpython versions""" + EVT_ETC_LAYOUT_NEEDED = expando.EVT_ETC_LAYOUT_NEEDED + + def __init__(self, *args, **kwargs): + expando.ExpandoTextCtrl.__init__(self, *args, **kwargs) + + +class ColourPickerCtrl(wx.ColourPickerCtrl): + """Wrapper around wx.ColourPickerCtrl to have more control + over the widget on different platforms/wxpython versions""" + + def __init__(self, *args, **kwargs): + wx.ColourPickerCtrl.__init__(self, *args, **kwargs) + + +class ListBox(wx.ListBox): + """Wrapper around wx.ListBox to have more control + over the widget on different platforms/wxpython versions""" + + def __init__(self, *args, **kwargs): + wx.ListBox.__init__(self, *args, **kwargs) + + def SetToolTip(self, tip): + if wxPythonPhoenix: + wx.ListBox.SetToolTip(self, tipString=tip) + else: + wx.ListBox.SetToolTipString(self, tip) + + +class HyperlinkCtrl(HyperlinkCtrl_): + """Wrapper around HyperlinkCtrl to have more control + over the widget on different platforms/wxpython versions""" + HL_ALIGN_LEFT = HL_ALIGN_LEFT + HL_CONTEXTMENU = HL_CONTEXTMENU + + def __init__(self, *args, **kwargs): + HyperlinkCtrl_.__init__(self, *args, **kwargs) + + def SetToolTip(self, tip): + if wxPythonPhoenix: + HyperlinkCtrl_.SetToolTip(self, tipString=tip) + else: + HyperlinkCtrl_.SetToolTipString(self, tip) + + +class ComboBox(wx.ComboBox): + """Wrapper around wx.ComboBox to have more control + over the widget on different platforms/wxpython versions""" + + def __init__(self, *args, **kwargs): + wx.ComboBox.__init__(self, *args, **kwargs) + + def SetToolTip(self, tip): + if wxPythonPhoenix: + wx.ComboBox.SetToolTip(self, tipString=tip) + else: + wx.ComboBox.SetToolTipString(self, tip) diff --git a/gui/wxpython/iclass/dialogs.py b/gui/wxpython/iclass/dialogs.py index 83d08a97559..82c7f3aef69 100644 --- a/gui/wxpython/iclass/dialogs.py +++ b/gui/wxpython/iclass/dialogs.py @@ -324,7 +324,7 @@ def __init__(self, parent, title=_("Class manager"), id=wx.ID_ANY): btnSizer = wx.BoxSizer(wx.HORIZONTAL) closeButton = Button(panel, id=wx.ID_CLOSE) btnSizer.Add(wx.Size(-1, -1), proportion=1, flag=wx.EXPAND) - btnSizer.Add(closeButton, proportion=0, flag=wx.ALIGN_RIGHT) + btnSizer.Add(closeButton, proportion=0) mainSizer.Add( btnSizer, proportion=0, @@ -570,16 +570,15 @@ def OnGetItemText(self, item, col): def OnGetItemImage(self, item): return -1 - def OnGetItemAttr(self, item): - return None - def OnGetItemAttr(self, item): """Set correct class color for a item""" back_c = wx.Colour(*map(int, self.OnGetItemText(item, 1).split(':'))) text_c = wx.Colour(*ContrastColor(back_c)) # if it is in scope of the method, gui falls, using self solved it - self.l = wx.ListItemAttr(colText=text_c, colBack=back_c) + self.l = wx.ListItemAttr() + self.l.SetBackgroundColour(back_c) + self.l.SetTextColour(text_c) return self.l diff --git a/gui/wxpython/iclass/digit.py b/gui/wxpython/iclass/digit.py index d3574c6f1f1..bd1a7f0234a 100644 --- a/gui/wxpython/iclass/digit.py +++ b/gui/wxpython/iclass/digit.py @@ -52,7 +52,7 @@ def _onLeftDown(self, event): return region = grass.region() - e, n = self.Pixel2Cell(event.GetPositionTuple()) + e, n = self.Pixel2Cell(event.GetPosition()) if not((region['s'] <= n <= region['n']) and(region['w'] <= e <= region['e'])): GWarning( @@ -103,7 +103,7 @@ def GetCurrentCategory(self): def GetCategoryColor(self, cat): """Get color associated with given category""" - r, g, b = map(int, self.parent.GetClassColor(cat).split(':')) + r, g, b = [int(x) for x in self.parent.GetClassColor(cat).split(':')][:3] return wx.Colour(r, g, b) diff --git a/gui/wxpython/iclass/frame.py b/gui/wxpython/iclass/frame.py index 98e6eea0a2e..fa02e19dcfd 100644 --- a/gui/wxpython/iclass/frame.py +++ b/gui/wxpython/iclass/frame.py @@ -50,7 +50,6 @@ from gui_core.wrap import Menu from mapwin.base import MapWindowProperties from dbmgr.vinfo import VectorDBInfo -import grass.script as grass from iclass.digit import IClassVDigitWindow, IClassVDigit from iclass.toolbars import IClassMapToolbar, IClassMiscToolbar,\ @@ -133,14 +132,7 @@ def __init__( # # Add toolbars # - - toolbarsCopy = toolbars[:] - if sys.platform == 'win32': - self.AddToolbar(toolbarsCopy.pop(1)) - toolbarsCopy.reverse() - else: - self.AddToolbar(toolbarsCopy.pop(0)) - for toolb in toolbarsCopy: + for toolb in toolbars: self.AddToolbar(toolb) self.firstMapWindow.SetToolbar(self.toolbars['vdigit']) @@ -314,7 +306,7 @@ def AddToolbar(self, name): ToolbarPane().Top(). LeftDockable(False).RightDockable(False). BottomDockable(False).TopDockable(True). - CloseButton(False).Layer(2).Row(1). + CloseButton(False).Layer(2).Row(1).Position(0). BestSize((self.toolbars[name].GetBestSize()))) if name == "iClass": @@ -327,7 +319,7 @@ def AddToolbar(self, name): ToolbarPane().Top(). LeftDockable(False).RightDockable(False). BottomDockable(False).TopDockable(True). - CloseButton(False).Layer(2).Row(2). + CloseButton(False).Layer(2).Row(2).Position(0). BestSize((self.toolbars[name].GetBestSize()))) if name == "iClassMisc": @@ -339,7 +331,7 @@ def AddToolbar(self, name): ToolbarPane().Top(). LeftDockable(False).RightDockable(False). BottomDockable(False).TopDockable(True). - CloseButton(False).Layer(2).Row(1). + CloseButton(False).Layer(2).Row(1).Position(1). BestSize((self.toolbars[name].GetBestSize()))) if name == "vdigit": @@ -366,21 +358,15 @@ def AddToolbar(self, name): ToolbarPane().Top(). LeftDockable(False).RightDockable(False). BottomDockable(False).TopDockable(True). - CloseButton(False).Layer(2).Row(2). + CloseButton(False).Layer(2).Row(2).Position(1). BestSize((self.toolbars[name].GetBestSize()))) def _addPanes(self): """Add mapwindows and toolbars to aui manager""" - if sys.platform == 'win32': - self._addPaneMapWindow(name='training') - self._addPaneToolbar(name='iClassTrainingMapManager') - self._addPaneMapWindow(name='preview') - self._addPaneToolbar(name='iClassPreviewMapManager') - else: - self._addPaneToolbar(name='iClassPreviewMapManager') - self._addPaneMapWindow(name='preview') - self._addPaneToolbar(name='iClassTrainingMapManager') - self._addPaneMapWindow(name='training') + self._addPaneMapWindow(name='training', position=0) + self._addPaneToolbar(name='iClassTrainingMapManager', position=1) + self._addPaneMapWindow(name='preview', position=2) + self._addPaneToolbar(name='iClassPreviewMapManager', position=3) # otherwise best size was ignored self._mgr.SetDockSizeConstraint(0.5, 0.5) @@ -390,7 +376,7 @@ def _addPanes(self): Dockable(False).Floatable(False).CloseButton(False). Left().Layer(1).BestSize((335, -1))) - def _addPaneToolbar(self, name): + def _addPaneToolbar(self, name, position): if name == 'iClassPreviewMapManager': parent = self.previewMapManager else: @@ -400,10 +386,10 @@ def _addPaneToolbar(self, name): self._mgr.AddPane(self.toolbars[name], wx.aui.AuiPaneInfo().ToolbarPane().Movable(). Name(name). - CloseButton(False).Center().Layer(0). + CloseButton(False).Center().Layer(0).Position(position). BestSize((self.toolbars[name].GetBestSize()))) - def _addPaneMapWindow(self, name): + def _addPaneMapWindow(self, name, position): if name == 'preview': window = self.GetSecondWindow() caption = _("Preview Display") @@ -414,7 +400,7 @@ def _addPaneMapWindow(self, name): self._mgr.AddPane(window, wx.aui.AuiPaneInfo(). Name(name).Caption(caption). Dockable(False).Floatable(False).CloseButton(False). - Center().Layer(0)) + Center().Layer(0).Position(position)) def IsStandalone(self): """Check if Map display is standalone""" @@ -870,7 +856,7 @@ def _runDBUpdate(self, tmpFile, table, column, value, cat): :param value: new value :param cat: which category to update """ - if isinstance(value, (types.IntType, types.FloatType)): + if isinstance(value, (int, float)): tmpFile.write("UPDATE %s SET %s = %d WHERE cat = %d\n" % (table, column, value, cat)) else: diff --git a/gui/wxpython/iclass/statistics.py b/gui/wxpython/iclass/statistics.py index 0e10024abe0..87539099871 100644 --- a/gui/wxpython/iclass/statistics.py +++ b/gui/wxpython/iclass/statistics.py @@ -138,12 +138,12 @@ def SetFromcStatistics(self, cStatistics): name = c_char_p() I_iclass_statistics_get_name(cStatistics, byref(name)) if self.name != name.value: - set_stats["name"] = name.value + set_stats["name"] = grass.decode(name.value) color = c_char_p() I_iclass_statistics_get_color(cStatistics, byref(color)) if self.color != color.value: - set_stats["color"] = color.value + set_stats["color"] = grass.decode(color.value) nbands = c_int() I_iclass_statistics_get_nbands(cStatistics, byref(nbands)) diff --git a/gui/wxpython/iclass/toolbars.py b/gui/wxpython/iclass/toolbars.py index 156be8b7198..911f746f9cf 100644 --- a/gui/wxpython/iclass/toolbars.py +++ b/gui/wxpython/iclass/toolbars.py @@ -207,7 +207,7 @@ def _updateColor(self, cat): if cat: stat = self.stats_data.GetStatistics(cat) - back_c = wx.Colour(*map(int, stat.color.split(':'))) + back_c = wx.Colour([int(x) for x in stat.color.split(':')]) text_c = wx.Colour(*ContrastColor(back_c)) else: back_c = wx.SystemSettings.GetColour(wx.SYS_COLOUR_BACKGROUND) diff --git a/gui/wxpython/image2target/ii2t_manager.py b/gui/wxpython/image2target/ii2t_manager.py index bb7e99ab688..0bef2d8ccb5 100644 --- a/gui/wxpython/image2target/ii2t_manager.py +++ b/gui/wxpython/image2target/ii2t_manager.py @@ -40,14 +40,16 @@ from copy import copy import wx -from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, ListCtrlAutoWidthMixin +from wx.lib.mixins.listctrl import ColumnSorterMixin, ListCtrlAutoWidthMixin import wx.lib.colourselect as csel from core import globalvar if globalvar.wxPythonPhoenix: - from wx.adv import Wizard as wiz + from wx import adv as wiz + from wx.adv import Wizard else: - import wx.wizard as wiz + from wx import wizard as wiz + from wx.wizard import Wizard import grass.script as grass @@ -61,7 +63,7 @@ from gcp.mapdisplay import MapFrame from core.giface import Notification from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \ - CheckListBox, TextCtrl, Menu, ListCtrl, BitmapFromImage + CheckListBox, TextCtrl, Menu, ListCtrl, BitmapFromImage, CheckListCtrlMixin from location_wizard.wizard import TitledPage as TitledPage @@ -207,7 +209,7 @@ def __init__(self, parent, giface): # if self.wizard.RunWizard(self.startpage): success = self.OnWizFinished() - if success == False: + if not success: GMessage(parent=self.parent, message=_("Georectifying setup canceled.")) self.Cleanup() @@ -219,7 +221,7 @@ def __init__(self, parent, giface): # # start GCP display # - if success != False: + if success: # instance of render.Map to be associated with display self.SwitchEnv('source') self.SrcMap = Map(gisrc=self.source_gisrc) @@ -1325,7 +1327,7 @@ def SetGCPSatus(self, item, itemIndex): # changed itemIndex += 1 - if not self.list.IsChecked(key - 1): + if not self.list.IsItemChecked(key - 1): wxPen = "unused" if not self.show_unused: item.SetPropertyVal('hide', True) @@ -1334,7 +1336,7 @@ def SetGCPSatus(self, item, itemIndex): else: item.SetPropertyVal('hide', False) - if self.highest_only == True: + if self.highest_only: if itemIndex == self.highest_key: wxPen = "highest" else: @@ -1451,7 +1453,7 @@ def SaveGCPs(self, event): "#---------------------------- --------------------------- ---------------\n") for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index) == True: + if self.list.IsItemChecked(index): check = "1" self.GCPcount += 1 else: @@ -1649,7 +1651,7 @@ def OnGeorect(self, event): global maptype self.SaveGCPs(None) - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): return if maptype == 'raster': @@ -1761,11 +1763,11 @@ def UpdateColours(self, srcrender=False, srcrenderVector=False, highest_idx = 0 for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): key = self.list.GetItemData(index) fwd_err = self.mapcoordlist[key][5] - if self.highest_only == True: + if self.highest_only: self.list.SetItemTextColour(index, wx.BLACK) if highest_fwd_err < fwd_err: highest_fwd_err = fwd_err @@ -1855,7 +1857,7 @@ def RMSError(self, xygroup, order): self.SaveGCPs(None) # self.SetStatusText('') - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): return # get list of forward and reverse rms error values for each point @@ -1892,7 +1894,7 @@ def RMSError(self, xygroup, order): for index in range(self.list.GetItemCount()): key = self.list.GetItemData(index) - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): fwd_err, bkw_err = errlist[GCPcount].split() self.list.SetItem(index, 7, fwd_err) self.list.SetItem(index, 8, bkw_err) @@ -1930,7 +1932,7 @@ def RMSError(self, xygroup, order): self.list.SetItemTextColour(highest_idx, wx.RED) elif GCPcount > 0 and self.rmsthresh > 0 and not self.highest_only: for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): key = self.list.GetItemData(index) if (self.mapcoordlist[key][7] > self.rmsthresh): self.list.SetItemTextColour(index, wx.RED) @@ -1964,7 +1966,7 @@ def GetNewExtent(self, region, map=None): order = self.gr_order self.gr_order = 1 - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): self.gr_order = order return @@ -2239,7 +2241,7 @@ def _Create(self): _('Forward error'), _('Backward error')): info.SetText(lbl) - self.InsertColumnInfo(idx_col, info) + self.InsertColumn(idx_col, info) idx_col += 1 def LoadData(self): @@ -2769,7 +2771,7 @@ def __CreateSymbologyPage(self, notebook): self.rmsWin = TextCtrl(parent=panel, id=wx.ID_ANY, size=(70, -1), style=wx.TE_NOHIDESEL) self.rmsWin.SetValue("%s" % str(sdfactor)) - if (self.parent.highest_only == True): + if (self.parent.highest_only): self.rmsWin.Disable() self.symbol['sdfactor'] = self.rmsWin.GetId() @@ -3253,7 +3255,7 @@ def UpdateSettings(self): tgtrenderVector = True if tgt_map['raster'] == '' and tgt_map['vector'] == '': - if self.parent.show_target == True: + if self.parent.show_target: self.parent.show_target = False self.parent._mgr.GetPane("target").Hide() self.parent._mgr.Update() @@ -3261,7 +3263,7 @@ def UpdateSettings(self): self.parent.activemap.Enable(False) self.parent.GetMapToolbar().Enable('zoommenu', enable=False) else: - if self.parent.show_target == False: + if not self.parent.show_target: self.parent.show_target = True self.parent._mgr.GetPane("target").Show() self.parent._mgr.Update() diff --git a/gui/wxpython/image2target/ii2t_mapdisplay.py b/gui/wxpython/image2target/ii2t_mapdisplay.py index 678406b7352..d2ab90806f7 100644 --- a/gui/wxpython/image2target/ii2t_mapdisplay.py +++ b/gui/wxpython/image2target/ii2t_mapdisplay.py @@ -278,7 +278,7 @@ def AddToolbar(self, name): BottomDockable(False).TopDockable(True). CloseButton(False).Layer(2)) - if self.show_target == False: + if not self.show_target: self.toolbars['gcpdisp'].Enable('zoommenu', enable=False) self.toolbars['gcpman'] = GCPManToolbar(self) diff --git a/gui/wxpython/iscatt/controllers.py b/gui/wxpython/iscatt/controllers.py index be35d177c52..d94471ce046 100644 --- a/gui/wxpython/iscatt/controllers.py +++ b/gui/wxpython/iscatt/controllers.py @@ -976,7 +976,7 @@ def UpdateCategoryRaster(self, cat_id, attrs, render=True): def RenderCatRast(self, cat_id): - if not cat_id in six.iterkeys(self.added_cats_rasts): + if cat_id not in six.iterkeys(self.added_cats_rasts): cat_rast = self.scatt_mgr.core.GetCatRast(cat_id) cat_name = self.cats_mgr.GetCategoryAttrs(cat_id)['name'] @@ -1053,7 +1053,7 @@ def UpdateCategoryRaster(self, cat_id, attrs, render=True): def RenderCatRast(self, cat_id): train_mgr, preview_mgr = self.iclass_frame.GetMapManagers() - if not cat_id in self.added_cats_rasts: + if cat_id not in self.added_cats_rasts: cat_rast = self.scatt_mgr.core.GetCatRast(cat_id) cat_name = self.cats_mgr.GetCategoryAttrs(cat_id)['name'] diff --git a/gui/wxpython/iscatt/core_c.py b/gui/wxpython/iscatt/core_c.py index f1503a2f090..d459522bf7a 100644 --- a/gui/wxpython/iscatt/core_c.py +++ b/gui/wxpython/iscatt/core_c.py @@ -24,6 +24,7 @@ sys.stderr.write(_("Loading ctypes libs failed")) from core.gcmd import GException +from grass.script import encode def Rasterize(polygon, rast, region, value): @@ -207,7 +208,7 @@ def _stringListToCharArr(str_list): char_arr = arr() for i, st in enumerate(str_list): if st: - char_arr[i] = st + char_arr[i] = encode(st) else: char_arr[i] = None diff --git a/gui/wxpython/iscatt/dialogs.py b/gui/wxpython/iscatt/dialogs.py index c490f30c8af..6c6b4d79ff2 100644 --- a/gui/wxpython/iscatt/dialogs.py +++ b/gui/wxpython/iscatt/dialogs.py @@ -172,7 +172,7 @@ def _addSelectSizer(self, title, sel): flag=wx.EXPAND) selSizer.Add(sel, proportion=1, - flag=wx.EXPAND | wx.TOP | wx.ALIGN_CENTER_VERTICAL, + flag=wx.EXPAND | wx.TOP, border=5) return selSizer @@ -417,7 +417,9 @@ def __init__( gridSizer = wx.GridBagSizer(vgap=1, hgap=1) row = 0 - setts = dict(self.colorsSetts.items() + self.sizeSetts.items()) + setts = dict() + setts.update(self.colorsSetts) + setts.update(self.sizeSetts) settsOrder = ["sel_pol", "sel_pol_vertex", "sel_area", "sel_area_opacty", "snap_tresh"] @@ -449,7 +451,7 @@ def __init__( flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) - gridSizer.AddGrowableCol(1) + gridSizer.AddGrowableCol(0) ellPolBoxSizer.Add(gridSizer, flag=wx.EXPAND) btnSizer = wx.BoxSizer(wx.HORIZONTAL) diff --git a/gui/wxpython/iscatt/frame.py b/gui/wxpython/iscatt/frame.py index 42953e0feea..2fa4d365490 100644 --- a/gui/wxpython/iscatt/frame.py +++ b/gui/wxpython/iscatt/frame.py @@ -408,7 +408,6 @@ def GetScattMgr(self): class CategoryListCtrl(ListCtrl, listmix.ListCtrlAutoWidthMixin): - # listmix.TextEditMixin): def __init__(self, parent, cats_mgr, sel_cats_in_iscatt, id=wx.ID_ANY): @@ -555,7 +554,9 @@ def OnGetItemAttr(self, item): wx.SYS_COLOUR_INACTIVECAPTIONTEXT) # if it is in scope of the method, gui falls, using self solved it - self.l = wx.ListItemAttr(colText=text_c, colBack=back_c) + self.l = wx.ListItemAttr() + self.l.SetBackgroundColour(back_c) + self.l.SetTextColour(text_c) return self.l def OnCategoryRightUp(self, event): @@ -573,13 +574,13 @@ def OnCategoryRightUp(self, event): menu = Menu() - item = menu.Append(wx.ID_ANY, text=_("Rename class")) + item = menu.Append(wx.ID_ANY, _("Rename class")) self.Bind(wx.EVT_MENU, self.OnRename, item) - item = menu.Append(wx.ID_ANY, text=_("Set color")) + item = menu.Append(wx.ID_ANY, _("Set color")) self.Bind(wx.EVT_MENU, self.OnSetColor, item) - item = menu.Append(item_id, text=_("Change opacity level")) + item = menu.Append(item_id, _("Change opacity level")) self.Bind(wx.EVT_MENU, self.OnPopupOpacityLevel, item) if showed: @@ -587,7 +588,7 @@ def OnCategoryRightUp(self, event): else: text = _("Show") - item = menu.Append(wx.ID_ANY, text=text) + item = menu.Append(wx.ID_ANY, text) self.Bind( wx.EVT_MENU, lambda event: self._setCatAttrs( @@ -598,31 +599,31 @@ def OnCategoryRightUp(self, event): menu.AppendSeparator() - item = menu.Append(wx.ID_ANY, text=_("Move to top")) + item = menu.Append(wx.ID_ANY, _("Move to top")) self.Bind(wx.EVT_MENU, self.OnMoveTop, item) if cat_idx == 0: menu.Enable(item.GetId(), False) - item = menu.Append(wx.ID_ANY, text=_("Move to bottom")) + item = menu.Append(wx.ID_ANY, _("Move to bottom")) self.Bind(wx.EVT_MENU, self.OnMoveBottom, item) if cat_idx == len(cats) - 1: menu.Enable(item.GetId(), False) menu.AppendSeparator() - item = menu.Append(wx.ID_ANY, text=_("Move category up")) + item = menu.Append(wx.ID_ANY, _("Move category up")) self.Bind(wx.EVT_MENU, self.OnMoveUp, item) if cat_idx == 0: menu.Enable(item.GetId(), False) - item = menu.Append(wx.ID_ANY, text=_("Move category down")) + item = menu.Append(wx.ID_ANY, _("Move category down")) self.Bind(wx.EVT_MENU, self.OnMoveDown, item) if cat_idx == len(cats) - 1: menu.Enable(item.GetId(), False) menu.AppendSeparator() - item = menu.Append(wx.ID_ANY, text=_("Export class raster")) + item = menu.Append(wx.ID_ANY, _("Export class raster")) self.Bind(wx.EVT_MENU, self.OnExportCatRast, item) self.PopupMenu(menu) diff --git a/gui/wxpython/iscatt/iscatt_core.py b/gui/wxpython/iscatt/iscatt_core.py index a971e802ade..9f61d9b97ed 100644 --- a/gui/wxpython/iscatt/iscatt_core.py +++ b/gui/wxpython/iscatt/iscatt_core.py @@ -34,7 +34,7 @@ import grass.script as grass -from core_c import CreateCatRast, ComputeScatts, UpdateCatRast, \ +from iscatt.core_c import CreateCatRast, ComputeScatts, UpdateCatRast, \ Rasterize, SC_SCATT_DATA, SC_SCATT_CONDITIONS MAX_SCATT_SIZE = 4100 * 4100 @@ -270,7 +270,7 @@ def _updateCatRast(self, bbox, areas_cats, updated_cats): if not areas_cats[c]: continue - layer = areas_cats[c].keys()[0] + layer = list(areas_cats[c])[0] cat = areas_cats[c][layer][0] if cat in rasterized_cats: @@ -812,7 +812,7 @@ def idScattToidBands(scatt_id, n_bands): band_1 = (int)( (2 * n_b1 + 1 - sqrt(((2 * n_b1 + 1) * (2 * n_b1 + 1) - 8 * scatt_id))) / 2) - band_2 = scatt_id - (band_1 * (2 * n_b1 + 1) - band_1 * band_1) / 2 + band_1 + 1 + band_2 = int(scatt_id - (band_1 * (2 * n_b1 + 1) - band_1 * band_1) / 2 + band_1 + 1) return band_1, band_2 @@ -826,8 +826,8 @@ def idBandsToidScatt(band_1_id, band_2_id, n_bands): n_b1 = n_bands - 1 - scatt_id = ( - band_1_id * (2 * n_b1 + 1) - band_1_id * band_1_id) / 2 + band_2_id - band_1_id - 1 + scatt_id = int(( + band_1_id * (2 * n_b1 + 1) - band_1_id * band_1_id) / 2 + band_2_id - band_1_id - 1) return scatt_id diff --git a/gui/wxpython/iscatt/plots.py b/gui/wxpython/iscatt/plots.py index e0662ce1684..965f33976f3 100644 --- a/gui/wxpython/iscatt/plots.py +++ b/gui/wxpython/iscatt/plots.py @@ -25,7 +25,7 @@ from iscatt.core_c import MergeArrays, ApplyColormap from iscatt.dialogs import ManageBusyCursorMixin from core.settings import UserSettings -from gui_core.wrap import Menu +from gui_core.wrap import Menu, NewId try: import matplotlib @@ -276,9 +276,7 @@ def Plot(self, cats_order, scatts, ellipses, styles): self.axes.add_artist(ellip) callafter_list.append([self.axes.draw_artist, [ellip]]) - color = map( - lambda v: int(v) / 255.0, - styles[cat_id]['color'].split(":")) + color = [int(v) / 255.0 for v in styles[cat_id]['color'].split(":")[:3]] ellip = Ellipse(xy=e['pos'], width=e['width'], @@ -620,8 +618,8 @@ def ContexMenu(self, event): lambda event: self.plot.ZoomToExtend()]] for item in menu_items: - item_id = wx.ID_ANY - menu.Append(item_id, text=item[1]) + item_id = NewId() + menu.Append(item_id, item[1]) menu.Bind(wx.EVT_MENU, item[2], id=item_id) wx.CallAfter(self.ShowMenu, menu) diff --git a/gui/wxpython/iscatt/toolbars.py b/gui/wxpython/iscatt/toolbars.py index 0827b01e389..ae4a21ba2e4 100644 --- a/gui/wxpython/iscatt/toolbars.py +++ b/gui/wxpython/iscatt/toolbars.py @@ -17,7 +17,6 @@ from icons.icon import MetaIcon from gui_core.toolbars import BaseToolbar, BaseIcons -from core.gcmd import RunCommand from core.gcmd import GException, GError, RunCommand from iscatt.iscatt_core import idBandsToidScatt from iscatt.dialogs import SettingsDialog @@ -73,7 +72,7 @@ def _toolbarData(self): lambda event: self.scatt_mgr.AddScattPlot()), (None,), ("cats_mgr", icons['cats_mgr'], - lambda event: self.parent.ShowCategoryPanel(event.Checked()), + lambda event: self.parent.ShowCategoryPanel(event.IsChecked()), wx.ITEM_CHECK), (None,), ("pan", icons["pan"], @@ -105,7 +104,7 @@ def GetToolId(self, toolName): # TODO can be useful in base def SetPloltsMode(self, event, tool_name): self.scatt_mgr.modeSet.disconnect(self.ModeSet) - if event.Checked() == True: + if event.IsChecked(): for i_tool_data in self._data: i_tool_name = i_tool_data[0] if not i_tool_name or i_tool_name in [ @@ -124,7 +123,7 @@ def SetPloltsMode(self, event, tool_name): def ActivateSelectionPolygonMode(self, event): activated = self.scatt_mgr.ActivateSelectionPolygonMode( - event.Checked()) + event.IsChecked()) self.parent.ShowPlotEditingToolbar(activated) i_tool_id = vars(self)['sel_pol_mode'] @@ -217,7 +216,7 @@ def _toolbarData(self): def SetMode(self, event, tool_name): self.scatt_mgr.modeSet.disconnect(self.ModeSet) - if event.Checked() == True: + if event.IsChecked(): for i_tool_data in self._data: i_tool_name = i_tool_data[0] if not i_tool_name: diff --git a/gui/wxpython/lmgr/frame.py b/gui/wxpython/lmgr/frame.py index 0a40c68c171..0ccff1fbeba 100644 --- a/gui/wxpython/lmgr/frame.py +++ b/gui/wxpython/lmgr/frame.py @@ -149,35 +149,31 @@ def show_menu_errors(messages): 'nviz': LMNvizToolbar(parent=self)} self._toolbarsData = {'workspace': ("toolbarWorkspace", # name _("Workspace Toolbar"), # caption - 1), # row + 1, 0), # row, position 'data': ("toolbarData", _("Data Toolbar"), - 1), + 1, 1), 'misc': ("toolbarMisc", _("Misc Toolbar"), - 2), + 2, 2), 'tools': ("toolbarTools", _("Tools Toolbar"), - 2), + 2, 1), 'vector': ("toolbarVector", _("Vector Toolbar"), - 2), + 2, 0), 'nviz': ("toolbarNviz", _("3D view Toolbar"), - 2), + 2, 3), } - if sys.platform == 'win32': - self._toolbarsList = ('workspace', 'data', - 'vector', 'tools', 'misc', 'nviz') - else: - self._toolbarsList = ('data', 'workspace', - 'nviz', 'misc', 'tools', 'vector') - for toolbar in self._toolbarsList: - name, caption, row = self._toolbarsData[toolbar] + toolbarsList = ('workspace', 'data', + 'vector', 'tools', 'misc', 'nviz') + for toolbar in toolbarsList: + name, caption, row, position = self._toolbarsData[toolbar] self._auimgr.AddPane(self.toolbars[toolbar], wx.aui.AuiPaneInfo(). Name(name).Caption(caption). - ToolbarPane().Top().Row(row). + ToolbarPane().Top().Row(row).Position(position). LeftDockable(False).RightDockable(False). BottomDockable(False).TopDockable(True). CloseButton(False).Layer(2). @@ -250,6 +246,13 @@ def show_menu_errors(messages): show_menu_errors(menu_errors) + # Enable copying to clipboard with cmd+c from console and python shell on macOS + # (default key binding will clear the console), trac #3008 + if sys.platform == "darwin": + self.Bind(wx.EVT_MENU, self.OnCopyToClipboard, id=wx.ID_COPY) + self.accel_tbl = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord("C"), wx.ID_COPY)]) + self.SetAcceleratorTable(self.accel_tbl) + # start with layer manager on top if self.currentPage: self.GetMapDisplay().Raise() @@ -407,7 +410,7 @@ def _createNoteBook(self): self.OnCBPageChanged) self.notebookLayers.Bind( FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, - self.OnCBPageClosed) + self.OnCBPageClosing) return self.notebook @@ -651,11 +654,37 @@ def OnPageChanged(self, event): event.Skip() - def OnCBPageClosed(self, event): - """Page of notebook closed - Also close associated map display + def OnCBPageClosing(self, event): + """Page of notebook is being closed + from Layer Manager (x button next to arrows) + Also close associated map display. """ + # save changes in the workspace + name = self.notebookLayers.GetPageText(event.GetSelection()) + caption = _("Close Map Display {}").format(name) + if not self.CanClosePage(caption): + event.Veto() + return + + maptree = self.notebookLayers.GetPage(event.GetSelection()).maptree + maptree.GetMapDisplay().CleanUp() + maptree.Close(True) + + self.currentPage = None + + event.Skip() + + def _closePageNoEvent(self, page_index): + """Close page and destroy map display without + generating notebook page closing event""" + self.notebookLayers.Unbind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING) + self.notebookLayers.DeletePage(page_index) + self.notebookLayers.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CLOSING, + self.OnCBPageClosing) + def CanClosePage(self, caption): + """Ask if page with map display(s) can be closed + """ # save changes in the workspace maptree = self.GetLayerTree() if self.workspaceChanged and UserSettings.Get( @@ -668,30 +697,28 @@ def OnCBPageClosed(self, event): # ask user to save current settings if maptree.GetCount() > 0: - name = self.notebookLayers.GetPageText(self.currentPageNum) dlg = wx.MessageDialog(self, message=message, - caption=_("Close Map Display %s") % name, + caption=caption, style=wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_QUESTION | wx.CENTRE) ret = dlg.ShowModal() + dlg.Destroy() if ret == wx.ID_YES: if not self.workspaceFile: self.OnWorkspaceSaveAs() else: self.SaveToWorkspaceFile(self.workspaceFile) elif ret == wx.ID_CANCEL: - event.Veto() - dlg.Destroy() - return - dlg.Destroy() - - self.notebookLayers.GetPage(event.GetSelection()).maptree.Map.Clean() - self.notebookLayers.GetPage(event.GetSelection()).maptree.Close(True) - - self.currentPage = None + return False + return True - event.Skip() + def OnCopyToClipboard(self, event): + """Copy selected text in shell to the clipboard""" + try: + wx.Window.FindFocus().Copy() + except: + pass def _switchPageHandler(self, event, notification): self._switchPage(notification=notification) @@ -1525,7 +1552,7 @@ def LoadWorkspaceFile(self, filename): lcmd=layer['cmd'], lgroup=layer['group'], lnviz=layer['nviz'], - lvdigit=layer['vdigit'], + lvdigit=layer['vdigit'], loadWorkspace=True) if 'selected' in layer: @@ -1722,7 +1749,7 @@ def OnWorkspaceClose(self, event=None): 4, "GMFrame.OnWorkspaceClose(): file=%s" % self.workspaceFile) - self.OnDisplayCloseAll() + self.DisplayCloseAll() self.workspaceFile = None self.workspaceChanged = False self._setTitle() @@ -1735,11 +1762,18 @@ def OnDisplayClose(self, event=None): if self.currentPage and self.GetMapDisplay(): self.GetMapDisplay().OnCloseWindow(event) - def OnDisplayCloseAll(self, event=None): + def OnDisplayCloseAll(self, event): + """Close all open map display windows (from menu) + """ + if not self.CanClosePage(caption=_("Close all Map Displays")): + return + self.DisplayCloseAll() + + def DisplayCloseAll(self): """Close all open map display windows """ for display in self.GetMapDisplay(onlyCurrent=False): - display.OnCloseWindow(event) + display.OnCloseWindow(event=None, askIfSaveWorkspace=False) def OnRenderAllMapDisplays(self, event=None): for display in self.GetAllMapDisplays(): @@ -2113,6 +2147,7 @@ def NewDisplay(self, name=None, show=True): self._onMapDisplayStarting3dMode(mapDisplayPage)) mapdisplay.starting3dMode.connect(self.AddNvizTools) mapdisplay.ending3dMode.connect(self.RemoveNvizTools) + mapdisplay.closingDisplay.connect(self._closePageNoEvent) # use default window layout if UserSettings.Get( @@ -2490,7 +2525,11 @@ def OnDeleteLayer(self, event): for layer in self.GetLayerTree().GetSelections(): if self.GetLayerTree().GetLayerInfo(layer, key='type') == 'group': self.GetLayerTree().DeleteChildren(layer) - self.GetLayerTree().Delete(layer) + # nested children group layer in the parent group layer (both selected) + try: + self.GetLayerTree().Delete(layer) + except ValueError: + pass def OnKeyDown(self, event): """Key pressed""" @@ -2545,45 +2584,15 @@ def _closeWindow(self, event): self._auimgr.UnInit() self.Destroy() return + if not self.CanClosePage(caption=_("Quit GRASS GUI")): + # when called from menu, it gets CommandEvent and not + # CloseEvent + if hasattr(event, 'Veto'): + event.Veto() + return - if UserSettings.Get(group='manager', key='askOnQuit', - subkey='enabled') and self.workspaceChanged: - maptree = self.GetLayerTree() - - if self.workspaceFile: - message = _("Do you want to save changes in the workspace?") - else: - message = _("Do you want to store current settings " - "to workspace file?") - - # ask user to save current settings - if maptree.GetCount() > 0: - dlg = wx.MessageDialog(self, - message=message, - caption=_("Quit GRASS GUI"), - style=wx.YES_NO | wx.YES_DEFAULT | - wx.CANCEL | wx.ICON_QUESTION | wx.CENTRE) - ret = dlg.ShowModal() - dlg.Destroy() - if ret == wx.ID_YES: - if not self.workspaceFile: - self.OnWorkspaceSaveAs() - else: - self.SaveToWorkspaceFile(self.workspaceFile) - elif ret == wx.ID_CANCEL: - # when called from menu, it gets CommandEvent and not - # CloseEvent - if hasattr(event, 'Veto'): - event.Veto() - return - - # don't ask any more... - UserSettings.Set(group='manager', key='askOnQuit', subkey='enabled', - value=False) - - self.OnDisplayCloseAll() + self.DisplayCloseAll() - self.notebookLayers.DeleteAllPages() self._auimgr.UnInit() self.Destroy() diff --git a/gui/wxpython/lmgr/layertree.py b/gui/wxpython/lmgr/layertree.py index 138afb690ce..d0f2fe284c1 100644 --- a/gui/wxpython/lmgr/layertree.py +++ b/gui/wxpython/lmgr/layertree.py @@ -37,19 +37,16 @@ from gui_core.forms import GUI from mapdisp.frame import MapFrame from core.render import Map -from wxplot.histogram import HistogramPlotFrame from core.utils import GetLayerNameFromCmd, ltype2command -from wxplot.profile import ProfileFrame from core.debug import Debug from core.settings import UserSettings, GetDisplayVectSettings from vdigit.main import haveVDigit from core.gcmd import GWarning, GError, RunCommand from icons.icon import MetaIcon -from web_services.dialogs import SaveWMSLayerDialog from gui_core.widgets import MapValidator from gui_core.wrap import Menu, GenBitmapButton, TextCtrl, NewId from lmgr.giface import LayerManagerGrassInterfaceForMapDisplay -from core.giface import Notification + TREE_ITEM_HEIGHT = 25 @@ -422,7 +419,9 @@ def OnLayerContextMenuButton(self, event): # select the layer in the same way as right click if not self.IsSelected(layer): self.DoSelectItem(layer, True, False) - self.OnLayerContextMenu(event) + # CallAfter to allow context button events to finish + # before destroying it when layer is deleted (mac specific) + wx.CallAfter(self.OnLayerContextMenu, event) def OnLayerContextMenu(self, event): """Contextual menu for item/layer""" @@ -550,8 +549,8 @@ def OnLayerContextMenu(self, event): wx.EVT_MENU, self.OnSetCompRegFromMap, id=self.popupID['region']) - - # raster align + + # raster align if ltype and ltype == "raster" and len(selected) == 1: item = wx.MenuItem( self.popupMenu, @@ -640,6 +639,14 @@ def OnLayerContextMenu(self, event): self.OnVectorColorTable, id=self.popupID['color']) + self.popupMenu.Append( + self.popupID['colori'], + _("Set color table interactively")) + self.Bind( + wx.EVT_MENU, + self.lmgr.OnVectorRules, + id=self.popupID['colori']) + item = wx.MenuItem( self.popupMenu, id=self.popupID['attr'], @@ -889,6 +896,7 @@ def OnLayerContextMenu(self, event): def OnSaveWs(self, event): """Show dialog for saving web service layer into GRASS vector/raster layer""" mapLayer = self.GetLayerInfo(self.layer_selected, key='maplayer') + from web_services.dialogs import SaveWMSLayerDialog dlg = SaveWMSLayerDialog(parent=self, layer=mapLayer, giface=self._gifaceForDisplay) dlg.CentreOnScreen() @@ -1127,7 +1135,9 @@ def OnHistogram(self, event): "raster map. No map name defined.")) return - win = HistogramPlotFrame(parent=self, rasterList=rasterList) + # lazy import to reduce dependecies and startup + from wxplot.histogram import HistogramPlotFrame + win = HistogramPlotFrame(parent=self, giface=self._giface, rasterList=rasterList) win.CentreOnScreen() win.Show() @@ -1332,7 +1342,7 @@ def AddLayer(self, ltype, lname=None, lchecked=None, lopacity=1.0, selectedLayer = self.GetSelectedLayer() # deselect active item - if lchecked != False and selectedLayer: + if lchecked is not False and selectedLayer: self.SelectItem(selectedLayer, select=False) Debug.msg(3, "LayerTree().AddLayer(): ltype=%s" % (ltype)) @@ -1369,10 +1379,8 @@ def AddLayer(self, ltype, lname=None, lchecked=None, lopacity=1.0, text='', ct_type=1, wnd=ctrl) else: if selectedLayer and selectedLayer != self.GetRootItem(): - if selectedLayer and self.GetLayerInfo(selectedLayer, key='type') == 'group' \ - and self.IsExpanded(selectedLayer): - # add to group (first child of self.layer_selected) if group - # expanded + if selectedLayer and self.GetLayerInfo(selectedLayer, key='type') == 'group': + # add to group (first child of self.layer_selected) layer = self.PrependItem(parent=selectedLayer, text='', ct_type=1, wnd=ctrl) else: @@ -1501,7 +1509,7 @@ def AddLayer(self, ltype, lname=None, lchecked=None, lopacity=1.0, None)) # select new item - if lchecked != False: + if lchecked is not False: self.SelectItem(layer, select=True) # use predefined layer name if given @@ -1654,8 +1662,10 @@ def OnLayerChecked(self, event): digitToolbar and digitToolbar.GetLayer() != mapLayer): - # ignore when map layer is edited - self.Map.ChangeLayerActive(mapLayer, checked) + # layer is maplayer type + if mapLayer: + # ignore when map layer is edited + self.Map.ChangeLayerActive(mapLayer, checked) self.lmgr.WorkspaceChanged() child = self.GetNextSibling(child) else: @@ -2039,15 +2049,15 @@ def GetOptData(self, dcmd, layer, params, propwin): if mapLayer.type == 'raster': if mapWin.IsLoaded(layer): mapWin.UnloadRaster(layer) - + mapWin.LoadRaster(layer) - + elif mapLayer.type == 'raster_3d': if mapWin.IsLoaded(layer): mapWin.UnloadRaster3d(layer) - + mapWin.LoadRaster3d(layer) - + elif mapLayer.type == 'vector': if mapWin.IsLoaded(layer): mapWin.UnloadVector(layer) @@ -2056,7 +2066,7 @@ def GetOptData(self, dcmd, layer, params, propwin): mapWin.LoadVector(layer, points=True) if (vInfo['lines'] + vInfo['boundaries']) > 0: mapWin.LoadVector(layer, points=False) - + # reset view when first layer loaded nlayers = len( mapWin.Map.GetListOfLayers( diff --git a/gui/wxpython/lmgr/pyshell.py b/gui/wxpython/lmgr/pyshell.py index fa363188b3d..3e63fcd5512 100644 --- a/gui/wxpython/lmgr/pyshell.py +++ b/gui/wxpython/lmgr/pyshell.py @@ -80,9 +80,9 @@ def _layout(self): flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=5) btnSizer.AddStretchSpacer() btnSizer.Add(self.btnClear, proportion=0, - flag=wx.EXPAND | wx.ALIGN_RIGHT, border=5) + flag=wx.EXPAND, border=5) sizer.Add(btnSizer, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL | wx.EXPAND, border=5) + flag=wx.ALL | wx.EXPAND, border=5) sizer.Fit(self) sizer.SetSizeHints(self) diff --git a/gui/wxpython/location_wizard/dialogs.py b/gui/wxpython/location_wizard/dialogs.py index dba93533462..e764843f8f8 100644 --- a/gui/wxpython/location_wizard/dialogs.py +++ b/gui/wxpython/location_wizard/dialogs.py @@ -688,13 +688,12 @@ def GetTransform(self): def testRegionDef(): - import sys import wx.lib.inspection - import grass.script as grass + import grass.script as gscript app = wx.App() - dlg = RegionDef(None, location=grass.gisenv()["LOCATION_NAME"]) + dlg = RegionDef(None, location=gscript.gisenv()["LOCATION_NAME"]) dlg.Show() wx.lib.inspection.InspectionTool().Show() app.MainLoop() diff --git a/gui/wxpython/location_wizard/wizard.py b/gui/wxpython/location_wizard/wizard.py index b42638bf48c..5004e2c5775 100644 --- a/gui/wxpython/location_wizard/wizard.py +++ b/gui/wxpython/location_wizard/wizard.py @@ -82,18 +82,19 @@ def __init__(self, parent, title): self.page = WizardPageSimple.__init__(self, parent) # page title - self.title = StaticText(parent=self, id=wx.ID_ANY, label=title) + self.title = StaticText(parent=self, id=wx.ID_ANY, label=title, + style=wx.ALIGN_CENTRE_HORIZONTAL) self.title.SetFont(wx.Font(13, wx.SWISS, wx.NORMAL, wx.BOLD)) # main sizers self.pagesizer = wx.BoxSizer(wx.VERTICAL) self.sizer = wx.GridBagSizer(vgap=0, hgap=0) self.sizer.SetCols(5) - self.sizer.SetRows(6) + self.sizer.SetRows(8) def DoLayout(self): """Do page layout""" self.pagesizer.Add(self.title, proportion=0, - flag=wx.ALIGN_CENTRE | wx.ALL, + flag=wx.EXPAND | wx.ALL, border=5) self.pagesizer.Add(wx.StaticLine(self, -1), proportion=0, flag=wx.EXPAND | wx.ALL, @@ -155,66 +156,51 @@ class DatabasePage(TitledPage): def __init__(self, wizard, parent, grassdatabase): TitledPage.__init__(self, wizard, _( - "Define GRASS Database and Location Name")) + "Define new GRASS Location")) self.grassdatabase = grassdatabase self.location = '' self.locTitle = '' - - # buttons - self.bbrowse = self.MakeButton(_("Browse")) + + self.bbrowse = self.MakeButton(_("Change")) # text controls - self.tgisdbase = self.MakeTextCtrl(grassdatabase, size=(300, -1)) - self.tlocation = self.MakeTextCtrl("newLocation", size=(300, -1)) + self.tgisdbase = self.MakeLabel(grassdatabase) + self.tlocation = self.MakeTextCtrl("newLocation", size=(400, -1)) self.tlocation.SetFocus() self.tlocation.SetValidator( GenericValidator( grass.legal_name, self._nameValidationFailed)) self.tlocTitle = self.MakeTextCtrl(size=(400, -1)) - - # checkbox - self.tlocRegion = self.MakeCheckBox(_("Set default region extent and resolution"), - tooltip=_("This option allows setting default " - "computation region immediately after " - "new location is created. Default " - "computation region can be defined later " - "using g.region based on imported data.")) - - self.tlocUserMapset = self.MakeCheckBox(_("Create user mapset"), - tooltip=_("This option allows creating user " - "mapset immediately after new location " - "is created. Note that GRASS always creates " - "PERMANENT mapset.")) + + # text for required options + required_txt = self.MakeLabel("*") + required_txt.SetForegroundColour(wx.RED) + required_txt.SetToolTip(_("This option is required")) + + # text for optional options + optional_txt = self.MakeLabel(_("(optional)")) + italics = wx.Font(10, wx.DEFAULT, wx.ITALIC, wx.NORMAL) + optional_txt.SetFont(italics) + optional_txt.SetForegroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT)) # layout - self.sizer.Add(self.MakeLabel(_("GIS Data Directory:")), - flag=wx.ALIGN_RIGHT | - wx.ALIGN_CENTER_VERTICAL | - wx.ALL, border=5, - pos=(1, 1)) - self.sizer.Add(self.tgisdbase, - flag=wx.ALIGN_LEFT | - wx.ALIGN_CENTER_VERTICAL | - wx.ALL, border=5, - pos=(1, 2)) - self.sizer.Add(self.bbrowse, - flag=wx.ALIGN_LEFT | - wx.ALIGN_CENTER_VERTICAL | - wx.ALL, border=5, - pos=(1, 3)) - self.sizer.Add( self.MakeLabel( "%s:" % - _("Project Location"), + _("Name"), tooltip=_("Name of location directory in GIS Data Directory")), - flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5, - pos=(2, 1) + pos=(1, 1) ) self.sizer.Add(self.tlocation, + flag=wx.ALIGN_LEFT | + wx.ALIGN_CENTER_VERTICAL | + wx.ALL, border=5, + pos=(2, 1)) + self.sizer.Add(required_txt, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5, @@ -223,11 +209,10 @@ def __init__(self, wizard, parent, grassdatabase): self.sizer.Add( self.MakeLabel( "%s:" % - _("Location Title"), + _("Description"), tooltip=_( - "Optional location title, " - "you can leave this field blank.")), - flag=wx.ALIGN_RIGHT | wx.ALIGN_TOP | wx.ALIGN_CENTER_VERTICAL | wx.ALL, + "Description of location directory in GIS Data Directory")), + flag=wx.ALIGN_LEFT | wx.ALIGN_TOP | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5, pos=(3, 1) ) @@ -235,24 +220,34 @@ def __init__(self, wizard, parent, grassdatabase): flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5, - pos=(3, 2), span=(1, 2)) - self.sizer.Add(self.tlocRegion, + pos=(4, 1)) + self.sizer.Add(optional_txt, + flag=wx.ALIGN_LEFT | + wx.ALIGN_CENTER_VERTICAL | + wx.ALL, border=5, + pos=(4, 2)) + + self.sizer.Add(self.MakeLabel(_("Location will be created in GRASS database:")), + flag=wx.ALIGN_LEFT | + wx.ALIGN_CENTER_VERTICAL | + wx.ALL, border=2, + pos=(5, 1)) + self.sizer.Add(self.tgisdbase, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5, - pos=(4, 2), span=(1, 2)) - self.sizer.Add(self.tlocUserMapset, + pos=(6, 1)) + self.sizer.Add(self.bbrowse, flag=wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=5, - pos=(5, 2), span=(1, 2)) - self.sizer.AddGrowableCol(3) + pos=(6, 2)) # bindings - self.Bind(wx.EVT_BUTTON, self.OnBrowse, self.bbrowse) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging) self.tgisdbase.Bind(wx.EVT_TEXT, self.OnChangeName) self.tlocation.Bind(wx.EVT_TEXT, self.OnChangeName) + self.Bind(wx.EVT_BUTTON, self.OnBrowse, self.bbrowse) def _nameValidationFailed(self, ctrl): message = _( @@ -276,14 +271,14 @@ def OnChangeName(self, event): nextButton.Disable() event.Skip() - + def OnBrowse(self, event): """Choose GRASS data directory""" dlg = wx.DirDialog(self, _("Choose GRASS data directory:"), os.getcwd(), wx.DD_DEFAULT_STYLE) if dlg.ShowModal() == wx.ID_OK: self.grassdatabase = dlg.GetPath() - self.tgisdbase.SetValue(self.grassdatabase) + self.tgisdbase.SetLabel(self.grassdatabase) dlg.Destroy() @@ -291,7 +286,7 @@ def OnPageChanging(self, event=None): error = None if os.path.isdir( os.path.join( - self.tgisdbase.GetValue(), + self.tgisdbase.GetLabel(), self.tlocation.GetValue())): error = _("Location already exists in GRASS Database.") @@ -305,7 +300,7 @@ def OnPageChanging(self, event=None): return self.location = self.tlocation.GetValue() - self.grassdatabase = self.tgisdbase.GetValue() + self.grassdatabase = self.tgisdbase.GetLabel() self.locTitle = self.tlocTitle.GetValue() if os.linesep in self.locTitle or \ len(self.locTitle) > 255: @@ -510,7 +505,6 @@ def __init__(self, wizard, parent): # events self.tproj.Bind(wx.EVT_TEXT, self.OnText) - self.tproj.Bind(wx.EVT_TEXT_ENTER, self.OnText) self.searchb.Bind(wx.EVT_TEXT_ENTER, self.OnSearch) self.projlist.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging) @@ -813,7 +807,7 @@ def __init__(self, wizard, parent): label=_("Ellipsoid only")) # default button setting - if self.radio1.GetValue() == False and self.radioEpsg.GetValue() == False: + if self.radio1.GetValue() is False and self.radioEpsg.GetValue() is False: self.radio1.SetValue(True) self.SetNext(self.parent.datumpage) # self.parent.sumpage.SetPrev(self.parent.datumpage) @@ -860,7 +854,7 @@ def OnPageChange(self, event=None): self.p4projparams = '' for id, param in six.iteritems(self.pparam): if param['type'] == 'bool': - if param['value'] == False: + if param['value'] is False: continue else: self.p4projparams += (' +' + param['proj4']) @@ -1049,7 +1043,6 @@ def __init__(self, wizard, parent): self.datumlist.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnDatumSelected) self.searchb.Bind(wx.EVT_TEXT_ENTER, self.OnDSearch) self.tdatum.Bind(wx.EVT_TEXT, self.OnDText) - self.tdatum.Bind(wx.EVT_TEXT_ENTER, self.OnDText) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGED, self.OnEnterPage) @@ -1236,7 +1229,6 @@ def __init__(self, wizard, parent): # events self.ellipselist.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected) self.tellipse.Bind(wx.EVT_TEXT, self.OnText) - self.tellipse.Bind(wx.EVT_TEXT_ENTER, self.OnText) self.searchb.Bind(wx.EVT_TEXT_ENTER, self.OnSearch) self.radio1.Bind( @@ -1567,7 +1559,6 @@ def __init__(self, wizard, parent): self.bbrowse.Bind(wx.EVT_BUTTON, self.OnBrowse) self.tfile.Bind(wx.EVT_TEXT_ENTER, self.OnBrowseCodes) self.tcode.Bind(wx.EVT_TEXT, self.OnText) - self.tcode.Bind(wx.EVT_TEXT_ENTER, self.OnText) self.epsglist.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected) self.searchb.Bind(wx.EVT_TEXT_ENTER, self.OnSearch) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging) @@ -1795,7 +1786,6 @@ def __init__(self, wizard, parent): self.bbrowse.Bind(wx.EVT_BUTTON, self.OnBrowse) self.tfile.Bind(wx.EVT_TEXT_ENTER, self.OnBrowseCodes) self.tcode.Bind(wx.EVT_TEXT, self.OnText) - self.tcode.Bind(wx.EVT_TEXT_ENTER, self.OnText) self.epsglist.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected) self.searchb.Bind(wx.EVT_TEXT_ENTER, self.OnSearch) self.Bind(wiz.EVT_WIZARD_PAGE_CHANGING, self.OnPageChanging) @@ -2132,7 +2122,7 @@ def _doLayout(self): self.sizer.Add(self.llocation, flag=wx.ALIGN_LEFT | wx.ALL, border=5, pos=(2, 1)) - self.sizer.Add(self.MakeLabel(_("Location Title:")), + self.sizer.Add(self.MakeLabel(_("Description:")), flag=wx.ALIGN_LEFT | wx.ALL, border=5, pos=(3, 0)) self.sizer.Add(self.panelTitle, @@ -2415,8 +2405,6 @@ def __init__(self, parent, grassdatabase): self.location = self.startpage.location self.grassdatabase = self.startpage.grassdatabase self.georeffile = self.filepage.georeffile - self.default_region = self.startpage.tlocRegion.IsChecked() - self.user_mapset = self.startpage.tlocUserMapset.IsChecked() # FIXME here was code for setting default region, what for is this if: # if self.altdb == False: @@ -2573,7 +2561,7 @@ def OnWizFinished(self): current_gdb = decode(grass.gisenv()['GISDBASE']) if current_gdb != database: # change to new GISDbase or create new one - if os.path.isdir(database) != True: + if not os.path.isdir(database): # create new directory try: os.mkdir(database) diff --git a/gui/wxpython/mapdisp/frame.py b/gui/wxpython/mapdisp/frame.py index a757dd050cf..85bceec46f4 100644 --- a/gui/wxpython/mapdisp/frame.py +++ b/gui/wxpython/mapdisp/frame.py @@ -103,6 +103,12 @@ def __init__(self, parent, giface, title=_("GRASS GIS - Map display"), # Emitted when ending (switching from) 3D mode. self.ending3dMode = Signal("MapFrame.ending3dMode") + # Emitted when closing display by closing its window. + self.closingDisplay = Signal("MapFrame.closingDisplay") + + # Emitted when closing display by closing its window. + self.closingVNETDialog = Signal("MapFrame.closingVNETDialog") + # properties are shared in other objects, so defining here self.mapWindowProperties = MapWindowProperties() self.mapWindowProperties.setValuesFromUserSettings() @@ -308,6 +314,7 @@ def _addToolbarVDigit(self): parent=self, toolSwitcher=self._toolSwitcher, MapWindow=self.MapWindow, digitClass=VDigit, giface=self._giface) + self.toolbars['vdigit'].quitDigitizer.connect(self.QuitVDigit) self.MapWindowVDigit.SetToolbar(self.toolbars['vdigit']) self._mgr.AddPane(self.toolbars['vdigit'], @@ -741,7 +748,7 @@ def _DToRastDone(): self._giface.WriteError(_('Failed to run d.to.rast:\n') + messages) grass.try_remove(pngFile) return - + # alignExtent changes only region variable oldRegion = self.GetMap().GetCurrentRegion().copy() self.GetMap().AlignExtentFromDisplay() @@ -774,7 +781,7 @@ def _DToRastDone(): pngFile = grass.tempfile(create=False) + '.png' dOutFileCmd = ['d.out.file', 'output=' + pngFile, 'format=png'] self.DOutFile(dOutFileCmd, callback=_DToRastDone) - + def DToRastOptData(self, dcmd, layer, params, propwin): @@ -826,14 +833,11 @@ def PrintMenu(self, event): self.PopupMenu(printmenu) printmenu.Destroy() - def OnCloseWindow(self, event): - """Window closed. - Also close associated layer tree page - """ - Debug.msg(2, "MapFrame.OnCloseWindow(): function starts") - pgnum = None + def CleanUp(self): + """Clean up before closing map display. + End digitizer/nviz.""" + Debug.msg(2, "MapFrame.CleanUp()") self.Map.Clean() - # close edited map and 3D tools properly if self.GetToolbar('vdigit'): maplayer = self.toolbars['vdigit'].GetLayer() @@ -843,15 +847,28 @@ def OnCloseWindow(self, event): self.RemoveNviz() if hasattr(self, 'rdigit') and self.rdigit: self.rdigit.CleanUp() + if self.dialogs['vnet']: + self.closingVNETDialog.emit() + self._mgr.UnInit() - if not self._layerManager: - self.Destroy() - elif self.page: + def OnCloseWindow(self, event, askIfSaveWorkspace=True): + """Window closed. + Also close associated layer tree page + """ + Debug.msg(2, "MapFrame.OnCloseWindow()") + if self._layerManager: pgnum = self.layerbook.GetPageIndex(self.page) - if pgnum > -1: - self._mgr.UnInit() - self.layerbook.DeletePage(pgnum) - Debug.msg(2, "MapFrame.OnCloseWindow(): function ends") + name = self.layerbook.GetPageText(pgnum) + caption = _("Close Map Display {}").format(name) + if not askIfSaveWorkspace or \ + (askIfSaveWorkspace and self._layerManager.CanClosePage(caption)): + self.CleanUp() + if pgnum > -1: + self.closingDisplay.emit(page_index=pgnum) + # Destroy is called when notebook page is deleted + else: + self.CleanUp() + self.Destroy() def Query(self, x, y): """Query selected layers. @@ -1136,7 +1153,7 @@ def Profile(self, rasters=None): self.profileController = ProfileController( self._giface, mapWindow=self.GetMapWindow()) - win = ProfileFrame(parent=self, rasterList=rasters, + win = ProfileFrame(parent=self, giface=self._giface, rasterList=rasters, units=self.Map.projinfo['units'], controller=self.profileController) win.Show() @@ -1154,7 +1171,8 @@ def OnHistogramPyPlot(self, event): raster.append(layer.maplayer.GetName()) from wxplot.histogram import HistogramPlotFrame - win = HistogramPlotFrame(parent=self, rasterList=raster) + win = HistogramPlotFrame(parent=self, giface=self._giface, + rasterList=raster) win.CentreOnParent() win.Show() @@ -1168,7 +1186,7 @@ def OnScatterplot(self, event): raster.append(layer.maplayer.GetName()) from wxplot.scatter import ScatterFrame - win = ScatterFrame(parent=self, rasterList=raster) + win = ScatterFrame(parent=self, giface=self._giface, rasterList=raster) win.CentreOnParent() win.Show() @@ -1475,6 +1493,7 @@ def OnVNet(self, event): from vnet.dialogs import VNETDialog self.dialogs['vnet'] = VNETDialog(parent=self, giface=self._giface) + self.closingVNETDialog.connect(self.dialogs['vnet'].OnCloseDialog) self.dialogs['vnet'].CenterOnScreen() self.dialogs['vnet'].Show() @@ -1561,3 +1580,11 @@ def QuitRDigit(self): self.RemoveToolbar('rdigit', destroy=True) self.rdigit = None + + def QuitVDigit(self): + """Quit VDigit""" + if not self.IsStandalone(): + # disable the toolbar + self.RemoveToolbar("vdigit", destroy=True) + else: + self.Close() diff --git a/gui/wxpython/mapdisp/statusbar.py b/gui/wxpython/mapdisp/statusbar.py index 65f237fd9e9..078333ad920 100644 --- a/gui/wxpython/mapdisp/statusbar.py +++ b/gui/wxpython/mapdisp/statusbar.py @@ -48,7 +48,7 @@ class SbException(Exception): """Exception class used in SbManager and SbItems""" def __init__(self, message): -# Exception.__init__(self, message) + # Exception.__init__(self, message) self.message = message def __str__(self): diff --git a/gui/wxpython/mapdisp/test_mapdisp.py b/gui/wxpython/mapdisp/test_mapdisp.py index 341233d5dc7..f5d1b7d39ff 100755 --- a/gui/wxpython/mapdisp/test_mapdisp.py +++ b/gui/wxpython/mapdisp/test_mapdisp.py @@ -267,6 +267,7 @@ def testMapWindowProfile(self, giface, map_): from wxplot.profile import ProfileFrame profileWindow = ProfileFrame(parent=self.frame, + giface=giface, controller=self.controller, units=map_.projinfo['units'], rasterList=rasters) diff --git a/gui/wxpython/mapswipe/dialogs.py b/gui/wxpython/mapswipe/dialogs.py index 7b76b75d828..1a59605478d 100644 --- a/gui/wxpython/mapswipe/dialogs.py +++ b/gui/wxpython/mapswipe/dialogs.py @@ -104,7 +104,7 @@ def _layout(self): mainSizer.Add(self.btnSwitch, proportion=0, flag=wx.ALL | wx.ALIGN_LEFT, border=5) mainSizer.Add(self.btnSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.mainSizer = mainSizer self._switchMode(simple=True) self.SetSizer(mainSizer) diff --git a/gui/wxpython/mapswipe/frame.py b/gui/wxpython/mapswipe/frame.py index 02d54213375..11df4de0168 100644 --- a/gui/wxpython/mapswipe/frame.py +++ b/gui/wxpython/mapswipe/frame.py @@ -46,14 +46,7 @@ def __init__(self, parent=None, giface=None, # # Add toolbars # - toolbars = ['swipeMisc', 'swipeMap', 'swipeMain'] - if sys.platform == 'win32': - self.AddToolbar(toolbars.pop(1)) - toolbars.reverse() - else: - self.AddToolbar(toolbars.pop(0)) - for toolb in toolbars: - self.AddToolbar(toolb) + self.AddToolbars() self._giface = giface # # create widgets @@ -275,47 +268,45 @@ def OnAutoRenderChanged(self, value): style ^= wx.SP_LIVE_UPDATE self.splitter.SetWindowStyle(style) - def AddToolbar(self, name): + def AddToolbars(self): """Add defined toolbar to the window Currently known toolbars are: - 'swipeMap' - basic map toolbar - 'swipeMain' - swipe functionality + - 'swipeMisc' - misc (settings, help) """ - if name == "swipeMap": - self.toolbars[name] = SwipeMapToolbar(self, self._toolSwitcher) - self._mgr.AddPane(self.toolbars[name], - wx.aui.AuiPaneInfo(). - Name(name).Caption(_("Map Toolbar")). - ToolbarPane().Top(). - LeftDockable(False).RightDockable(False). - BottomDockable(False).TopDockable(True). - CloseButton(False).Layer(2).Row(1). - BestSize((self.toolbars[name].GetBestSize()))) - - if name == "swipeMain": - self.toolbars[name] = SwipeMainToolbar(self) - - self._mgr.AddPane(self.toolbars[name], - wx.aui.AuiPaneInfo(). - Name(name).Caption(_("Main Toolbar")). - ToolbarPane().Top(). - LeftDockable(False).RightDockable(False). - BottomDockable(False).TopDockable(True). - CloseButton(False).Layer(2).Row(1). - BestSize((self.toolbars[name].GetBestSize()))) - - if name == "swipeMisc": - self.toolbars[name] = SwipeMiscToolbar(self) - - self._mgr.AddPane(self.toolbars[name], - wx.aui.AuiPaneInfo(). - Name(name).Caption(_("Misc Toolbar")). - ToolbarPane().Top(). - LeftDockable(False).RightDockable(False). - BottomDockable(False).TopDockable(True). - CloseButton(False).Layer(2).Row(1). - BestSize((self.toolbars[name].GetBestSize()))) + self.toolbars["swipeMap"] = SwipeMapToolbar(self, self._toolSwitcher) + self._mgr.AddPane(self.toolbars["swipeMap"], + wx.aui.AuiPaneInfo(). + Name("swipeMap").Caption(_("Map Toolbar")). + ToolbarPane().Top(). + LeftDockable(False).RightDockable(False). + BottomDockable(False).TopDockable(True). + CloseButton(False).Layer(2).Row(1).Position(1). + BestSize((self.toolbars["swipeMap"].GetBestSize()))) + + self.toolbars["swipeMain"] = SwipeMainToolbar(self) + + self._mgr.AddPane(self.toolbars["swipeMain"], + wx.aui.AuiPaneInfo(). + Name("swipeMain").Caption(_("Main Toolbar")). + ToolbarPane().Top(). + LeftDockable(False).RightDockable(False). + BottomDockable(False).TopDockable(True). + CloseButton(False).Layer(2).Row(1).Position(0). + BestSize((self.toolbars["swipeMain"].GetBestSize()))) + + self.toolbars["swipeMisc"] = SwipeMiscToolbar(self) + + self._mgr.AddPane(self.toolbars["swipeMisc"], + wx.aui.AuiPaneInfo(). + Name("swipeMisc").Caption(_("Misc Toolbar")). + ToolbarPane().Top(). + LeftDockable(False).RightDockable(False). + BottomDockable(False).TopDockable(True). + CloseButton(False).Layer(2).Row(1).Position(2). + BestSize((self.toolbars["swipeMisc"].GetBestSize()))) def _addPanes(self): """Add splitter window and sliders to aui manager""" @@ -790,7 +781,6 @@ def EnableSash(self, enable): def Init(self): self.OnSashChanged(evt=None) self.SetMinimumPaneSize(0) - self.SetSashSize(self.sashWidthMin) # def OnMotion(self, event): # w = self.GetSashSize() diff --git a/gui/wxpython/mapwin/buffered.py b/gui/wxpython/mapwin/buffered.py index af8c5e17016..c66827a68c4 100644 --- a/gui/wxpython/mapwin/buffered.py +++ b/gui/wxpython/mapwin/buffered.py @@ -51,7 +51,7 @@ try: import grass.lib.gis as gislib haveCtypes = True -except ImportError: +except (ImportError, TypeError): haveCtypes = False @@ -909,8 +909,6 @@ def _updateM(self, render=True, renderVector=True): Debug.msg(1, "BufferedWindow.UpdateMap(): started " "(render=%s, renderVector=%s)" % (render, renderVector)) - self.resize = False - # was if self.Map.cmdfile and ... if self.IsAlwaysRenderEnabled() and self.img is None: render = True @@ -1483,7 +1481,7 @@ def OnDragging(self, event): if (event.LeftIsDown() and not (digitToolbar and digitToolbar.GetAction() in ("moveLine",) and - self.digit.GetDisplay().GetSelected() > 0)): + len(self.digit.GetDisplay().GetSelected()) > 0)): self.MouseDraw(pdc=self.pdcTmp) def OnLeftDown(self, event): @@ -1597,8 +1595,8 @@ def OnLeftUp(self, event): # redraw map self.UpdateMap(render=False) - # TODO: decide which coordinates to send (e, n, mouse['begin'], - # mouse['end']) + # TODO: decide which coordinates to send (e, n, mouse['begin'], + # mouse['end']) self.mouseLeftUp.emit(x=coordinates[0], y=coordinates[1]) def OnButtonDClick(self, event): @@ -1615,7 +1613,7 @@ def OnButtonDClick(self, event): screenCoords[0], screenCoords[1], self.hitradius) - if idlist: + if idlist and idlist[0] != 99: self.dragid = idlist[0] self.overlayActivated.emit(overlayId=self.dragid) diff --git a/gui/wxpython/mapwin/graphics.py b/gui/wxpython/mapwin/graphics.py index 46278fcce1b..1eb7e2ad46e 100644 --- a/gui/wxpython/mapwin/graphics.py +++ b/gui/wxpython/mapwin/graphics.py @@ -414,7 +414,7 @@ def AddProperty(self, propName): :param propName - name of the newly defined property :type propName: str """ - if not propName in self.properties: + if propName not in self.properties: self.properties[propName] = None def SetPropertyVal(self, propName, propVal): diff --git a/gui/wxpython/modules/colorrules.py b/gui/wxpython/modules/colorrules.py index 621670888c6..c3be6499256 100644 --- a/gui/wxpython/modules/colorrules.py +++ b/gui/wxpython/modules/colorrules.py @@ -82,8 +82,8 @@ def __init__(self, parent, mapType, attributeType, # clear button self.clearAll = Button(parent, id=wx.ID_ANY, label=_("Clear all")) # determines how many rules should be added - self.numRules = SpinCtrl(parent, id=wx.ID_ANY, - min=1, max=1e6, initial=1) + self.numRules = SpinCtrl(parent, id=wx.ID_ANY, min=1, max=1e6, + initial=1, size=(150, -1)) # add rules self.btnAdd = Button(parent, id=wx.ID_ADD) @@ -424,7 +424,7 @@ def _createMapSelection(self, parent): # layout inputSizer.Add( self.selectionInput, - flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, + flag=wx.ALL | wx.EXPAND, border=5) return inputSizer @@ -611,6 +611,9 @@ def OnCloseWindow(self, event): self.OnCancel(event) def OnApply(self, event): + return self._apply() + + def _apply(self, updatePreview=True): """Apply selected color table :return: True on success otherwise False @@ -620,7 +623,8 @@ def OnApply(self, event): GMessage(parent=self, message=_("No valid color rules given.")) else: # re-render preview and current map window - self.OnPreview(None) + if updatePreview: + self.OnPreview(None) display = self.layerTree.GetMapDisplay() if display and display.IsAutoRendered(): display.GetWindow().UpdateMap(render=True) @@ -629,7 +633,7 @@ def OnApply(self, event): def OnOK(self, event): """Apply selected color table and close the dialog""" - if self.OnApply(event): + if self._apply(updatePreview=False): self.OnCancel(event) def OnCancel(self, event): @@ -1086,9 +1090,7 @@ def __init__(self, parent, attributeType, **kwargs): # additional bindings for vector color management self.Bind(wx.EVT_COMBOBOX, self.OnLayerSelection, self.layerSelect) - self.sourceColumn.Bind(wx.EVT_TEXT, self.OnSourceColumnSelection) - self.fromColumn.Bind(wx.EVT_TEXT, self.OnFromColSelection) - self.toColumn.Bind(wx.EVT_TEXT, self.OnToColSelection) + self._columnWidgetEvtHandler() self.Bind(wx.EVT_BUTTON, self.OnAddColumn, self.addColumn) self._initLayer() @@ -1175,7 +1177,7 @@ def _createVectorAttrb(self, parent): flag=wx.ALIGN_CENTER_VERTICAL) inputSizer.Add( vSizer, - flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, + flag=wx.ALL | wx.EXPAND, border=5) self.colorColumnSizer = vSizer return inputSizer @@ -1199,7 +1201,7 @@ def _doLayout(self): self.cp = wx.CollapsiblePane( scrollPanel, label=_("Import or export color table"), - winid=wx.ID_ANY, + id=wx.ID_ANY, style=wx.CP_DEFAULT_STYLE | wx.CP_NO_TLW_RESIZE) self.Bind( wx.EVT_COLLAPSIBLEPANE_CHANGED, @@ -1240,7 +1242,7 @@ def _doLayout(self): style=wx.LI_HORIZONTAL), proportion=0, flag=wx.EXPAND | wx.ALL, border=5) mainsizer.Add(btnSizer, proportion=0, - flag=wx.ALL | wx.ALIGN_RIGHT | wx.EXPAND, border=5) + flag=wx.ALL | wx.EXPAND, border=5) self.panel.SetSizer(mainsizer) mainsizer.Layout() @@ -1249,7 +1251,7 @@ def _doLayout(self): def OnPaneChanged(self, event=None): # redo the layout - self.Layout() + self.panel.Layout() # and also change the labels if self.cp.IsExpanded(): self.cp.SetLabel('') @@ -1392,8 +1394,8 @@ def UpdateDialog(self): self.useColumn.SetValue(False) self.OnCheckColumn(event=None) self.useColumn.Enable(self.CheckMapset()) - - self.LoadTable() + else: + self.LoadTable() self.btnPreview.Enable(enable) self.btnOK.Enable(enable) @@ -1443,6 +1445,7 @@ def DeleteTemporaryColumn(self): def OnLayerSelection(self, event): # reset choices in column selection comboboxes if layer changes vlayer = int(self.layerSelect.GetStringSelection()) + self._columnWidgetEvtHandler(bind=False) self.sourceColumn.InsertColumns( vector=self.inmap, layer=vlayer, type=['integer', 'double precision'], @@ -1481,6 +1484,8 @@ def OnLayerSelection(self, event): self.properties['loadColumn'] = '' self.properties['storeColumn'] = '' + self._columnWidgetEvtHandler() + if event: self.LoadTable() self.Update() @@ -1560,7 +1565,7 @@ def LoadRulesFromColumn(self): sep = ';' if self.inmap: - outFile = tempfile.NamedTemporaryFile(mode='w+b') + outFile = tempfile.NamedTemporaryFile(mode='w+') ret = RunCommand('v.db.select', quiet=True, flags='c', @@ -1609,7 +1614,7 @@ def LoadRulesFromColumn(self): colvallist.append(col1) i += 1 - if i > limit and readvals == False: + if i > limit and readvals is False: dlg = wx.MessageDialog(parent=self, message=_( "Number of loaded records reached %d, " "displaying all the records will be time-consuming " @@ -1846,7 +1851,7 @@ def OnCancel(self, event): self.Map.Clean() self.Destroy() - def OnApply(self, event): + def _apply(self, updatePreview=True): """Apply selected color table :return: True on success otherwise False @@ -1861,7 +1866,34 @@ def OnApply(self, event): self.UseAttrColumn(True) - return ColorTable.OnApply(self, event) + return ColorTable._apply(self, updatePreview) + + def _columnWidgetEvtHandler(self, bind=True): + """Bind/Unbind Column widgets handlers""" + widgets = [ + { + 'widget': self.sourceColumn, + 'event': wx.EVT_TEXT, + 'handler': self.OnSourceColumnSelection, + }, + { + 'widget': self.fromColumn, + 'event': wx.EVT_TEXT, + 'handler': self.OnFromColSelection, + }, + { + 'widget': self.toColumn, + 'event': wx.EVT_TEXT, + 'handler': self.OnToColSelection, + }, + ] + for widget in widgets: + if bind is True: + getattr(widget['widget'], 'Bind')( + widget['event'], widget['handler'], + ) + else: + getattr(widget['widget'], 'Unbind')(widget['event']) class ThematicVectorTable(VectorColorTable): @@ -1880,7 +1912,7 @@ def _initLayer(self): self.selectionInput.SetValue(self.inmap) self.selectionInput.Disable() - def OnApply(self, event): + def _apply(self, updatePreview=True): """Apply selected color table :return: True on success otherwise False diff --git a/gui/wxpython/modules/extensions.py b/gui/wxpython/modules/extensions.py index b928b64a94f..26cc7d8dec1 100644 --- a/gui/wxpython/modules/extensions.py +++ b/gui/wxpython/modules/extensions.py @@ -175,7 +175,7 @@ def _layout(self): sizer.Add(optionSizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3) sizer.Add(btnSizer, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL | wx.EXPAND, border=5) + flag=wx.ALL | wx.EXPAND, border=5) self.panel.SetSizer(sizer) sizer.Fit(self.panel) @@ -236,12 +236,12 @@ def OnContextMenu(self, node): data = node.data if data and 'command' in data: self.popupMenu = Menu() - self.popupMenu.Append(self.popupID['install'], text=_("Install")) + self.popupMenu.Append(self.popupID['install'], _("Install")) self.Bind(wx.EVT_MENU, self.OnInstall, id=self.popupID['install']) self.popupMenu.AppendSeparator() self.popupMenu.Append( self.popupID['help'], - text=_("Show manual page")) + _("Show manual page")) self.Bind(wx.EVT_MENU, self.OnItemHelp, id=self.popupID['help']) self.PopupMenu(self.popupMenu) diff --git a/gui/wxpython/modules/import_export.py b/gui/wxpython/modules/import_export.py index 48886f58b2b..c3b1cca710f 100644 --- a/gui/wxpython/modules/import_export.py +++ b/gui/wxpython/modules/import_export.py @@ -21,6 +21,7 @@ """ import os +import sys import wx from core import globalvar @@ -137,6 +138,13 @@ def __init__(self, parent, giface, itype, self.createSettingsPage() + # Enable copying to clipboard with cmd+c from dialog on macOS + # (default key binding will close the dialog), trac #3592 + if sys.platform == "darwin": + self.Bind(wx.EVT_MENU, self.OnCopyToClipboard, id=wx.ID_COPY) + self.accel_tbl = wx.AcceleratorTable([(wx.ACCEL_CTRL, ord("C"), wx.ID_COPY)]) + self.SetAcceleratorTable(self.accel_tbl) + def createSettingsPage(self): self._blackList = { @@ -205,7 +213,7 @@ def doLayout(self): dialogSizer.Add( btnsizer, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.ALIGN_RIGHT, + flag=wx.BOTTOM | wx.ALIGN_RIGHT, border=10) # dialogSizer.SetSizeHints(self.panel) @@ -214,7 +222,7 @@ def doLayout(self): dialogSizer.Fit(self.panel) # auto-layout seems not work here - FIXME - size = wx.Size(globalvar.DIALOG_GSELECT_SIZE[0] + 225, 550) + size = wx.Size(globalvar.DIALOG_GSELECT_SIZE[0] + 322, 550) self.SetMinSize(size) self.SetSize((size.width, size.height + 100)) # width = self.GetSize()[0] @@ -310,6 +318,13 @@ def OnCmdDone(self, event): """Do what has to be done after importing""" pass + def OnCopyToClipboard(self, event): + """Copy selected text in dialog to the clipboard""" + try: + wx.Window.FindFocus().Copy() + except: + pass + def _getLayersToReprojetion(self, projMatch_idx, grassName_idx): """If there are layers with different projection from loation projection, show dialog to user to explicitly select layers which will be reprojected...""" @@ -707,7 +722,7 @@ def _layout(self): dialogSizer.Fit(self.panel) size = wx.Size( - globalvar.DIALOG_GSELECT_SIZE[0] + 225, + globalvar.DIALOG_GSELECT_SIZE[0] + 320, self.GetBestSize()[1] + 35) self.SetMinSize(size) self.SetSize((size.width, size.height)) @@ -765,14 +780,6 @@ def __init__(self, parent, giface): self.doLayout() - def _getCommand(self): - """Get command""" - return 'v.in.dxf' - - def _getBlackListedParameters(self): - - return ['input', 'output', 'layers'] - def OnRun(self, event): """Import/Link data (each layes as separate vector map)""" data = self.list.GetLayers() @@ -939,7 +946,7 @@ def doLayout(self): dialogSizer.Add( btnsizer, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL | wx.BOTTOM | wx.ALIGN_RIGHT, + flag=wx.BOTTOM | wx.ALIGN_RIGHT, border=10) self.panel.SetSizer(dialogSizer) diff --git a/gui/wxpython/modules/mcalc_builder.py b/gui/wxpython/modules/mcalc_builder.py index dd75bc2be7b..ee7821135b6 100644 --- a/gui/wxpython/modules/mcalc_builder.py +++ b/gui/wxpython/modules/mcalc_builder.py @@ -245,7 +245,7 @@ def __init__(self, parent, giface, cmd, id=wx.ID_ANY, # Text area # self.text_mcalc = TextCtrl( - parent=self.panel, id=wx.ID_ANY, size=(-1, 75), + parent=self.panel, id=wx.ID_ANY, size=(-1, 100), style=wx.TE_MULTILINE) wx.CallAfter(self.text_mcalc.SetFocus) @@ -339,9 +339,9 @@ def __init__(self, parent, giface, cmd, id=wx.ID_ANY, self._layout() - self.SetMinSize(self.GetBestSize()) + self.SetMinSize(self.panel.GetBestSize()) # workaround for http://trac.wxwidgets.org/ticket/13628 - self.SetSize(self.GetBestSize()) + self.SetSize(self.panel.GetBestSize()) def _return_funct(self, event): i = event.GetString() @@ -388,15 +388,15 @@ def _layout(self): outputSizer = wx.StaticBoxSizer(self.outputBox, wx.VERTICAL) outputSizer.Add(self.newmaplabel, - flag=wx.ALIGN_CENTER | wx.BOTTOM | wx.TOP, border=5) + flag=wx.ALIGN_CENTER | wx.TOP, border=5) outputSizer.Add(self.newmaptxt, - flag=wx.EXPAND) + flag=wx.EXPAND | wx.ALL, border=5) operandSizer = wx.StaticBoxSizer(self.operandBox, wx.HORIZONTAL) buttonSizer3 = wx.GridBagSizer(7, 1) buttonSizer3.Add(self.functlabel, pos=(0, 0), - span=(1, 2), flag=wx.ALIGN_CENTER) + span=(1, 2), flag=wx.ALIGN_CENTER | wx.EXPAND) buttonSizer3.Add(self.function, pos=(1, 0), span=(1, 2)) buttonSizer3.Add(self.mapsellabel, pos=(2, 0), @@ -437,7 +437,7 @@ def _layout(self): border=5) operandSizer.Add(buttonSizer3, proportion=0, - flag=wx.TOP | wx.BOTTOM | wx.RIGHT, border=5) + flag=wx.ALL, border=5) controlSizer.Add(operatorSizer, proportion=1, flag=wx.RIGHT | wx.EXPAND, border=5) diff --git a/gui/wxpython/nviz/mapwindow.py b/gui/wxpython/nviz/mapwindow.py index b7a2205b910..8d4e9d37004 100644 --- a/gui/wxpython/nviz/mapwindow.py +++ b/gui/wxpython/nviz/mapwindow.py @@ -404,7 +404,8 @@ def OnSize(self, event): else: self.SetCurrent() self._display.ResizeWindow(size.width, - size.height) + size.height, + self.GetContentScaleFactor()) # reposition checkbox in statusbar self.parent.StatusbarReposition() @@ -674,7 +675,7 @@ def OnLeftDown(self, event): size = self.GetClientSize() self._display.LookHere( self.mouse['begin'][0], - size[1] - self.mouse['begin'][1]) + size[1] - self.mouse['begin'][1], self.GetContentScaleFactor()) focus = self._display.GetFocus() for i, coord in enumerate(('x', 'y', 'z')): self.iview['focus'][coord] = focus[i] @@ -743,7 +744,8 @@ def Pixel2Cell(self, xyCoords): size = self.GetClientSize() # UL -> LL x, y = xyCoords - sid, x, y, z = self._display.GetPointOnSurface(x, size[1] - y) + sid, x, y, z = self._display.GetPointOnSurface(x, size[1] - y, + self.GetContentScaleFactor()) if not sid: return None @@ -768,9 +770,10 @@ def DoZoom(self, zoomtype, pos): if hasattr(self.lmgr, "nviz"): self.lmgr.nviz.UpdateSettings() x, y = pos[0], self.GetClientSize()[1] - pos[1] - result = self._display.GetPointOnSurface(x, y) + result = self._display.GetPointOnSurface(x, y, + self.GetContentScaleFactor()) if result[0]: - self._display.LookHere(x, y) + self._display.LookHere(x, y, self.GetContentScaleFactor()) focus = self._display.GetFocus() for i, coord in enumerate(('x', 'y', 'z')): self.iview['focus'][coord] = focus[i] @@ -859,9 +862,11 @@ def FocusPanning(self, event): """Simulation of panning using focus""" size = self.GetClientSize() id1, x1, y1, z1 = self._display.GetPointOnSurface( - self.mouse['tmp'][0], size[1] - self.mouse['tmp'][1]) + self.mouse['tmp'][0], size[1] - self.mouse['tmp'][1], + self.GetContentScaleFactor()) id2, x2, y2, z2 = self._display.GetPointOnSurface( - event.GetX(), size[1] - event.GetY()) + event.GetX(), size[1] - event.GetY(), + self.GetContentScaleFactor()) if id1 and id1 == id2: dx, dy, dz = x2 - x1, y2 - y1, z2 - z1 focus = self.iview['focus'] @@ -883,9 +888,11 @@ def HorizontalPanning(self, event): """ size = self.GetClientSize() id1, x1, y1, z1 = self._display.GetPointOnSurface( - self.mouse['tmp'][0], size[1] - self.mouse['tmp'][1]) + self.mouse['tmp'][0], size[1] - self.mouse['tmp'][1], + self.GetContentScaleFactor()) id2, x2, y2, z2 = self._display.GetPointOnSurface( - event.GetX(), size[1] - event.GetY()) + event.GetX(), size[1] - event.GetY(), + self.GetContentScaleFactor()) if id1 and id1 == id2: dx, dy = x2 - x1, y2 - y1 @@ -1015,7 +1022,7 @@ def GoTo(self, e, n): def QuerySurface(self, x, y): """Query surface on given position""" size = self.GetClientSize() - result = self._display.QueryMap(x, size[1] - y) + result = self._display.QueryMap(x, size[1] - y, self.GetContentScaleFactor()) if result: self.qpoints.append((result['x'], result['y'], result['z'])) self.log.WriteLog("%-30s: %.3f" % (_("Easting"), result['x'])) @@ -1417,7 +1424,7 @@ def SetVectorFromCmd(self, item, data): except ValueError: continue if key == 'color': - if not ':' in value: + if ':' not in value: value = ':'.join(map(str, str2rgb[value])) data['lines']['color']['value'] = value data['points']['color']['value'] = value diff --git a/gui/wxpython/nviz/tools.py b/gui/wxpython/nviz/tools.py index ae3dc524bf7..0d789c0c0e2 100644 --- a/gui/wxpython/nviz/tools.py +++ b/gui/wxpython/nviz/tools.py @@ -53,7 +53,7 @@ from gui_core.widgets import ScrolledPanel, NumTextCtrl, FloatSlider, SymbolButton from gui_core.gselect import Select from gui_core.wrap import Window, SpinCtrl, PseudoDC, ToggleButton, Button, \ - TextCtrl, ToggleButton, StaticText, StaticBox, CheckListBox, ColourSelect + TextCtrl, StaticText, StaticBox, CheckListBox, ColourSelect from core.debug import Debug try: from nviz.mapwindow import wxUpdateProperties, wxUpdateView,\ @@ -441,7 +441,7 @@ def _createViewPage(self): reset.SetToolTip(_("Reset to default view")) reset.Bind(wx.EVT_BUTTON, self.OnResetView) viewSizer.Add(reset, proportion=0, - flag=wx.TOP | wx.BOTTOM | wx.RIGHT | wx.ALIGN_RIGHT, + flag=wx.TOP | wx.BOTTOM | wx.RIGHT, border=5) gridSizer.Add(viewSizer, pos=(4, 0), span=(1, 3), @@ -2482,7 +2482,7 @@ def OnRecord(self, event): "Do you want to record new animation without saving the previous one?") dlg = wx.MessageDialog(parent=self, message=msg, - caption=_("Animation already axists"), + caption=_("Animation already exists"), style=wx.YES_NO | wx.CENTRE) if dlg.ShowModal() == wx.ID_NO: dlg.Destroy() @@ -2753,7 +2753,7 @@ def OnSetConstantProp(self, event): data['constant']['transp'] = self._getPercent( data['constant']['transp'], toPercent=False) - # update properties + # update properties event = wxUpdateProperties(data=data) wx.PostEvent(self.mapWindow, event) if self.mapDisplay.IsAutoRendered(): diff --git a/gui/wxpython/nviz/wxnviz.py b/gui/wxpython/nviz/wxnviz.py index e71c04eac36..42bd8fc245c 100644 --- a/gui/wxpython/nviz/wxnviz.py +++ b/gui/wxpython/nviz/wxnviz.py @@ -41,7 +41,10 @@ import wx -from ctypes import * +try: + from ctypes import * +except KeyError as e: + print("wxnviz.py: {}".format(e), file=sys.stderr) try: WindowsError @@ -54,7 +57,7 @@ from grass.lib.ogsf import * from grass.lib.nviz import * from grass.lib.raster import * -except (ImportError, WindowsError) as e: +except (ImportError, WindowsError, TypeError) as e: print("wxnviz.py: {}".format(e), file=sys.stderr) from core.debug import Debug @@ -150,7 +153,7 @@ def Init(self): GVL_libinit() GVL_init_region() - def ResizeWindow(self, width, height): + def ResizeWindow(self, width, height, scale=1): """GL canvas resized :param width: window width @@ -159,11 +162,11 @@ def ResizeWindow(self, width, height): :return: 1 on success :return: 0 on failure (window resized by default to 20x20 px) """ - self.width = width - self.height = height + self.width = int(width * scale) + self.height = int(height * scale) Debug.msg(3, "Nviz::ResizeWindow(): width=%d height=%d", - width, height) - return Nviz_resize_window(width, height) + self.width, self.height) + return Nviz_resize_window(self.width, self.height) def GetLongDim(self): """Get longest dimension, used for initial size of north arrow""" @@ -219,13 +222,13 @@ def GetViewpointPosition(self): return (x.value, y.value, h.value) - def LookHere(self, x, y): + def LookHere(self, x, y, scale=1): """Look here feature :param x,y: screen coordinates """ - Nviz_look_here(x, y) - Debug.msg(3, "Nviz::LookHere(): x=%f, y=%f", x, y) + Nviz_look_here(int(x * scale), int(y * scale)) + Debug.msg(3, "Nviz::LookHere(): x=%f, y=%f", x * scale, y * scale) def LookAtCenter(self): """Center view at center of displayed surface""" @@ -1922,7 +1925,7 @@ def DeleteScalebar(self, id): """ Nviz_delete_scalebar(self.data, id) - def GetPointOnSurface(self, sx, sy): + def GetPointOnSurface(self, sx, sy, scale=1): """Get point on surface :param sx,sy: canvas coordinates (LL) @@ -1931,20 +1934,20 @@ def GetPointOnSurface(self, sx, sy): x = c_float() y = c_float() z = c_float() - Debug.msg(5, "Nviz::GetPointOnSurface(): sx=%d sy=%d" % (sx, sy)) + Debug.msg(5, "Nviz::GetPointOnSurface(): sx=%d sy=%d" % (sx * scale, sy * scale)) num = GS_get_selected_point_on_surface( - sx, sy, byref(sid), byref(x), byref(y), byref(z)) + int(sx * scale), int(sy * scale), byref(sid), byref(x), byref(y), byref(z)) if num == 0: return (None, None, None, None) return (sid.value, x.value, y.value, z.value) - def QueryMap(self, sx, sy): + def QueryMap(self, sx, sy, scale=1): """Query surface map :param sx,sy: canvas coordinates (LL) """ - sid, x, y, z = self.GetPointOnSurface(sx, sy) + sid, x, y, z = self.GetPointOnSurface(sx, sy, scale) if not sid: return None @@ -1957,8 +1960,8 @@ def QueryMap(self, sx, sy): 'x': x, 'y': y, 'z': z, - 'elevation': catstr.value.replace('(', '').replace(')', ''), - 'color': valstr.value} + 'elevation': DecodeString(catstr.value).replace('(', '').replace(')', ''), + 'color': DecodeString(valstr.value)} def GetDistanceAlongSurface(self, sid, p1, p2, useExag=True): """Get distance measured along surface""" diff --git a/gui/wxpython/photo2image/ip2i_manager.py b/gui/wxpython/photo2image/ip2i_manager.py index 0f54ea973ac..e501e132c83 100644 --- a/gui/wxpython/photo2image/ip2i_manager.py +++ b/gui/wxpython/photo2image/ip2i_manager.py @@ -33,18 +33,12 @@ from copy import copy import wx -from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, ListCtrlAutoWidthMixin +from wx.lib.mixins.listctrl import ColumnSorterMixin, ListCtrlAutoWidthMixin import wx.lib.colourselect as csel -from core import globalvar -if globalvar.wxPythonPhoenix: - from wx.adv import Wizard as wiz -else: - import wx.wizard as wiz - import grass.script as grass -from core import utils +from core import utils, globalvar from core.render import Map from gui_core.gselect import Select, LocationSelect, MapsetSelect from gui_core.dialogs import GroupDialog @@ -53,7 +47,7 @@ from photo2image.ip2i_mapdisplay import MapFrame from core.giface import Notification from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \ - TextCtrl, Menu, ListCtrl, BitmapFromImage + TextCtrl, Menu, ListCtrl, BitmapFromImage, CheckListCtrlMixin from location_wizard.wizard import TitledPage as TitledPage @@ -382,7 +376,7 @@ def __init__(self, parent, giface, grwiz=None, id=wx.ID_ANY, GMessage (_("A POINTS file exists, renaming it to POINTS_BAK")) #"""Make a POINTS file """ - import re,sys + import re try: fc = open(self.file['camera'], mode='r') fc_count=0 @@ -717,7 +711,7 @@ def SetGCPSatus(self, item, itemIndex): # changed itemIndex += 1 - if not self.list.IsChecked(key - 1): + if not self.list.IsItemChecked(key - 1): wxPen = "unused" if not self.show_unused: item.SetPropertyVal('hide', True) @@ -726,7 +720,7 @@ def SetGCPSatus(self, item, itemIndex): else: item.SetPropertyVal('hide', False) - if self.highest_only == True: + if self.highest_only: if itemIndex == self.highest_key: wxPen = "highest" else: @@ -817,7 +811,7 @@ def SaveGCPs(self, event): "#----------------------- ----------------------- ---------------\n") for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index) == True: + if self.list.IsItemChecked(index): check = "1" self.GCPcount += 1 else: @@ -1008,7 +1002,7 @@ def OnGeorect(self, event): global maptype self.SaveGCPs(None) - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): return if maptype == 'raster': @@ -1086,11 +1080,11 @@ def UpdateColours(self, srcrender=False, highest_idx = 0 for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): key = self.list.GetItemData(index) fwd_err = self.mapcoordlist[key][5] - if self.highest_only == True: + if self.highest_only: self.list.SetItemTextColour(index, wx.BLACK) if highest_fwd_err < fwd_err: highest_fwd_err = fwd_err @@ -1177,7 +1171,7 @@ def RMSError(self, xygroup, order): self.SaveGCPs(None) # self.SetStatusText('') - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): return # get list of forward and reverse rms error values for each point @@ -1215,7 +1209,7 @@ def RMSError(self, xygroup, order): for index in range(self.list.GetItemCount()): key = self.list.GetItemData(index) - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): fwd_err, bkw_err = errlist[GCPcount].split() self.list.SetItem(index, 5, fwd_err) self.list.SetItem(index, 6, bkw_err) @@ -1253,7 +1247,7 @@ def RMSError(self, xygroup, order): self.list.SetItemTextColour(highest_idx, wx.RED) elif GCPcount > 0 and self.rmsthresh > 0 and not self.highest_only: for index in range(self.list.GetItemCount()): - if self.list.IsChecked(index): + if self.list.IsItemChecked(index): key = self.list.GetItemData(index) if (self.mapcoordlist[key][5] > self.rmsthresh): self.list.SetItemTextColour(index, wx.RED) @@ -1287,7 +1281,7 @@ def GetNewExtent(self, region, map=None): order = self.gr_order self.gr_order = 1 - if self.CheckGCPcount(msg=True) == False: + if not self.CheckGCPcount(msg=True): self.gr_order = order return @@ -1560,7 +1554,7 @@ def _Create(self): _('Forward error'), _('Backward error')): info.SetText(lbl) - self.InsertColumnInfo(idx_col, info) + self.InsertColumn(idx_col, info) idx_col += 1 def LoadData(self): @@ -1943,7 +1937,7 @@ def __CreateSymbologyPage(self, notebook): self.rmsWin = TextCtrl(parent=panel, id=wx.ID_ANY, size=(70, -1), style=wx.TE_NOHIDESEL) self.rmsWin.SetValue("%s" % str(sdfactor)) - if (self.parent.highest_only == True): + if (self.parent.highest_only): self.rmsWin.Disable() self.symbol['sdfactor'] = self.rmsWin.GetId() @@ -2384,7 +2378,7 @@ def UpdateSettings(self): tgtrender = True if tgt_map['raster'] == '': - if self.parent.show_target == True: + if self.parent.show_target: self.parent.show_target = False self.parent._mgr.GetPane("target").Hide() self.parent._mgr.Update() @@ -2392,7 +2386,7 @@ def UpdateSettings(self): self.parent.activemap.Enable(False) self.parent.GetMapToolbar().Enable('zoommenu', enable=False) else: - if self.parent.show_target == False: + if not self.parent.show_target: self.parent.show_target = True self.parent._mgr.GetPane("target").Show() self.parent._mgr.Update() diff --git a/gui/wxpython/photo2image/ip2i_mapdisplay.py b/gui/wxpython/photo2image/ip2i_mapdisplay.py index d8726190dd3..bc14889dfb9 100644 --- a/gui/wxpython/photo2image/ip2i_mapdisplay.py +++ b/gui/wxpython/photo2image/ip2i_mapdisplay.py @@ -277,7 +277,7 @@ def AddToolbar(self, name): BottomDockable(False).TopDockable(True). CloseButton(False).Layer(2)) - if self.show_target == False: + if self.show_target is False: self.toolbars['gcpdisp'].Enable('zoommenu', enable=False) self.toolbars['gcpman'] = GCPManToolbar(self) diff --git a/gui/wxpython/psmap/dialogs.py b/gui/wxpython/psmap/dialogs.py index 8eff03d0113..453748638d4 100644 --- a/gui/wxpython/psmap/dialogs.py +++ b/gui/wxpython/psmap/dialogs.py @@ -35,33 +35,18 @@ """ import os -import sys import string +import sys from copy import deepcopy import wx -import wx.lib.scrolledpanel as scrolled -import wx.lib.filebrowsebutton as filebrowse -from wx.lib.mixins.listctrl import CheckListCtrlMixin, ListCtrlAutoWidthMixin -from wx.lib.expando import ExpandoTextCtrl, EVT_ETC_LAYOUT_NEEDED -try: - import wx.lib.agw.floatspin as fs -except ImportError: - fs = None +import wx.lib.agw.floatspin as fs +from wx.lib.mixins.listctrl import ListCtrlAutoWidthMixin from core import globalvar if globalvar.wxPythonPhoenix: - import wx.adv - from wx.adv import OwnerDrawnComboBox, ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED - from wx.adv import BitmapComboBox -else: - import wx.combo - from wx.combo import OwnerDrawnComboBox, ODCB_PAINTING_CONTROL, ODCB_PAINTING_SELECTED - from wx.combo import BitmapComboBox - -if globalvar.wxPythonPhoenix: - from wx import Validator as Validator + from wx import Validator else: from wx import PyValidator as Validator @@ -72,9 +57,14 @@ from gui_core.gselect import Select from core.gcmd import RunCommand, GError, GMessage from gui_core.dialogs import SymbolDialog -from gui_core.wrap import SpinCtrl, Button, TextCtrl, BitmapButton, \ - StaticText, StaticBox, Rect, EmptyBitmap, TextEntryDialog, ListCtrl, NewId, \ - BitmapFromImage +from gui_core.wrap import ( + BitmapButton, BitmapComboBox, BitmapFromImage, Button, + CheckBox, Choice, ClientDC, ColourPickerCtrl, Dialog, DirBrowseButton, + EmptyBitmap, ExpandoTextCtrl, FileBrowseButton, FloatSpin, ListBox, + ListCtrl, Notebook, OwnerDrawnComboBox, Panel, RadioButton, + Rect, ScrolledPanel, SpinCtrl, StaticBox, StaticText, TextCtrl, + TextEntryDialog, EmptyImage, CheckListCtrlMixin +) from psmap.utils import * from psmap.instructions import * @@ -179,8 +169,8 @@ def OnDrawBackground(self, dc, rect, item, flags): background area of each item.""" # If the item is selected, or its item # iseven, or we are painting the # combo control itself, then use the default rendering. - if (item & 1 == 0 or flags & (ODCB_PAINTING_CONTROL | - ODCB_PAINTING_SELECTED)): + if (item & 1 == 0 or flags & (OwnerDrawnComboBox.ODCB_PAINTING_CONTROL | + OwnerDrawnComboBox.ODCB_PAINTING_SELECTED)): OwnerDrawnComboBox.OnDrawBackground( self, dc, rect, item, flags) return @@ -189,7 +179,10 @@ def OnDrawBackground(self, dc, rect, item, flags): bgCol = wx.Colour(240, 240, 250) dc.SetBrush(wx.Brush(bgCol)) dc.SetPen(wx.Pen(bgCol)) - dc.DrawRectangleRect(rect) + if globalvar.wxPythonPhoenix: + dc.DrawRectangle(rect) + else: + dc.DrawRectangleRect(rect) def OnMeasureItem(self, item): """Overridden from OwnerDrawnComboBox, should return the height @@ -213,10 +206,10 @@ def __init__(self, parent): ListCtrlAutoWidthMixin.__init__(self) -class PsmapDialog(wx.Dialog): +class PsmapDialog(Dialog): def __init__(self, parent, id, title, settings, apply=True): - wx.Dialog.__init__(self, parent=parent, id=wx.ID_ANY, + Dialog.__init__(self, parent=parent, id=wx.ID_ANY, title=title, size=wx.DefaultSize, style=wx.CAPTION | wx.MINIMIZE_BOX | wx.CLOSE_BOX) self.apply = apply @@ -234,7 +227,7 @@ def AddUnits(self, parent, dialogDict): parent.units['unitsLabel'] = StaticText( parent, id=wx.ID_ANY, label=_("Units:")) choices = self.unitConv.getPageUnitsNames() - parent.units['unitsCtrl'] = wx.Choice( + parent.units['unitsCtrl'] = Choice( parent, id=wx.ID_ANY, choices=choices) parent.units['unitsCtrl'].SetStringSelection( self.unitConv.findName(dialogDict['unit'])) @@ -273,9 +266,9 @@ def AddExtendedPosition(self, panel, gridBagSizer, dialogDict): panel.position = dict() positionLabel = StaticText( panel, id=wx.ID_ANY, label=_("Position is given:")) - panel.position['toPaper'] = wx.RadioButton( + panel.position['toPaper'] = RadioButton( panel, id=wx.ID_ANY, label=_("relative to paper"), style=wx.RB_GROUP) - panel.position['toMap'] = wx.RadioButton( + panel.position['toMap'] = RadioButton( panel, id=wx.ID_ANY, label=_("by map coordinates")) panel.position['toPaper'].SetValue(dialogDict['XY']) panel.position['toMap'].SetValue(not dialogDict['XY']) @@ -391,7 +384,7 @@ def AddFont(self, parent, dialogDict, color=True): ## # if color: ## parent.font['colorLabel'] = wx.StaticText(parent, id = wx.ID_ANY, label = _("Choose color:")) -## parent.font['colorCtrl'] = wx.ColourPickerCtrl(parent, id = wx.ID_ANY, style=wx.FNTP_FONTDESC_AS_LABEL) +## parent.font['colorCtrl'] = ColourPickerCtrl(parent, id = wx.ID_ANY, style=wx.FNTP_FONTDESC_AS_LABEL) # parent.font['colorCtrl'].SetColour(dialogDict['color']) # parent.font['colorCtrl'].SetColour(convertRGB(dialogDict['color'])) @@ -413,7 +406,7 @@ def AddFont(self, parent, dialogDict, color=True): 'Courier-Oblique', 'Courier-Bold', 'Courier-BoldOblique'] - parent.font['fontCtrl'] = wx.Choice( + parent.font['fontCtrl'] = Choice( parent, id=wx.ID_ANY, choices=fontChoices) if dialogDict['font'] in fontChoices: parent.font['fontCtrl'].SetStringSelection(dialogDict['font']) @@ -426,15 +419,15 @@ def AddFont(self, parent, dialogDict, color=True): if color: parent.font['colorLabel'] = StaticText( parent, id=wx.ID_ANY, label=_("Choose color:")) - parent.font['colorCtrl'] = wx.ColourPickerCtrl( + parent.font['colorCtrl'] = ColourPickerCtrl( parent, id=wx.ID_ANY) parent.font['colorCtrl'].SetColour(convertRGB(dialogDict['color'])) ## parent.font['colorLabel'] = wx.StaticText(parent, id = wx.ID_ANY, label = _("Color:")) # colorChoices = [ 'aqua', 'black', 'blue', 'brown', 'cyan', 'gray', 'green', 'indigo', 'magenta',\ # 'orange', 'purple', 'red', 'violet', 'white', 'yellow'] -## parent.colorCtrl = wx.Choice(parent, id = wx.ID_ANY, choices = colorChoices) +## parent.colorCtrl = Choice(parent, id = wx.ID_ANY, choices = colorChoices) # parent.colorCtrl.SetStringSelection(parent.rLegendDict['color']) -## parent.font['colorCtrl'] = wx.ColourPickerCtrl(parent, id = wx.ID_ANY) +## parent.font['colorCtrl'] = ColourPickerCtrl(parent, id = wx.ID_ANY) # parent.font['colorCtrl'].SetColour(dialogDict['color']) def OnApply(self, event): @@ -497,7 +490,7 @@ def _layout(self, panel): flag=wx.EXPAND | wx.ALL, border=5) mainSizer.Add(btnSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) mainSizer.Layout() @@ -628,7 +621,7 @@ def _layout(self): hBox = wx.BoxSizer(wx.HORIZONTAL) stText = StaticText( self, id=wx.ID_ANY, label=self.catsLabels[item] + ':') - choice = wx.Choice( + choice = Choice( self, id=wx.ID_ANY, choices=choices[i], @@ -686,7 +679,7 @@ def _layout(self): mainSizer.Add( btnSizer, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.ALL, + flag=wx.ALIGN_RIGHT | wx.ALL, border=10) self.SetSizer(mainSizer) mainSizer.Fit(self) @@ -748,7 +741,7 @@ def __init__(self, parent, id, settings, rect=None, notebook=False): # notebook if self.isNotebook: - self.notebook = wx.Notebook( + self.notebook = Notebook( parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) self.mPanel = MapFramePanel( parent=self.notebook, @@ -823,11 +816,11 @@ def updateDialog(self): self.mPanel.drawMap.SetValue(found) -class MapFramePanel(wx.Panel): - """wx.Panel with map (scale, region, border) settings""" +class MapFramePanel(Panel): + """Panel with map (scale, region, border) settings""" def __init__(self, parent, id, settings, rect, notebook=True): - wx.Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) + Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.id = id self.instruction = settings @@ -899,7 +892,7 @@ def _layout(self): _("fit frame to match saved region"), _("fit frame to match current computational region"), _("fixed scale and map center")] - self.scaleChoice = wx.Choice(self, id=wx.ID_ANY, choices=scaleChoices) + self.scaleChoice = Choice(self, id=wx.ID_ANY, choices=scaleChoices) gridBagSizer.Add( frameText, pos=(0, 0), @@ -919,17 +912,17 @@ def _layout(self): sizerM = wx.StaticBoxSizer(self.staticBox, wx.HORIZONTAL) self.mapSizer = wx.GridBagSizer(hgap=5, vgap=5) - self.rasterTypeRadio = wx.RadioButton( + self.rasterTypeRadio = RadioButton( self, id=wx.ID_ANY, label=" %s " % _("raster"), style=wx.RB_GROUP) - self.vectorTypeRadio = wx.RadioButton( + self.vectorTypeRadio = RadioButton( self, id=wx.ID_ANY, label=" %s " % _("vector")) - self.drawMap = wx.CheckBox( + self.drawMap = CheckBox( self, id=wx.ID_ANY, label="add selected map") self.mapOrRegionText = [_("Map:"), _("Region:")] - dc = wx.ClientDC(self) # determine size of labels + dc = ClientDC(self) # determine size of labels width = max( dc.GetTextExtent( self.mapOrRegionText[0])[0], dc.GetTextExtent( @@ -1104,7 +1097,7 @@ def _layout(self): sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5) - self.borderCheck = wx.CheckBox( + self.borderCheck = CheckBox( self, id=wx.ID_ANY, label=( _("draw border around map frame"))) if self.mapFrameDict['border'] == 'y': @@ -1116,7 +1109,7 @@ def _layout(self): self, id=wx.ID_ANY, label=_("border color:")) self.borderWidthText = StaticText( self, id=wx.ID_ANY, label=_("border width (pts):")) - self.borderColourPicker = wx.ColourPickerCtrl(self, id=wx.ID_ANY) + self.borderColourPicker = ColourPickerCtrl(self, id=wx.ID_ANY) self.borderWidthCtrl = SpinCtrl( self, id=wx.ID_ANY, min=1, max=100, initial=1) @@ -1532,11 +1525,11 @@ def update(self): return True -class RasterPanel(wx.Panel): +class RasterPanel(Panel): """Panel for raster map settings""" def __init__(self, parent, id, settings, notebook=True): - wx.Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) + Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.instruction = settings if notebook: @@ -1570,10 +1563,10 @@ def _layout(self): sizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5) - self.rasterNoRadio = wx.RadioButton( + self.rasterNoRadio = RadioButton( self, id=wx.ID_ANY, label=_("no raster map"), style=wx.RB_GROUP) - self.rasterYesRadio = wx.RadioButton( + self.rasterYesRadio = RadioButton( self, id=wx.ID_ANY, label=_("raster:")) self.rasterSelect = Select( @@ -1668,11 +1661,11 @@ def getId(self): return self.id -class VectorPanel(wx.Panel): +class VectorPanel(Panel): """Panel for vector maps settings""" def __init__(self, parent, id, settings, notebook=True): - wx.Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) + Panel.__init__(self, parent, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) self.parent = parent self.instruction = settings @@ -1766,7 +1759,7 @@ def _layout(self): text = StaticText(self, id=wx.ID_ANY, label=_( "The topmost vector map overlaps the others")) - self.listbox = wx.ListBox( + self.listbox = ListBox( self, id=wx.ID_ANY, choices=[], style=wx.LB_SINGLE | wx.LB_NEEDED_SB) self.btnUp = Button(self, id=wx.ID_ANY, label=_("Up")) @@ -2137,7 +2130,7 @@ def __init__(self, parent, id, settings, vectors, tmpSettings): self.patternPath = os.path.join(gisbase, 'etc', 'paint', 'patterns') # notebook - notebook = wx.Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) + notebook = Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) self.DSpanel = self._DataSelectionPanel(notebook) self.EnableLayerSelection(enable=self.connection) selectPanel = { @@ -2163,7 +2156,7 @@ def __init__(self, parent, id, settings, vectors, tmpSettings): self._layout(notebook) def _DataSelectionPanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Data selection")) @@ -2188,9 +2181,9 @@ def _DataSelectionPanel(self, notebook): name = ("point", "centroid") else: name = ("line", "boundary") - self.checkType1 = wx.CheckBox( + self.checkType1 = CheckBox( panel, id=wx.ID_ANY, label=label[0], name=name[0]) - self.checkType2 = wx.CheckBox( + self.checkType2 = CheckBox( panel, id=wx.ID_ANY, label=label[1], name=name[1]) self.checkType1.SetValue( self.vPropertiesDict['type'].find( @@ -2230,7 +2223,7 @@ def _DataSelectionPanel(self, notebook): self.warning = StaticText(panel, id=wx.ID_ANY, label=_( "Database connection is not defined in DB file.")) text = StaticText(panel, id=wx.ID_ANY, label=_("Select layer:")) - self.layerChoice = wx.Choice( + self.layerChoice = Choice( panel, id=wx.ID_ANY, choices=[str(each) for each in self.layers], size=self.spinCtrlSize) @@ -2241,7 +2234,7 @@ def _DataSelectionPanel(self, notebook): else: table = "" - self.radioWhere = wx.RadioButton( + self.radioWhere = RadioButton( panel, id=wx.ID_ANY, label="SELECT * FROM %s WHERE" % table, style=wx.RB_GROUP) self.textCtrlWhere = TextCtrl(panel, id=wx.ID_ANY, value="") @@ -2252,9 +2245,9 @@ def _DataSelectionPanel(self, notebook): else: cols = [] - self.choiceColumns = wx.Choice(panel, id=wx.ID_ANY, choices=cols) + self.choiceColumns = Choice(panel, id=wx.ID_ANY, choices=cols) - self.radioCats = wx.RadioButton( + self.radioCats = RadioButton( panel, id=wx.ID_ANY, label="Choose categories ") self.textCtrlCats = TextCtrl(panel, id=wx.ID_ANY, value="") self.textCtrlCats.SetToolTip( @@ -2314,7 +2307,7 @@ def _DataSelectionPanel(self, notebook): _("Mask")) sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) - self.mask = wx.CheckBox( + self.mask = CheckBox( panel, id=wx.ID_ANY, label=_("Use current mask")) if self.vPropertiesDict['masked'] == 'y': self.mask.SetValue(True) @@ -2331,7 +2324,7 @@ def _DataSelectionPanel(self, notebook): return panel def _ColorsPointAreaPanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Colors")) @@ -2347,26 +2340,22 @@ def _ColorsPointAreaPanel(self, notebook): sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) self.gridBagSizerO = wx.GridBagSizer(hgap=5, vgap=2) - self.outlineCheck = wx.CheckBox( + self.outlineCheck = CheckBox( panel, id=wx.ID_ANY, label=_("draw outline")) self.outlineCheck.SetValue(self.vPropertiesDict['color'] != 'none') widthText = StaticText(panel, id=wx.ID_ANY, label=_("Width (pts):")) - if fs: - self.widthSpin = fs.FloatSpin( - panel, - id=wx.ID_ANY, - min_val=0, - max_val=30, - increment=0.5, - value=1, - style=fs.FS_RIGHT) - self.widthSpin.SetFormat("%f") - self.widthSpin.SetDigits(2) - else: - self.widthSpin = SpinCtrl( - panel, id=wx.ID_ANY, min=1, max=25, initial=1, - size=self.spinCtrlSize) + + self.widthSpin = FloatSpin( + panel, + id=wx.ID_ANY, + min_val=0, + max_val=30, + increment=0.5, + value=1, + style=fs.FS_RIGHT) + self.widthSpin.SetFormat("%f") + self.widthSpin.SetDigits(2) if self.vPropertiesDict['color'] is None: self.vPropertiesDict['color'] = 'none' @@ -2377,7 +2366,7 @@ def _ColorsPointAreaPanel(self, notebook): self.widthSpin.SetValue(1) colorText = StaticText(panel, id=wx.ID_ANY, label=_("Color:")) - self.colorPicker = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) + self.colorPicker = ColourPickerCtrl(panel, id=wx.ID_ANY) if self.vPropertiesDict['color'] != 'none': self.colorPicker.SetColour( convertRGB(self.vPropertiesDict['color'])) @@ -2419,13 +2408,13 @@ def _ColorsPointAreaPanel(self, notebook): sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) self.gridBagSizerF = wx.GridBagSizer(hgap=5, vgap=2) - self.fillCheck = wx.CheckBox( + self.fillCheck = CheckBox( panel, id=wx.ID_ANY, label=_("fill color")) self.fillCheck.SetValue( self.vPropertiesDict['fcolor'] != 'none' or self.vPropertiesDict['rgbcolumn'] is not None) - self.colorPickerRadio = wx.RadioButton( + self.colorPickerRadio = RadioButton( panel, id=wx.ID_ANY, label=_("choose color:"), style=wx.RB_GROUP) # set choose color option if there is no db connection if self.connection: @@ -2433,14 +2422,14 @@ def _ColorsPointAreaPanel(self, notebook): not self.vPropertiesDict['rgbcolumn']) else: self.colorPickerRadio.SetValue(False) - self.fillColorPicker = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) + self.fillColorPicker = ColourPickerCtrl(panel, id=wx.ID_ANY) if self.vPropertiesDict['fcolor'] != 'none': self.fillColorPicker.SetColour( convertRGB(self.vPropertiesDict['fcolor'])) else: self.fillColorPicker.SetColour(convertRGB('red')) - self.colorColRadio = wx.RadioButton( + self.colorColRadio = RadioButton( panel, id=wx.ID_ANY, label=_("color from map table column:")) self.colorColChoice = self.getColsChoice(parent=panel) if self.connection: @@ -2487,7 +2476,7 @@ def _ColorsPointAreaPanel(self, notebook): return panel def _ColorsLinePanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Colors")) @@ -2508,29 +2497,24 @@ def _ColorsLinePanel(self, notebook): if self.vPropertiesDict['color'] is None: self.vPropertiesDict['color'] = 'none' - self.outlineCheck = wx.CheckBox( + self.outlineCheck = CheckBox( panel, id=wx.ID_ANY, label=_("draw outline")) self.outlineCheck.SetValue(self.vPropertiesDict['hcolor'] != 'none') - self.outlineCheck.SetToolTipString( + self.outlineCheck.SetToolTip( _("No effect for fill color from table column")) widthText = StaticText(panel, id=wx.ID_ANY, label=_("Width (pts):")) - if fs: - self.outWidthSpin = fs.FloatSpin( - panel, - id=wx.ID_ANY, - min_val=0, - max_val=30, - increment=0.5, - value=1, - style=fs.FS_RIGHT) - self.outWidthSpin.SetFormat("%f") - self.outWidthSpin.SetDigits(1) - else: - self.outWidthSpin = SpinCtrl( - panel, id=wx.ID_ANY, min=1, max=30, initial=1, - size=self.spinCtrlSize) + self.outWidthSpin = FloatSpin( + panel, + id=wx.ID_ANY, + min_val=0, + max_val=30, + increment=0.5, + value=1, + style=fs.FS_RIGHT) + self.outWidthSpin.SetFormat("%f") + self.outWidthSpin.SetDigits(1) if self.vPropertiesDict['hcolor'] != 'none': self.outWidthSpin.SetValue(self.vPropertiesDict['hwidth']) @@ -2538,7 +2522,7 @@ def _ColorsLinePanel(self, notebook): self.outWidthSpin.SetValue(1) colorText = StaticText(panel, id=wx.ID_ANY, label=_("Color:")) - self.colorPicker = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) + self.colorPicker = ColourPickerCtrl(panel, id=wx.ID_ANY) if self.vPropertiesDict['hcolor'] != 'none': self.colorPicker.SetColour( convertRGB(self.vPropertiesDict['hcolor'])) @@ -2583,7 +2567,7 @@ def _ColorsLinePanel(self, notebook): fillText = StaticText( panel, id=wx.ID_ANY, label=_("Color of lines:")) - self.colorPickerRadio = wx.RadioButton( + self.colorPickerRadio = RadioButton( panel, id=wx.ID_ANY, label=_("choose color:"), style=wx.RB_GROUP) # set choose color option if there is no db connection @@ -2592,14 +2576,14 @@ def _ColorsLinePanel(self, notebook): not self.vPropertiesDict['rgbcolumn']) else: self.colorPickerRadio.SetValue(False) - self.fillColorPicker = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) + self.fillColorPicker = ColourPickerCtrl(panel, id=wx.ID_ANY) if self.vPropertiesDict['color'] != 'none': self.fillColorPicker.SetColour( convertRGB(self.vPropertiesDict['color'])) else: self.fillColorPicker.SetColour(convertRGB('black')) - self.colorColRadio = wx.RadioButton( + self.colorColRadio = RadioButton( panel, id=wx.ID_ANY, label=_("color from map table column:")) self.colorColChoice = self.getColsChoice(parent=panel) if self.connection: @@ -2645,7 +2629,7 @@ def _ColorsLinePanel(self, notebook): return panel def _StylePointPanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Size and style")) @@ -2661,7 +2645,7 @@ def _StylePointPanel(self, notebook): sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5) - self.symbolRadio = wx.RadioButton( + self.symbolRadio = RadioButton( panel, id=wx.ID_ANY, label=_("symbol:"), style=wx.RB_GROUP) self.symbolRadio.SetValue(bool(self.vPropertiesDict['symbol'])) @@ -2675,11 +2659,11 @@ def _StylePointPanel(self, notebook): '.png') self.symbolButton = BitmapButton(panel, id=wx.ID_ANY, bitmap=bitmap) - self.epsRadio = wx.RadioButton( + self.epsRadio = RadioButton( panel, id=wx.ID_ANY, label=_("eps file:")) self.epsRadio.SetValue(bool(self.vPropertiesDict['eps'])) - self.epsFileCtrl = filebrowse.FileBrowseButton( + self.epsFileCtrl = FileBrowseButton( panel, id=wx.ID_ANY, labelText='', buttonText=_("Browse"), toolTip=_("Type filename or click browse to choose file"), dialogTitle=_("Choose a file"), @@ -2735,12 +2719,12 @@ def _StylePointPanel(self, notebook): sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5) - self.sizeRadio = wx.RadioButton( + self.sizeRadio = RadioButton( panel, id=wx.ID_ANY, label=_("size:"), style=wx.RB_GROUP) self.sizeSpin = SpinCtrl( panel, id=wx.ID_ANY, min=1, max=50, initial=1) - self.sizecolumnRadio = wx.RadioButton( + self.sizecolumnRadio = RadioButton( panel, id=wx.ID_ANY, label=_("size from map table column:")) self.sizeColChoice = self.getColsChoice(panel) self.scaleText = StaticText(panel, id=wx.ID_ANY, label=_("scale:")) @@ -2812,13 +2796,13 @@ def _StylePointPanel(self, notebook): sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5) - self.rotateCheck = wx.CheckBox( + self.rotateCheck = CheckBox( panel, id=wx.ID_ANY, label=_("rotate symbols:")) - self.rotateRadio = wx.RadioButton(panel, id=wx.ID_ANY, label=_( + self.rotateRadio = RadioButton(panel, id=wx.ID_ANY, label=_( "counterclockwise in degrees:"), style=wx.RB_GROUP) self.rotateSpin = SpinCtrl( panel, id=wx.ID_ANY, min=0, max=360, initial=0) - self.rotatecolumnRadio = wx.RadioButton( + self.rotatecolumnRadio = RadioButton( panel, id=wx.ID_ANY, label=_("from map table column:")) self.rotateColChoice = self.getColsChoice(panel) @@ -2877,7 +2861,7 @@ def _StylePointPanel(self, notebook): return panel def _StyleLinePanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Size and style")) @@ -2895,22 +2879,19 @@ def _StyleLinePanel(self, notebook): widthText = StaticText( panel, id=wx.ID_ANY, label=_("Set width (pts):")) - if fs: - self.widthSpin = fs.FloatSpin( - panel, - id=wx.ID_ANY, - min_val=0, - max_val=30, - increment=0.5, - value=1, - style=fs.FS_RIGHT) - self.widthSpin.SetFormat("%f") - self.widthSpin.SetDigits(1) - else: - self.widthSpin = SpinCtrl( - panel, id=wx.ID_ANY, min=1, max=30, initial=1) - self.cwidthCheck = wx.CheckBox( + self.widthSpin = FloatSpin( + panel, + id=wx.ID_ANY, + min_val=0, + max_val=30, + increment=0.5, + value=1, + style=fs.FS_RIGHT) + self.widthSpin.SetFormat("%f") + self.widthSpin.SetDigits(1) + + self.cwidthCheck = CheckBox( panel, id=wx.ID_ANY, label=_("multiply width by category value")) if self.vPropertiesDict['width']: @@ -2962,7 +2943,7 @@ def _StyleLinePanel(self, notebook): # "will repeat the pattern, an odd number of blocks will alternate the pattern.")) linecapText = StaticText( panel, id=wx.ID_ANY, label=_("Choose linecap:")) - self.linecapChoice = wx.Choice( + self.linecapChoice = Choice( panel, id=wx.ID_ANY, choices=[ "butt", "round", "extended_butt"]) @@ -3002,7 +2983,7 @@ def _StyleLinePanel(self, notebook): return panel def _StyleAreaPanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Size and style")) @@ -3018,9 +2999,9 @@ def _StyleAreaPanel(self, notebook): sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5) - self.patternCheck = wx.CheckBox( + self.patternCheck = CheckBox( panel, id=wx.ID_ANY, label=_("use pattern:")) - self.patFileCtrl = filebrowse.FileBrowseButton( + self.patFileCtrl = FileBrowseButton( panel, id=wx.ID_ANY, labelText=_("Choose pattern file:"), buttonText=_("Browse"), toolTip=_("Type filename or click browse to choose file"), @@ -3165,14 +3146,14 @@ def EnableLayerSelection(self, enable=True): widget.GetWindow().Enable(enable) def getColsChoice(self, parent): - """Returns a wx.Choice with table columns""" + """Returns a Choice with table columns""" if self.connection: cols = self.mapDBInfo.GetColumns( self.mapDBInfo.layers[int(self.currLayer)]['table']) else: cols = [] - choice = wx.Choice(parent=parent, id=wx.ID_ANY, choices=cols) + choice = Choice(parent=parent, id=wx.ID_ANY, choices=cols) return choice def update(self): @@ -3366,7 +3347,7 @@ def __init__(self, parent, id, settings, page): self.currRaster = None # notebook - self.notebook = wx.Notebook( + self.notebook = Notebook( parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) self.panelRaster = self._rasterLegend(self.notebook) self.panelVector = self._vectorLegend(self.notebook) @@ -3388,7 +3369,7 @@ def OnPageChanging(self, event): self.FindWindowByName('showVLegend')) def _rasterLegend(self, notebook): - panel = scrolled.ScrolledPanel( + panel = ScrolledPanel( parent=notebook, id=wx.ID_ANY, size=(-1, 500), style=wx.TAB_TRAVERSAL) panel.SetupScrolling(scroll_x=False, scroll_y=True) @@ -3397,7 +3378,7 @@ def _rasterLegend(self, notebook): border = wx.BoxSizer(wx.VERTICAL) # is legend - self.isRLegend = wx.CheckBox( + self.isRLegend = CheckBox( panel, id=wx.ID_ANY, label=_("Show raster legend")) self.isRLegend.SetValue(self.rLegendDict['rLegend']) self.isRLegend.SetName("showRLegend") @@ -3416,10 +3397,10 @@ def _rasterLegend(self, notebook): sizer = wx.StaticBoxSizer(box, wx.VERTICAL) flexSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) - self.rasterDefault = wx.RadioButton( + self.rasterDefault = RadioButton( panel, id=wx.ID_ANY, label=_("current raster"), style=wx.RB_GROUP) - self.rasterOther = wx.RadioButton( + self.rasterOther = RadioButton( panel, id=wx.ID_ANY, label=_("select raster")) self.rasterDefault.SetValue(self.rLegendDict['rasterDefault']) self.rasterOther.SetValue(not self.rLegendDict['rasterDefault']) @@ -3479,11 +3460,11 @@ def _rasterLegend(self, notebook): _("Type of legend")) sizer = wx.StaticBoxSizer(box, wx.VERTICAL) vbox = wx.BoxSizer(wx.VERTICAL) - self.discrete = wx.RadioButton( + self.discrete = RadioButton( parent=panel, id=wx.ID_ANY, label=" %s " % _("discrete legend (categorical maps)"), style=wx.RB_GROUP) - self.continuous = wx.RadioButton( + self.continuous = RadioButton( parent=panel, id=wx.ID_ANY, label=" %s " % _("continuous color gradient legend (floating point map)")) @@ -3515,14 +3496,14 @@ def _rasterLegend(self, notebook): sizer = wx.StaticBoxSizer(box, wx.VERTICAL) gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5) # no data - self.nodata = wx.CheckBox( + self.nodata = CheckBox( panel, id=wx.ID_ANY, label=_('draw "no data" box')) if self.rLegendDict['nodata'] == 'y': self.nodata.SetValue(True) else: self.nodata.SetValue(False) # tickbar - self.ticks = wx.CheckBox( + self.ticks = CheckBox( panel, id=wx.ID_ANY, label=_("draw ticks across color table")) @@ -3538,7 +3519,7 @@ def _rasterLegend(self, notebook): self.minim, self.maxim = rinfo['min'], rinfo['max'] else: self.minim, self.maxim = 0, 0 - self.range = wx.CheckBox(panel, id=wx.ID_ANY, label=_("range")) + self.range = CheckBox(panel, id=wx.ID_ANY, label=_("range")) self.range.SetValue(self.rLegendDict['range']) self.minText = StaticText( panel, @@ -3592,7 +3573,6 @@ def _rasterLegend(self, notebook): sizer.Add( gridBagSizer, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL, border=0) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) @@ -3612,7 +3592,7 @@ def _rasterLegend(self, notebook): return panel def _vectorLegend(self, notebook): - panel = scrolled.ScrolledPanel( + panel = ScrolledPanel( parent=notebook, id=wx.ID_ANY, size=(-1, 500), style=wx.TAB_TRAVERSAL) panel.SetupScrolling(scroll_x=False, scroll_y=True) @@ -3621,7 +3601,7 @@ def _vectorLegend(self, notebook): border = wx.BoxSizer(wx.VERTICAL) # is legend - self.isVLegend = wx.CheckBox( + self.isVLegend = CheckBox( panel, id=wx.ID_ANY, label=_("Show vector legend")) self.isVLegend.SetValue(self.vLegendDict['vLegend']) self.isVLegend.SetName("showVLegend") @@ -3694,7 +3674,7 @@ def _vectorLegend(self, notebook): sizer.Add( gridBagSizer, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL | wx.EXPAND, + flag=wx.EXPAND, border=0) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) @@ -3714,9 +3694,9 @@ def _vectorLegend(self, notebook): sizer = wx.StaticBoxSizer(box, wx.VERTICAL) flexGridSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) - self.borderCheck = wx.CheckBox( + self.borderCheck = CheckBox( panel, id=wx.ID_ANY, label=_("draw border around legend")) - self.borderColorCtrl = wx.ColourPickerCtrl( + self.borderColorCtrl = ColourPickerCtrl( panel, id=wx.ID_ANY, style=wx.FNTP_FONTDESC_AS_LABEL) if self.vLegendDict['border'] == 'none': self.borderColorCtrl.SetColour(wx.BLACK) @@ -3791,7 +3771,6 @@ def sizePositionFont(self, legendType, parent, mainSizer): sizer.Add( unitBox, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL, border=0) hBox = wx.BoxSizer(wx.HORIZONTAL) @@ -3898,7 +3877,7 @@ def sizePositionFont(self, legendType, parent, mainSizer): max=maxVect, initial=legendDict['cols']) # span - panel.spanRadio = wx.CheckBox( + panel.spanRadio = CheckBox( panel, id=wx.ID_ANY, label=_("column span:")) panel.spanTextCtrl = TextCtrl(panel, id=wx.ID_ANY, value='') panel.spanTextCtrl.SetToolTip(_("Column separation distance between the left edges\n" @@ -4312,12 +4291,12 @@ def updateVectorLegend(self): self.vLegendDict['vLegend'] = False else: self.vLegendDict['vLegend'] = True - if self.vLegendDict['vLegend'] == True and self.vectorId is not None: + if self.vLegendDict['vLegend'] and self.vectorId is not None: # labels # reindex order idx = 1 for item in range(self.vectorListCtrl.GetItemCount()): - if self.vectorListCtrl.IsChecked(item): + if self.vectorListCtrl.IsItemChecked(item): self.vectorListCtrl.SetItemData(item, idx) idx += 1 else: @@ -4359,7 +4338,7 @@ def updateVectorLegend(self): 'fontCtrl'].GetStringSelection() self.vLegendDict['fontsize'] = self.panelVector.font[ 'fontSizeCtrl'].GetValue() - dc = wx.ClientDC(self) + dc = ClientDC(self) dc.SetFont( wx.Font( pointSize=self.vLegendDict['fontsize'], @@ -4508,7 +4487,7 @@ def __init__(self, parent, id, settings): self.OnIsBorder(None) def _mapinfoPanel(self): - panel = wx.Panel( + panel = Panel( parent=self, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) #panel.SetupScrolling(scroll_x = False, scroll_y = True) @@ -4595,12 +4574,12 @@ def _mapinfoPanel(self): flexSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) self.colors = {} - self.colors['borderCtrl'] = wx.CheckBox( + self.colors['borderCtrl'] = CheckBox( panel, id=wx.ID_ANY, label=_("use border color:")) - self.colors['backgroundCtrl'] = wx.CheckBox( + self.colors['backgroundCtrl'] = CheckBox( panel, id=wx.ID_ANY, label=_("use background color:")) - self.colors['borderColor'] = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) - self.colors['backgroundColor'] = wx.ColourPickerCtrl( + self.colors['borderColor'] = ColourPickerCtrl(panel, id=wx.ID_ANY) + self.colors['backgroundColor'] = ColourPickerCtrl( panel, id=wx.ID_ANY) if self.mapinfoDict['border'] is None: @@ -4788,7 +4767,7 @@ def __init__(self, parent, id, settings): self.mapUnit = 'meters' def _scalebarPanel(self): - panel = wx.Panel(parent=self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) + panel = Panel(parent=self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) border = wx.BoxSizer(wx.VERTICAL) # # position @@ -4871,9 +4850,9 @@ def _scalebarPanel(self): _("Scalebar height is real height on paper")) choices = [_('default')] + self.unitConv.getMapUnitsNames() - self.unitsLength = wx.Choice(panel, id=wx.ID_ANY, choices=choices) + self.unitsLength = Choice(panel, id=wx.ID_ANY, choices=choices) choices = self.unitConv.getPageUnitsNames() - self.unitsHeight = wx.Choice(panel, id=wx.ID_ANY, choices=choices) + self.unitsHeight = Choice(panel, id=wx.ID_ANY, choices=choices) # set values unitName = self.unitConv.findName(self.scalebarDict['unitsLength']) @@ -4985,7 +4964,7 @@ def _scalebarPanel(self): panel, id=wx.ID_ANY, min=4, max=30, initial=10) self.fontsizeCtrl.SetValue(self.scalebarDict['fontsize']) - self.backgroundCheck = wx.CheckBox( + self.backgroundCheck = CheckBox( panel, id=wx.ID_ANY, label=_("transparent text background")) if self.scalebarDict['background'] == 'y': self.backgroundCheck.SetValue(False) @@ -5028,7 +5007,6 @@ def _scalebarPanel(self): sizer.Add( gridBagSizer, proportion=1, - flag=wx.ALIGN_CENTER_VERTICAL, border=5) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) @@ -5173,7 +5151,7 @@ def __init__(self, parent, id, settings): y=self.textDict['where'][1], paperToMap=True) - notebook = wx.Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) + notebook = Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) self.textPanel = self._textPanel(notebook) self.positionPanel = self._positionPanel(notebook) self.OnBackground(None) @@ -5185,7 +5163,7 @@ def __init__(self, parent, id, settings): self._layout(notebook) def _textPanel(self, notebook): - panel = wx.Panel(parent=notebook, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) + panel = Panel(parent=notebook, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Text")) border = wx.BoxSizer(wx.VERTICAL) @@ -5274,23 +5252,23 @@ def _textPanel(self, notebook): gridBagSizer = wx.GridBagSizer(hgap=5, vgap=5) self.effect = {} - self.effect['backgroundCtrl'] = wx.CheckBox( + self.effect['backgroundCtrl'] = CheckBox( panel, id=wx.ID_ANY, label=_("text background")) - self.effect['backgroundColor'] = wx.ColourPickerCtrl( + self.effect['backgroundColor'] = ColourPickerCtrl( panel, id=wx.ID_ANY) - self.effect['highlightCtrl'] = wx.CheckBox( + self.effect['highlightCtrl'] = CheckBox( panel, id=wx.ID_ANY, label=_("highlight")) - self.effect['highlightColor'] = wx.ColourPickerCtrl( + self.effect['highlightColor'] = ColourPickerCtrl( panel, id=wx.ID_ANY) self.effect['highlightWidth'] = SpinCtrl( panel, id=wx.ID_ANY, size=self.spinCtrlSize, min=0, max=5, initial=1) self.effect['highlightWidthLabel'] = StaticText( panel, id=wx.ID_ANY, label=_("Width (pts):")) - self.effect['borderCtrl'] = wx.CheckBox( + self.effect['borderCtrl'] = CheckBox( panel, id=wx.ID_ANY, label=_("text border")) - self.effect['borderColor'] = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) + self.effect['borderColor'] = ColourPickerCtrl(panel, id=wx.ID_ANY) self.effect['borderWidth'] = SpinCtrl( panel, id=wx.ID_ANY, size=self.spinCtrlSize, min=1, max=25, initial=1) self.effect['borderWidthLabel'] = StaticText( @@ -5360,7 +5338,7 @@ def _textPanel(self, notebook): border=1) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) - self.Bind(EVT_ETC_LAYOUT_NEEDED, self.OnRefit, self.textCtrl) + self.Bind(ExpandoTextCtrl.EVT_ETC_LAYOUT_NEEDED, self.OnRefit, self.textCtrl) self.Bind( wx.EVT_CHECKBOX, self.OnBackground, @@ -5377,7 +5355,7 @@ def _textPanel(self, notebook): return panel def _positionPanel(self, notebook): - panel = wx.Panel(parent=notebook, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) + panel = Panel(parent=notebook, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Position")) border = wx.BoxSizer(wx.VERTICAL) @@ -5451,7 +5429,7 @@ def _positionPanel(self, notebook): for col in ["left", "center", "right"]: ref.append(row + " " + col) self.radio = [ - wx.RadioButton( + RadioButton( panel, id=wx.ID_ANY, label='', @@ -5465,7 +5443,7 @@ def _positionPanel(self, notebook): border=0) for i in range(1, 9): self.radio.append( - wx.RadioButton( + RadioButton( panel, id=wx.ID_ANY, label='', @@ -5500,7 +5478,7 @@ def _positionPanel(self, notebook): _("Text rotation")) sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL) - self.rotCtrl = wx.CheckBox( + self.rotCtrl = CheckBox( panel, id=wx.ID_ANY, label=_("rotate text (counterclockwise)")) @@ -5682,7 +5660,7 @@ def update(self): self.textDict['rotate'] = None # reference point for radio in self.radio: - if radio.GetValue() == True: + if radio.GetValue(): self.textDict['ref'] = radio.GetName() if self.id not in self.instruction: @@ -5751,7 +5729,7 @@ def __init__(self, parent, id, settings, imagePanelName=_("Image")): y=self.imageDict['where'][1], paperToMap=True) - notebook = wx.Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) + notebook = Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) self.imagePanelName = imagePanelName self.imagePanel = self._imagePanel(notebook) self.positionPanel = self._positionPanel(notebook) @@ -5771,7 +5749,7 @@ def _newObject(self): return Image(self.id, self.instruction) def _imagePanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=self.imagePanelName) @@ -5792,7 +5770,7 @@ def _imagePanel(self, notebook): startDir = os.path.dirname(self.imageDict['epsfile']) else: startDir = self._getImageDirectory() - dir = filebrowse.DirBrowseButton( + dir = DirBrowseButton( parent=panel, id=wx.ID_ANY, labelText=_("Choose a directory:"), @@ -5807,7 +5785,7 @@ def _imagePanel(self, notebook): # image list hSizer = wx.BoxSizer(wx.HORIZONTAL) - imageList = wx.ListBox(parent=panel, id=wx.ID_ANY) + imageList = ListBox(parent=panel, id=wx.ID_ANY) panel.image['list'] = imageList imageList.Bind(wx.EVT_LISTBOX, self.OnImageSelectionChanged) @@ -5820,7 +5798,7 @@ def _imagePanel(self, notebook): # image preview vSizer = wx.BoxSizer(wx.VERTICAL) self.previewSize = (150, 150) - img = wx.EmptyImage(*self.previewSize) + img = EmptyImage(*self.previewSize) panel.image['preview'] = wx.StaticBitmap( panel, wx.ID_ANY, BitmapFromImage(img)) vSizer.Add( @@ -5843,7 +5821,7 @@ def _imagePanel(self, notebook): sizer.Add( epsInfo, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALL, border=3) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) @@ -5862,27 +5840,18 @@ def _imagePanel(self, notebook): scaleLabel = StaticText( parent=panel, id=wx.ID_ANY, label=_("Scale:")) - if fs: - panel.image['scale'] = fs.FloatSpin( - panel, id=wx.ID_ANY, min_val=0, max_val=50, increment=0.5, - value=1, style=fs.FS_RIGHT, size=self.spinCtrlSize) - panel.image['scale'].SetFormat("%f") - panel.image['scale'].SetDigits(1) - else: - panel.image['scale'] = TextCtrl( - panel, id=wx.ID_ANY, size=self.spinCtrlSize, - validator=TCValidator(flag='DIGIT_ONLY')) + + panel.image['scale'] = FloatSpin( + panel, id=wx.ID_ANY, min_val=0, max_val=50, increment=0.5, + value=1, style=fs.FS_RIGHT) + panel.image['scale'].SetFormat("%f") + panel.image['scale'].SetDigits(1) if self.imageDict['scale']: - if fs: - value = float(self.imageDict['scale']) - else: - value = str(self.imageDict['scale']) + value = float(self.imageDict['scale']) else: - if fs: - value = 0 - else: - value = '0' + value = 0 + panel.image['scale'].SetValue(value) gridSizer.Add( @@ -5897,21 +5866,13 @@ def _imagePanel(self, notebook): parent=panel, id=wx.ID_ANY, label=_("Rotation angle (deg):")) - if fs: - panel.image['rotate'] = fs.FloatSpin( - panel, id=wx.ID_ANY, min_val=0, max_val=360, increment=0.5, - value=0, style=fs.FS_RIGHT, size=self.spinCtrlSize) - panel.image['rotate'].SetFormat("%f") - panel.image['rotate'].SetDigits(1) - else: - panel.image['rotate'] = SpinCtrl( - parent=panel, - id=wx.ID_ANY, - size=self.spinCtrlSize, - min=0, - max=359, - initial=0) - panel.image['rotate'].SetToolTipString( + panel.image['rotate'] = FloatSpin( + panel, id=wx.ID_ANY, min_val=0, max_val=360, increment=0.5, + value=0, style=fs.FS_RIGHT) + panel.image['rotate'].SetFormat("%f") + panel.image['rotate'].SetDigits(1) + + panel.image['rotate'].SetToolTip( _("Counterclockwise rotation in degrees")) if self.imageDict['rotate']: panel.image['rotate'].SetValue(int(self.imageDict['rotate'])) @@ -5943,7 +5904,7 @@ def _imagePanel(self, notebook): return panel def _positionPanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Position")) @@ -5976,7 +5937,7 @@ def _positionPanel(self, notebook): sizer.Add( gridBagSizer, proportion=1, - flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALL, border=5) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) @@ -6309,7 +6270,7 @@ def __init__( y=self.pointDict['where'][1], paperToMap=True) - notebook = wx.Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) + notebook = Notebook(parent=self, id=wx.ID_ANY, style=wx.BK_DEFAULT) self.pointPanelName = pointPanelName self.pointPanel = self._pointPanel(notebook) self.positionPanel = self._positionPanel(notebook) @@ -6318,7 +6279,7 @@ def __init__( self._layout(notebook) def _pointPanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=self.pointPanelName) @@ -6345,7 +6306,7 @@ def _pointPanel(self, notebook): gridSizer.Add(self.symbolLabel, pos=(0, 1), flag=wx.ALIGN_CENTER_VERTICAL) bitmap = wx.Bitmap(os.path.join(globalvar.SYMBDIR, - self.pointDict['symbol']) + '.png') + self.pointDict['symbol']) + '.png') self.symbolButton = BitmapButton(panel, id=wx.ID_ANY, bitmap=bitmap) self.symbolButton.Bind(wx.EVT_BUTTON, self.OnSymbolSelection) @@ -6388,8 +6349,8 @@ def _pointPanel(self, notebook): parent=panel, id=wx.ID_ANY, label=_("Outline color:")) - self.outlineColorCtrl = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) - self.outlineTranspCtrl = wx.CheckBox( + self.outlineColorCtrl = ColourPickerCtrl(panel, id=wx.ID_ANY) + self.outlineTranspCtrl = CheckBox( panel, id=wx.ID_ANY, label=_("transparent")) if self.pointDict['color'] != 'none': @@ -6415,8 +6376,8 @@ def _pointPanel(self, notebook): parent=panel, id=wx.ID_ANY, label=_("Fill color:")) - self.fillColorCtrl = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) - self.fillTranspCtrl = wx.CheckBox( + self.fillColorCtrl = ColourPickerCtrl(panel, id=wx.ID_ANY) + self.fillTranspCtrl = CheckBox( panel, id=wx.ID_ANY, label=_("transparent")) if self.pointDict['fcolor'] != 'none': @@ -6464,7 +6425,7 @@ def _pointPanel(self, notebook): label=_("Size (pt):")) self.sizeCtrl = SpinCtrl( panel, id=wx.ID_ANY, size=self.spinCtrlSize) - self.sizeCtrl.SetToolTipString(_("Symbol size in points")) + self.sizeCtrl.SetToolTip(_("Symbol size in points")) self.sizeCtrl.SetValue(self.pointDict['size']) gridSizer.Add( @@ -6479,27 +6440,19 @@ def _pointPanel(self, notebook): parent=panel, id=wx.ID_ANY, label=_("Rotation angle (deg):")) - if fs: - self.rotCtrl = fs.FloatSpin( - panel, - id=wx.ID_ANY, - min_val=-360, - max_val=360, - increment=1, - value=0, - style=fs.FS_RIGHT, - size=self.spinCtrlSize) - self.rotCtrl.SetFormat("%f") - self.rotCtrl.SetDigits(1) - else: - self.rotCtrl = SpinCtrl( - parent=panel, - id=wx.ID_ANY, - size=self.spinCtrlSize, - min=-360, - max=360, - initial=0) - self.rotCtrl.SetToolTipString( + + self.rotCtrl = FloatSpin( + panel, + id=wx.ID_ANY, + min_val=-360, + max_val=360, + increment=1, + value=0, + style=fs.FS_RIGHT) + self.rotCtrl.SetFormat("%f") + self.rotCtrl.SetDigits(1) + + self.rotCtrl.SetToolTip( _("Counterclockwise rotation in degrees")) self.rotCtrl.SetValue(float(self.pointDict['rotate'])) @@ -6527,7 +6480,7 @@ def _pointPanel(self, notebook): return panel def _positionPanel(self, notebook): - panel = wx.Panel( + panel = Panel( parent=notebook, id=wx.ID_ANY, size=(-1, -1), style=wx.TAB_TRAVERSAL) notebook.AddPage(page=panel, text=_("Position")) @@ -6560,7 +6513,7 @@ def _positionPanel(self, notebook): sizer.Add( gridBagSizer, proportion=1, - flag=wx.ALIGN_CENTER_VERTICAL | wx.ALL, + flag=wx.ALL, border=5) border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=5) @@ -6731,7 +6684,7 @@ def __init__(self, parent, id, settings, self._layout(self.panel) def _rectPanel(self): - panel = wx.Panel(parent=self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) + panel = Panel(parent=self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) border = wx.BoxSizer(wx.VERTICAL) # color @@ -6747,8 +6700,8 @@ def _rectPanel(self): parent=panel, id=wx.ID_ANY, label=_("Outline color:")) - self.outlineColorCtrl = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) - self.outlineTranspCtrl = wx.CheckBox( + self.outlineColorCtrl = ColourPickerCtrl(panel, id=wx.ID_ANY) + self.outlineTranspCtrl = CheckBox( panel, id=wx.ID_ANY, label=_("transparent")) if self.rectDict['color'] != 'none': @@ -6777,8 +6730,8 @@ def _rectPanel(self): if self.objectType == ('rectangle',): fillLabel = StaticText( parent=panel, id=wx.ID_ANY, label=_("Fill color:")) - self.fillColorCtrl = wx.ColourPickerCtrl(panel, id=wx.ID_ANY) - self.fillTranspCtrl = wx.CheckBox( + self.fillColorCtrl = ColourPickerCtrl(panel, id=wx.ID_ANY) + self.fillTranspCtrl = CheckBox( panel, id=wx.ID_ANY, label=_("transparent")) if self.rectDict['fcolor'] != 'none': @@ -6815,27 +6768,19 @@ def _rectPanel(self): parent=panel, id=wx.ID_ANY, label=_("Line width:")) - if fs: - self.widthCtrl = fs.FloatSpin( - panel, - id=wx.ID_ANY, - min_val=0, - max_val=50, - increment=1, - value=0, - style=fs.FS_RIGHT, - size=self.spinCtrlSize) - self.widthCtrl.SetFormat("%f") - self.widthCtrl.SetDigits(1) - else: - self.widthCtrl = SpinCtrl( - parent=panel, - id=wx.ID_ANY, - size=self.spinCtrlSize, - min=-360, - max=360, - initial=0) - self.widthCtrl.SetToolTipString(_("Line width in points")) + + self.widthCtrl = FloatSpin( + panel, + id=wx.ID_ANY, + min_val=0, + max_val=50, + increment=1, + value=0, + style=fs.FS_RIGHT) + self.widthCtrl.SetFormat("%f") + self.widthCtrl.SetDigits(1) + + self.widthCtrl.SetToolTip(_("Line width in points")) self.widthCtrl.SetValue(float(self.rectDict['width'])) gridSizer.Add( @@ -6923,7 +6868,7 @@ def __init__(self, parent, id, settings): self._layout(self.panel) def _labelPanel(self): - panel = wx.Panel(parent=self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) + panel = Panel(parent=self, id=wx.ID_ANY, style=wx.TAB_TRAVERSAL) border = wx.BoxSizer(wx.VERTICAL) diff --git a/gui/wxpython/psmap/frame.py b/gui/wxpython/psmap/frame.py index f5f8de1117a..d0e48a32625 100644 --- a/gui/wxpython/psmap/frame.py +++ b/gui/wxpython/psmap/frame.py @@ -42,7 +42,7 @@ from gui_core.forms import GUI from gui_core.dialogs import HyperlinkDialog from gui_core.ghelp import ShowAboutDialog -from gui_core.wrap import ClientDC, PseudoDC, Rect, StockCursor, EmptyBitmap, NewId +from gui_core.wrap import ClientDC, PseudoDC, Rect, StockCursor, EmptyBitmap from psmap.menudata import PsMapMenuData from gui_core.toolbars import ToolSwitcher @@ -1009,7 +1009,7 @@ def deleteObject(self, id): def DialogDataChanged(self, id): ids = id - if isinstance(id, int) or isinstance(id, wx.WindowIDRef): + if isinstance(id, int): ids = [id] for id in ids: itype = self.instruction[id].type @@ -2528,6 +2528,8 @@ def OnIdle(self, event): # Make new off screen bitmap: this bitmap will always have the # current drawing in it, so it can be used to save the image # to a file, or whatever. + width = max(width, 20) + height = max(height, 20) self._buffer = EmptyBitmap(width, height) # re-render image on idle self.resize = True diff --git a/gui/wxpython/psmap/instructions.py b/gui/wxpython/psmap/instructions.py index 5f1e09a19cb..0df52120b0e 100644 --- a/gui/wxpython/psmap/instructions.py +++ b/gui/wxpython/psmap/instructions.py @@ -46,10 +46,14 @@ from core.gcmd import RunCommand, GError, GMessage, GWarning from core.utils import GetCmdString from dbmgr.vinfo import VectorDBInfo -from gui_core.wrap import NewId +from gui_core.wrap import NewId as wxNewId from psmap.utils import * +def NewId(): + return int(wxNewId()) + + class Instruction: """Class which represents instruction file""" diff --git a/gui/wxpython/psmap/utils.py b/gui/wxpython/psmap/utils.py index 1792cd5209e..e60ddd3e318 100644 --- a/gui/wxpython/psmap/utils.py +++ b/gui/wxpython/psmap/utils.py @@ -472,7 +472,6 @@ def GhostscriptForWindows(tile, size, fp): length, bbox = data import tempfile - import os file = tempfile.mkstemp()[1] diff --git a/gui/wxpython/rdigit/controller.py b/gui/wxpython/rdigit/controller.py index 98fa5f394ef..bb4b2b9ae97 100644 --- a/gui/wxpython/rdigit/controller.py +++ b/gui/wxpython/rdigit/controller.py @@ -81,6 +81,8 @@ def __init__(self, giface, mapWindow): self._currentCellValue = None # last edited buffer value self._currentWidthValue = None + # digit env + self._env = os.environ.copy() self._oldMouseUse = None self._oldCursor = None @@ -298,16 +300,19 @@ def Start(self): def Stop(self): """Before stopping digitizer, asks to save edits""" - dlg = wx.MessageDialog( - self._mapWindow, - _("Do you want to save changes?"), - _("Save raster map changes"), - wx.YES_NO) - if dlg.ShowModal() == wx.ID_YES: - if self._drawing: - self._finish() - self._thread.Run(callable=self._exportRaster, - ondone=lambda event: self._updateAndQuit()) + if self._editedRaster: + dlg = wx.MessageDialog( + self._mapWindow, + _("Do you want to save changes?"), + _("Save raster map changes"), + wx.YES_NO) + if dlg.ShowModal() == wx.ID_YES: + if self._drawing: + self._finish() + self._thread.Run(callable=self._exportRaster, + ondone=lambda event: self._updateAndQuit()) + else: + self.quitDigitizer.emit() else: self.quitDigitizer.emit() @@ -336,12 +341,13 @@ def CleanUp(self, restore=True): :param restore: if restore previous cursor, mouse['use'] """ try: - gcore.run_command( - 'g.remove', - type='raster', - flags='f', - name=self._backupRasterName, - quiet=True) + if self._backupRasterName: + gcore.run_command( + 'g.remove', + type='raster', + flags='f', + name=self._backupRasterName, + quiet=True) except CalledModuleError: pass @@ -469,6 +475,8 @@ def _exportRaster(self): keep the order of editing. These rasters are then patched together. Sets default color table for the newly digitized raster. """ + self._setRegion() + if not self._editedRaster or self._running: return self._running = True @@ -525,7 +533,8 @@ def _exportRaster(self): gcore.run_command( 'r.patch', input=rastersToPatch[:: -1] + [self._backupRasterName], - output=self._editedRaster, overwrite=True, quiet=True) + output=self._editedRaster, overwrite=True, quiet=True, + env=self._env) gcore.run_command( 'g.remove', type='raster', @@ -605,9 +614,15 @@ def _rasterize(self, text, bufferDist, mapType, tempRaster): overwrite=True, quiet=True) gcore.run_command('r.grow', input=tempRaster, output=output, - flags='m', radius=bufferDist, quiet=True) + flags='m', radius=bufferDist, quiet=True, + env=self._env) else: gcore.run_command('r.in.poly', input=asciiFile.name, output=output, - type_=mapType, quiet=True) + type_=mapType, quiet=True, env=self._env) os.unlink(asciiFile.name) return output + + def _setRegion(self): + """Set region according input raster map""" + self._env['GRASS_REGION'] = gcore.region_env( + raster=self._backupRasterName) diff --git a/gui/wxpython/rlisetup/frame.py b/gui/wxpython/rlisetup/frame.py index 9d5c4baa935..95d2dcb1b30 100644 --- a/gui/wxpython/rlisetup/frame.py +++ b/gui/wxpython/rlisetup/frame.py @@ -218,7 +218,12 @@ def OnHelp(self, event): def OnRemove(self, event): """Remove configuration file from path and update the list""" - confile = self.listfiles[self.listfileBox.GetSelections()[0]] + try: + confile = self.listfiles[self.listfileBox.GetSelections()[0]] + except IndexError: + gcmd.GMessage(parent=self, + message=_("You have to select a configuration file")) + return dlg = wx.MessageDialog( parent=self.parent, message=_( @@ -246,7 +251,7 @@ def OnRename(self, event): """Rename an existing configuration file""" try: confile = self.listfiles[self.listfileBox.GetSelections()[0]] - except: + except IndexError: gcmd.GMessage(parent=self, message=_("You have to select a configuration file")) return @@ -266,7 +271,7 @@ def OnView(self, event): """Show and edit a configuration file""" try: confile = self.listfiles[self.listfileBox.GetSelections()[0]] - except: + except IndexError: gcmd.GMessage(parent=self, message=_("You have to select a configuration file")) return diff --git a/gui/wxpython/rlisetup/wizard.py b/gui/wxpython/rlisetup/wizard.py index 681dc45cb87..a4d29cb45a6 100644 --- a/gui/wxpython/rlisetup/wizard.py +++ b/gui/wxpython/rlisetup/wizard.py @@ -42,8 +42,10 @@ from grass.script import vector as gvect from grass.exceptions import CalledModuleError -from functions import SamplingType, sampleAreaVector, convertFeature -from functions import obtainAreaVector, obtainCategories +from .functions import ( + SamplingType, convertFeature, obtainAreaVector, obtainCategories, + sampleAreaVector, +) from core.gcmd import GError, GMessage, RunCommand @@ -142,7 +144,7 @@ def __init__(self, parent): def _write_confile(self): """Write the configuration file""" - f = open(os.path.join(self.rlipath, self.startpage.conf_name), 'wb') + f = open(os.path.join(self.rlipath, self.startpage.conf_name), 'w') self.rasterinfo = grast.raster_info(self.startpage.rast) self._write_region(f) self._write_area(f) @@ -360,8 +362,8 @@ def _write_area(self, fil): cl = float(self.CIR_CL) / float(self.rasterinfo['cols']) rl = float(self.CIR_RL) / float(self.rasterinfo['rows']) else: - cl = float(self.moving.width) / float(self.rasterinfo['cols']) - rl = float(self.moving.height) / float(self.rasterinfo['rows']) + cl = float(self.units.width) / float(self.rasterinfo['cols']) + rl = float(self.units.height) / float(self.rasterinfo['rows']) fil.write("SAMPLEAREA -1|-1|%r|%r\n" % (rl, cl)) if self.units.distrtype == 'non_overlapping': diff --git a/gui/wxpython/startup/locdownload.py b/gui/wxpython/startup/locdownload.py index 8b2db53e4fd..75650d37ef5 100644 --- a/gui/wxpython/startup/locdownload.py +++ b/gui/wxpython/startup/locdownload.py @@ -90,7 +90,7 @@ class DownloadError(Exception): class RedirectText(object): def __init__(self, window): self.out = window - + def write(self, string): try: wx.CallAfter(self.out.SetLabel, string) @@ -98,6 +98,9 @@ def write(self, string): # window closed -> PyDeadObjectError pass + def flush(self): + pass + # copy from g.extension, potentially move to library def move_extracted_files(extract_dir, target_dir, files): """Fix state of extracted file by moving them to different diretcory @@ -185,7 +188,7 @@ def reporthook(count, block_size, total_size): sys.stdout.write("Download in progress, wait until it is finished\n{0}%, {1} MB, {2} KB/s, {3:.0f} seconds passed".format( percent, progress_size / (1024 * 1024), speed, duration )) - + # based on g.extension, potentially move to library def download_and_extract(source): """Download a file (archive) from URL and uncompress it""" @@ -341,11 +344,10 @@ def _layout(self): button_sizer.Add(self.download_button, proportion=0) vertical.Add(button_sizer, proportion=0, - flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT | wx.ALIGN_RIGHT, border=10) + flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=10) vertical.AddStretchSpacer() vertical.Add(self.message, proportion=0, - flag=wx.ALIGN_CENTER_VERTICAL | - wx.ALIGN_LEFT | wx.ALL | wx.EXPAND, border=10) + flag=wx.ALIGN_LEFT | wx.ALL | wx.EXPAND, border=10) self.SetSizer(vertical) vertical.Fit(self) @@ -491,14 +493,14 @@ def OnClose(self, event): caption=_("Abort download"), style=wx.YES_NO | wx.NO_DEFAULT | wx.ICON_QUESTION | wx.CENTRE ) - + ret = dlg.ShowModal() dlg.Destroy() # TODO: terminate download process on wx.ID_YES if ret == wx.ID_NO: return - + self.Close() def main(): diff --git a/gui/wxpython/tools/build_modules_xml.py b/gui/wxpython/tools/build_modules_xml.py index df7cf79fda4..56e845e6693 100644 --- a/gui/wxpython/tools/build_modules_xml.py +++ b/gui/wxpython/tools/build_modules_xml.py @@ -122,13 +122,13 @@ def doc_test(): def module_test(): grass_commands = gcore.get_commands()[0] - if not 'g.region' in grass_commands: + if 'g.region' not in grass_commands: print("No g.region") return 1 - if not 'm.proj' in grass_commands: + if 'm.proj' not in grass_commands: print("No m.proj") return 1 - if not 't.rast.univar' in grass_commands: + if 't.rast.univar' not in grass_commands: print("No t.rast.univar") return 1 print(get_module_metadata('g.region')) diff --git a/gui/wxpython/vdigit/dialogs.py b/gui/wxpython/vdigit/dialogs.py index 03f21e07d0c..5bcbca9d613 100644 --- a/gui/wxpython/vdigit/dialogs.py +++ b/gui/wxpython/vdigit/dialogs.py @@ -29,7 +29,7 @@ from core.debug import Debug from core.settings import UserSettings from gui_core.wrap import SpinCtrl, Button, StaticText, \ - StaticBox, Menu, ListCtrl, NewId + StaticBox, Menu, ListCtrl, NewId, CheckListCtrlMixin class VDigitCategoryDialog(wx.Dialog, listmix.ColumnSorterMixin): @@ -167,9 +167,9 @@ def __init__(self, parent, title, mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add(listSizer, proportion=1, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) mainSizer.Add(addSizer, proportion=0, - flag=wx.EXPAND | wx.ALIGN_CENTER | + flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5) fidSizer = wx.BoxSizer(wx.HORIZONTAL) fidSizer.Add(StaticText(parent=self, id=wx.ID_ANY, @@ -183,7 +183,7 @@ def __init__(self, parent, title, mainSizer.Add(fidSizer, proportion=0, flag=wx.EXPAND | wx.ALL, border=5) mainSizer.Add(btnSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER, border=5) + flag=wx.EXPAND | wx.ALL, border=5) self.SetSizer(mainSizer) mainSizer.Fit(self) @@ -768,14 +768,14 @@ def GetUnSelected(self): wlist = self.FindWindowById(id) for item in range(wlist.GetItemCount()): - if not wlist.IsChecked(item): + if not wlist.IsItemChecked(item): ids.append(int(wlist.GetItem(item, 0).GetText())) return ids class CheckListFeature( - ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin): + ListCtrl, listmix.ListCtrlAutoWidthMixin, CheckListCtrlMixin): def __init__(self, parent, data, pos=wx.DefaultPosition, log=None): @@ -786,7 +786,7 @@ def __init__(self, parent, data, ListCtrl.__init__(self, parent, wx.ID_ANY, style=wx.LC_REPORT) - listmix.CheckListCtrlMixin.__init__(self) + CheckListCtrlMixin.__init__(self) self.log = log diff --git a/gui/wxpython/vdigit/preferences.py b/gui/wxpython/vdigit/preferences.py index c14bfbff62a..f42fc718036 100644 --- a/gui/wxpython/vdigit/preferences.py +++ b/gui/wxpython/vdigit/preferences.py @@ -73,11 +73,11 @@ def __init__(self, parent, giface, title=_("Digitization settings"), # sizers btnSizer = wx.BoxSizer(wx.HORIZONTAL) btnSizer.Add(btnCancel, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, border=5) + flag=wx.ALL, border=5) btnSizer.Add(btnApply, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, border=5) + flag=wx.ALL, border=5) btnSizer.Add(btnSave, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, border=5) + flag=wx.ALL, border=5) mainSizer = wx.BoxSizer(wx.VERTICAL) mainSizer.Add( diff --git a/gui/wxpython/vdigit/toolbars.py b/gui/wxpython/vdigit/toolbars.py index 577736ca619..9ec1312cbe4 100644 --- a/gui/wxpython/vdigit/toolbars.py +++ b/gui/wxpython/vdigit/toolbars.py @@ -49,12 +49,16 @@ def __init__(self, parent, toolSwitcher, MapWindow, digitClass, giface, self.editingStarted = Signal("VDigitToolbar.editingStarted") self.editingStopped = Signal("VDigitToolbar.editingStopped") self.editingBgMap = Signal("VDigitToolbar.editingBgMap") + self.quitDigitizer = Signal("VDigitToolbar.quitDigitizer") layerTree = self._giface.GetLayerTree() if layerTree: self.editingStarted.connect(layerTree.StartEditing) self.editingStopped.connect(layerTree.StopEditing) self.editingBgMap.connect(layerTree.SetBgMapForEditing) + # bind events + self.Bind(wx.EVT_SHOW, self.OnShow) + # currently selected map layer for editing (reference to MapLayer # instance) self.mapLayer = None @@ -420,12 +424,7 @@ def OnExit(self, event=None): self.parent.GetMapToolbar().SelectDefault() self.MapWindow.polycoords = [] - # TODO: replace this by binding wx event in parent (or use signals...) - if not self.parent.IsStandalone(): - # disable the toolbar - self.parent.RemoveToolbar("vdigit") - else: - self.parent.Close() + self.quitDigitizer.emit() def OnMoveVertex(self, event): """Move line vertex""" @@ -492,13 +491,15 @@ def OnDisplayAttr(self, event): def OnUndo(self, event): """Undo previous changes""" - self.digit.Undo() + if self.digit: + self.digit.Undo() event.Skip() def OnRedo(self, event): """Undo previous changes""" - self.digit.Undo(level=1) + if self.digit: + self.digit.Undo(level=1) event.Skip() @@ -1087,7 +1088,7 @@ def UpdateListOfLayers(self, updateTool=False): mapset=grass.gisenv()['MAPSET']) for layer in self.layers: - if not layer.name in layerNameList: # do not duplicate layer + if layer.name not in layerNameList: # do not duplicate layer layerNameList.append(layer.GetName()) if updateTool: # update toolbar @@ -1116,3 +1117,9 @@ def UpdateListOfLayers(self, updateTool=False): def GetLayer(self): """Get selected layer for editing -- MapLayer instance""" return self.mapLayer + + def OnShow(self, event): + """Show frame event""" + if event.IsShown(): + # list of available vector maps + self.UpdateListOfLayers(updateTool=True) diff --git a/gui/wxpython/vdigit/wxdigit.py b/gui/wxpython/vdigit/wxdigit.py index dcfe609aa52..dd8b6105e16 100644 --- a/gui/wxpython/vdigit/wxdigit.py +++ b/gui/wxpython/vdigit/wxdigit.py @@ -47,7 +47,7 @@ from grass.lib.vector import * from grass.lib.vedit import * from grass.lib.dbmi import * -except (ImportError, WindowsError) as e: +except (ImportError, WindowsError, TypeError) as e: print("wxdigit.py: {}".format(e), file=sys.stderr) class VDigitError: @@ -266,12 +266,11 @@ def OpenBackgroundMap(self, bgmap): name = create_string_buffer(GNAME_MAX) mapset = create_string_buffer(GMAPSET_MAX) if not G_name_is_fully_qualified(bgmap, name, mapset): - name = str(bgmap) - mapset = str(G_find_vector2(bgmap, '')) + name = bgmap + mapset = grass.decode(G_find_vector2(bgmap, '')) else: - name = str(name.value) - mapset = str(mapset.value) - + name = grass.decode(name.value) + mapset = grass.decode(mapset.value) if (name == Vect_get_name(self.poMapInfo) and mapset == Vect_get_mapset(self.poMapInfo)): self.poBgMapInfo = self.popoBgMapInfo = None @@ -1166,7 +1165,7 @@ def BreakLine(self): def SnapLine(self): """Snap selected lines/boundaries - :return: on success + :return: 0 on success :return: -1 on error """ if not self._checkMap(): @@ -1182,6 +1181,8 @@ def SnapLine(self): self._addChangeset() self.toolbar.EnableUndo() + return 0 + def ConnectLine(self): """Connect selected lines/boundaries diff --git a/gui/wxpython/vdigit/wxdisplay.py b/gui/wxpython/vdigit/wxdisplay.py index e73f291e59d..175de1e6a44 100644 --- a/gui/wxpython/vdigit/wxdisplay.py +++ b/gui/wxpython/vdigit/wxdisplay.py @@ -39,7 +39,7 @@ from grass.lib.gis import * from grass.lib.vector import * from grass.lib.vedit import * -except (ImportError, WindowsError) as e: +except (ImportError, WindowsError, TypeError) as e: print("wxdigit.py: {}".format(e), file=sys.stderr) log = None @@ -1000,7 +1000,7 @@ def OpenMap(self, name, mapset, update=True, tmp=False): :return: map_info :return: None on error """ - Debug.msg("DisplayDriver.OpenMap(): name=%s mapset=%s updated=%d", + Debug.msg(1, "DisplayDriver.OpenMap(): name=%s mapset=%s updated=%d", name, mapset, update) if not self.mapInfo: self.mapInfo = Map_info() @@ -1021,7 +1021,7 @@ def OpenMap(self, name, mapset, update=True, tmp=False): ret = open_fn(self.poMapInfo, name, mapset) if ret == -1: - # fatal error detected + # fatal error detected del self.mapInfo self.poMapInfo = self.mapInfo = None elif ret < 2: diff --git a/gui/wxpython/vnet/dialogs.py b/gui/wxpython/vnet/dialogs.py index 02a7a6b55a1..43c8849930d 100644 --- a/gui/wxpython/vnet/dialogs.py +++ b/gui/wxpython/vnet/dialogs.py @@ -55,8 +55,10 @@ from gui_core.widgets import GNotebook from gui_core.goutput import GConsoleWindow from gui_core.gselect import Select, LayerSelect, ColumnSelect -from gui_core.wrap import SpinCtrl, Button, BitmapButton, StaticText, \ - StaticBox, TextCtrl, ListCtrl, BitmapFromImage +from gui_core.wrap import ( + BitmapButton, BitmapFromImage, Button, CheckBox, ComboBox, ListCtrl, + Panel, ScrolledPanel, SpinCtrl, StaticBox, StaticText, TextCtrl +) from vnet.widgets import PointsList from vnet.toolbars import MainToolbar, PointListToolbar, AnalysisToolbar @@ -67,8 +69,6 @@ # - when layer tree of is changed, tmp result map is removed from render list # - optimization of map drawing # - tmp maps - add number of process -# - destructor problem - when GRASS GIS is closed with open VNETDialog, -# it's destructor is not called class VNETDialog(wx.Dialog): @@ -126,7 +126,7 @@ def __init__(self, parent, giface, id=wx.ID_ANY, # self._mgr = wx.aui.AuiManager(self) - self.mainPanel = wx.Panel(parent=self) + self.mainPanel = Panel(parent=self) self.notebook = GNotebook(parent=self.mainPanel, style=FN.FNB_FANCY_TABS | FN.FNB_BOTTOM | FN.FNB_NO_X_BUTTON) @@ -157,12 +157,15 @@ def __init__(self, parent, giface, id=wx.ID_ANY, # Stores data which are needed for attribute table browser of analysis # input map layers self.inpDbMgrData = {} - self._createInputDbMgrPage() + self._checkSelectedVectorMap() # Stores data which are need for attribute table browser of analysis # result map layers self.resultDbMgrData = {} - self._createResultDbMgrPage() + if self.tmp_result: + self.resultDbMgrData['input'] = self.tmp_result.GetVectMapName() + else: + self.resultDbMgrData['input'] = None self.notebook.Bind( FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, @@ -226,9 +229,9 @@ def _doVnetDialogLayout(self): def _createPointsPage(self): """Tab with points list and analysis settings""" - pointsPanel = wx.Panel(parent=self) - anSettingsPanel = wx.Panel(parent=pointsPanel) - maxDistPanel = wx.Panel(parent=anSettingsPanel) + pointsPanel = Panel(parent=self) + anSettingsPanel = Panel(parent=pointsPanel) + maxDistPanel = Panel(parent=anSettingsPanel) maxValue = 1e8 listBox = StaticBox(parent=pointsPanel, id=wx.ID_ANY, @@ -254,18 +257,20 @@ def _createPointsPage(self): parent=maxDistPanel, id=wx.ID_ANY, label=_("Maximum distance of point to the network:")) self.anSettings["max_dist"] = SpinCtrl( - parent=maxDistPanel, id=wx.ID_ANY, min=0, max=maxValue) + parent=maxDistPanel, id=wx.ID_ANY, min=0, max=maxValue, + size=(150, -1), + ) self.anSettings["max_dist"].Bind( wx.EVT_SPINCTRL, lambda event: self.MaxDist()) self.anSettings["max_dist"].SetValue(100000) # TODO init val self.MaxDist() - #showCutPanel = wx.Panel(parent = anSettingsPanel) - # self.anSettings["show_cut"] = wx.CheckBox(parent = showCutPanel, id=wx.ID_ANY, + #showCutPanel = Panel(parent = anSettingsPanel) + # self.anSettings["show_cut"] = CheckBox(parent = showCutPanel, id=wx.ID_ANY, # label = _("Show minimal cut")) #self.anSettings["show_cut"].Bind(wx.EVT_CHECKBOX, self.OnShowCut) - isoLinesPanel = wx.Panel(parent=anSettingsPanel) + isoLinesPanel = Panel(parent=anSettingsPanel) isoLineslabel = StaticText( parent=isoLinesPanel, id=wx.ID_ANY, @@ -347,7 +352,7 @@ def OnShowCut(self, event): def _createOutputPage(self): """Tab with output console""" - outputPanel = wx.Panel(parent=self) + outputPanel = Panel(parent=self) self.notebook.AddPage(page=outputPanel, text=_("Output"), name='output') @@ -364,7 +369,7 @@ def _createOutputPage(self): def _createParametersPage(self): """Tab for selection of data for analysis""" - dataPanel = scrolled.ScrolledPanel(parent=self) + dataPanel = ScrolledPanel(parent=self) self.notebook.AddPage(page=dataPanel, text=_('Parameters'), name='parameters') @@ -380,7 +385,7 @@ def _createParametersPage(self): ['node_column', "", ColumnSelect], ] - # self.useTurns = wx.CheckBox(parent = dataPanel, id=wx.ID_ANY, + # self.useTurns = CheckBox(parent = dataPanel, id=wx.ID_ANY, # label = _('Use turns')) box = StaticBox(dataPanel, -1, "Vector map and layers for analysis") @@ -390,7 +395,7 @@ def _createParametersPage(self): selPanels = {} for dataSel in dataSelects: - selPanels[dataSel[0]] = wx.Panel(parent=dataPanel) + selPanels[dataSel[0]] = Panel(parent=dataPanel) if dataSel[0] == 'input': self.inputData[ dataSel[0]] = dataSel[2]( @@ -497,33 +502,36 @@ def _doSelLayout(self, title, sel, btn=None): flag=wx.EXPAND | wx.ALL) selSizer.Add(selFiledSizer, proportion=0, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_VERTICAL, + flag=wx.EXPAND | wx.ALL, border=5) else: selSizer.Add(sel, proportion=1, - flag=wx.EXPAND | wx.ALL | wx.ALIGN_CENTER_VERTICAL, + flag=wx.EXPAND | wx.ALL, border=5) return selSizer - def _createInputDbMgrPage(self): - """Tab with attribute tables of analysis input layers""" - self.inpDbMgrData['dbMgr'] = DbMgrBase() - + def _checkSelectedVectorMap(self): + """Check selected vector map""" selMapName = None # if selected vector map is in layer tree then set it layer = self.giface.GetLayerList().GetSelectedLayer() if layer is not None and layer.type == 'vector': selMapName = layer.maplayer.name - - self.inpDbMgrData['browse'] = self.inpDbMgrData[ - 'dbMgr'].CreateDbMgrPage(parent=self.notebook, pageName='browse') - self.inpDbMgrData['browse'].SetTabAreaColour(globalvar.FNPageColor) + self._createInputDbMgrPage() self.inpDbMgrData['input'] = None if selMapName: self.inputData['input'].SetValue(selMapName) self.OnVectSel(None) + def _createInputDbMgrPage(self): + """Tab with attribute tables of analysis input layers""" + self.inpDbMgrData['dbMgr'] = DbMgrBase() + + self.inpDbMgrData['browse'] = self.inpDbMgrData[ + 'dbMgr'].CreateDbMgrPage(parent=self.notebook, pageName='browse') + self.inpDbMgrData['browse'].SetTabAreaColour(globalvar.FNPageColor) + def _updateInputDbMgrPage(self, show): """Show or hide input tables tab""" if show and self.notebook.GetPageIndexByName('inputDbMgr') == -1: @@ -531,7 +539,7 @@ def _updateInputDbMgrPage(self, show): text=_('Input tables'), name='inputDbMgr') elif not show: - self.notebook.RemovePage(page='inputDbMgr') + self.notebook.RemovePage(page=self.notebook.GetPageIndexByName('inputDbMgr')) def _createResultDbMgrPage(self): """Tab with attribute tables of analysis result layers""" @@ -540,11 +548,6 @@ def _createResultDbMgrPage(self): 'dbMgr'].CreateDbMgrPage(parent=self.notebook, pageName='browse') self.resultDbMgrData['browse'].SetTabAreaColour(globalvar.FNPageColor) - if self.tmp_result: - self.resultDbMgrData['input'] = self.tmp_result.GetVectMapName() - else: - self.resultDbMgrData['input'] = None - def _updateResultDbMgrPage(self): """Show or Hide Result tables tab""" # analysis, which created result @@ -555,11 +558,12 @@ def _updateResultDbMgrPage(self): analysis)["resultProps"]["dbMgr"] if haveDbMgr and self.notebook.GetPageIndexByName('resultDbMgr') == -1: + self._createResultDbMgrPage() self.notebook.AddPage(page=self.resultDbMgrData['browse'], text=_('Result tables'), name='resultDbMgr') elif not haveDbMgr: - self.notebook.RemovePage(page='resultDbMgr') + self.notebook.RemovePage(page=self.notebook.GetPageIndexByName('resultDbMgr')) def OnPageChanged(self, event): """Tab switched""" @@ -758,7 +762,10 @@ def OnVectSel(self, event): self.inputData['node_layer'].SetSelection(iItem) self.addToTreeBtn.Enable() - if hasattr(self, 'inpDbMgrData'): + if 'browse' in self.inpDbMgrData: + self._updateInputDbMgrPage(show=True) + else: + self._createInputDbMgrPage() self._updateInputDbMgrPage(show=True) self.OnALayerSel(event) @@ -817,9 +824,10 @@ def _parseMapStr(self, vectMapStr): return mapName, mapSet - def OnCloseDialog(self, event): + def OnCloseDialog(self, event=None): """Cancel dialog""" self.vnet_mgr.CleanUp() + self._mgr.UnInit() toolSwitcher = self.giface.GetMapDisplay().GetToolSwitcher() toolSwitcher.RemoveToolbarFromGroup( 'mouseUse', self.toolbars['pointsList']) @@ -828,7 +836,7 @@ def OnCloseDialog(self, event): def OnDefIsecTurnCosts(self, event): """Registers/unregisters mouse handler into map window""" - if self.defIsecTurnsHndlrReg == False: + if not self.defIsecTurnsHndlrReg: self.mapWin.RegisterMouseEventHandler(wx.EVT_LEFT_DOWN, self.OnDefIsecTurnCost, 'cross') @@ -1161,9 +1169,9 @@ def SetData(self, key, data): for k, v in six.iteritems(data): if k == "use": - if v and not self.IsChecked(idx): + if v and not self.IsItemChecked(idx): self.CheckItem(idx, True) - elif not v and self.IsChecked(idx): + elif not v and self.IsItemChecked(idx): self.CheckItem(idx, False) else: found = 0 @@ -1231,7 +1239,7 @@ def __init__( id=wx.ID_ANY, label=_('Color table style %s:') % '(v.net.flow)') - self.settings['color_table'] = wx.ComboBox( + self.settings['color_table'] = ComboBox( parent=self, id=wx.ID_ANY, choices=rules.split(), style=wx.CB_READONLY, size=(180, -1)) @@ -1243,7 +1251,7 @@ def __init__( if i != wx.NOT_FOUND: self.settings['color_table'].Select(i) - self.settings["invert_colors"] = wx.CheckBox( + self.settings["invert_colors"] = CheckBox( parent=self, id=wx.ID_ANY, label=_('Invert colors %s:') % @@ -1371,7 +1379,7 @@ def __init__( gridSizer = wx.GridBagSizer(vgap=1, hgap=1) row = 0 - setts = dict(self.colorsSetts.items() + self.sizeSetts.items()) + setts = {**self.colorsSetts, **self.sizeSetts} settsOrder = [ "selected", @@ -1503,7 +1511,7 @@ def __init__(self, parent, init_data, id=wx.ID_ANY, selPanels = {} for dataSel in dataSelects: - selPanels[dataSel[0]] = wx.Panel(parent=self) + selPanels[dataSel[0]] = Panel(parent=self) if dataSel[0] in ['input', 'output']: self.inputData[ dataSel[0]] = dataSel[2]( @@ -1632,7 +1640,7 @@ def __init__(self, parent, id=wx.ID_ANY, title=_( """Save analysis result""" wx.Dialog.__init__(self, parent, id, title=_(title), style=style) - self.panel = wx.Panel(parent=self) + self.panel = Panel(parent=self) box = StaticBox(parent=self.panel, id=wx.ID_ANY, label="Vector map") @@ -1798,7 +1806,7 @@ def __init__(self, parent, data, style=wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDE self.btnAdd = Button(parent=self, id=wx.ID_ANY, label="Add") self.btnRemove = Button(parent=self, id=wx.ID_ANY, label="Remove") self.btnClose = Button(parent=self, id=wx.ID_CLOSE) - self.useUTurns = wx.CheckBox( + self.useUTurns = CheckBox( parent=self, id=wx.ID_ANY, label="Use U-turns") self.btnAdd.Bind(wx.EVT_BUTTON, self.OnAddButtonClick) diff --git a/gui/wxpython/vnet/toolbars.py b/gui/wxpython/vnet/toolbars.py index 4a37c9ab261..3c48b8b8715 100644 --- a/gui/wxpython/vnet/toolbars.py +++ b/gui/wxpython/vnet/toolbars.py @@ -21,6 +21,7 @@ from icons.icon import MetaIcon from gui_core.toolbars import BaseToolbar, BaseIcons +from gui_core.wrap import ComboBox from core.gcmd import RunCommand @@ -193,7 +194,7 @@ def __init__(self, parent, vnet_mgr): choices.append( self.vnet_mgr.GetAnalysisProperties(moduleName)['label']) - self.anChoice = wx.ComboBox( + self.anChoice = ComboBox( parent=self, id=wx.ID_ANY, choices=choices, @@ -201,7 +202,7 @@ def __init__(self, parent, vnet_mgr): size=( 350, 30)) # FIXME - self.anChoice.SetToolTipString(_('Availiable analyses')) + self.anChoice.SetToolTip(_('Available analyses')) self.anChoice.SetSelection(0) self.anChoiceId = self.AddControl(self.anChoice) diff --git a/gui/wxpython/vnet/vnet_data.py b/gui/wxpython/vnet/vnet_data.py index de06c503f3a..aabc8e5b17c 100644 --- a/gui/wxpython/vnet/vnet_data.py +++ b/gui/wxpython/vnet/vnet_data.py @@ -23,7 +23,6 @@ @author Eliska Kyzlikova (turn costs support) """ import os -import types import six from copy import deepcopy @@ -695,7 +694,7 @@ def _getInvalidParams(self, params): vectMaps = grass.list_grouped('vector')[mapSet] if not params["input"] or mapName not in vectMaps: - invParams = params.keys()[:] + invParams = list(params.keys())[:] return invParams # check arc/node layer @@ -1217,7 +1216,7 @@ def Add(self, key, subkey, value): if key not in self.newHistStepData: self.newHistStepData[key] = {} - if isinstance(subkey, types.ListType): + if isinstance(subkey, list): if subkey[0] not in self.newHistStepData[key]: self.newHistStepData[key][subkey[0]] = {} self.newHistStepData[key][subkey[0]][subkey[1]] = value @@ -1271,7 +1270,7 @@ def _savePreviousHist(self, newHist, oldHist): removedHistStep = removedHistData[line] = {} continue else: - newHist.write('%s%s%s' % (os.linesep, line, os.linesep)) + newHist.write('%s%s%s' % ('\n', line, '\n')) self.histStepsNum = newHistStepsNum else: if newHistStepsNum >= self.maxHistSteps: @@ -1283,15 +1282,15 @@ def _savePreviousHist(self, newHist, oldHist): def _saveNewHistStep(self, newHist): """Save buffer (new step) data into file""" - newHist.write('%s%s%s' % (os.linesep, "history step=0", os.linesep)) + newHist.write('%s%s%s' % ('\n', "history step=0", '\n')) for key in list(self.newHistStepData.keys()): subkeys = list(self.newHistStepData[key].keys()) newHist.write('%s%s' % (key, self.sep)) for idx in range(len(subkeys)): value = self.newHistStepData[key][subkeys[idx]] - if isinstance(value, types.DictType): + if isinstance(value, dict): if idx > 0: - newHist.write('%s%s%s' % (os.linesep, key, self.sep)) + newHist.write('%s%s%s' % ('\n', key, self.sep)) newHist.write('%s%s' % (subkeys[idx], self.sep)) kvalues = list(self.newHistStepData[key][subkeys[idx]].keys()) srange = range(len(kvalues)) @@ -1308,16 +1307,16 @@ def _saveNewHistStep(self, newHist): else: if idx > 0 and isinstance( self.newHistStepData[key][subkeys[idx - 1]], - types.DictType): - newHist.write('%s%s%s' % (os.linesep, key, self.sep)) + dict): + newHist.write('%s%s%s' % ('\n', key, self.sep)) value = self._parseValue( self.newHistStepData[key][subkeys[idx]]) newHist.write('%s%s%s' % (subkeys[idx], self.sep, value)) if idx < len(subkeys) - 1 and not isinstance( self.newHistStepData[key][subkeys[idx + 1]], - types.DictType): + dict): newHist.write('%s' % self.sep) - newHist.write(os.linesep) + newHist.write('\n') self.histStepsNum = 0 def _parseValue(self, value, read=False): @@ -1417,7 +1416,7 @@ def _parseLine(self, line, histStepData): if key not in histStepData: histStepData[key] = {} - if isinstance(subkey, types.ListType): + if isinstance(subkey, list): if subkey[0] not in histStepData[key]: histStepData[key][subkey[0]] = {} histStepData[key][subkey[0]][subkey[1]] = value diff --git a/gui/wxpython/vnet/widgets.py b/gui/wxpython/vnet/widgets.py index 6a0ec6d1222..ca50b6c8e2a 100644 --- a/gui/wxpython/vnet/widgets.py +++ b/gui/wxpython/vnet/widgets.py @@ -24,12 +24,14 @@ from copy import copy, deepcopy import wx -from wx.lib.mixins.listctrl import CheckListCtrlMixin, ColumnSorterMixin, \ +from wx.lib.mixins.listctrl import ColumnSorterMixin, \ ListCtrlAutoWidthMixin, TextEditMixin from core import globalvar -from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, ListCtrl, \ - BitmapFromImage +from gui_core.wrap import ( + BitmapFromImage, Button, ComboBox, ListCtrl, Panel, StaticBox, + StaticText, TextCtrl, CheckListCtrlMixin +) if sys.version_info.major >= 3: basestring = str @@ -555,7 +557,7 @@ def __init__( wx.Dialog.__init__(self, parent, id, title=_(title), style=style) self.parent = parent - panel = wx.Panel(parent=self) + panel = Panel(parent=self) sizer = wx.BoxSizer(wx.VERTICAL) box = StaticBox(parent=panel, id=wx.ID_ANY, @@ -575,10 +577,10 @@ def __init__( # Select if type(cell[2]).__name__ == "list": - self.fields.append(wx.ComboBox(parent=panel, id=wx.ID_ANY, - choices=cell[2], - style=wx.CB_READONLY, - size=(110, -1))) + self.fields.append(ComboBox(parent=panel, id=wx.ID_ANY, + choices=cell[2], + style=wx.CB_READONLY, + size=(110, -1))) # Text field else: if cell[2] == float: diff --git a/gui/wxpython/web_services/dialogs.py b/gui/wxpython/web_services/dialogs.py index 151f5876f85..6bb9ae6c82f 100644 --- a/gui/wxpython/web_services/dialogs.py +++ b/gui/wxpython/web_services/dialogs.py @@ -37,7 +37,7 @@ from core.gconsole import CmdThread, GStderr, EVT_CMD_DONE, EVT_CMD_OUTPUT from gui_core.gselect import Select -from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl +from gui_core.wrap import Button, StaticText, StaticBox, TextCtrl, RadioButton from web_services.widgets import WSPanel, WSManageSettingsWidget @@ -363,8 +363,6 @@ def OnOutputLayerName(self, event): """Update layer name to web service panel """ lname = event.GetString() - lname = lname.encode('ascii', 'replace') - for v in six.itervalues(self.ws_panels): v['panel'].SetOutputLayerName(lname.strip()) @@ -869,17 +867,17 @@ def _createWidgets(self): self.region_types_order = ['display', 'comp', 'named'] self.region_types = {} - self.region_types['display'] = wx.RadioButton( + self.region_types['display'] = RadioButton( parent=self, label=_("Map display"), style=wx.RB_GROUP) - self.region_types['comp'] = wx.RadioButton( + self.region_types['comp'] = RadioButton( parent=self, label=_("Computational region")) - self.region_types['named'] = wx.RadioButton( + self.region_types['named'] = RadioButton( parent=self, label=_("Named region")) - self.region_types['display'].SetToolTipString( + self.region_types['display'].SetToolTip( _("Extent and resolution" " are based on Map Display geometry.")) - self.region_types['comp'].SetToolTipString( + self.region_types['comp'].SetToolTip( _("Extent and resolution" " are based on computational region.")) - self.region_types['named'].SetToolTipString( + self.region_types['named'].SetToolTip( _("Extent and resolution" " are based on named region.")) self.region_types['display'].SetValue( True) # set default as map display diff --git a/gui/wxpython/web_services/widgets.py b/gui/wxpython/web_services/widgets.py index fa84e46b579..1264d1c53de 100644 --- a/gui/wxpython/web_services/widgets.py +++ b/gui/wxpython/web_services/widgets.py @@ -37,15 +37,6 @@ else: import wx.lib.flatnotebook as FN import wx.lib.colourselect as csel -import wx.lib.mixins.listctrl as listmix -from wx.lib.newevent import NewEvent -if globalvar.wxPythonPhoenix: - try: - from agw.hypertreelist import HyperTreeList as TreeListCtrl - except ImportError: # if it's not there locally, try the wxPython lib. - from wx.lib.agw.hypertreelist import HyperTreeList as TreeListCtrl -else: - from wx.gizmos import TreeListCtrl from core.debug import Debug from core.gcmd import GWarning, GMessage @@ -55,8 +46,8 @@ from gui_core.widgets import GNotebook from gui_core.widgets import ManageSettingsWidget -from gui_core.wrap import SpinCtrl, Button, StaticText, StaticBox, \ - TextCtrl +from gui_core.wrap import Button, ScrolledPanel, SpinCtrl, StaticBox, \ + StaticText, TextCtrl, TreeCtrl import grass.script as grass @@ -156,6 +147,8 @@ def __init__(self, parent, web_service, **kwargs): self.Bind(EVT_CMD_DONE, self.OnCapDownloadDone) self.Bind(EVT_CMD_OUTPUT, self.OnCmdOutput) + self.SetMinSize((-1, 300)) + def __del__(self): self.cmd_thread.abort(abortall=True) grass.try_remove(self.cap_file) @@ -250,7 +243,8 @@ def _advancedSettsPage(self): """ # TODO parse maxcol, maxrow, settings from d.wms module? # TODO OnEarth driver - add selection of time - adv_setts_panel = wx.Panel(parent=self, id=wx.ID_ANY) + adv_setts_panel = ScrolledPanel(parent=self, id=wx.ID_ANY, + style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER) self.notebook.AddPage(page=adv_setts_panel, text=_('Advanced request settings'), name='adv_req_setts') @@ -307,7 +301,7 @@ def _advancedSettsPage(self): self.params['maxrows'].SetValue(val) self.flags['o'] = self.params['bgcolor'] = None - if not 'o' in self.drv_props['ignored_flags']: + if 'o' not in self.drv_props['ignored_flags']: self.flags['o'] = wx.CheckBox( parent=adv_setts_panel, id=wx.ID_ANY, label=_("Do not request transparent data")) @@ -420,6 +414,8 @@ def _advancedSettsPage(self): border=5) adv_setts_panel.SetSizer(border) + adv_setts_panel.SetAutoLayout(True) + adv_setts_panel.SetupScrolling() def OnUp(self, event): """Move selected layer up @@ -448,7 +444,7 @@ def OnDown(self, event): def _updateLayerOrderList(self, selected=None): """Update order in list. """ - def getlayercaption(layer): + def getlayercaption(l): if l['title']: cap = (l['title']) else: @@ -722,7 +718,7 @@ def CreateCmd(self): i_method = self.params['method'].GetSelection() lcmd.append('method=' + self.reproj_methods[i_method]) - if not 'o' in self.drv_props['ignored_flags'] and \ + if 'o' not in self.drv_props['ignored_flags'] and \ self.flags['o'].IsChecked(): lcmd.append('-o') @@ -846,7 +842,7 @@ def _updateFormatRadioBox(self, formats_list): choices=formats_list, majorDimension=4, style=wx.RA_SPECIFY_COLS) - self.source_sizer.Insert(item=self.params['format'], before=2, + self.source_sizer.Insert(2, window=self.params['format'], flag=wx.LEFT | wx.RIGHT | wx.BOTTOM, border=5) @@ -918,8 +914,7 @@ def GetWebService(self): """ return self.ws - -class LayersList(TreeListCtrl, listmix.ListCtrlAutoWidthMixin): +class LayersList(TreeCtrl): def __init__(self, parent, web_service, style, pos=wx.DefaultPosition): """List of layers and styles available in capabilities file @@ -927,18 +922,7 @@ def __init__(self, parent, web_service, style, pos=wx.DefaultPosition): self.parent = parent self.ws = web_service - TreeListCtrl.__init__(self, parent=parent, id=wx.ID_ANY, style=style) - - # setup mixins - listmix.ListCtrlAutoWidthMixin.__init__(self) - if self.ws != 'OnEarth': - self.AddColumn(_('Name')) - self.AddColumn(_('Type')) - else: - self.AddColumn(_('Layer name')) - - self.SetMainColumn(0) # column with the tree - self.setResizeColumn(0) + TreeCtrl.__init__(self, parent=parent, id=wx.ID_ANY, style=style) self.root = None self.Bind(wx.EVT_TREE_SEL_CHANGING, self.OnListSelChanging) @@ -970,10 +954,6 @@ def gettitle(layer): return layer_title def addlayer(layer, item): - - if self.ws != 'OnEarth': - self.SetItemText(item, _('layer'), 1) - styles = layer.GetLayerData('styles') def_st = None @@ -991,14 +971,12 @@ def addlayer(layer, item): def_st = st style_item = self.AppendItem(item, style_name) - if self.ws != 'OnEarth': - self.SetItemText(style_item, _('style'), 1) - self.SetPyData(style_item, {'type': 'style', + self.SetItemData(style_item, {'type': 'style', 'layer': layer, # it is parent layer of style 'style': st}) - self.SetPyData(item, {'type': 'layer', # is it layer or style? + self.SetItemData(item, {'type': 'layer', # is it layer or style? 'layer': layer, # Layer instance from web_services.cap_interface 'style': def_st}) # layer can have assigned default style @@ -1030,13 +1008,13 @@ def GetSelectedLayers(self): sel_layers_dict = [] for s in sel_layers: try: - layer = self.GetPyData(s)['layer'] + layer = self.GetItemData(s)['layer'] except ValueError: continue sel_layers_dict.append({ 'name': layer.GetLayerData('name'), 'title': layer.GetLayerData('title'), - 'style': self.GetPyData(s)['style'], + 'style': self.GetItemData(s)['style'], 'cap_intf_l': layer }) return sel_layers_dict @@ -1052,23 +1030,23 @@ def _selectRequestableChildren(item, list_to_check, items_to_sel): self.Expand(item) child_item, cookie = self.GetFirstChild(item) - while child_item.IsOk(): - if self.GetPyData(child_item)['layer'].IsRequestable() \ + while child_item and child_item.IsOk(): + if self.GetItemData(child_item)['layer'].IsRequestable() \ and not self.IsSelected(child_item): items_to_sel.append(child_item) - elif not self.GetPyData(child_item)['layer'].IsRequestable(): + elif not self.GetItemData(child_item)['layer'].IsRequestable(): list_to_check.append(child_item) child_item, cookie = self.GetNextChild(item, cookie) cur_item = event.GetItem() - if not self.GetPyData(cur_item)['layer'].IsRequestable(): + if not self.GetItemData(cur_item)['layer'].IsRequestable(): event.Veto() if not self.HasFlag(wx.TR_MULTIPLE): return - _emitSelected(self.GetPyData(cur_item)['layer']) + _emitSelected(self.GetItemData(cur_item)['layer']) items_to_chck = [] items_to_sel = [] @@ -1083,9 +1061,9 @@ def _selectRequestableChildren(item, list_to_check, items_to_sel): break while items_to_sel: - self.SelectItem(items_to_sel.pop(), unselect_others=False) + self.SelectItem(items_to_sel.pop(), select=True) else: - _emitSelected(self.GetPyData(cur_item)['layer']) + _emitSelected(self.GetItemData(cur_item)['layer']) def GetItemCount(self): """Required for listmix.ListCtrlAutoWidthMixin @@ -1105,9 +1083,9 @@ def SelectLayers(self, l_st_list): """ def checknext(item, l_st_list, items_to_sel): def compare(item, l_name, st_name): - it_l_name = self.GetPyData(item)['layer'].GetLayerData('name') - it_st = self.GetPyData(item)['style'] - it_type = self.GetPyData(item)['type'] + it_l_name = self.GetItemData(item)['layer'].GetLayerData('name') + it_st = self.GetItemData(item)['style'] + it_type = self.GetItemData(item)['type'] if it_l_name == l_name and ((not it_st and not st_name) or ( it_st and it_st['name'] == st_name and it_type == 'style')): @@ -1125,7 +1103,7 @@ def compare(item, l_name, st_name): break if len(items_to_sel) == len(l_st_list): - item = self.GetNext(item) + item = self.GetNextVisible(item) if not item.IsOk(): return checknext(item, l_st_list, items_to_sel) @@ -1145,11 +1123,11 @@ def compare(item, l_name, st_name): continue item, l_st = i - un_o = True + keep = False if self.HasFlag(wx.TR_MULTIPLE): - un_o = False + keep = True - self.SelectItem(item, unselect_others=un_o) + self.SelectItem(item, select=keep) l_st_list.remove(l_st) return l_st_list diff --git a/gui/wxpython/wxplot/base.py b/gui/wxpython/wxplot/base.py index 9e47ae7ed10..9912918a004 100755 --- a/gui/wxpython/wxplot/base.py +++ b/gui/wxpython/wxplot/base.py @@ -56,7 +56,7 @@ class BasePlotFrame(wx.Frame): """Abstract PyPlot display frame class""" - def __init__(self, parent=None, size=wx.Size(700, 400), + def __init__(self, parent=None, giface=None, size=wx.Size(700, 400), style=wx.DEFAULT_FRAME_STYLE, rasterList=[], **kwargs): wx.Frame.__init__( @@ -68,6 +68,7 @@ def __init__(self, parent=None, size=wx.Size(700, 400), **kwargs) self.parent = parent # MapFrame for a plot type + self._giface = giface self.Map = Map() # instance of render.Map to be associated with display self.rasterList = rasterList # list of rasters to plot self.raster = {} # dictionary of raster maps and their plotting parameters @@ -145,9 +146,12 @@ def InitPlotOpts(self, plottype): self.properties['font'] = {} self.properties['font']['prop'] = UserSettings.Get( group=self.plottype, key='font') - self.properties['font']['wxfont'] = wx.Font(11, wx.FONTFAMILY_SWISS, - wx.FONTSTYLE_NORMAL, - wx.FONTWEIGHT_NORMAL) + self.wx_font = wx.Font( + self.properties['font']['prop']['defaultSize'], + self.properties['font']['prop']['family'], + self.properties['font']['prop']['style'], + self.properties['font']['prop']['weight'], + ) self.properties['raster'] = {} self.properties['raster'] = UserSettings.Get( @@ -191,15 +195,15 @@ def InitPlotOpts(self, plottype): # x and y axis set to normal (non-log) self.client.logScale = (False, False) - if self.properties['x-axis']['prop']['type']: - self.client.xSpec = self.properties['x-axis']['prop']['type'] + if self.properties['x-axis']['prop']['type'] == 'custom': + self.client.xSpec = 'min' else: - self.client.xSpec = 'auto' + self.client.xSpec = self.properties['x-axis']['prop']['type'] - if self.properties['y-axis']['prop']['type']: - self.client.ySpec = self.properties['y-axis']['prop']['type'] + if self.properties['y-axis']['prop']['type'] == 'custom': + self.client.ySpec = 'min' else: - self.client.ySpec = 'auto' + self.client.ySpec = self.properties['y-axis']['prop']['type'] def InitRasterOpts(self, rasterList, plottype): """Initialize or update raster dictionary for plotting @@ -336,7 +340,7 @@ def InitRasterPairs(self, rasterList, plottype): def SetGraphStyle(self): """Set plot and text options """ - self.client.SetFont(self.properties['font']['wxfont']) + self.client.SetFont(self.wx_font) self.client.fontSizeTitle = self.properties['font']['prop']['titleSize'] self.client.fontSizeAxis = self.properties['font']['prop']['axisSize'] @@ -372,10 +376,10 @@ def SetGraphStyle(self): else: self.properties['y-axis']['axis'] = None - if self.properties['x-axis']['prop']['log'] == True: + if self.properties['x-axis']['prop']['log']: self.properties['x-axis']['axis'] = None self.client.xSpec = 'min' - if self.properties['y-axis']['prop']['log'] == True: + if self.properties['y-axis']['prop']['log']: self.properties['y-axis']['axis'] = None self.client.ySpec = 'min' @@ -561,7 +565,7 @@ def OnPlotText(self, dlg): def UpdateLabels(self): x, y = self._getPlotLabels() - self.client.SetFont(self.properties['font']['wxfont']) + self.client.SetFont(self.wx_font) self.client.fontSizeTitle = self.properties['font']['prop']['titleSize'] self.client.fontSizeAxis = self.properties['font']['prop']['axisSize'] @@ -572,7 +576,7 @@ def UpdateLabels(self): def PlotText(self, event): """Set custom text values for profile title and axis labels. """ - dlg = TextDialog(parent=self, id=wx.ID_ANY, + dlg = TextDialog(parent=self, giface=self._giface, id=wx.ID_ANY, plottype=self.plottype, title=_('Text settings')) @@ -586,7 +590,7 @@ def PlotOptions(self, event): options. Calls OptDialog class. """ - dlg = OptDialog(parent=self, id=wx.ID_ANY, + dlg = OptDialog(parent=self, giface=self._giface, id=wx.ID_ANY, plottype=self.plottype, title=_('Plot settings')) btnval = dlg.ShowModal() diff --git a/gui/wxpython/wxplot/dialogs.py b/gui/wxpython/wxplot/dialogs.py index ece8ebd5192..ebd76be7e3b 100755 --- a/gui/wxpython/wxplot/dialogs.py +++ b/gui/wxpython/wxplot/dialogs.py @@ -22,15 +22,15 @@ import os import wx -import wx.lib.colourselect as csel -import wx.lib.scrolledpanel as scrolled from core import globalvar from core.settings import UserSettings from core.globalvar import ICONDIR from gui_core.gselect import Select -from gui_core.wrap import SpinCtrl, Button, StaticText, \ - StaticBox, TextCtrl, Choice +from gui_core.wrap import ( + ColourSelect, ComboBox, Button, CheckBox, Choice, Panel, RadioButton, + ScrolledPanel, SpinCtrl, StaticBox, StaticText, TextCtrl, +) from grass.script import core as grass @@ -98,7 +98,7 @@ def _do_layout(self): parent=self, id=wx.ID_ANY, size=( 20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, flag=wx.GROW | - wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5) + wx.LEFT | wx.RIGHT, border=5) btnsizer = wx.StdDialogButtonSizer() @@ -211,7 +211,7 @@ def _do_layout(self): # box.Add(item = label, # flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0)) # types = ['normal', 'bubble'] -# scattertype = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1), +# scattertype = ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1), # choices = types, style = wx.CB_DROPDOWN) # scattertype.SetStringSelection(self.scattertype) # box.Add(item = scattertype, @@ -224,7 +224,7 @@ def _do_layout(self): parent=self, id=wx.ID_ANY, size=( 20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, flag=wx.GROW | - wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5) + wx.LEFT | wx.RIGHT, border=5) btnsizer = wx.StdDialogButtonSizer() @@ -296,7 +296,7 @@ def __init__(self, parent, id, message='', title='', wx.BITMAP_TYPE_ICO)) self.panel = wx.Panel(self) - sp = scrolled.ScrolledPanel( + sp = ScrolledPanel( self.panel, -1, size=(400, 400), style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER, name="Statistics") @@ -319,25 +319,25 @@ def __init__(self, parent, id, message='', title='', id=wx.ID_ANY, label=self.title) sizer.Add(statstitle, proportion=0, - flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=3) + flag=wx.GROW | wx.ALL, border=3) line = wx.StaticLine( parent=self.panel, id=wx.ID_ANY, size=( 20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, - flag=wx.GROW | wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=3) + flag=wx.GROW | wx.ALL, border=3) for stats in self.message: statstxt = StaticText(parent=sp, id=wx.ID_ANY, label=stats) statstxt.SetBackgroundColour("WHITE") txtSizer.Add( statstxt, proportion=1, - flag=wx.EXPAND | wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, + flag=wx.EXPAND | wx.LEFT | wx.RIGHT, border=3) line = wx.StaticLine( parent=sp, id=wx.ID_ANY, size=( 20, -1), style=wx.LI_HORIZONTAL) txtSizer.Add(line, proportion=0, flag=wx.GROW | - wx.ALIGN_CENTER_VERTICAL | wx.ALL, border=3) + wx.ALL, border=3) sp.SetSizer(txtSizer) sp.SetAutoLayout(1) @@ -350,7 +350,7 @@ def __init__(self, parent, id, message='', title='', parent=self.panel, id=wx.ID_ANY, size=( 20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, flag=wx.GROW | - wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=3) + wx.LEFT | wx.RIGHT, border=3) # # buttons @@ -363,7 +363,7 @@ def __init__(self, parent, id, message='', title='', btnSizer.Add( btn_clipboard, proportion=0, - flag=wx.ALIGN_LEFT | wx.ALL, + flag=wx.ALL, border=5) btnCancel = Button(self.panel, wx.ID_CLOSE) @@ -371,13 +371,13 @@ def __init__(self, parent, id, message='', title='', btnSizer.Add( btnCancel, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, + flag=wx.ALL, border=5) sizer.Add( btnSizer, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, + flag=wx.ALL, border=5) # bindings @@ -469,7 +469,7 @@ def _do_layout(self): self.rselection = Select(self, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE, type='cell') - if self.groupRadio.GetValue() == True: + if self.groupRadio.GetValue(): self.rselection.Disable() else: rastText = '' @@ -488,7 +488,7 @@ def _do_layout(self): self.gselection = Select(self, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE, type='group') - if self.rasterRadio.GetValue() == True: + if self.rasterRadio.GetValue(): self.gselection.Disable() else: if self.group is not None: @@ -516,7 +516,7 @@ def _do_layout(self): box.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(4, 0)) types = ['count', 'percent', 'area'] - histtype = wx.ComboBox(parent=self, id=wx.ID_ANY, size=(250, -1), + histtype = ComboBox(parent=self, id=wx.ID_ANY, size=(250, -1), choices=types, style=wx.CB_DROPDOWN) histtype.SetStringSelection(self.histtype) box.Add(histtype, @@ -529,7 +529,7 @@ def _do_layout(self): parent=self, id=wx.ID_ANY, size=( 20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, flag=wx.GROW | - wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=5) + wx.LEFT | wx.RIGHT, border=5) btnsizer = wx.StdDialogButtonSizer() @@ -613,7 +613,7 @@ def OnSetHisttypes(self, event): class TextDialog(wx.Dialog): - def __init__(self, parent, id, title, plottype='', + def __init__(self, parent, giface, id, title, plottype='', style=wx.DEFAULT_DIALOG_STYLE, **kwargs): """Dialog to set histogram text options: font, title and font size, axis labels and font size @@ -622,6 +622,7 @@ def __init__(self, parent, id, title, plottype='', # # initialize variables # + self._giface = giface # combo box entry lists self.ffamilydict = {'default': wx.FONTFAMILY_DEFAULT, 'decorative': wx.FONTFAMILY_DECORATIVE, @@ -649,9 +650,9 @@ def __init__(self, parent, id, title, plottype='', self.properties = self.parent.properties # read-only # font size - self.fontfamily = self.properties['font']['wxfont'].GetFamily() - self.fontstyle = self.properties['font']['wxfont'].GetStyle() - self.fontweight = self.properties['font']['wxfont'].GetWeight() + self.fontfamily = self.parent.wx_font.GetFamily() + self.fontstyle = self.parent.wx_font.GetStyle() + self.fontweight = self.parent.wx_font.GetWeight() self._do_layout() @@ -760,7 +761,7 @@ def _do_layout(self): id=wx.ID_ANY, label=_("Font family:")) gridSizer.Add(label1, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0)) - self.ffamilycb = wx.ComboBox( + self.ffamilycb = ComboBox( parent=self, id=wx.ID_ANY, size=(250, -1), choices=list(self.ffamilydict.keys()), style=wx.CB_DROPDOWN) @@ -776,7 +777,7 @@ def _do_layout(self): # label = StaticText(parent=self, id=wx.ID_ANY, label=_("Style:")) gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0)) - self.fstylecb = wx.ComboBox( + self.fstylecb = ComboBox( parent=self, id=wx.ID_ANY, size=(250, -1), choices=list(self.fstyledict.keys()), style=wx.CB_DROPDOWN) @@ -792,7 +793,7 @@ def _do_layout(self): # label = StaticText(parent=self, id=wx.ID_ANY, label=_("Weight:")) gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0)) - self.fwtcb = wx.ComboBox( + self.fwtcb = ComboBox( parent=self, size=(250, -1), choices=list(self.fwtdict.keys()), style=wx.CB_DROPDOWN) @@ -813,7 +814,7 @@ def _do_layout(self): parent=self, id=wx.ID_ANY, size=( 20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, flag=wx.GROW | - wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=3) + wx.LEFT | wx.RIGHT, border=3) # # buttons @@ -834,7 +835,6 @@ def _do_layout(self): btnSave.Bind(wx.EVT_BUTTON, self.OnSave) btnSave.SetToolTip( _("Apply and save changes to user settings file (default for next sessions)")) - btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel) btnCancel.SetToolTip(_("Close dialog and ignore changes")) # sizers @@ -848,17 +848,17 @@ def _do_layout(self): btnSizer.Add( btnSave, proportion=0, - flag=wx.ALIGN_LEFT | wx.ALL, + flag=wx.ALL, border=5) btnSizer.Add( btnStdSizer, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, + flag=wx.ALL, border=5) sizer.Add( btnSizer, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, + flag=wx.ALL, border=5) # @@ -887,11 +887,14 @@ def UpdateSettings(self): 'axisSize'] = self.axislabelsize.GetValue() family = self.ffamilydict[self.ffamilycb.GetStringSelection()] - self.properties['font']['wxfont'].SetFamily(family) + self.properties['font']['prop']['family'] = family + self.parent.wx_font.SetFamily(family) style = self.fstyledict[self.fstylecb.GetStringSelection()] - self.properties['font']['wxfont'].SetStyle(style) + self.properties['font']['prop']['style'] = style + self.parent.wx_font.SetStyle(style) weight = self.fwtdict[self.fwtcb.GetStringSelection()] - self.properties['font']['wxfont'].SetWeight(weight) + self.properties['font']['prop']['weight'] = weight + self.parent.wx_font.SetWeight(weight) def OnSave(self, event): """Button 'Save' pressed""" @@ -900,7 +903,7 @@ def OnSave(self, event): UserSettings.ReadSettingsFile(settings=fileSettings) fileSettings[self.plottype] = UserSettings.Get(group=self.plottype) UserSettings.SaveToFile(fileSettings) - self.parent.parent.GetLayerManager().GetLogWindow().WriteLog( + self._giface.WriteLog( _('Plot text sizes saved to file \'%s\'.') % UserSettings.filePath) self.EndModal(wx.ID_OK) @@ -914,14 +917,10 @@ def OnOk(self, event): self.OnApply(None) self.EndModal(wx.ID_OK) - def OnCancel(self, event): - """Button 'Cancel' pressed""" - self.EndModal(wx.ID_CANCEL) - class OptDialog(wx.Dialog): - def __init__(self, parent, id, title, plottype='', + def __init__(self, parent, giface, id, title, plottype='', style=wx.DEFAULT_DIALOG_STYLE, **kwargs): """Dialog to set various options for data plotted, including: line width, color, style; marker size, color, fill, and style; grid @@ -931,6 +930,7 @@ def __init__(self, parent, id, title, plottype='', # init variables self.parent = parent + self._giface = giface self.linestyledict = parent.linestyledict self.ptfilldict = parent.ptfilldict self.parent = parent @@ -1041,7 +1041,7 @@ def _do_layout(self): pos=( row, 0)) - color = csel.ColourSelect( + color = ColourSelect( parent=self, id=wx.ID_ANY, colour=self.raster[ self.map]['pcolor']) self.wxId['pcolor'] = color.GetId() @@ -1113,7 +1113,7 @@ def _do_layout(self): pos=( 0, 0)) - ptcolor = csel.ColourSelect( + ptcolor = ColourSelect( parent=self, id=wx.ID_ANY, colour=self.properties['marker']['color']) @@ -1195,7 +1195,7 @@ def _do_layout(self): pos=( 0, 0)) - ptcolor = csel.ColourSelect( + ptcolor = ColourSelect( parent=self, id=wx.ID_ANY, colour=self.raster[ self.map]['pcolor']) self.wxId['pcolor'] = ptcolor.GetId() @@ -1332,7 +1332,7 @@ def _do_layout(self): gridSizer.Add(max, pos=(row, 1)) row += 1 - log = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Log scale")) + log = CheckBox(parent=self, id=wx.ID_ANY, label=_("Log scale")) log.SetValue(prop['log']) self.wxId[atype]['log'] = log.GetId() gridSizer.Add(log, pos=(row, 0), span=(1, 2)) @@ -1363,7 +1363,7 @@ def _do_layout(self): row = 0 label = StaticText(parent=self, id=wx.ID_ANY, label=_("Grid color")) gridSizer.Add(label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0)) - gridcolor = csel.ColourSelect( + gridcolor = ColourSelect( parent=self, id=wx.ID_ANY, colour=self.properties['grid']['color']) @@ -1371,7 +1371,7 @@ def _do_layout(self): gridSizer.Add(gridcolor, pos=(row, 1)) row += 1 - gridshow = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Show grid")) + gridshow = CheckBox(parent=self, id=wx.ID_ANY, label=_("Show grid")) gridshow.SetValue(self.properties['grid']['enabled']) self.wxId['grid']['enabled'] = gridshow.GetId() gridSizer.Add(gridshow, pos=(row, 0), span=(1, 2)) @@ -1391,7 +1391,7 @@ def _do_layout(self): gridSizer.Add(legendfontsize, pos=(row, 1)) row += 1 - legendshow = wx.CheckBox( + legendshow = CheckBox( parent=self, id=wx.ID_ANY, label=_("Show legend")) @@ -1413,7 +1413,7 @@ def _do_layout(self): parent=self, id=wx.ID_ANY, size=( 20, -1), style=wx.LI_HORIZONTAL) sizer.Add(line, proportion=0, flag=wx.GROW | - wx.ALIGN_CENTER_VERTICAL | wx.LEFT | wx.RIGHT, border=3) + wx.LEFT | wx.RIGHT, border=3) # # buttons @@ -1443,17 +1443,17 @@ def _do_layout(self): btnSizer.Add( btnSave, proportion=0, - flag=wx.ALIGN_LEFT | wx.ALL, + flag=wx.ALL, border=5) btnSizer.Add( btnStdSizer, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, + flag=wx.ALL, border=5) sizer.Add( btnSizer, proportion=0, - flag=wx.ALIGN_RIGHT | wx.ALL, + flag=wx.ALL, border=5) # @@ -1464,7 +1464,6 @@ def _do_layout(self): btnOk.Bind(wx.EVT_BUTTON, self.OnOk) btnOk.SetDefault() btnSave.Bind(wx.EVT_BUTTON, self.OnSave) - btnCancel.Bind(wx.EVT_BUTTON, self.OnCancel) self.SetSizer(sizer) sizer.Fit(self) @@ -1593,9 +1592,9 @@ def OnSave(self, event): UserSettings.ReadSettingsFile(settings=fileSettings) fileSettings[self.plottype] = UserSettings.Get(group=self.plottype) UserSettings.SaveToFile(fileSettings) - self.parent.parent.GetLayerManager().GetLogWindow().WriteLog( + self._giface.WriteLog( _('Plot settings saved to file \'%s\'.') % UserSettings.filePath) - self.Close() + self.EndModal(wx.ID_OK) def OnApply(self, event): """Button 'Apply' pressed. Does not close dialog""" @@ -1608,7 +1607,3 @@ def OnOk(self, event): """Button 'OK' pressed""" self.OnApply(None) self.EndModal(wx.ID_OK) - - def OnCancel(self, event): - """Button 'Cancel' pressed""" - self.Close() diff --git a/gui/wxpython/wxplot/histogram.py b/gui/wxpython/wxplot/histogram.py index 9f32d810f49..1f5e8472b1c 100644 --- a/gui/wxpython/wxplot/histogram.py +++ b/gui/wxpython/wxplot/histogram.py @@ -32,9 +32,9 @@ class HistogramPlotFrame(BasePlotFrame): """Mainframe for displaying histogram of raster map. Uses wx.lib.plot. """ - def __init__(self, parent, id=wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE, + def __init__(self, parent, giface, id=wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE, size=wx.Size(700, 400), rasterList=[], **kwargs): - BasePlotFrame.__init__(self, parent, size=size, **kwargs) + BasePlotFrame.__init__(self, parent, giface=giface, size=size, **kwargs) self.toolbar = HistogramPlotToolbar(parent=self) # workaround for http://trac.wxwidgets.org/ticket/13888 diff --git a/gui/wxpython/wxplot/profile.py b/gui/wxpython/wxplot/profile.py index 02c233c4544..e77f7bda43c 100644 --- a/gui/wxpython/wxplot/profile.py +++ b/gui/wxpython/wxplot/profile.py @@ -36,9 +36,9 @@ class ProfileFrame(BasePlotFrame): """Mainframe for displaying profile of one or more raster maps. Uses wx.lib.plot. """ - def __init__(self, parent, controller, units, size=wx.Size(700, 400), + def __init__(self, parent, giface, controller, units, size=wx.Size(700, 400), rasterList=None, **kwargs): - BasePlotFrame.__init__(self, parent=parent, size=size, **kwargs) + BasePlotFrame.__init__(self, parent=parent, giface=giface, size=size, **kwargs) self.controller = controller self.controller.transectChanged.connect(self.SetTransect) diff --git a/gui/wxpython/wxplot/scatter.py b/gui/wxpython/wxplot/scatter.py index 4d41e0cf019..49b8ed05a11 100644 --- a/gui/wxpython/wxplot/scatter.py +++ b/gui/wxpython/wxplot/scatter.py @@ -32,10 +32,10 @@ class ScatterFrame(BasePlotFrame): """Mainframe for displaying bivariate scatter plot of two raster maps. Uses wx.lib.plot. """ - def __init__(self, parent, id=wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE, + def __init__(self, parent, giface, id=wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE, size=wx.Size(700, 400), rasterList=[], **kwargs): - BasePlotFrame.__init__(self, parent, size=size, **kwargs) + BasePlotFrame.__init__(self, parent, giface=giface, size=size, **kwargs) self.toolbar = ScatterToolbar(parent=self) # workaround for http://trac.wxwidgets.org/ticket/13888 @@ -260,7 +260,7 @@ def OnRegression(self, event): title = _('Regression Statistics for Scatterplot(s)') for rpair in self.rasterList: - if isinstance(rpair, tuple) == False: + if not isinstance(rpair, tuple): continue rast1, rast2 = rpair rast1 = rast1.split('@')[0] diff --git a/imagery/i.atcorr/create_iwave.py b/imagery/i.atcorr/create_iwave.py index dee98de8193..c751373e9f1 100644 --- a/imagery/i.atcorr/create_iwave.py +++ b/imagery/i.atcorr/create_iwave.py @@ -31,21 +31,21 @@ def usage(): """How to use this...""" - print "create_iwave.py " + print("create_iwave.py ") print - print "Generates filter function template for iwave.cpp from csv file. Note:" - print "- csv file must have wl response for each band in each column" - print "- first line must be a header with wl followed by band names" - print "- all following lines will be the data." - print "If spectral response is null, leave field empty in csv file. Example:" + print("Generates filter function template for iwave.cpp from csv file. Note:") + print("- csv file must have wl response for each band in each column") + print("- first line must be a header with wl followed by band names") + print("- all following lines will be the data.") + print("If spectral response is null, leave field empty in csv file. Example:") print - print "WL(nm),band 1,band 2,band 3,band 4" - print "455,0.93,,," - print "485,0.94,0.00,," - print "545,0.00,0.87,0.00," + print("WL(nm),band 1,band 2,band 3,band 4") + print("455,0.93,,,") + print("485,0.94,0.00,,") + print("545,0.00,0.87,0.00,") print - print "This script will interpolate the filter functions to 2.5 nm steps" - print "and output a cpp template file in the IWave format to be added to iwave.cpp" + print("This script will interpolate the filter functions to 2.5 nm steps") + print("and output a cpp template file in the IWave format to be added to iwave.cpp") def read_input(csvfile): """ @@ -64,7 +64,7 @@ def read_input(csvfile): bands = infile.readline().split(',') bands.remove(bands[0]) bands[-1] = bands[-1].strip() - print " > Number of bands found: %d" % len(bands) + print(" > Number of bands found: %d" % len(bands)) infile.close() # create converter dictionary for import @@ -197,7 +197,7 @@ def write_cpp(bands, values, sensor, folder): # keep in sync with IWave::parse() rthresh = 0.01 print - print " > Response peaks from interpolation to 2.5 nm steps:" + print(" > Response peaks from interpolation to 2.5 nm steps:") # getting necessary data # single or multiple bands? @@ -218,7 +218,7 @@ def write_cpp(bands, values, sensor, folder): while c < len(fi) - 1 and fi[c + 1] > rthresh: c = c + 1 max_wavelength = np.floor(li[0] * 1000 + (2.5 * c)) - print " %s (%inm - %inm)" % (bands[b], min_wavelength, max_wavelength) + print(" %s (%inm - %inm)" % (bands[b], min_wavelength, max_wavelength)) else: filter_f = [] @@ -240,7 +240,7 @@ def write_cpp(bands, values, sensor, folder): while c < len(fi) - 1 and fi[c + 1] > rthresh: c = c + 1 max_wavelength = np.floor(li[0] * 1000 + (2.5 * c)) - print " %s (%inm - %inm)" % (bands[b], min_wavelength, max_wavelength) + print(" %s (%inm - %inm)" % (bands[b], min_wavelength, max_wavelength)) # writing... outfile = open(os.path.join(folder, sensor+"_cpp_template.txt"), 'w') @@ -314,7 +314,7 @@ def main(): sensor = os.path.splitext(os.path.basename(inputfile))[0] print - print " > Getting sensor name from csv file: %s" % (sensor) + print(" > Getting sensor name from csv file: %s" % (sensor)) # getting data from file bands, values = read_input(inputfile) @@ -324,7 +324,7 @@ def main(): # around the peak response, keep in sync with IWave::parse() rthresh = 0.01 print - print " > Response peaks from input file:" + print(" > Response peaks from input file:") for b in range(1, len(bands) + 1): lowl = 0 hiwl = 0 @@ -346,15 +346,15 @@ def main(): hiwl = values[i,0] i += 1 - print " %s (%inm - %inm)" % (bands[b - 1], lowl, hiwl) + print(" %s (%inm - %inm)" % (bands[b - 1], lowl, hiwl)) # writing file in same folder of input file write_cpp(bands, values, sensor, os.path.dirname(inputfile)) print - print " > Filter functions exported to %s" % ("sensors_csv/"+sensor+"_cpp_template.txt") - print " > Please check this file for possible errors before inserting the code into file iwave.cpp" - print " > Don't forget to add the necessary data to the files iwave.h, geomcond.h, geomcond.cpp, and to i.atcorr.html" + print(" > Filter functions exported to %s" % ("sensors_csv/"+sensor+"_cpp_template.txt")) + print(" > Please check this file for possible errors before inserting the code into file iwave.cpp") + print(" > Don't forget to add the necessary data to the files iwave.h, geomcond.h, geomcond.cpp, and to i.atcorr.html") print return diff --git a/imagery/i.ortho.photo/i.ortho.camera/i.ortho.camera.html b/imagery/i.ortho.photo/i.ortho.camera/i.ortho.camera.html index 29b5bf57107..91d82cd7ffd 100644 --- a/imagery/i.ortho.photo/i.ortho.camera/i.ortho.camera.html +++ b/imagery/i.ortho.photo/i.ortho.camera/i.ortho.camera.html @@ -54,7 +54,7 @@

DESCRIPTION

calibration certificate) the center is the origin and the values are 0 for both X and Y of Point of Symmetry. But usually the principal point does not fall on the intersection of the radii at the center of the picture. This -excentricity is usually of the order of a few micrometers.

+eccentricity is usually of the order of a few micrometers.

You are then asked to enter the X and Y photo coordinates of each fiducial as follows. diff --git a/imagery/i.ortho.photo/i.ortho.elev/main.c b/imagery/i.ortho.photo/i.ortho.elev/main.c index ba0f4be3295..60245cfb843 100644 --- a/imagery/i.ortho.photo/i.ortho.elev/main.c +++ b/imagery/i.ortho.photo/i.ortho.elev/main.c @@ -48,13 +48,13 @@ int main(int argc, char *argv[]) char group[GNAME_MAX]; char *elev_layer; - char *mapset_elev; - char *location_elev; + char *mapset_elev, *mapset_elev_old; + char *location_elev, *location_elev_old; char *math_exp; char *units; char *nd; - char buf[100]; + char buf[GPATH_MAX]; int stat; int overwrite; @@ -111,30 +111,34 @@ int main(int argc, char *argv[]) elev_layer = (char *)G_malloc(GNAME_MAX * sizeof(char)); mapset_elev = (char *)G_malloc(GMAPSET_MAX * sizeof(char)); + mapset_elev_old = (char *)G_malloc(GMAPSET_MAX * sizeof(char)); location_elev = (char *)G_malloc(80 * sizeof(char)); + location_elev_old = (char *)G_malloc(80 * sizeof(char)); math_exp = (char *)G_malloc(80 * sizeof(char)); units = (char *)G_malloc(80 * sizeof(char)); nd = (char *)G_malloc(80 * sizeof(char)); *elev_layer = 0; *mapset_elev = 0; + *mapset_elev_old = 0; *location_elev = 0; + *location_elev_old = 0; *math_exp = 0; *units = 0; *nd = 0; strcpy(group, group_opt->answer); - if(loc_opt->answer) + if (loc_opt->answer) strcpy(location_elev, loc_opt->answer); - if(mapset_opt->answer) + if (mapset_opt->answer) strcpy(mapset_elev, mapset_opt->answer); /*if(elev_opt->answer) strcpy(elev_layer, elev_opt->answer);*/ - if(math_opt->answer) + if (math_opt->answer) strcpy(math_exp, math_opt->answer); - if(unit_opt->answer) + if (unit_opt->answer) strcpy(units, unit_opt->answer); - if(nd_opt->answer) + if (nd_opt->answer) strcpy(nd, nd_opt->answer); if (!I_get_target(group, location, mapset)) { @@ -149,17 +153,18 @@ int main(int argc, char *argv[]) /*Report the contents of the ELEVATION file as in the GROUP */ if (print_flag->answer) { /*If the content is empty report an error */ - if(!I_get_group_elev(group, elev_layer, mapset_elev, location_elev, math_exp, units, nd)){ + if (!I_get_group_elev(group, elev_layer, mapset_elev, location_elev, math_exp, units, nd)) { G_fatal_error(_("Cannot find default elevation map for target in group [%s]"),group); - /*If there is a content, report it as a message */ - } else { - G_message("map:\t\t\t%s",elev_layer); - G_message("mapset:\t\t\t%s",mapset_elev); - G_message("location:\t\t%s",location_elev); - G_message("math expression:\t%s",math_exp); - G_message("units:\t\t\t%s",units); - G_message("nodata value:\t\t%s",nd); - exit(EXIT_SUCCESS); + } + /*If there is a content, print it */ + else { + fprintf(stdout, "map:\t\t\t%s\n",elev_layer); + fprintf(stdout, "mapset:\t\t\t%s\n",mapset_elev); + fprintf(stdout, "location:\t\t%s\n",location_elev); + fprintf(stdout, "math expression:\t%s\n",math_exp); + fprintf(stdout, "units:\t\t\t%s\n",units); + fprintf(stdout, "nodata value:\t\t%s\n",nd); + exit(EXIT_SUCCESS); } } @@ -190,27 +195,44 @@ int main(int argc, char *argv[]) G_fatal_error(_("Elevation map name is missing. Please set '%s' option"), elev_opt->key); } - /* elevation map exists in target ? */ - if (G_find_raster2(elev_opt->answer, mapset) == NULL) { - /* select current location */ - select_current_env(); - G_fatal_error(_("Raster map <%s> not found"), elev_opt->answer); - } /* return to current Location/mapset to write in the group file */ select_current_env(); /* load information from the ELEVATION file in the GROUP */ - I_get_group_elev(group, elev_layer, mapset_elev, location_elev, math_exp, units, nd); - /* Modify ELEVATION file in source GROUP */ - I_put_group_elev(group,elev_opt->answer,mapset_opt->answer,loc_opt->answer, - math_opt->answer, unit_opt->answer, nd_opt->answer); + if (I_find_group_elev_file(group)) { + I_get_group_elev(group, elev_layer, mapset_elev_old, location_elev_old, + math_exp, units, nd); + if (*location_elev == 0) + strcpy(location_elev, location_elev_old); + if (*mapset_elev == 0) + strcpy(mapset_elev, mapset_elev_old); + } + /* if location and/or mapset of elevation are not set, use target */ + if (*mapset_elev == 0) + strcpy(mapset_elev, mapset); + if (*location_elev == 0) + strcpy(location_elev, location); + + /* select target location */ + select_target_env(); + /* elevation map exists in target ? */ + if (G_find_raster2(elev_opt->answer, mapset_elev) == NULL) { + /* select current location */ + select_current_env(); + G_fatal_error(_("Raster map <%s> not found"), elev_opt->answer); + } /* select current location */ select_current_env(); + /* Modify ELEVATION file in source GROUP */ + I_put_group_elev(group, elev_opt->answer, mapset_elev, location_elev, + math_exp, units, nd); + G_message(_("Group [%s] in location [%s] mapset [%s] now uses elevation map [%s]"), - group, location, mapset, elev_opt->answer); - }else{ + group, G_location(), G_mapset(), elev_opt->answer); + } + else { G_fatal_error(_("Mapset [%s] in target location [%s] - %s "), mapset, location, stat == 0 ? _("permission denied\n") : _("not found\n")); diff --git a/imagery/i.ortho.photo/i.ortho.init/i.ortho.init.html b/imagery/i.ortho.photo/i.ortho.init/i.ortho.init.html index e1cd1e82e2d..664acaf1219 100644 --- a/imagery/i.ortho.photo/i.ortho.init/i.ortho.init.html +++ b/imagery/i.ortho.photo/i.ortho.init/i.ortho.init.html @@ -32,15 +32,15 @@

DESCRIPTION

INITIAL XC: Meters __________ INITIAL YC: Meters __________ INITIAL ZC: Meters __________ - INITIAL omega (roll) degrees: __________ - INITIAL phi (pitch) degrees: __________ + INITIAL omega (pitch) degrees: __________ + INITIAL phi (roll) degrees: __________ INITIAL kappa (yaw) degrees: __________ Standard Deviation XC: Meters __________ Standard Deviation YC: Meters __________ Standard Deviation ZC: Meters __________ - Std. Dev. omega (roll) degrees: __________ - Std. Dev. phi (pitch) degrees: __________ + Std. Dev. omega (pitch) degrees: __________ + Std. Dev. phi (roll) degrees: __________ Std. Dev. kappa (yaw) degrees: __________ Use these values at run time? (1=yes, 0=no) @@ -67,24 +67,33 @@

DESCRIPTION

exposure.
    -
  • Omega (roll): Raising or lowering of the wings (turning around the - aircraft's axis); -
  • Phi (pitch): Raising or lowering of the aircraft's front (turning +
  • Omega (pitch): Raising or lowering of the aircraft's front (turning around the wings' axis); +
  • Phi (roll): Raising or lowering of the wings (turning around the + aircraft's axis);
  • Kappa (yaw): Rotation needed to align the aerial photo to true north: needs to be denoted as +90 degree for clockwise turn and -90 degree for a counterclockwise turn.
+ +

+If ground control points are available, the INITIAL values are iteratively +corrected. This is particularl useful when the INITIAL values are rather +rough estimates. +

The standard deviations for (XC,YC,ZC) are expressed in meters, and are used as a priori values for the standard deviations used in -computation of the ortho rectification parameters. +computation of the ortho rectification parameters. Higher values improve +the refinement of the initial camera exposure. As a rule of thumb, 5% +of the estimated target extents should be used.

The standard deviations for (omega,phi,kappa) are expressed in degrees, and are used as a priori values for the standard deviations used in -computation of the ortho rectification parameters. +computation of the ortho rectification parameters. As a rule of thumb, +2 degrees should be used.

If Use these values at run time? (1=yes, 0=no) is set to 0, the diff --git a/imagery/i.ortho.photo/i.ortho.init/main.c b/imagery/i.ortho.photo/i.ortho.init/main.c index a3806a43981..4bf82edb6f0 100644 --- a/imagery/i.ortho.photo/i.ortho.init/main.c +++ b/imagery/i.ortho.photo/i.ortho.init/main.c @@ -89,12 +89,12 @@ int main(int argc, char *argv[]) omega_opt = G_define_option(); omega_opt->key = "omega"; omega_opt->type = TYPE_DOUBLE; - omega_opt->description = _("Initial Camera Omega (roll) degrees"); + omega_opt->description = _("Initial Camera Omega (pitch) degrees"); phi_opt = G_define_option(); phi_opt->key = "phi"; phi_opt->type = TYPE_DOUBLE; - phi_opt->description = _("Initial Camera Phi (pitch) degrees"); + phi_opt->description = _("Initial Camera Phi (roll) degrees"); kappa_opt = G_define_option(); kappa_opt->key = "kappa"; @@ -104,12 +104,12 @@ int main(int argc, char *argv[]) omegasd_opt = G_define_option(); omegasd_opt->key = "omega_sd"; omegasd_opt->type = TYPE_DOUBLE; - omegasd_opt->description = _("Apriori Omega (roll) standard deviation"); + omegasd_opt->description = _("Apriori Omega (pitch) standard deviation"); phisd_opt = G_define_option(); phisd_opt->key = "phi_sd"; phisd_opt->type = TYPE_DOUBLE; - phisd_opt->description = _("Apriori Phi (pitch) standard deviation"); + phisd_opt->description = _("Apriori Phi (roll) standard deviation"); kappasd_opt = G_define_option(); kappasd_opt->key = "kappa_sd"; diff --git a/imagery/i.ortho.photo/i.ortho.photo/i.ortho.photo.html b/imagery/i.ortho.photo/i.ortho.photo/i.ortho.photo.html index 5ba4e3f21bf..48e5ae7a8e9 100644 --- a/imagery/i.ortho.photo/i.ortho.photo/i.ortho.photo.html +++ b/imagery/i.ortho.photo/i.ortho.photo/i.ortho.photo.html @@ -227,13 +227,13 @@

EXAMPLE

  • X: East aircraft position;
  • Y: North aircraft position;
  • Z: Flight heigh above surface;
  • -
  • Omega (roll): Raising or lowering of the wings (turning - around the aircraft's axis);
  • -
  • Phi (pitch): Raising or lowering of the aircraft's front +
  • Omega (pitch): Raising or lowering of the aircraft's front (turning around the wings' axis);
  • -
  • Kappa (yaw): Rotation needed to align the aerial photo to - true north: needs to be denoted as +90° for clockwise turn and - -90° for a counter-clockwise turn.
  • +
  • Phi (roll): Raising or lowering of the wings (turning + around the aircraft's axis);
  • +
  • Kappa (yaw): Rotation needed to align the aerial photo to + true north: needs to be denoted as +90° for clockwise turn and + -90° for a counter-clockwise turn.
  • @@ -325,6 +325,12 @@

    EXAMPLE

    +

    REFERENCES

    +Wolf P.R. (1983). Elements of Photogrammetry: With Air Photo +Interpretation and Remote Sensing +McGraw Hill Higher Education +ISBN-10: 0070713456, ISBN-13: 978-0070713451
    +

    SEE ALSO

    diff --git a/imagery/i.ortho.photo/i.ortho.rectify/cp.c b/imagery/i.ortho.photo/i.ortho.rectify/cp.c index 3cb96293491..c38c67699c0 100644 --- a/imagery/i.ortho.photo/i.ortho.rectify/cp.c +++ b/imagery/i.ortho.photo/i.ortho.rectify/cp.c @@ -4,17 +4,19 @@ int get_conz_points(struct Ortho_Image_Group *group) { - char msg[200]; + char msg[1024]; if (!I_get_con_points(group->name, &group->control_points)) - exit(0); + group->control_points.count = 0; sprintf(msg, _("Control Z Point file for group <%s@%s> - "), group->name, G_mapset()); G_verbose_message(_("Computing equations...")); + select_target_env(); Compute_ortho_equation(group); + select_current_env(); switch (group->con_equation_stat) { case -1: @@ -37,7 +39,7 @@ int get_conz_points(struct Ortho_Image_Group *group) int get_ref_points(struct Ortho_Image_Group *group) { - char msg[200]; + char msg[1024]; if (!I_get_ref_points(group->name, &group->photo_points)) exit(0); diff --git a/imagery/i.ortho.photo/i.ortho.rectify/main.c b/imagery/i.ortho.photo/i.ortho.rectify/main.c index 56d42adf7e5..56e16220fa3 100644 --- a/imagery/i.ortho.photo/i.ortho.rectify/main.c +++ b/imagery/i.ortho.photo/i.ortho.rectify/main.c @@ -78,7 +78,7 @@ int main(int argc, char *argv[]) *interpol; /* interpolation method: nearest neighbor, bilinear, cubic */ - struct Flag *c, *a; + struct Flag *c, *a, *pan_flag; struct GModule *module; G_gisinit(argv[0]); @@ -139,6 +139,10 @@ int main(int argc, char *argv[]) a->key = 'a'; a->description = _("Rectify all raster maps in group"); + pan_flag = G_define_flag(); + pan_flag->key = 'p'; + pan_flag->description = _("Enable panorama camera correction"); + if (G_parser(argc, argv)) exit(EXIT_FAILURE); @@ -256,15 +260,19 @@ int main(int argc, char *argv[]) group.name); } + /* panorama camera correction */ + if (pan_flag->answer) + I_ortho_panorama(); + + /* get the target */ + get_target(group.name); + /* read the reference points for the group, compute image-to-photo trans. */ get_ref_points(&group); /* read the control points for the group, convert to photo coords. */ get_conz_points(&group); - /* get the target */ - get_target(group.name); - /* Check the GRASS_OVERWRITE environment variable */ if ((overstr = getenv("GRASS_OVERWRITE"))) /* OK ? */ target_overwrite = atoi(overstr); diff --git a/imagery/i.ortho.photo/i.ortho.target/main.c b/imagery/i.ortho.photo/i.ortho.target/main.c index 461ef5ed72e..0b9f5bfc31f 100644 --- a/imagery/i.ortho.photo/i.ortho.target/main.c +++ b/imagery/i.ortho.photo/i.ortho.target/main.c @@ -40,6 +40,8 @@ int main(int argc, char *argv[]) /* newly defined location and maspet */ char target_location[GMAPSET_MAX]; char target_mapset[GMAPSET_MAX]; + int stat; + struct Cell_head target_window; G_gisinit(argv[0]); @@ -75,6 +77,20 @@ int main(int argc, char *argv[]) I_get_target(group, location, mapset); G_create_alt_env(); + G_setenv_nogisrc("LOCATION_NAME", target_location); + stat = G_mapset_permissions(target_mapset); + if (stat != 1) { + G_fatal_error(_("Unable to access target location/mapset %s/%s"), + target_location, target_mapset); + } + + G_setenv_nogisrc("MAPSET", target_mapset); + G_get_window(&target_window); + if (target_window.proj == PROJECTION_XY) + G_fatal_error(_("Target locations with XY (unreferenced) are not supported")); + else if (target_window.proj == PROJECTION_LL) + G_fatal_error(_("Target locations with lon/lat are not supported")); + G_switch_env(); I_put_target(group, target_location, target_mapset); diff --git a/imagery/i.ortho.photo/i.ortho.transform/main.c b/imagery/i.ortho.photo/i.ortho.transform/main.c index f14f6783c99..f390b650d7f 100644 --- a/imagery/i.ortho.photo/i.ortho.transform/main.c +++ b/imagery/i.ortho.photo/i.ortho.transform/main.c @@ -16,6 +16,7 @@ * *****************************************************************************/ +#include #include #include #include @@ -55,6 +56,72 @@ static struct Ortho_Control_Points *points; static int count; static struct Stats fwd, rev; +/* target fns taken from i.ortho.rectify */ +static int which_env = -1; /* 0 = cur, 1 = target */ + +int select_current_env(void) +{ + if (which_env < 0) { + G_create_alt_env(); + which_env = 0; + } + if (which_env != 0) { + G_switch_env(); + which_env = 0; + } + + return 0; +} + +int select_target_env(void) +{ + if (which_env < 0) { + G_create_alt_env(); + which_env = 1; + } + if (which_env != 1) { + G_switch_env(); + which_env = 1; + } + + return 0; +} + +static int get_target(void) +{ + char location[GMAPSET_MAX]; + char mapset[GMAPSET_MAX]; + char buf[1024]; + int stat; + + if (!I_get_target(group.name, location, mapset)) { + sprintf(buf, _("Target information for group <%s> missing"), group.name); + goto error; + } + + sprintf(buf, "%s/%s", G_gisdbase(), location); + if (access(buf, 0) != 0) { + sprintf(buf, _("Target location <%s> not found"), location); + goto error; + } + select_target_env(); + G_setenv_nogisrc("LOCATION_NAME", location); + stat = G_mapset_permissions(mapset); + if (stat > 0) { + G_setenv_nogisrc("MAPSET", mapset); + select_current_env(); + return 1; + } + sprintf(buf, _("Mapset <%s> in target location <%s> - "), mapset, location); + strcat(buf, stat == 0 ? _("permission denied") : _("not found")); + error: + strcat(buf, "\n"); + strcat(buf, _("Please run i.target for group ")); + strcat(buf, group.name); + G_fatal_error("%s", buf); + return 1; /* never reached */ +} + static void update_max(struct Max *m, int n, double k) { if (k > m->val) { @@ -375,13 +442,13 @@ static void do_pt_xforms(void) fclose(fp); } - int main(int argc, char **argv) { struct Option *grp, *fmt, *xfm_pts; - struct Flag *sum, *rev_flag, *dump_flag; + struct Flag *sum, *rev_flag, *dump_flag, *pan_flag; struct GModule *module; char *desc; + char *camera; G_gisinit(argv[0]); @@ -438,6 +505,10 @@ int main(int argc, char **argv) dump_flag->key = 'x'; dump_flag->description = _("Display transform matrix coefficients"); + pan_flag = G_define_flag(); + pan_flag->key = 'p'; + pan_flag->description = _("Enable panorama camera correction"); + if (G_parser(argc, argv)) exit(EXIT_FAILURE); @@ -450,20 +521,44 @@ int main(int argc, char **argv) forward = !rev_flag->answer; coord_file = xfm_pts->answer; + if (pan_flag->answer) + I_ortho_panorama(); + if (!I_get_ref_points(group.name, &group.photo_points)) { G_fatal_error(_("Can not read reference points for group <%s>"), group.name); } if (!I_get_con_points(group.name, &group.control_points)) { - G_fatal_error(_("Can not read control points for group <%s>"), - group.name); + group.control_points.count = 0; } + camera = (char *)G_malloc(GNAME_MAX * sizeof(char)); + if (!I_get_group_camera(group.name, camera)) + G_fatal_error(_("No camera reference file selected for group <%s>"), + group.name); + + if (!I_get_cam_info(camera, &group.camera_ref)) + G_fatal_error(_("Bad format in camera file for group <%s>"), + group.name); + + /* get initial camera exposure station, if any */ + if (I_find_initial(group.name)) { + if (!I_get_init_info(group.name, &group.camera_exp)) + G_warning(_("Bad format in initial exposure station file for group <%s>"), + group.name); + } + + /* get the target */ + get_target(); + points = &group.control_points; parse_format(); + /* I_compute_ortho_equations() must be run in the target location */ + select_target_env(); compute_transformation(); + select_current_env(); analyze(); diff --git a/imagery/i.ortho.photo/lib/orthophoto.h b/imagery/i.ortho.photo/lib/orthophoto.h index e9953339450..ff6148d73d1 100644 --- a/imagery/i.ortho.photo/lib/orthophoto.h +++ b/imagery/i.ortho.photo/lib/orthophoto.h @@ -141,6 +141,8 @@ int I_ortho_ref(double, double, double, double *, double *, double *, int I_inverse_ortho_ref(double, double, double, double *, double *, double *, struct Ortho_Camera_File_Ref *, double, double, double, MATRIX); +void I_ortho_panorama(void); + /* ref_points.c */ int I_new_ref_point(struct Ortho_Photo_Points *, double, double, double, double, int); diff --git a/imagery/i.ortho.photo/lib/orthoref.c b/imagery/i.ortho.photo/lib/orthoref.c index 3f97046883e..03e6af55899 100644 --- a/imagery/i.ortho.photo/lib/orthoref.c +++ b/imagery/i.ortho.photo/lib/orthoref.c @@ -44,6 +44,15 @@ FILE *debug; char msg[120]; #endif +static int panorama = 0; +static double ellps_a = 0; + +/* enable panorama camera correction, + * e.g. for CORONA KH-4A/B */ +void I_ortho_panorama(void) +{ + panorama = 1; +} /* Compute the ortho rectification parameters */ /* Camera position: XC, YC, ZC */ @@ -65,10 +74,15 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, double Q1; double kappa1, kappa2, XC_var, YC_var, ZC_var; double omega_var, phi_var, kappa_var; - int i, iter, n; + int i, iter, max_iters, n; int first, active; + double e_a, e2; Q1 = (double)1.0; + + if (!G_get_ellipsoid_parameters(&e_a, &e2)) + G_fatal_error(_("No ellpsoid parameters available")); + ellps_a = e_a; /* DEBUG */ #ifdef DEBUG @@ -79,17 +93,14 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, } #endif - /* Need at least 4 active control points */ + /* Need at least 4 active control points, + * or user-provided camera position */ active = 0; - for (i = 0; i < cpz->count; i++) { - if (cpz->status[i] > 0) - active++; - } - if (active < 4) { -#ifdef DEBUG - fclose(debug); -#endif - return (-1); + if (cpz) { + for (i = 0; i < cpz->count; i++) { + if (cpz->status[i] > 0) + active++; + } } /* Initialize (and zero out) all matrices needed */ @@ -169,6 +180,7 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, * - init_info->status allows for disactivation of defined values */ if ((init_info != NULL) && (init_info->status == 1)) { + G_verbose_message("Using provided values for XC,YC,ZC,omega,phi,kappa"); /* Have initial values */ *XC = init_info->XC_init; *YC = init_info->YC_init; @@ -185,10 +197,11 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, WT1.x[4][4] = (Q1 / (init_info->phi_var * init_info->phi_var)); WT1.x[5][5] = (Q1 / (init_info->kappa_var * init_info->kappa_var)); } - else { /* set from mean values of active control points */ + else if (active >= 4) { /* set from mean values of active control points */ double dist_grnd, dist_photo; double meanx, meany, meanX, meanY, meanZ; + G_verbose_message("Estimating values for XC,YC,ZC,omega,phi,kappa"); /* set initial XC and YC from mean values of control points */ meanx = meany = meanX = meanY = meanZ = 0; x = y = X = Y = 0; @@ -263,9 +276,18 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, WT1.x[4][4] = (Q1 / (phi_var * phi_var)); WT1.x[5][5] = (Q1 / (kappa_var * kappa_var)); } - G_debug(1, "INITIAL CAMERA POSITION:"); - G_debug(1, "XC: %.2f, YC: %.2f, ZC: %.2f", *XC, *YC, *ZC); - G_debug(1, "Omega %.2f, Phi %.2f, Kappa: %.2f", *Omega, *Phi, *Kappa); + else { + G_warning(_("Camera postion not available")); +#ifdef DEBUG + fclose(debug); +#endif + return (0); + } + + G_verbose_message("INITIAL CAMERA POSITION:"); + G_verbose_message("XC: %.2f, YC: %.2f, ZC: %.2f", *XC, *YC, *ZC); + G_verbose_message("Omega %.2f, Phi %.2f, Kappa: %.2f", + *Omega * 180. / M_PI, *Phi * 180. / M_PI, *Kappa * 180. / M_PI); #ifdef DEBUG fprintf(debug, "\nINITIAL CAMERA POSITION:\n"); @@ -282,10 +304,15 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, epsilon.x[4][0] = *Phi; epsilon.x[5][0] = *Kappa; + /* adjust camera position only if enough control points are available */ + max_iters = MAX_ITERS; + if (active < 4) + max_iters = -1; + /************************** Start Iterations *****************************/ /* itererate until convergence */ - for (iter = 0; iter <= MAX_ITERS; iter++) { + for (iter = 0; iter < max_iters; iter++) { /* break if converged */ dx = delta.x[0][0]; dy = delta.x[1][0]; @@ -328,6 +355,7 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, /* see WOLF 1983, Appendix, p. 591 */ + /* ground -> photo */ M.x[0][0] = (cp * ck); M.x[0][1] = (cw * sk) + (sw * sp * ck); M.x[0][2] = (sw * sk) - (cw * sp * ck); @@ -364,6 +392,12 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, X = cpz->e2[i]; Y = cpz->n2[i]; Z = cpz->z2[i]; + + /* adjust for earth curvature */ + dx = X - *XC; + dy = Y - *YC; + dd = (dx * dx) + (dy * dy); + Z -= dd / (2.0 * ellps_a); #ifdef DEBUG fprintf(debug, @@ -389,6 +423,31 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, V = UVW.x[1][0]; W = UVW.x[2][0]; + /* panorama correction + * in theory either for U, V or for xbar, ybar + * U, V is recommended because U, V are only used + * for the residuals + * correcting U, V also gives a slightly smaller RMSE */ + if (panorama) { + double a, epan; + + epan = U; + if (epan < 0) { + a = atan2(-epan, -W); + epan = -a * -W; + } + else { + a = atan2(epan, -W); + epan = a * -W; + } + U = epan; + + V *= cos(a); + + UVW.x[0][0] = U; + UVW.x[1][0] = V; + } + /* Form Partial derivatives of Normal Equations */ xbar = x - Xp; ybar = y - Yp; @@ -396,6 +455,7 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, B.x[0][0] = (-Q1 / W) * ((xbar * m31) + (CFL * m11)); B.x[0][1] = (-Q1 / W) * ((xbar * m32) + (CFL * m12)); B.x[0][2] = (-Q1 / W) * ((xbar * m33) + (CFL * m13)); + B.x[0][3] = (Q1 / W) * ((xbar * ((-m33 * mu) + (m32 * nu))) + (CFL * ((-m13 * mu) + (m12 * nu))) @@ -412,6 +472,7 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, B.x[1][0] = (-Q1 / W) * ((ybar * m31) + (CFL * m21)); B.x[1][1] = (-Q1 / W) * ((ybar * m32) + (CFL * m22)); B.x[1][2] = (-Q1 / W) * ((ybar * m33) + (CFL * m23)); + B.x[1][3] = (Q1 / W) * ((ybar * ((-m33 * mu) + (m32 * nu))) + (CFL * ((-m23 * mu) + (m22 * nu))) @@ -425,6 +486,7 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, B.x[1][5] = (Q1 / W) * (CFL * ((-m11 * lam) + (-m12 * mu) + (-m13 * nu))); + /* residuals of image coordinates */ E.x[0][0] = (-Q1) * (xbar + (CFL * (U / W))); E.x[1][0] = (-Q1) * (ybar + (CFL * (V / W))); @@ -463,6 +525,8 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, /* Add weigth matrix of unknowns to NN */ m_add(&NN, &WT1, &NN); /* Solve for delta */ + + /* similar but not identical to solvemat in lib/imagery/georef.c */ if (!inverse(&NN, &N)) { /* control point status becomes zero if matrix is non-invertable */ error("Matrix Inversion (Control Points status modified)"); for (i = 0; i < cpz->count; i++) @@ -470,7 +534,6 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, return (0); } - /* delta = N-1 * CC */ m_mult(&N, &CC, &delta); /* epsilon += delta */ @@ -484,6 +547,7 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, #endif } /* end ITERATION loop */ + G_verbose_message("%d iterations to refine camera postion", iter); /* This is the solution */ *XC = epsilon.x[0][0]; @@ -493,13 +557,16 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, *Phi = epsilon.x[4][0]; *Kappa = epsilon.x[5][0]; - G_debug(1, "FINAL CAMERA POSITION:"); - G_debug(1, "XC: %.2f, YC: %.2f, ZC: %.2f", *XC, *YC, *ZC); - G_debug(1, "Omega %.2f, Phi %.2f, Kappa: %.2f", *Omega, *Phi, *Kappa); + G_verbose_message("FINAL CAMERA POSITION:"); + G_verbose_message("XC: %.2f, YC: %.2f, ZC: %.2f", *XC, *YC, *ZC); + G_verbose_message("Omega %.2f, Phi %.2f, Kappa: %.2f", + *Omega * 180. / M_PI, *Phi * 180. / M_PI, *Kappa * 180. / M_PI); + if (*ZC < 0) G_warning(_("Potential BUG in ortholib: camera altitude < 0")); /* Compute Orientation Matrix from Omega, Phi, Kappa */ + /* ground -> photo */ sw = sin(*Omega); cw = cos(*Omega); sp = sin(*Phi); @@ -522,6 +589,7 @@ int I_compute_ortho_equations(struct Ortho_Control_Points *cpz, MO->x[2][2] = cw * cp; /* Compute Transposed Orientation Matrix from Omega, Phi, Kappa */ + /* photo -> ground */ MT->nrows = 3; MT->ncols = 3; @@ -555,6 +623,7 @@ int I_ortho_ref(double e1, double n1, double z1, MATRIX UVW, XYZ; double U, V, W; double Xp, Yp, CFL; + double dx, dy, dd; /* Initialize and zero the matrices */ /* Object Space Coordinates */ @@ -572,6 +641,12 @@ int I_ortho_ref(double e1, double n1, double z1, Yp = cam_info->Yp; CFL = cam_info->CFL; + /* adjust for earth curvature */ + dx = e1 - XC; + dy = n1 - YC; + dd = (dx * dx) + (dy * dy); + z1 -= dd / (2.0 * ellps_a); + /* Object Space (&XYZ, XC,YC,ZC, X,Y,Z); */ XYZ.x[0][0] = e1 - XC; XYZ.x[1][0] = n1 - YC; @@ -584,9 +659,29 @@ int I_ortho_ref(double e1, double n1, double z1, V = UVW.x[1][0]; W = UVW.x[2][0]; + /* panorama correction could also be done for e2, n2 below + * results are identical */ + if (panorama) { + double a, epan; + + epan = U; + if (epan < 0) { + a = atan2(-epan, -W); + epan = -a * -W; + } + else { + a = atan2(epan, -W); + epan = a * -W; + } + U = epan; + + V *= cos(a); + } + /* This is the solution */ *e2 = (-CFL) * (U / W); *n2 = (-CFL) * (V / W); + return (1); } @@ -622,6 +717,23 @@ int I_inverse_ortho_ref(double e1, double n1, double z1, UVW.x[0][0] = e1 - Xp; UVW.x[1][0] = n1 - Yp; UVW.x[2][0] = -CFL; + + if (panorama) { + double a, epan; + + epan = UVW.x[0][0]; + if (epan < 0) { + a = -epan / CFL; + epan = -CFL * tan(a); + } + else { + a = epan / CFL; + epan = CFL * tan(a); + } + UVW.x[0][0] = epan; + + UVW.x[1][0] /= cos(a); + } m_mult(&M, &UVW, &XYZ); diff --git a/imagery/i.segment/region_growing.c b/imagery/i.segment/region_growing.c index 92dd7f60ee3..699615daafd 100644 --- a/imagery/i.segment/region_growing.c +++ b/imagery/i.segment/region_growing.c @@ -474,7 +474,7 @@ int region_growing(struct globals *globals) pathflag = FALSE; if (Rk_bestn.id < 0) { - G_debug(4, "Rk's best neighour is negative"); + G_debug(4, "Rk's best neighbour is negative"); pathflag = FALSE; } diff --git a/include/VERSION b/include/VERSION index 72724b26f13..551e9f555b4 100644 --- a/include/VERSION +++ b/include/VERSION @@ -1,4 +1,4 @@ 7 9 dev -2019 +2020 diff --git a/include/gis.h b/include/gis.h index 75518a6c1be..ba29a6d16f7 100644 --- a/include/gis.h +++ b/include/gis.h @@ -27,6 +27,7 @@ /* Grass and local include files */ #include #include +#include /*=========================== Constants/Defines ============================*/ @@ -38,8 +39,14 @@ static const char *GRASS_copyright __attribute__ ((unused)) = "GRASS GNU GPL licensed Software"; -#define GIS_H_VERSION "$Revision$" -#define GIS_H_DATE "$Date$" +/* GRASS version, GRASS date, git short hash of last change in GRASS headers + * (and anything else in include) + */ +#define GIS_H_VERSION GRASS_HEADERS_VERSION +/* git date of last change in GRASS headers + * (and anything else in include) + */ +#define GIS_H_DATE GRASS_HEADERS_DATE #define G_gisinit(pgm) G__gisinit(GIS_H_VERSION, (pgm)) #define G_no_gisinit() G__no_gisinit(GIS_H_VERSION) diff --git a/include/version.h.in b/include/version.h.in index a5ad69c86db..b7e1b11dcc1 100644 --- a/include/version.h.in +++ b/include/version.h.in @@ -1,4 +1,6 @@ -#define GRASS_VERSION_STRING "@(#) @GRASS_VERSION_NUMBER@ (@GRASS_VERSION_DATE@)" +#define GRASS_VERSION_STRING "@GRASS_VERSION_NUMBER@ (@GRASS_VERSION_DATE@)" #define GRASS_VERSION_MAJOR @GRASS_VERSION_MAJOR@ #define GRASS_VERSION_MINOR @GRASS_VERSION_MINOR@ -#define GRASS_VERSION_RELEASE @GRASS_VERSION_RELEASE@ +#define GRASS_VERSION_RELEASE "@GRASS_VERSION_RELEASE@" +#define GRASS_HEADERS_VERSION "@GRASS_HEADERS_GIT_HASH@" +#define GRASS_HEADERS_DATE "@GRASS_HEADERS_GIT_DATE@" diff --git a/lib/gis/colors.desc b/lib/gis/colors.desc index 649a1aef870..acf76d26977 100644 --- a/lib/gis/colors.desc +++ b/lib/gis/colors.desc @@ -28,6 +28,7 @@ kelvin: blue to red for temperature in Kelvin scale magma: perceptually uniform sequential color table magma ndvi: Normalized Difference Vegetation Index colors ndwi: Normalized Difference Water Index colors +nlcd: US National Land Cover Dataset colors oranges: white to orange plasma: perceptually uniform sequential color table plasma population: color table covering human population classification breaks diff --git a/lib/gis/colors/nlcd b/lib/gis/colors/nlcd new file mode 100644 index 00000000000..193381b37d6 --- /dev/null +++ b/lib/gis/colors/nlcd @@ -0,0 +1,22 @@ +# color table for USGS National Land Cover Dataset +0 255 255 255 +11 72:109:162 +12 231:239:252 +21 225:205:206 +22 220:152:129 +23 241:1:0 +24 171:1:1 +31 179:175:164 +41 108:169:102 +42 29:101:51 +43 189:204:147 +51 175:150:60 +52 209:187:130 +71 237:236:205 +72 208:209:129 +73 164:204:81 +74 130:186:157 +81 221:216:62 +82 174:114:41 +90 187:215:237 +95 113:164:193 diff --git a/lib/gis/datum.table b/lib/gis/datum.table index 29578d8ab34..361e349b46f 100644 --- a/lib/gis/datum.table +++ b/lib/gis/datum.table @@ -99,3 +99,5 @@ itrf92 "ITRF92" grs80 dx=0 dy=0 dz=0 S_JTSK "System_Jednotne_Trigonometricke_Site_Katastralni" bessel dx=589 dy=76 dz=480 # http://spatialreference.org/ref/epsg/4674/ sirgas2000 "Sistema_de_Referencia_Geocentrico_para_las_AmericaS_2000" grs80 dx=0 dy=0 dz=0 +# https://epsg.io/4170, sirgas1995 in degree +sirgas1995 "Sistema_de_Referencia_Geocentrico_para_las_AmericaS_1995" grs80 dx=0 dy=0 dz=0 diff --git a/lib/gis/gisinit.c b/lib/gis/gisinit.c index 864a44924a7..8f4a4c79800 100644 --- a/lib/gis/gisinit.c +++ b/lib/gis/gisinit.c @@ -49,14 +49,13 @@ void G__gisinit(const char *version, const char *pgm) G_set_program_name(pgm); - /* temporary disabled since svn keywords are not maintained by git + /* verify version of GRASS headers (and anything else in include) */ if (strcmp(version, GIS_H_VERSION) != 0) G_fatal_error(_("Module built against version %s but " "trying to use version %s. " "You need to rebuild GRASS GIS or untangle multiple installations."), version, GIS_H_VERSION); - */ - + /* Make sure location and mapset are set */ G_location_path(); mapset = G_mapset(); @@ -85,6 +84,7 @@ void G__no_gisinit(const char *version) if (initialized) return; + /* verify version of GRASS headers (and anything else in include) */ if (strcmp(version, GIS_H_VERSION) != 0) G_fatal_error(_("Module built against version %s but " "trying to use version %s. " diff --git a/lib/gis/mapset_nme.c b/lib/gis/mapset_nme.c index 7685fd0eb46..2d348e416c7 100644 --- a/lib/gis/mapset_nme.c +++ b/lib/gis/mapset_nme.c @@ -139,10 +139,11 @@ void G_reset_mapsets(void) List is updated by each call to this function. - \return pointer to zero terminated array of available mapsets + \return pointer to NULL terminated array of available mapsets */ char **G_get_available_mapsets(void) { + char *location; char **mapsets = NULL; int alloc = 50; int n = 0; @@ -153,15 +154,18 @@ char **G_get_available_mapsets(void) mapsets = G_calloc(alloc, sizeof(char *)); - dir = opendir(G_location_path()); - if (!dir) - return mapsets; + location = G_location_path(); + dir = opendir(location); + if (!dir) { + G_free(location); + return mapsets; + } while ((ent = readdir(dir))) { char buf[GPATH_MAX]; struct stat st; - sprintf(buf, "%s/%s/WIND", G_location_path(), ent->d_name); + sprintf(buf, "%s/%s/WIND", location, ent->d_name); if (G_stat(buf, &st) != 0) { G_debug(4, "%s is not mapset", ent->d_name); @@ -176,10 +180,11 @@ char **G_get_available_mapsets(void) } mapsets[n++] = G_store(ent->d_name); - mapsets[n] = NULL; } + mapsets[n] = NULL; closedir(dir); + G_free(location); return mapsets; } diff --git a/lib/init/Makefile b/lib/init/Makefile index 202313b57f3..b2378fdc7a5 100644 --- a/lib/init/Makefile +++ b/lib/init/Makefile @@ -68,6 +68,7 @@ endif sed \ -e 's#@GISBASE@#$(RUN_GISBASE)#' \ -e 's#@GRASS_VERSION_NUMBER@#$(GRASS_VERSION_NUMBER)#' \ + -e 's#@GRASS_VERSION_GIT@#$(GRASS_VERSION_GIT)#' \ -e 's#@LD_LIBRARY_PATH_VAR@#$(LD_LIBRARY_PATH_VAR)#' \ -e 's#@START_UP@#$(START_UP)#' \ -e 's#@CONFIG_PROJSHARE@#$(PROJSHARE)#' \ @@ -78,6 +79,7 @@ $(ARCH_DISTDIR)/$(START_UP).tmp: grass.py rm -f $@ sed \ -e 's#@GRASS_VERSION_NUMBER@#$(GRASS_VERSION_NUMBER)#' \ + -e 's#@GRASS_VERSION_GIT@#$(GRASS_VERSION_GIT)#' \ -e 's#@START_UP@#$(START_UP)#' \ -e 's#@GRASS_CONFIG_DIR@#$(GRASS_CONFIG_DIR)#' \ -e 's#@LD_LIBRARY_PATH_VAR@#$(LD_LIBRARY_PATH_VAR)#' \ diff --git a/lib/init/grass.py b/lib/init/grass.py index 784d2f89e8d..a9d1aa8751f 100644 --- a/lib/init/grass.py +++ b/lib/init/grass.py @@ -18,7 +18,7 @@ # command line options for setting the GISDBASE, LOCATION, # and/or MAPSET. Finally it starts GRASS with the appropriate # user interface and cleans up after it is finished. -# COPYRIGHT: (C) 2000-2019 by the GRASS Development Team +# COPYRIGHT: (C) 2000-2020 by the GRASS Development Team # # This program is free software under the GNU General # Public License (>=v2). Read the file COPYING that @@ -53,6 +53,7 @@ import platform import tempfile import locale +import uuid # mechanism meant for debugging this script (only) @@ -275,6 +276,7 @@ def wxpath(*args): [[[GISDBASE/]LOCATION/]MAPSET] $CMD_NAME [FLAG]... GISDBASE/LOCATION/MAPSET --exec EXECUTABLE [EPARAM]... $CMD_NAME --tmp-location [geofile | EPSG | XY] --exec EXECUTABLE [EPARAM]... + $CMD_NAME --tmp-mapset GISDBASE/LOCATION/ --exec EXECUTABLE [EPARAM]... {flags}: -h or --help {help_flag} @@ -293,6 +295,9 @@ def wxpath(*args): --exec EXECUTABLE {exec_} {exec_detail} --tmp-location {tmp_location} + {tmp_location_detail} + --tmp-mapset {tmp_mapset} + {tmp_mapset_detail} {params}: GISDBASE {gisdbase} @@ -334,7 +339,7 @@ def help_message(default_gui): gui=_("use $DEFAULT_GUI graphical user interface"), gui_detail=_("and set as default"), config=_("print GRASS configuration parameters"), - config_detail=_("options: arch,build,compiler,path,revision,svn_revision,version"), + config_detail=_("options: arch,build,compiler,date,path,revision,svn_revision,version"), params=_("Parameters"), gisdbase=_("initial GRASS database directory"), gisdbase_detail=_("directory containing Locations"), @@ -355,6 +360,9 @@ def help_message(default_gui): executable_params=_("parameters of the executable"), standard_flags=_("standard flags"), tmp_location=_("create temporary location (use with the --exec flag)"), + tmp_location_detail=_("created in a temporary directory and deleted at exit"), + tmp_mapset=_("create temporary mapset (use with the --exec flag)"), + tmp_mapset_detail=_("created in the specified location and deleted at exit"), ) ) s = t.substitute(CMD_NAME=CMD_NAME, DEFAULT_GUI=default_gui, @@ -512,8 +520,10 @@ def read_env_file(path): return kv -def write_gisrc(kv, filename): - f = open(filename, 'w') +def write_gisrc(kv, filename, append=False): + # use append=True to avoid a race condition between write_gisrc() and + # grass_prompt() on startup (PR #548) + f = open(filename, 'a' if append else 'w') for k, v in kv.items(): f.write("%s: %s\n" % (k, v)) f.close() @@ -854,23 +864,15 @@ def get_mapset_invalid_reason(gisdbase, location, mapset): :returns: translated message """ full_location = os.path.join(gisdbase, location) - full_permanent = os.path.join(full_location, 'PERMANENT') full_mapset = os.path.join(full_location, mapset) # first checking the location validity - if not os.path.exists(full_location): - return _("Location <%s> doesn't exist") % full_location - elif 'PERMANENT' not in os.listdir(full_location): - return _("<%s> is not a valid GRASS Location" - " because PERMANENT Mapset is missing") % full_location - elif not os.path.isdir(full_permanent): - return _("<%s> is not a valid GRASS Location" - " because PERMANENT is not a directory") % full_location - # partially based on the is_location_valid() function - elif not os.path.isfile(os.path.join(full_permanent, - 'DEFAULT_WIND')): - return _("<%s> is not a valid GRASS Location" - " because PERMANENT Mapset does not have a DEFAULT_WIND file" - " (default computational region)") % full_location + # perhaps a special set of checks with different messages mentioning mapset + # will be needed instead of the same set of messages used for location + location_msg = get_location_invalid_reason( + gisdbase, location, none_for_no_reason=True + ) + if location_msg: + return location_msg # if location is valid, check mapset elif mapset not in os.listdir(full_location): return _("Mapset <{mapset}> doesn't exist in GRASS Location <{loc}>. " @@ -889,7 +891,87 @@ def get_mapset_invalid_reason(gisdbase, location, mapset): else: return _("Mapset <{mapset}> or Location <{location}> is" " invalid for an unknown reason").format( - mapset=mapset, loc=location) + mapset=mapset, location=location) + + +def get_location_invalid_reason(gisdbase, location, none_for_no_reason=False): + """Returns a message describing what is wrong with the Location + + The goal is to provide the most suitable error message + (rather than to do a quick check). + + By default, when no reason is found, a message about unknown reason is + returned. This applies also to the case when this function is called on + a valid location (e.g. as a part of larger investigation). + ``none_for_no_reason=True`` allows the function to be used as part of other + diagnostic. When this function fails to find reason for invalidity, other + the caller can continue the investigation in their context. + + :param gisdbase: Path to GRASS GIS database directory + :param location: name of a Location + :param none_for_no_reason: When True, return None when reason is unknown + :returns: translated message or None + """ + full_location = os.path.join(gisdbase, location) + full_permanent = os.path.join(full_location, 'PERMANENT') + + # directory + if not os.path.exists(full_location): + return _("Location <%s> doesn't exist") % full_location + # permament mapset + elif 'PERMANENT' not in os.listdir(full_location): + return _("<%s> is not a valid GRASS Location" + " because PERMANENT Mapset is missing") % full_location + elif not os.path.isdir(full_permanent): + return _("<%s> is not a valid GRASS Location" + " because PERMANENT is not a directory") % full_location + # partially based on the is_location_valid() function + elif not os.path.isfile(os.path.join(full_permanent, + 'DEFAULT_WIND')): + return _("<%s> is not a valid GRASS Location" + " because PERMANENT Mapset does not have a DEFAULT_WIND file" + " (default computational region)") % full_location + # no reason for invalidity found (might be valid) + if none_for_no_reason: + return None + else: + return _("Location <{location}> is" + " invalid for an unknown reason").format(location=full_location) + + +def dir_contains_location(path): + """Return True if directory *path* contains a valid location""" + if not os.path.isdir(path): + return False + for name in os.listdir(path): + if os.path.isdir(os.path.join(path, name)): + if is_location_valid(path, name): + return True + return False + + +def get_location_invalid_suggestion(gisdbase, location_name): + """Return suggestion what to do when specified location is not valid + + It gives suggestion when: + * A mapset was specified instead of a location. + * A GRASS database was specified instead of a location. + """ + full_path = os.path.join(gisdbase, location_name) + # a common error is to use mapset instead of location, + # if that's the case, include that info into the message + if is_mapset_valid(full_path): + return _( + "<{loc}> looks like a mapset, not a location." + " Did you mean just <{one_dir_up}>?").format( + loc=location_name, one_dir_up=gisdbase) + # confusion about what is database and what is location + elif dir_contains_location(full_path): + return _( + "It looks like <{loc}> contains locations." + " Did you mean to specify one of them?").format( + loc=location_name) + return None def can_create_location(gisdbase, location): @@ -929,7 +1011,7 @@ def cannot_create_location_reason(gisdbase, location): def set_mapset(gisrc, arg=None, geofile=None, create_new=False, - tmp_location=False, tmpdir=None): + tmp_location=False, tmp_mapset=False, tmpdir=None): """Selected Location and Mapset are checked and created if requested The gisrc (GRASS environment file) is written at the end @@ -941,13 +1023,25 @@ def set_mapset(gisrc, arg=None, geofile=None, create_new=False, # in a distant past), refactor l = arg if l: + # TODO: the block below could be just one line: os.path.abspath(l) + # abspath both resolves relative paths and normalizes the path + # so that trailing / is stripped away and split then always returns + # non-empty element as the last element (which is good for both mapset + # and location split) if l == '.': l = os.getcwd() elif not os.path.isabs(l): l = os.path.abspath(l) - - l, mapset = os.path.split(l) - if not mapset: + if l.endswith(os.path.sep): + l = l.rstrip(os.path.sep) + # now we can get the last element by split on the first go + # and it works for the last element being mapset or location + + if tmp_mapset: + # We generate a random name and then create the mapset as usual. + mapset = "tmp_" + uuid.uuid4().hex + create_new = True + else: l, mapset = os.path.split(l) l, location_name = os.path.split(l) gisdbase = l @@ -969,7 +1063,15 @@ def set_mapset(gisrc, arg=None, geofile=None, create_new=False, # check if 'path' is a valid GRASS location/mapset path_is_valid_mapset = is_mapset_valid(path) - if path_is_valid_mapset and create_new: + if path_is_valid_mapset and tmp_mapset: + # If we would be creating the mapset directory at the same time as + # generating the name, we could just try another name in case of + # conflict. Conflict is unlikely, but it would be worth considering + # it during refactoring of this code. + fatal(_("Mapset <{}> already exists." + " Unable to create a new temporary mapset of that name.") + .format(path)) + elif path_is_valid_mapset and create_new: warning(_("Mapset <{}> already exists. Ignoring the" " request to create it. Note that this warning" " may become an error in future versions.") @@ -985,7 +1087,7 @@ def set_mapset(gisrc, arg=None, geofile=None, create_new=False, # mapset on the fly # check if 'location_name' is a valid GRASS location if not is_location_valid(gisdbase, location_name): - if not tmp_location: + if not (tmp_location or tmp_mapset): # 'location_name' is not a valid GRASS location # and user requested its creation, so we parsed # the path wrong and need to move one level @@ -994,6 +1096,15 @@ def set_mapset(gisrc, arg=None, geofile=None, create_new=False, gisdbase = os.path.join(gisdbase, location_name) location_name = mapset mapset = "PERMANENT" + if tmp_mapset: + suggestion = get_location_invalid_suggestion( + gisdbase, location_name) + reason = get_location_invalid_reason( + gisdbase, location_name) + if suggestion: + fatal("{reason}\n{suggestion}".format(**locals())) + else: + fatal(reason) if not can_create_location(gisdbase, location_name): fatal(cannot_create_location_reason( gisdbase, location_name)) @@ -1023,6 +1134,19 @@ def set_mapset(gisrc, arg=None, geofile=None, create_new=False, else: # create mapset directory os.mkdir(path) + if tmp_mapset: + # The tmp location is handled by (re-)using the + # tmpdir, but we need to take care of the tmp + # mapset which is only a subtree in an existing + # location. We simply remove the tree at exit. + # All mapset cleaning functions should succeed + # because they are called before exit or registered + # only later (and thus called before this one). + # (Theoretically, they could be disabled if that's + # just cleaning a files in the mapset directory.) + atexit.register( + lambda: shutil.rmtree(path, ignore_errors=True) + ) # make directory a mapset, add the region # copy PERMANENT/DEFAULT_WIND to /WIND s = readfile(os.path.join(gisdbase, location_name, @@ -1368,13 +1492,18 @@ def set_language(grass_config_dir): os.environ['LANGUAGE'] = language os.environ['LANG'] = language - if language == 'ko_KR' and encoding == 'cp949': + if WINDOWS and (language == 'ko' or (language == 'ko_KR' and encoding == 'cp949')): # The default encoding for the Korean language in Windows is cp949, # Microsoft's proprietary extension to euc-kr, but gettext prints no # translated messages at all in the Command Prompt window if LC_CTYPE # is set to ko_KR.cp949. Here, force LC_CTYPE to be euc-kr. normalized = 'euc-kr' encoding = None + + # XXX: In UN*X, LC_CTYPE needs to be set to *any* value before GRASS + # starts when the language setting is overriden by the user. For + # example, 'LC_CTYPE= grass' will break the welcome message. + # Interestingly, modules' help messages look fine. elif encoding: normalized = locale.normalize('%s.%s' % (language, encoding)) else: @@ -1866,10 +1995,10 @@ def print_params(): """Write compile flags and other configuration to stderr""" params = sys.argv[2:] if not params: - params = ['arch', 'build', 'compiler', 'path', 'revision', 'version'] + params = ['arch', 'build', 'compiler', 'path', 'revision', 'version', 'date'] # check if we are dealing with parameters which require dev files - dev_params = ["arch", "compiler", "build", "revision"] + dev_params = ["arch", "compiler", "build", "date"] if any([param in dev_params for param in params]): plat = gpath('include', 'Make', 'Platform.make') if not os.path.exists(plat): @@ -1895,13 +2024,7 @@ def print_params(): val = grep('CC', linesplat) sys.stdout.write("%s\n" % val[0].split('=')[1].strip()) elif arg == 'revision': - rev = gpath('include', 'grass', 'gis.h') - filerev = open(rev) - linesrev = filerev.readlines() - val = grep('#define GIS_H_VERSION', linesrev) - filerev.close() - sys.stdout.write( - "%s\n" % val[0].split(':')[1].rstrip('$"\n').strip()) + sys.stdout.write("@GRASS_VERSION_GIT@\n") elif arg == 'svn_revision': filerev = open(gpath('etc', 'VERSIONNUMBER')) linerev = filerev.readline().rstrip('\n') @@ -1913,6 +2036,16 @@ def print_params(): sys.stdout.write("No SVN revision defined\n") elif arg == 'version': sys.stdout.write("%s\n" % GRASS_VERSION) + elif arg == 'date': + date_str = "#define GRASS_HEADERS_DATE " + gdate = gpath('include', 'grass', 'version.h') + with open(gdate) as filegdate: + for line in filegdate.readlines(): + if line.startswith(date_str): + sys.stdout.write('{}\n'.format( + line.replace(date_str, '').lstrip()[1:-2]) # remove quotes + ) + break else: message(_("Parameter <%s> not supported") % arg) @@ -1954,6 +2087,7 @@ def __init__(self): self.mapset = None self.geofile = None self.tmp_location = False + self.tmp_mapset = False def parse_cmdline(argv, default_gui): @@ -1994,6 +2128,8 @@ def parse_cmdline(argv, default_gui): sys.exit() elif i == "--tmp-location": params.tmp_location = True + elif i == "--tmp-mapset": + params.tmp_mapset = True else: args.append(i) if len(args) > 1: @@ -2013,6 +2149,11 @@ def validate_cmdline(params): """ Validate the cmdline params and exit if necessary. """ if params.exit_grass and not params.create_new: fatal(_("Flag -e requires also flag -c")) + if params.tmp_location and params.tmp_mapset: + fatal(_( + "Either --tmp-location or --tmp-mapset can be used, not both").format( + params.mapset) + ) if params.tmp_location and not params.geofile: fatal( _( @@ -2167,6 +2308,9 @@ def main(): elif params.create_new and params.geofile: set_mapset(gisrc=gisrc, arg=params.mapset, geofile=params.geofile, create_new=True) + elif params.tmp_mapset: + set_mapset(gisrc=gisrc, arg=params.mapset, + tmp_mapset=params.tmp_mapset) else: set_mapset(gisrc=gisrc, arg=params.mapset, create_new=params.create_new) @@ -2235,9 +2379,14 @@ def main(): # start GUI and register shell PID in rc file start_gui(grass_gui) - kv = read_gisrc(gisrc) + kv = {} kv['PID'] = str(shell_process.pid) - write_gisrc(kv, gisrc) + + # grass_prompt() tries to read gisrc while write_gisrc() is adding PID + # to this file, so don't rewrite it; just append PID to make it + # available to grass_prompt() at all times (PR #548) + write_gisrc(kv, gisrc, append=True) + exit_val = shell_process.wait() if exit_val != 0: warning(_("Failed to start shell '%s'") % os.getenv('SHELL')) diff --git a/lib/init/grass.sh b/lib/init/grass.sh index 654abc6d3ce..bde89fe9832 100755 --- a/lib/init/grass.sh +++ b/lib/init/grass.sh @@ -13,7 +13,7 @@ # setting the GISDBASE, LOCATION, and/or MAPSET. # Finally it starts GRASS with the appropriate user # interface and cleans up after it is finished. -# COPYRIGHT: (C) 2000-2010 by the GRASS Development Team +# COPYRIGHT: (C) 2000-2020 by the GRASS Development Team # # This program is free software under the GNU General # Public License (>=v2). Read the file COPYING that diff --git a/lib/init/grass7.html b/lib/init/grass7.html index 40ae58bf75b..6c993227c85 100644 --- a/lib/init/grass7.html +++ b/lib/init/grass7.html @@ -4,9 +4,11 @@

    SYNOPSIS

    grass79 [-h | -help | --help] [-v | --version] | [-c | -c geofile | -c EPSG:code[:datum_trans]] | -e | -f | -[--text | --gtext | --gui] | --config | --exec EXECUTABLE | --tmp-location +[--text | --gtext | --gui] | --config | +[--tmp-location | --tmp-mapset] [[[<GISDBASE>/]<LOCATION>/] <MAPSET>] +[--exec EXECUTABLE]

    Flags:

    @@ -47,7 +49,7 @@

    Flags:

    (
    wxGUI) should be used
    --config -
    Prints GRASS configuration parameters (options: arch, build, compiler, path, revision) +
    Prints GRASS configuration parameters (options: arch, build, compiler, date, path, revision, svn_revision, version)
    --exec EXECUTABLE
    Execute GRASS module or script. The provided executable will be executed in a GRASS GIS non-interactive session. @@ -55,8 +57,13 @@

    Flags:

    --tmp-location
    Run using a temporary location which is created based on the given coordinate reference system and deleted at the end of the execution -(use the --exec flag). -The active mapset will be PERMANENT. +(use with the --exec flag). +The active mapset will be the PERMANENT mapset. + +
    --tmp-mapset +
    Run using a temporary mapset which is created in the specified +location and deleted at the end of the execution +(use with the --exec flag). @@ -103,6 +110,23 @@

    DESCRIPTION

    these checks fail then grass79 will automatically switch back to the text user interface mode. +

    FLAGS

    + +The flag --config option prints GRASS GIS configuration and +version parameters, with the options: + +
      +
    • arch: system architecture (e.g., x86_64-pc-linux-gnu)
    • +
    • build: (e.g., ./configure --with-cxx --enable-largefile --with-proj [...])
    • +
    • compiler: (e.g., gcc)
    • +
    • date: (e.g., Tue Mar 31 20:34:57 2020 +0200)
    • +
    • path: (e.g., /usr/lib64/grass79)
    • +
    • revision: (e.g., 745ee7ec9)
    • +
    • svn_revision: (e.g., 062bffc8)
    • +
    • version: (e.g., 7.9.dev)
    • +
    + +

    SAMPLE DATA

    The GRASS GIS project provides several free sample geospatial datasets @@ -390,6 +414,44 @@

    Using temporary location

    grass79 --tmp-location XY --exec r.neighbors --help
    + +

    Using temporary mapset

    + +

    +A single command can be executed, e.g., to examine properties of a +location (here using the NC SPM sample location): + +

    +grass79 --tmp-mapset /path/to/grassdata/nc_spm_08/ --exec g.proj -p
    +
    + +Computation in a Python script can be executed in the same way: + +
    +grass79 --tmp-mapset /path/to/grassdata/nc_spm_08/ --exec processing.py
    +
    + +Additional parameters are just passed to the script, so we can run the +script with different sets of parameters (here 5, 8 and 3, 9) in +different temporary mapsets which is good for parallel processing. + +
    +grass79 --tmp-mapset /path/to/grassdata/nc_spm_08/ --exec processing.py 5 8
    +grass79 --tmp-mapset /path/to/grassdata/nc_spm_08/ --exec processing.py 3 9
    +
    + +The same applies to Bash scripts (and other scripts supported on you +platform): + +
    +grass79 --tmp-mapset /path/to/grassdata/nc_spm_08/ --exec processing.sh 5 8
    +
    + +The temporary mapset is automatically deleted after computation, +so the script is expected to export, link or otherwise preserve the +output data before ending. + +

    Troubleshooting

    Importantly, to avoid an "[Errno 8] Exec format error" there must be a shebang line at the top of @@ -416,11 +478,10 @@

    SEE ALSO

    List of GRASS environment variables

    -GRASS GIS Web site
    -GRASS GIS User Wiki
    -GRASS GIS Bug Tracker
    -GRASS GIS 7 Programmer's - Manual +GRASS GIS Web site
    +GRASS GIS User Wiki
    +GRASS GIS Bug Tracker
    +GRASS GIS 7 Programmer's Manual

    AUTHORS (of this page)

    diff --git a/lib/init/helptext.html b/lib/init/helptext.html index b7a86e05c7b..469ec2981f7 100644 --- a/lib/init/helptext.html +++ b/lib/init/helptext.html @@ -175,7 +175,7 @@

    5. Text-based startup and location creation

    For a first time startup, the following steps have to be followed:
      -
    1. Create a GRASS GIS database as explained above.
    2. +
    3. Create the GRASS GIS database directory (with a file manager; or on command line: mkdir /home/user/grassdata
    4. Create a new location, including it's default PERMANENT mapset, without entering the new location:
        diff --git a/lib/init/testsuite/test_grass_tmp_mapset.py b/lib/init/testsuite/test_grass_tmp_mapset.py new file mode 100644 index 00000000000..7a488dadb5f --- /dev/null +++ b/lib/init/testsuite/test_grass_tmp_mapset.py @@ -0,0 +1,107 @@ +#!/usr/bin/env python3 + +""" +TEST: Test of grass --tmp-mapset + +AUTHOR(S): Vaclav Petras + +PURPOSE: Test that --tmp-mapset option of grass command works + +COPYRIGHT: (C) 2020 Vaclav Petras and the GRASS Development Team + +This program is free software under the GNU General Public +License (>=v2). Read the file COPYING that comes with GRASS +for details. +""" + +import unittest +import os +import shutil +import subprocess + + +# Note that unlike rest of GRASS GIS, here we are using unittest package +# directly. The grass.gunittest machinery for mapsets is not needed here. +# How this plays out together with the rest of testing framework is yet to be +# determined. + + +class TestTmpMapset(unittest.TestCase): + """Tests --tmp-mapset option of grass command""" + + # TODO: here we need a name of or path to the main GRASS GIS executable + executable = "grass" + # an arbitrary, but identifiable and fairly unique name + location = "test_tmp_mapset_xy" + + def setUp(self): + """Creates a location used in the tests""" + subprocess.check_call([self.executable, "-c", "XY", self.location, "-e"]) + self.subdirs = os.listdir(self.location) + + def tearDown(self): + """Deletes the location""" + shutil.rmtree(self.location, ignore_errors=True) + + def test_command_runs(self): + """Check that correct parameters are accepted""" + return_code = subprocess.call( + [self.executable, "--tmp-mapset", self.location, "--exec", "g.proj", "-g"] + ) + self.assertEqual( + return_code, + 0, + msg=( + "Non-zero return code from {self.executable}" + " when creating mapset".format(**locals()) + ), + ) + + def test_command_fails_without_location(self): + """Check that the command fails with a nonexistent location""" + return_code = subprocess.call( + [ + self.executable, + "--tmp-mapset", + "does_not_exist", + "--exec", + "g.proj", + "-g", + ] + ) + self.assertNotEqual( + return_code, + 0, + msg=( + "Zero return code from {self.executable}," + " but the location directory does not exist".format(**locals()) + ), + ) + + def test_mapset_metadata_correct(self): + """Check that metadata is readable and have expected value (XY CRS)""" + output = subprocess.check_output( + [self.executable, "--tmp-mapset", self.location, "--exec", "g.proj", "-g"] + ) + self.assertEqual( + output.strip(), + "name=xy_location_unprojected".encode("ascii"), + msg="Mapset metadata are not what was expected, but: {output}".format( + **locals() + ), + ) + + def test_mapset_deleted(self): + """Check that mapset is deleted at the end of execution""" + subprocess.check_call( + [self.executable, "--tmp-mapset", self.location, "--exec", "g.proj", "-p"] + ) + for directory in os.listdir(self.location): + self.assertTrue( + directory in self.subdirs, + msg="Directory {directory} should have been deleted".format(**locals()), + ) + + +if __name__ == "__main__": + unittest.main() diff --git a/lib/python/.flake8 b/lib/python/.flake8 new file mode 100644 index 00000000000..648b231c99d --- /dev/null +++ b/lib/python/.flake8 @@ -0,0 +1,81 @@ +[flake8] +ignore = + E711, # comparison to None should be 'if cond is None:' + E712, # comparison to True should be 'if cond is True:' or 'if cond:' + E722, # do not use bare 'except' + E741, # ambiguous variable name 'l' + F401, # '.reader.BandReferenceReader' imported but unused + F403, # 'from ctypes import *' used; unable to detect undefined names + F405, # 'RasterRow' may be undefined, or defined from star imports: ctypes, grass.pygrass.raster, grass.pygrass.vector + F841, # local variable 't0' is assigned to but never used + W605, # invalid escape sequence '\_' + E262, # inline comment should start with '# ' + E265, # block comment should start with '# ' + E266, # too many leading '#' for block comment + F821, # undefined name '_' + E502, # the backslash is redundant between brackets + W291, # trailing whitespace + W292, # no newline at end of file + W293, # blank line contains whitespace + W391, # blank line at end of file + W503, # line break before binary operator + W504, # line break after binary operator + E117, # over-indented + E121, # continuation line under-indented for hanging indent + E122, # continuation line missing indentation or outdented + E123, # closing bracket does not match indentation of opening bracket's line + E124, # closing bracket does not match visual indentation + E125, # continuation line with same indent as next logical line + E126, # continuation line over-indented for hanging indent + E127, # continuation line over-indented for visual indent + E128, # continuation line under-indented for visual indent + E129, # visually indented line with same indent as next logical line + E201, # whitespace after '{' + E202, # whitespace before ')' + E203, # whitespace before ':' + E211, # whitespace before '(' + E221, # multiple spaces before operator + E222, # multiple spaces after operator + E225, # missing whitespace around operator + E226, # missing whitespace around arithmetic operator + E228, # missing whitespace around modulo operator + E231, # missing whitespace after ':' + E241, # multiple spaces after ',' + E251, # unexpected spaces around keyword / parameter equals + E261, # at least two spaces before inline comment + E271, # multiple spaces after keyword + E272, # multiple spaces before keyword + E501, # line too long (183 > 150 characters) + E301, # expected 1 blank line, found 0 + E302, # expected 2 blank lines, found 1 + E303, # too many blank lines (3) + E305, # expected 2 blank lines after class or function definition, found 1 + E401, # multiple imports on one line + +per-file-ignores = + # C wrappers call libgis.G_gisinit before importing other modules. + # TODO: Is this really needed? + pygrass/vector/__init__.py: E402, + pygrass/raster/__init__.py: E402, + pygrass/utils.py: E402, + # Current benchmarks/tests are changing sys.path before import. + # Possibly, a different approach should be taken there anyway. + pygrass/tests/benchmark.py: E402, + # Configuration file for Sphinx: + # Ignoring import/code mix and line length. + docs/conf.py: E402, E501 + +max-line-length = 88 +exclude = + .git, + __pycache__, + .env, + .venv, + env, + venv, + ENV, + env.bak, + venv.bak, + ctypes, + pydispatch, + testsuite, diff --git a/lib/python/ctypes/Makefile b/lib/python/ctypes/Makefile index cd324ee7a72..f30c8401116 100644 --- a/lib/python/ctypes/Makefile +++ b/lib/python/ctypes/Makefile @@ -56,9 +56,14 @@ proj_INC = $(PROJINC) vector_INC = $(VECT_INC) $(VECT_CFLAGS) vedit_INC = $(VECT_INC) $(VECT_CFLAGS) +MAC_FLAGS = "" +ifneq ($(findstring darwin,$(ARCH)),) +MAC_FLAGS = "-D_Nullable=" +endif + SED = sed CTYPESGEN = ./ctypesgen.py -CTYPESFLAGS = --cpp "$(CC) -E $(CPPFLAGS) $(LFS_CFLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(DEFS) $(EXTRA_INC) $(INC) -D__GLIBC_HAVE_LONG_LONG" +CTYPESFLAGS = --cpp "$(CC) -E $(CPPFLAGS) $(LFS_CFLAGS) $(MAC_FLAGS) $(EXTRA_CFLAGS) $(NLS_CFLAGS) $(DEFS) $(EXTRA_INC) $(INC) -D__GLIBC_HAVE_LONG_LONG" EXTRA_CLEAN_FILES := $(wildcard ctypesgencore/*.pyc) $(wildcard ctypesgencore/*/*.pyc) ifneq ($(MINGW),) diff --git a/lib/python/ctypes/ctypesgencore/parser/cgrammar.py b/lib/python/ctypes/ctypesgencore/parser/cgrammar.py index 5577b92b942..e371bffcd92 100644 --- a/lib/python/ctypes/ctypesgencore/parser/cgrammar.py +++ b/lib/python/ctypes/ctypesgencore/parser/cgrammar.py @@ -29,7 +29,7 @@ from . import yacc -if sys.version_info.major == 3: +if sys.version_info.major >= 3: long = int diff --git a/lib/python/ctypes/ctypesgencore/parser/pplexer.py b/lib/python/ctypes/ctypesgencore/parser/pplexer.py index bd8b33b5f1c..372ac866495 100644 --- a/lib/python/ctypes/ctypesgencore/parser/pplexer.py +++ b/lib/python/ctypes/ctypesgencore/parser/pplexer.py @@ -24,7 +24,7 @@ PY2 = True -if sys.version_info.major == 3: +if sys.version_info.major >= 3: PY2 = False long = int diff --git a/lib/python/ctypes/ctypesgencore/parser/preprocessor.py b/lib/python/ctypes/ctypesgencore/parser/preprocessor.py old mode 100644 new mode 100755 index 18999483ed8..1fb1e68dd09 --- a/lib/python/ctypes/ctypesgencore/parser/preprocessor.py +++ b/lib/python/ctypes/ctypesgencore/parser/preprocessor.py @@ -169,8 +169,25 @@ def parse(self, filename): shell=True, universal_newlines=True, stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - ppout, pperr = pp.communicate() + stderr=subprocess.PIPE) + try: + ppout, pperr = pp.communicate() + except UnicodeError: + # Fix for https://trac.osgeo.org/grass/ticket/3883, + # handling file(s) encoded with mac_roman + if sys.platform == 'darwin': + pp = subprocess.Popen(cmd, + shell=True, + universal_newlines=False, #read as binary + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + ppout, pperr = pp.communicate() + + data = ppout.decode('utf8', errors='replace') + ppout = data.replace('\r\n', '\n').replace('\r', '\n') + pperr = pperr.decode('utf8', errors='replace') + else: + raise UnicodeError for line in pperr.split("\n"): if line: diff --git a/lib/python/ctypes/ctypesgencore/parser/yacc.py b/lib/python/ctypes/ctypesgencore/parser/yacc.py index da0d48c6735..f1ad1d9d331 100644 --- a/lib/python/ctypes/ctypesgencore/parser/yacc.py +++ b/lib/python/ctypes/ctypesgencore/parser/yacc.py @@ -2276,7 +2276,7 @@ def yacc( raise YaccError("no rules of the form p_rulename are defined.") # Sort the symbols by line number - symbols.sort(lambda x, y: cmp(get_func_code(x).co_firstlineno, get_func_code(y).co_firstlineno)) + symbols.sort(key=lambda x: get_func_code(x).co_firstlineno) # Add all of the symbols to the grammar for f in symbols: @@ -2288,7 +2288,7 @@ def yacc( # Make a signature of the docstrings for f in symbols: if f.__doc__: - Signature.update(f.__doc__) + Signature.update(f.__doc__.encode("utf-8")) lr_init_vars() diff --git a/lib/python/docs/src/gunittest_running_tests.rst b/lib/python/docs/src/gunittest_running_tests.rst index 033b44bdafe..34d0c9c686f 100644 --- a/lib/python/docs/src/gunittest_running_tests.rst +++ b/lib/python/docs/src/gunittest_running_tests.rst @@ -67,6 +67,22 @@ scripts. The flag causes execution to stop once some command gives a non-zero return code. +Setting sensitivity of the test run +----------------------------------- + +Sensitivity, specified by the ``--min-success`` parameter, determined +how many tests need to fail for the runner to consider it an error +and return a non-zero return code. +For example, if at least 60% of test is required to succeed, you can +use:: + + python -m grass.gunittest.main ... --min-success 60 + +If all tests should succeed, use ``--min-success 100``. If you want +to run the test and ``grass.gunittest.main`` returning zero return code +even if some tests fail, use ``--min-success 0`` + + Running tests and creating report --------------------------------- diff --git a/lib/python/gunittest/checkers.py b/lib/python/gunittest/checkers.py index edf4c8c2c52..cb5bd56e425 100644 --- a/lib/python/gunittest/checkers.py +++ b/lib/python/gunittest/checkers.py @@ -13,6 +13,7 @@ import sys import re import doctest +import hashlib from grass.script.utils import decode, encode, _get_encoding @@ -555,8 +556,6 @@ def check_text_ellipsis_doctest(reference, actual): optionflags=doctest.ELLIPSIS) -import hashlib - # optimal size depends on file system and maybe on hasher.block_size _BUFFER_SIZE = 2**16 diff --git a/lib/python/gunittest/invoker.py b/lib/python/gunittest/invoker.py index 20327550c75..52f460da820 100644 --- a/lib/python/gunittest/invoker.py +++ b/lib/python/gunittest/invoker.py @@ -241,7 +241,13 @@ def _run_test_module(self, module, results_dir, gisdbase, location): def run_in_location(self, gisdbase, location, location_type, results_dir): - """Run tests in a given location""" + """Run tests in a given location + + Returns an object with counting attributes of GrassTestFilesCountingReporter, + i.e., a file-oriented reporter as opposed to testsuite-oriented one. + Use only the attributes related to the summary, such as file_pass_per, + not to one file as these will simply contain the last executed file. + """ if os.path.abspath(results_dir) == os.path.abspath(self.start_dir): raise RuntimeError("Results root directory should not be the same" " as discovery start directory") @@ -291,3 +297,4 @@ def run_in_location(self, gisdbase, location, location_type, top_level_testsuite_page_name='testsuite_index.html') testsuite_dir_reporter.report_for_dirs(root=results_dir, directories=self.testsuite_dirs) + return self.reporter diff --git a/lib/python/gunittest/main.py b/lib/python/gunittest/main.py index 185d0770ad5..70758c9920e 100644 --- a/lib/python/gunittest/main.py +++ b/lib/python/gunittest/main.py @@ -86,7 +86,7 @@ def test(): # cov.start() #except ImportError: # pass - # TODO: add some message somewhere + # TODO: add some message somewhere # TODO: enable passing omit to exclude also gunittest or nothing program = GrassTestProgram(module='__main__', exit_at_end=False, grass_location='all') @@ -135,6 +135,10 @@ def main(): parser.add_argument('--output', dest='output', action='store', default='testreport', help='Output directory') + parser.add_argument('--min-success', dest='min_success', action='store', + default='90', type=int, + help=("Minimum success percentage (lower percentage" + " than this will result in a non-zero return code; values 0-100)")) args = parser.parse_args() gisdbase = args.gisdbase if gisdbase is None: @@ -168,11 +172,15 @@ def main(): # as an enhancemnt # we can just iterate over all locations available in database # but the we don't know the right location type (category, label, shortcut) - invoker.run_in_location(gisdbase=gisdbase, - location=location, - location_type=location_type, - results_dir=results_dir) - return 0 + reporter = invoker.run_in_location( + gisdbase=gisdbase, + location=location, + location_type=location_type, + results_dir=results_dir + ) + if reporter.file_pass_per >= args.min_success: + return 0 + return 1 if __name__ == '__main__': sys.exit(main()) diff --git a/lib/python/gunittest/multireport.py b/lib/python/gunittest/multireport.py index 7a48c57f7df..4a148324381 100644 --- a/lib/python/gunittest/multireport.py +++ b/lib/python/gunittest/multireport.py @@ -18,17 +18,17 @@ import operator from collections import defaultdict, namedtuple - -# TODO: we should be able to work without matplotlib -import matplotlib -matplotlib.use('Agg') -import matplotlib.pyplot as plt -from matplotlib.dates import date2num - from grass.gunittest.checkers import text_to_keyvalue from grass.gunittest.utils import ensure_dir from grass.gunittest.reporters import success_to_html_percent +# TODO: we should be able to work without matplotlib +import matplotlib +matplotlib.use('Agg') +# This counts as code already, so silence "import not at top of file". +# Perhaps in the future, switch_backend() could be used. +import matplotlib.pyplot as plt # noqa: E402 +from matplotlib.dates import date2num # noqa: E402 class TestResultSummary(object): def __init__(self): diff --git a/lib/python/gunittest/reporters.py b/lib/python/gunittest/reporters.py index 7f05a8aedb1..9daa476c115 100644 --- a/lib/python/gunittest/reporters.py +++ b/lib/python/gunittest/reporters.py @@ -307,7 +307,14 @@ def get_html_test_authors_table(directory, tests_authors): class GrassTestFilesMultiReporter(object): + """Interface to multiple repoter objects + For start and finish of the tests and of a test of one file, + it calls corresponding methods of all contained reporters. + For all other attributes, it returns attribute of a first reporter + which has this attribute using the order in which the reporters were + provided. + """ def __init__(self, reporters, forgiving=False): self.reporters = reporters self.forgiving = forgiving @@ -356,6 +363,14 @@ def end_file_test(self, **kwargs): else: raise + def __getattr__(self, name): + for reporter in self.reporters: + try: + return getattr(reporter, name) + except AttributeError: + continue + raise AttributeError + class GrassTestFilesCountingReporter(object): def __init__(self): @@ -444,10 +459,10 @@ def html_file_preview(filename): before = '
        '
             after = '
        ' if not os.path.isfile(filename): - return '

        File %s does not exist

        ' % filename size = os.path.getsize(filename) if not size: - return '

        File %s is empty

        ' % filename max_size = 10000 html = StringIO() html.write(before) @@ -462,7 +477,7 @@ def tail(filename, n): for line in tail(filename, 50): html.write(color_error_line(html_escape(line))) else: - return '

        File %s is too large to show

        ' % filename html.write(after) return html.getvalue() diff --git a/lib/python/imaging/images2gif.py b/lib/python/imaging/images2gif.py index e1a04bde61d..7137d3fe690 100644 --- a/lib/python/imaging/images2gif.py +++ b/lib/python/imaging/images2gif.py @@ -209,10 +209,11 @@ def getAppExt(self, loops=float('inf')): if loops == 0 or loops == float('inf'): loops = 2 ** 16 - 1 - #bb = "" # application extension should not be used - # (the extension interprets zero loops - # to mean an infinite number of loops) - # Mmm, does not seem to work + # bb = "" + # application extension should not be used + # (the extension interprets zero loops + # to mean an infinite number of loops) + # Mmm, does not seem to work if True: bb = "\x21\xFF\x0B" # application extension bb += "NETSCAPE2.0" diff --git a/lib/python/imaging/images2swf.py b/lib/python/imaging/images2swf.py index 79859ff37d7..5ae6792204a 100644 --- a/lib/python/imaging/images2swf.py +++ b/lib/python/imaging/images2swf.py @@ -425,7 +425,7 @@ def __init__(self): def ProcessTag(self): """ Implement this to create the tag. """ - raise NotImplemented() + raise NotImplementedError() def GetTag(self): """ Calls processTag and attaches the header. """ @@ -876,10 +876,14 @@ def _readPixels(bb, i, tagType, L1): raise RuntimeError("Need Numpy to read an SWF file.") # Get info - charId = bb[i:i + 2]; i += 2 - format = ord(bb[i:i + 1]); i += 1 - width = bitsToInt(bb[i:i + 2], 16); i += 2 - height = bitsToInt(bb[i:i + 2], 16); i += 2 + charId = bb[i:i + 2] + i += 2 + format = ord(bb[i:i + 1]) + i += 1 + width = bitsToInt(bb[i:i + 2], 16) + i += 2 + height = bitsToInt(bb[i:i + 2], 16) + i += 2 # If we can, get pixeldata and make nunmpy array if format != 5: diff --git a/lib/python/pygrass/modules/grid/grid.py b/lib/python/pygrass/modules/grid/grid.py index 0bba2e1db0e..1dfbe6ac829 100644 --- a/lib/python/pygrass/modules/grid/grid.py +++ b/lib/python/pygrass/modules/grid/grid.py @@ -169,12 +169,15 @@ def copy_groups(groups, gisrc_src, gisrc_dst, region=None): :returns: None """ + + def rmloc(r): + return r.split('@')[0] if '@' in r else r + env = os.environ.copy() # instantiate modules get_grp = Module('i.group', flags='lg', stdout_=sub.PIPE, run_=False) set_grp = Module('i.group') get_grp.run_ = True - rmloc = lambda r: r.split('@')[0] if '@' in r else r src = read_gisrc(gisrc_src) dst = read_gisrc(gisrc_dst) diff --git a/lib/python/pygrass/raster/abstract.py b/lib/python/pygrass/raster/abstract.py index 610a692e0c1..8a14a12af02 100644 --- a/lib/python/pygrass/raster/abstract.py +++ b/lib/python/pygrass/raster/abstract.py @@ -527,7 +527,7 @@ def get_value(self, point, region=None): :param point: pair of coordinates in tuple object or class object with coords() method """ # Check for tuple - if type(point) != type([]) and type(point) != type(()): + if not isinstance(point, list) and not isinstance(point, tuple): point = point.coords() if not region: diff --git a/lib/python/pygrass/rpc/__init__.py b/lib/python/pygrass/rpc/__init__.py index 0006948cbdf..b7492496b3a 100644 --- a/lib/python/pygrass/rpc/__init__.py +++ b/lib/python/pygrass/rpc/__init__.py @@ -23,7 +23,7 @@ import grass.lib.gis as libgis from .base import RPCServerBase from grass.pygrass.gis.region import Region -import grass.pygrass.utils as utils +from grass.pygrass import utils import logging ############################################################################### @@ -434,7 +434,6 @@ def get_vector_features_as_wkb_list(self, name, mapset=None, extent=None, if __name__ == "__main__": import doctest - from grass.pygrass import utils from grass.pygrass.modules import Module Module("g.region", n=40, s=0, e=40, w=0, res=10) Module("r.mapcalc", expression="%s = row() + (10 * col())"%(test_raster_name), diff --git a/lib/python/pygrass/rpc/base.py b/lib/python/pygrass/rpc/base.py index 3e8f88f4b82..36a21e55c78 100644 --- a/lib/python/pygrass/rpc/base.py +++ b/lib/python/pygrass/rpc/base.py @@ -168,7 +168,7 @@ def safe_receive(self, message): try: ret = self.client_conn.recv() if isinstance(ret, FatalError): - raise ret + raise ret return ret except (EOFError, IOError, FatalError) as e: # The pipe was closed by the checker thread because diff --git a/lib/python/pygrass/tests/benchmark.py b/lib/python/pygrass/tests/benchmark.py index be8833b9e59..ee31d57770a 100644 --- a/lib/python/pygrass/tests/benchmark.py +++ b/lib/python/pygrass/tests/benchmark.py @@ -374,7 +374,7 @@ def check_values(self, values, args): for option in self.option_list: if hasattr(option, strREQUIRED) and option.required: if not getattr(values, option.dest): - self.error("option %s is required".format(str(option))) + self.error("option {} is required".format(str(option))) return optparse.OptionParser.check_values(self, values, args) diff --git a/lib/python/pygrass/vector/abstract.py b/lib/python/pygrass/vector/abstract.py index 444ec96d5cc..2eb59e4e4a1 100644 --- a/lib/python/pygrass/vector/abstract.py +++ b/lib/python/pygrass/vector/abstract.py @@ -443,6 +443,5 @@ def build(self): if __name__ == "__main__": import doctest - from grass.pygrass import utils utils.create_test_vector_map(test_vector_name) doctest.testmod() diff --git a/lib/python/pygrass/vector/table.py b/lib/python/pygrass/vector/table.py index b2c35edc34f..713c0847218 100644 --- a/lib/python/pygrass/vector/table.py +++ b/lib/python/pygrass/vector/table.py @@ -11,10 +11,6 @@ import os import sys -if sys.version_info.major == 3: - long = int - unicode = str - import ctypes import numpy as np from sqlite3 import OperationalError @@ -34,6 +30,12 @@ from grass.pygrass.vector import sql from grass.lib.ctypes_preamble import String + +if sys.version_info.major >= 3: + long = int + unicode = str + + # For test purposes test_vector_name = "table_doctest_map" diff --git a/lib/python/pygrass/vector/testsuite/test_table.py b/lib/python/pygrass/vector/testsuite/test_table.py index 2d7fa6691ac..322acc8b66b 100644 --- a/lib/python/pygrass/vector/testsuite/test_table.py +++ b/lib/python/pygrass/vector/testsuite/test_table.py @@ -18,7 +18,7 @@ from grass.pygrass.vector.table import Table, get_path -if sys.version_info.major == 3: +if sys.version_info.major >= 3: long = int # dictionary that generate random data diff --git a/lib/python/script/core.py b/lib/python/script/core.py index cc057dc708a..ff8bfaa322f 100644 --- a/lib/python/script/core.py +++ b/lib/python/script/core.py @@ -34,7 +34,7 @@ from grass.exceptions import ScriptError, CalledModuleError # PY2/PY3 compat -if sys.version_info.major > 2: +if sys.version_info.major >= 3: unicode = str # subprocess wrapper that uses shell on Windows @@ -193,7 +193,7 @@ def _access_check(fn, mode): if sys.platform == "win32": # The current directory takes precedence on Windows. - if not os.curdir in path: + if os.curdir not in path: path.insert(0, os.curdir) # PATHEXT is necessary to check on Windows (force lowercase) @@ -218,7 +218,7 @@ def _access_check(fn, mode): seen = set() for dir in path: normdir = os.path.normcase(dir) - if not normdir in seen: + if normdir not in seen: seen.add(normdir) for thefile in files: name = os.path.join(dir, thefile) @@ -226,8 +226,9 @@ def _access_check(fn, mode): return name return None -if sys.version_info.major > 2: - shutil_which = shutil.which +if sys.version_info.major >= 3: + # Use shutil.which in Python 3, not the custom implementation. + shutil_which = shutil.which # noqa: F811 # Added because of scripts calling scripts on MS Windows. # Module name (here cmd) differs from the file name (does not have extension). @@ -1221,18 +1222,18 @@ def region_env(region3d=False, flags=None, env=None, **kwargs): gis_env = gisenv(env) windfile = os.path.join(gis_env['GISDBASE'], gis_env['LOCATION_NAME'], gis_env['MAPSET'], "WIND") - fd = open(windfile, "r") - grass_region = '' - for line in fd.readlines(): - key, value = map(lambda x: x.strip(), line.split(":", 1)) - if kwargs and key not in ('proj', 'zone'): - continue - if not kwargs and not region3d and \ - key in ('top', 'bottom', 'cols3', 'rows3', - 'depths', 'e-w resol3', 'n-s resol3', 't-b resol'): - continue - - grass_region += '%s: %s;' % (key, value) + with open(windfile, "r") as fd: + grass_region = '' + for line in fd.readlines(): + key, value = map(lambda x: x.strip(), line.split(":", 1)) + if kwargs and key not in ('proj', 'zone'): + continue + if not kwargs and not region3d and \ + key in ('top', 'bottom', 'cols3', 'rows3', + 'depths', 'e-w resol3', 'n-s resol3', 't-b resol'): + continue + + grass_region += '%s: %s;' % (key, value) if not kwargs: # return current region return grass_region @@ -1279,7 +1280,7 @@ def use_temp_region(): handler to delete the temporary region upon termination. """ name = "tmp.%s.%d" % (os.path.basename(sys.argv[0]), os.getpid()) - run_command("g.region", save=name, overwrite=True) + run_command("g.region", flags="u", save=name, overwrite=True) os.environ['WIND_OVERRIDE'] = name atexit.register(del_temp_region) diff --git a/lib/python/script/raster.py b/lib/python/script/raster.py index e1a048775f9..58aceb60c9c 100644 --- a/lib/python/script/raster.py +++ b/lib/python/script/raster.py @@ -29,7 +29,7 @@ from .utils import float_or_dms, parse_key_val, try_remove -if sys.version_info.major == 3: +if sys.version_info.major >= 3: unicode = str diff --git a/lib/python/script/setup.py b/lib/python/script/setup.py index caff8de7398..afb65873e9a 100644 --- a/lib/python/script/setup.py +++ b/lib/python/script/setup.py @@ -228,7 +228,7 @@ def clean_default_db(): if os.path.exists(database): gcore.message(_("Cleaning up default sqlite database ...")) gcore.start_command('db.execute', sql = 'VACUUM') - # give it some time to start + # give it some time to start import time time.sleep(0.1) diff --git a/lib/python/script/task.py b/lib/python/script/task.py index 0793087c415..e7fffe70f40 100644 --- a/lib/python/script/task.py +++ b/lib/python/script/task.py @@ -21,8 +21,9 @@ import sys import string -if sys.version_info.major == 3: - unicode = str +from .utils import encode, decode, split +from .core import * + try: import xml.etree.ElementTree as etree @@ -36,8 +37,9 @@ else: ETREE_EXCEPTIONS = (expat.ExpatError) -from .utils import encode, decode, split -from .core import * + +if sys.version_info.major >= 3: + unicode = str class grassTask: @@ -201,7 +203,7 @@ def get_cmd_error(self): if not desc: desc = p['description'] errorList.append(_("Parameter '%(name)s' (%(desc)s) is missing.") % \ - {'name': p['name'], 'desc': encode(desc)}) + {'name': p['name'], 'desc': desc}) return errorList diff --git a/lib/python/script/testsuite/data/script_using_temporary_region.py b/lib/python/script/testsuite/data/script_using_temporary_region.py new file mode 100755 index 00000000000..31957a69ea1 --- /dev/null +++ b/lib/python/script/testsuite/data/script_using_temporary_region.py @@ -0,0 +1,78 @@ +#!/usr/bin/env python3 + +import subprocess +import sys +import os +import platform + +import grass.script as gs + + +def call_use_temp_region(script, size, remaining, nesting, map_name=None): + pid = os.getpid() + node = platform.node() + gs.message( + "PID {pid} ({node}):" + " Using {size}x{size} for temporary region on level {nesting}".format( + **locals() + ) + ) + # The use_temp_region() function is using program name to generate an + # identifiable name, so uncomment the following line to trick it and + # give us even more unique names. (This won't fully test the + # actual behavior, but it may be useful for debugging). + # sys.argv[0] = "{script}_nesting_{nesting}".format(**locals()) + gs.use_temp_region() + gs.run_command("g.region", rows=size, cols=size) + if remaining: + nesting += 1 + call = [sys.executable, script, remaining, str(nesting)] + if map_name: + call.append(map_name) + subprocess.check_call(call) + if map_name: + gs.run_command("r.mapcalc", expression="{map_name}_size_{size}_nesting_{nesting} = 1".format(**locals())) + + +def main(): + this_file = sys.argv[0] + if len(sys.argv) == 1: + # Some resonable defaults for a trivial test to allow calling without + # any parameters. + size = 100 + remaining = None + nesting = 0 + map_name = None + elif len(sys.argv) not in [3, 4]: + gs.fatal( + "Usage: