4,027 changes: 2,063 additions & 1,964 deletions i18n/qgis_lt.ts

Large diffs are not rendered by default.

58,497 changes: 58,497 additions & 0 deletions i18n/qgis_mr.ts

Large diffs are not rendered by default.

7,217 changes: 4,523 additions & 2,694 deletions i18n/qgis_nb_NO.ts

Large diffs are not rendered by default.

Binary file added images/flags/mr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added images/flags/sr_Latn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion images/images.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
<file>flags/sk.png</file>
<file>flags/sl_SI.png</file>
<file>flags/sq_AL.png</file>
<file>flags/sr.png</file>
<file>flags/sr_Cyrl.png</file>
<file>flags/sr_Latn.png</file>
<file>flags/sv.png</file>
<file>flags/sw.png</file>
<file>flags/ta.png</file>
Expand Down Expand Up @@ -442,6 +443,7 @@
<file>themes/default/mActionLink.svg</file>
<file>themes/default/mActionUnlink.svg</file>
<file>themes/default/mActionRemove.svg</file>
<file>flags/mr.png</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
Expand Down
39 changes: 32 additions & 7 deletions ms-windows/osgeo4w/creatensis.pl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ sub getDeps {
my @desc;
foreach my $p ( keys %pkgs ) {
my @f;
unless( exists $file{$p} ) {
print "No file for package $p found found.\n" if $verbose;
next;
}
push @f, "$root/$file{$p}";

if( exists $lic{$p} ) {
Expand Down Expand Up @@ -164,17 +168,38 @@ sub getDeps {
my $taropt = "v" x $verbose;

unless(-d $unpacked ) {
mkdir $unpacked, 0755;
mkdir "$unpacked", 0755;
mkdir "$unpacked/bin", 0755;
mkdir "$unpacked/etc", 0755;
mkdir "$unpacked/etc/setup", 0755;

# Create package database
open O, ">$unpacked/etc/setup/installed.db";
print O "INSTALLED.DB 2\n";

foreach my $pn ( keys %pkgs ) {
my $p = $file{$pn};
unless( defined $p ) {
print "No package found for $pn\n" if $verbose;
next;
}

foreach my $p ( keys %pkgs ) {
$p = $file{$p};
$p =~ s#^.*/#$packages/#;

unless( -r $p ) {
print "Package $p not found.\n" if $verbose;
next;
}

print O "$pn $p 0\n";

print "Unpacking $p...\n" if $verbose;
system "tar $taropt -C $unpacked -xjf $p";
system "tar $taropt -C $unpacked -xjvf $p | gzip -c >$unpacked/etc/setup/$pn.lst.gz";
die "unpacking of $p failed" if $?;
}

close O;

chdir $unpacked;

mkdir "bin", 0755;
Expand Down Expand Up @@ -277,8 +302,8 @@ sub getDeps {
$version = "$major.$minor.$patch" unless defined $version;

unless( defined $binary ) {
if( -f "binary-$archpostfix$version" ) {
open P, "binary-$archpostfix$version";
if( -f "binary$archpostfix-$version" ) {
open P, "binary$archpostfix-$version";
$binary = <P>;
close P;
$binary++;
Expand Down Expand Up @@ -375,7 +400,7 @@ sub getDeps {
system $cmd;
die "running nsis failed" if $?;

open P, ">osgeo4w/binary-$archpostfix$version";
open P, ">osgeo4w/binary$archpostfix-$version";
print P $binary;
close P;

Expand Down
131 changes: 86 additions & 45 deletions ms-windows/osgeo4w/package-nightly.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@echo off
REM ***************************************************************************
REM package-nightly.cmd
REM ---------------------
Expand All @@ -12,48 +13,81 @@ REM * the Free Software Foundation; either version 2 of the License, or *
REM * (at your option) any later version. *
REM * *
REM ***************************************************************************
@echo off
set GRASS_VERSION=6.4.3

set BUILDDIR=%CD%\build
REM set BUILDDIR=%TEMP%\qgis_unstable
set LOG=%BUILDDIR%\build.log

if not exist "%BUILDDIR%" mkdir %BUILDDIR%
if not exist "%BUILDDIR%" goto error

set VERSION=%1
set PACKAGE=%2
set PACKAGENAME=%3
if "%VERSION%"=="" goto error
if "%PACKAGE%"=="" goto error
if "%PACKAGENAME%"=="" set PACKAGENAME=qgis-dev
set ARCH=%4
if "%VERSION%"=="" goto usage
if "%PACKAGE%"=="" goto usage
if "%PACKAGENAME%"=="" goto usage
if "%ARCH%"=="" goto usage

path %SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\System32\Wbem;%PROGRAMFILES%\CMake 2.8\bin
set PYTHONPATH=
set BUILDDIR=%CD%\build-nightly-%ARCH%
set LOG=%BUILDDIR%\build.log

if "%PROGRAMFILES%"=="" set PROGRAMFILES=C:\Programme
set VS90COMNTOOLS=%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\Tools\
call "%PROGRAMFILES%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
if "%OSGEO4W_ROOT%"=="" (
if "%ARCH%"=="x86" (
set OSGEO4W_ROOT=C:\OSGeo4W
) else (
set OSGEO4W_ROOT=C:\OSGeo4W64
)
)

if "%OSGEO4W_ROOT%"=="" set OSGEO4W_ROOT=%PROGRAMFILES%\OSGeo4W
if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" goto error
if not exist "%BUILDDIR%" mkdir %BUILDDIR%
if not exist "%BUILDDIR%" (echo "could not create build directory %BUILDDIR%" & goto error)

if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" (echo "o4w_env.bat not found" & goto error)
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"

set O4W_ROOT=%OSGEO4W_ROOT:\=/%
set LIB_DIR=%O4W_ROOT%

if not "%PROGRAMFILES(X86)%"=="" set PF86=%PROGRAMFILES(X86)%
if "%PF86%"=="" set PF86=%PROGRAMFILES%
if "%PF86%"=="" (echo "PROGRAMFILES not set" & goto error)

if "%ARCH%"=="x86" goto devenv_x86
goto devenv_x86_64

:devenv_x86
set VS90COMNTOOLS=%PF86%\Microsoft Visual Studio 9.0\Common7\Tools\
call "%PF86%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86

set DEVENV=
if exist "%DevEnvDir%\vcexpress.exe" set DEVENV=vcexpress
if exist "%DevEnvDir%\devenv.exe" set DEVENV=devenv
if "%DEVENV%"=="" goto error

set CMAKE_OPT=^
-G "Visual Studio 9 2008" ^
-D BUILDNAME="OSGeo4W-Nightly-VC9" ^
-D SIP_BINARY_PATH=%O4W_ROOT%/apps/Python27/sip.exe ^
-D QT_ZLIB_LIBRARY=%O4W_ROOT%/lib/zlib.lib ^
-D QT_PNG_LIBRARY=%O4W_ROOT%/lib/libpng13.lib ^
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MD /ZI /MP /Od /D NDEBUG /D QGISDEBUG"
goto devenv

:devenv_x86_64
call "%PF86%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64

set DEVENV=devenv
set CMAKE_OPT=^
-G "Visual Studio 10 Win64" ^
-D BUILDNAME="OSGeo4W-Nightly-VC10-64" ^
-D SPATIALINDEX_LIBRARY=%O4W_ROOT%/lib/spatialindex-64.lib ^
-D SIP_BINARY_PATH=%O4W_ROOT%/bin/sip.exe ^
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MD /Zi /MP /Od /D NDEBUG /D QGISDEBUG" ^
-D SETUPAPI_LIBRARY="%PF86%/Microsoft SDKs/Windows/v7.0A/Lib/x64/SetupAPI.Lib"

:devenv
set PYTHONPATH=
path %PF86%\CMake 2.8\bin;%PATH%;c:\cygwin\bin
if "%DEVENV%"=="" (echo "DEVENV not found" & goto error)

PROMPT qgis%VERSION%$g

set BUILDCONF=RelWithDebInfo
REM set BUILDCONF=Release


cd ..\..
set SRCDIR=%CD%
Expand All @@ -70,7 +104,7 @@ REM try renaming the logfile to see if it's locked
REM

if exist build.tmp del build.tmp
if exist build.tmp goto error
if exist build.tmp (echo "could not remove build.tmp" & goto error)

ren build.log build.tmp
if exist build.log goto locked
Expand All @@ -90,7 +124,7 @@ goto error
:build
echo Logging to %LOG%
echo BEGIN: %DATE% %TIME%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo "could not write to log %LOG%" & goto error)

set >buildenv.log

Expand All @@ -103,8 +137,7 @@ set LIB=%LIB%;%OSGEO4W_ROOT%\lib
set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%\include
set GRASS_PREFIX=%O4W_ROOT%/apps/grass/grass-%GRASS_VERSION%

cmake -G "Visual Studio 9 2008" ^
-D BUILDNAME="OSGeo4W-Nightly-VC9" ^
cmake %CMAKE_OPT% ^
-D SITE="qgis.org" ^
-D PEDANTIC=TRUE ^
-D WITH_QSPATIALITE=TRUE ^
Expand All @@ -114,54 +147,56 @@ cmake -G "Visual Studio 9 2008" ^
-D WITH_GLOBE=TRUE ^
-D WITH_TOUCH=TRUE ^
-D WITH_ORACLE=TRUE ^
-D WITH_GRASS=TRUE ^
-D CMAKE_BUILD_TYPE=%BUILDCONF% ^
-D CMAKE_CONFIGURATION_TYPES=%BUILDCONF% ^
-D GEOS_LIBRARY=%O4W_ROOT%/lib/geos_c.lib ^
-D SQLITE3_LIBRARY=%O4W_ROOT%/lib/sqlite3_i.lib ^
-D SPATIALITE_LIBRARY=%O4W_ROOT%/lib/spatialite_i.lib ^
-D PYTHON_EXECUTABLE=%O4W_ROOT%/bin/python.exe ^
-D PYTHON_INCLUDE_PATH=%O4W_ROOT%/apps/Python27/include ^
-D PYTHON_LIBRARY=%O4W_ROOT%/apps/Python27/libs/python27.lib ^
-D SIP_BINARY_PATH=%O4W_ROOT%/apps/Python27/sip.exe ^
-D QT_BINARY_DIR=%O4W_ROOT%/bin ^
-D QT_LIBRARY_DIR=%O4W_ROOT%/lib ^
-D QT_HEADERS_DIR=%O4W_ROOT%/include/qt4 ^
-D QT_ZLIB_LIBRARY=%O4W_ROOT%/lib/zlib.lib ^
-D QT_PNG_LIBRARY=%O4W_ROOT%/lib/libpng13.lib ^
-D QWT_INCLUDE_DIR=%O4W_ROOT%/include/qwt ^
-D QWT_LIBRARY=%O4W_ROOT%/lib/qwt5.lib ^
-D CMAKE_INSTALL_PREFIX=%O4W_ROOT%/apps/%PACKAGENAME% ^
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MD /ZI /MP /Od /D NDEBUG /D QGISDEBUG" ^
-D FCGI_INCLUDE_DIR=%O4W_ROOT%/include ^
-D FCGI_LIBRARY=%O4W_ROOT%/lib/libfcgi.lib ^
%SRCDIR%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo "cmake failed" & goto error)

REM bail out if python or grass was not found
grep -Eq "^(Python not being built|Could not find GRASS)" %LOG%
if not errorlevel 1 goto error
if not errorlevel 1 (echo "python or grass not found" & goto error)

:skipcmake

echo ZERO_CHECK: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ZERO_CHECK /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo "ZERO_CHECK failed" & goto error)

echo ALL_BUILD: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ALL_BUILD /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo "ALL_BUILD failed" & goto error)

if not exist ..\skiptests (
echo RUN_TESTS: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project Nightly /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 echo "TESTS WERE NOT SUCCESSFUL."
)

echo RUN_TESTS: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project Nightly /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
REM if errorlevel 1 echo "TESTS WERE NOT SUCCESSFUL."
set PKGDIR=%OSGEO4W_ROOT%\apps\%PACKAGENAME%

if exist %OSGEO4W_ROOT%\apps\%PACKAGENAME% (
if exist %PKGDIR% (
echo REMOVE: %DATE% %TIME%>>%LOG% 2>&1
rmdir /s /q %OSGEO4W_ROOT%\apps\%PACKAGENAME%
rmdir /s /q %PKGDIR%
)

echo INSTALL: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project INSTALL /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo INSTALL failed & goto error)

:package
echo PACKAGE: %DATE% %TIME%>>%LOG% 2>&1
Expand All @@ -174,16 +209,17 @@ sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' -e 's/@grassve
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' -e 's/@grassversion@/%GRASS_VERSION%/g' qgis.reg.tmpl >%OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qgis.reg.tmpl

REM sed -e 's/%OSGEO4W_ROOT:\=\\\\\\\\%/@osgeo4w@/' %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py >%OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py.tmpl
REM if errorlevel 1 goto error
REM if errorlevel 1 (echo creation of qgisconfig.py.tmpl failed & goto error)

REM del %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py
REM del %PKGDIR%\python\qgis\qgisconfig.py

touch exclude

move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-bin.exe
move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser-bin.exe
move %PKGDIR%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-bin.exe
move %PKGDIR%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser-bin.exe

tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
if not exist %ARCH%\release\qgis\%PACKAGENAME% mkdir %ARCH%\release\qgis\%PACKAGENAME%
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%/%PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
apps/%PACKAGENAME% ^
bin/%PACKAGENAME%-bin.exe ^
Expand All @@ -195,10 +231,15 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
etc/postinstall/%PACKAGENAME%.bat ^
etc/preremove/%PACKAGENAME%.bat ^
>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo tar failed & goto error)

goto end

:usage
echo usage: %0 version package packagename arch
echo sample: %0 2.1.0 38 qgis-dev x86_64
exit

:error
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%>>%LOG% 2>&1
Expand Down
202 changes: 0 additions & 202 deletions ms-windows/osgeo4w/package-nightly64.cmd

This file was deleted.

163 changes: 98 additions & 65 deletions ms-windows/osgeo4w/package.cmd
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@echo off
REM ***************************************************************************
REM package.cmd
REM ---------------------
Expand All @@ -12,47 +13,77 @@ REM * the Free Software Foundation; either version 2 of the License, or *
REM * (at your option) any later version. *
REM * *
REM ***************************************************************************
@echo off
set GRASS_VERSION=6.4.3

set BUILDDIR=%CD%\build
REM set BUILDDIR=%TEMP%\qgis_unstable
set LOG=%BUILDDIR%\build.log

if not exist "%BUILDDIR%" mkdir %BUILDDIR%
if not exist "%BUILDDIR%" goto error

set VERSION=%1
set PACKAGE=%2
set PACKAGENAME=%3
if "%VERSION%"=="" goto error
if "%PACKAGE%"=="" goto error
if "%PACKAGENAME%"=="" set PACKAGENAME=qgis
set ARCH=%4
if "%VERSION%"=="" goto usage
if "%PACKAGE%"=="" goto usage
if "%PACKAGENAME%"=="" goto usage
if "%ARCH%"=="" goto usage

path %SYSTEMROOT%\system32;%SYSTEMROOT%;%SYSTEMROOT%\System32\Wbem;%PROGRAMFILES%\CMake 2.8\bin
set PYTHONPATH=
set BUILDDIR=%CD%\build-%ARCH%
set LOG=%BUILDDIR%\build.log

set VS90COMNTOOLS=%PROGRAMFILES%\Microsoft Visual Studio 9.0\Common7\Tools\
call "%PROGRAMFILES%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86
if "%OSGEO4W_ROOT%"=="" (
if "%ARCH%"=="x86" (
set OSGEO4W_ROOT=C:\OSGeo4W
) else (
set OSGEO4W_ROOT=C:\OSGeo4W64
)
)

if not exist "%BUILDDIR%" mkdir %BUILDDIR%
if not exist "%BUILDDIR%" (echo "could not create build directory %BUILDDIR%" & goto error)

if "%OSGEO4W_ROOT%"=="" set OSGEO4W_ROOT=%PROGRAMFILES%\OSGeo4W
if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" goto error
if not exist "%OSGEO4W_ROOT%\bin\o4w_env.bat" (echo "o4w_env.bat not found" & goto error)
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
path %PATH%;c:\cygwin\bin

set O4W_ROOT=%OSGEO4W_ROOT:\=/%
set LIB_DIR=%O4W_ROOT%

if not "%PROGRAMFILES(X86)%"=="" set PF86=%PROGRAMFILES(X86)%
if "%PF86%"=="" set PF86=%PROGRAMFILES%
if "%PF86%"=="" (echo "PROGRAMFILES not set" & goto error)

if "%ARCH%"=="x86" goto devenv_x86
goto devenv_x86_64

:devenv_x86
set VS90COMNTOOLS=%PF86%\Microsoft Visual Studio 9.0\Common7\Tools\
call "%PF86%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" x86

set DEVENV=
if exist "%DevEnvDir%\vcexpress.exe" set DEVENV=vcexpress
if exist "%DevEnvDir%\devenv.exe" set DEVENV=devenv
if "%DEVENV%"=="" goto error

PROMPT qgis%VERSION%$g
set CMAKE_OPT=^
-G "Visual Studio 9 2008" ^
-D SIP_BINARY_PATH=%O4W_ROOT%/apps/Python27/sip.exe ^
-D QT_ZLIB_LIBRARY=%O4W_ROOT%/lib/zlib.lib ^
-D QT_PNG_LIBRARY=%O4W_ROOT%/lib/libpng13.lib
goto devenv

:devenv_x86_64
call "%PF86%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64

set DEVENV=devenv
set CMAKE_OPT=^
-G "Visual Studio 10 Win64" ^
-D SPATIALINDEX_LIBRARY=%O4W_ROOT%/lib/spatialindex-64.lib ^
-D SIP_BINARY_PATH=%O4W_ROOT%/bin/sip.exe ^
-D SETUPAPI_LIBRARY="%PF86%/Microsoft SDKs/Windows/v7.0A/Lib/x64/SetupAPI.Lib"

:devenv
set PYTHONPATH=
path %PF86%\CMake 2.8\bin;%PATH%;c:\cygwin\bin
if "%DEVENV%"=="" (echo "DEVENV not found" & goto error)

set BUILDCONF=RelWithDebInfo
REM set BUILDCONF=Release
PROMPT qgis%VERSION%$g

set BUILDCONF=Release

cd ..\..
set SRCDIR=%CD%
Expand All @@ -69,7 +100,7 @@ REM try renaming the logfile to see if it's locked
REM

if exist build.tmp del build.tmp
if exist build.tmp goto error
if exist build.tmp (echo "could not remove build.tmp" & goto error)

ren build.log build.tmp
if exist build.log goto locked
Expand All @@ -89,7 +120,7 @@ goto error
:build
echo Logging to %LOG%
echo BEGIN: %DATE% %TIME%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo "could not write to log %LOG%" & goto error)

set >buildenv.log

Expand All @@ -102,14 +133,16 @@ set LIB=%LIB%;%OSGEO4W_ROOT%\lib
set INCLUDE=%INCLUDE%;%OSGEO4W_ROOT%\include
set GRASS_PREFIX=%O4W_ROOT%/apps/grass/grass-%GRASS_VERSION%

cmake -G "Visual Studio 9 2008" ^
cmake %CMAKE_OPT% ^
-D PEDANTIC=TRUE ^
-D WITH_QSPATIALITE=TRUE ^
-D WITH_MAPSERVER=TRUE ^
-D MAPSERVER_SKIP_ECW=TRUE ^
-D WITH_GLOBE=TRUE ^
-D WITH_TOUCH=TRUE ^
-D WITH_ORACLE=TRUE ^
-D WITH_GRASS=TRUE ^
-D CMAKE_CXX_FLAGS_RELEASE="/MD /MP /O2 /Ob2 /D NDEBUG" ^
-D CMAKE_BUILD_TYPE=%BUILDCONF% ^
-D CMAKE_CONFIGURATION_TYPES=%BUILDCONF% ^
-D GEOS_LIBRARY=%O4W_ROOT%/lib/geos_c.lib ^
Expand All @@ -118,43 +151,41 @@ cmake -G "Visual Studio 9 2008" ^
-D PYTHON_EXECUTABLE=%O4W_ROOT%/bin/python.exe ^
-D PYTHON_INCLUDE_PATH=%O4W_ROOT%/apps/Python27/include ^
-D PYTHON_LIBRARY=%O4W_ROOT%/apps/Python27/libs/python27.lib ^
-D SIP_BINARY_PATH=%O4W_ROOT%/apps/Python27/sip.exe ^
-D QT_BINARY_DIR=%O4W_ROOT%/bin ^
-D QT_LIBRARY_DIR=%O4W_ROOT%/lib ^
-D QT_HEADERS_DIR=%O4W_ROOT%/include/qt4 ^
-D QT_ZLIB_LIBRARY=%O4W_ROOT%/lib/zlib.lib ^
-D QT_PNG_LIBRARY=%O4W_ROOT%/lib/libpng13.lib ^
-D QWT_INCLUDE_DIR=%O4W_ROOT%/include/qwt ^
-D QWT_LIBRARY=%O4W_ROOT%/lib/qwt5.lib ^
-D CMAKE_INSTALL_PREFIX=%O4W_ROOT%/apps/%PACKAGENAME% ^
-D CMAKE_CXX_FLAGS_RELWITHDEBINFO="/MD /ZI /Od /D NDEBUG" ^
-D FCGI_INCLUDE_DIR=%O4W_ROOT%/include ^
-D FCGI_LIBRARY=%O4W_ROOT%/lib/libfcgi.lib ^
%SRCDIR%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo "cmake failed" & goto error)

REM bail out if python or grass was not found
grep -Eq "^(Python not being built|Could not find GRASS)" %LOG%
if not errorlevel 1 goto error
if not errorlevel 1 (echo "python or grass not found" & goto error)

:skipcmake

echo ZERO_CHECK: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ZERO_CHECK /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo "ZERO_CHECK failed" & goto error)

echo ALL_BUILD: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project ALL_BUILD /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo "ALL_BUILD failed" & goto error)

set PKGDIR=%OSGEO4W_ROOT%\apps\%PACKAGENAME%

if exist %OSGEO4W_ROOT%\apps\%PACKAGENAME% (
if exist %PKGDIR% (
echo REMOVE: %DATE% %TIME%>>%LOG% 2>&1
rmdir /s /q %OSGEO4W_ROOT%\apps\%PACKAGENAME%
rmdir /s /q %PKGDIR%
)

echo INSTALL: %DATE% %TIME%>>%LOG% 2>&1
%DEVENV% qgis%VERSION%.sln /Project INSTALL /Build %BUILDCONF% /Out %LOG%>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo INSTALL failed & goto error)

:package
echo PACKAGE: %DATE% %TIME%>>%LOG% 2>&1
Expand All @@ -174,19 +205,19 @@ if not exist %OSGEO4W_ROOT%\httpd.d mkdir %OSGEO4W_ROOT%\httpd.d
sed -e 's/@package@/%PACKAGENAME%/g' -e 's/@version@/%VERSION%/g' -e 's/@grassversion@/%GRASS_VERSION%/g' httpd.conf.tmpl >%OSGEO4W_ROOT%\httpd.d\httpd_%PACKAGENAME%.conf.tmpl

REM sed -e 's/%OSGEO4W_ROOT:\=\\\\\\\\%/@osgeo4w@/' %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py >%OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py.tmpl
REM if errorlevel 1 goto error
REM if errorlevel 1 (echo creation of qgisconfig.py.tmpl failed & goto error)

REM del %OSGEO4W_ROOT%\apps\%PACKAGENAME%\python\qgis\qgisconfig.py
REM del %PKGDIR%\python\qgis\qgisconfig.py

touch exclude

tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-common-%VERSION%-%PACKAGE%.tar.bz2 ^
for %%i in ("" "-common" "-server" "-devel" "-grass-plugin" "-globe-plugin" "-oracle-provider") do (
if not exist %ARCH%\release\qgis\%PACKAGENAME%%%i mkdir %ARCH%\release\qgis\%PACKAGENAME%%%i
)

tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-common/%PACKAGENAME%-common-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/bin/Microsoft.VC90.CRT.manifest" ^
"apps/%PACKAGENAME%/bin/msvcm90.dll" ^
"apps/%PACKAGENAME%/bin/msvcp90.dll" ^
"apps/%PACKAGENAME%/bin/msvcr90.dll" ^
"apps/%PACKAGENAME%/bin/qgispython.dll" ^
"apps/%PACKAGENAME%/bin/qgis_analysis.dll" ^
"apps/%PACKAGENAME%/bin/qgis_networkanalysis.dll" ^
Expand Down Expand Up @@ -216,9 +247,9 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-common-%VERSION%-%PACKAGE%.tar.bz2 ^
"apps/%PACKAGENAME%/crssync.exe" ^
"etc/postinstall/%PACKAGENAME%-common.bat" ^
>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo tar common failed & goto error)

tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 ^
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-server/%PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/bin/qgis_mapserv.fcgi.exe" ^
Expand All @@ -228,11 +259,12 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 ^
"etc/postinstall/%PACKAGENAME%-server.bat" ^
"etc/preremove/%PACKAGENAME%-server.bat" ^
>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo tar server failed & goto error)

move %PKGDIR%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-bin.exe
move %PKGDIR%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser-bin.exe

move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qgis.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-bin.exe
move %OSGEO4W_ROOT%\apps\%PACKAGENAME%\bin\qbrowser.exe %OSGEO4W_ROOT%\bin\%PACKAGENAME%-browser-bin.exe
tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%/%PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"bin/%PACKAGENAME%-browser-bin.exe" ^
Expand Down Expand Up @@ -266,9 +298,9 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 ^
"etc/postinstall/%PACKAGENAME%.bat" ^
"etc/preremove/%PACKAGENAME%.bat" ^
>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo tar desktop failed & goto error)

tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz2 ^
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-grass-plugin/%PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/grass" ^
Expand All @@ -278,43 +310,44 @@ tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz
"apps/%PACKAGENAME%/plugins/grassprovider.dll" ^
"apps/%PACKAGENAME%/plugins/libgrass_gis.%GRASS_VERSION%.dll" ^
>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo tar grass-plugin failed & goto error)

tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-globe-plugin-%VERSION%-%PACKAGE%.tar.bz2 ^
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-globe-plugin/%PACKAGENAME%-globe-plugin-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/globe" ^
"apps/%PACKAGENAME%/plugins/globeplugin.dll" ^
>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo tar globe-plugin failed & goto error)

tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-oracle-provider-%VERSION%-%PACKAGE%.tar.bz2 ^
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-oracle-provider/%PACKAGENAME%-oracle-provider-%VERSION%-%PACKAGE%.tar.bz2 ^
"apps/%PACKAGENAME%/plugins/oracleprovider.dll" ^
apps/qt4/plugins/sqldrivers/qsqlocispatial.dll ^
>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo tar oracle-provider failed & goto error)

tar -C %OSGEO4W_ROOT% -cjf %PACKAGENAME%-devel-%VERSION%-%PACKAGE%.tar.bz2 ^
tar -C %OSGEO4W_ROOT% -cjf %ARCH%/release/qgis/%PACKAGENAME%-devel/%PACKAGENAME%-devel-%VERSION%-%PACKAGE%.tar.bz2 ^
--exclude-from exclude ^
--exclude "*.pyc" ^
"apps/%PACKAGENAME%/FindQGIS.cmake" ^
"apps/%PACKAGENAME%/include/" ^
"apps/%PACKAGENAME%/lib/" ^
>>%LOG% 2>&1
if errorlevel 1 goto error
if errorlevel 1 (echo tar devel failed & goto error)

goto end

:usage
echo usage: %0 version package packagename arch
echo sample: %0 2.0.1 3 qgis x86
exit

:error
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%
echo BUILD ERROR %ERRORLEVEL%: %DATE% %TIME%>>%LOG% 2>&1
if exist %PACKAGENAME%-common-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-common-%VERSION%-%PACKAGE%.tar.bz2
if exist %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-%VERSION%-%PACKAGE%.tar.bz2
if exist %PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-server-%VERSION%-%PACKAGE%.tar.bz2
if exist %PACKAGENAME%-devel-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-devel-%VERSION%-%PACKAGE%.tar.bz2
if exist %PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-grass-plugin-%VERSION%-%PACKAGE%.tar.bz2
if exist %PACKAGENAME%-globe-plugin-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-globe-plugin-%VERSION%-%PACKAGE%.tar.bz2
if exist %PACKAGENAME%-oracle-provider-%VERSION%-%PACKAGE%.tar.bz2 del %PACKAGENAME%-oracle-provider-%VERSION%-%PACKAGE%.tar.bz2
for %%i in ("" "-common" "-server" "-devel" "-grass-plugin" "-globe-plugin" "-oracle-provider") do (
if exist %ARCH%\release\qgis\%PACKAGENAME%%%i\%PACKAGENAME%%%i-%VERSION%-%PACKAGE%.tar.bz2 del %ARCH%\release\qgis\%PACKAGENAME%%%i\%PACKAGENAME%%%i-%VERSION%-%PACKAGE%.tar.bz2
)

:end
echo FINISHED: %DATE% %TIME% >>%LOG% 2>&1
309 changes: 0 additions & 309 deletions ms-windows/osgeo4w/package64.cmd

This file was deleted.

119 changes: 55 additions & 64 deletions python/console/console_editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,79 +297,64 @@ def contextMenuEvent(self, e):
iconCut = QgsApplication.getThemeIcon("console/iconCutEditorConsole.png")
iconCopy = QgsApplication.getThemeIcon("console/iconCopyEditorConsole.png")
iconPaste = QgsApplication.getThemeIcon("console/iconPasteEditorConsole.png")
hideEditorAction = menu.addAction(QCoreApplication.translate("PythonConsole", "Hide Editor"),
self.hideEditor)
menu.addSeparator()
hideEditorAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Hide Editor"),
self.hideEditor)
menu.addSeparator() # ------------------------------
syntaxCheck = menu.addAction(iconSyntaxCk,
QCoreApplication.translate("PythonConsole",
"Check Syntax"),
self.syntaxCheck, 'Ctrl+4')
QCoreApplication.translate("PythonConsole", "Check Syntax"),
self.syntaxCheck, 'Ctrl+4')
menu.addSeparator()
runSelected = menu.addAction(iconRun,
QCoreApplication.translate("PythonConsole",
"Run selected"),
self.runSelectedCode, 'Ctrl+E')
QCoreApplication.translate("PythonConsole", "Run selected"),
self.runSelectedCode, 'Ctrl+E')
runScript = menu.addAction(iconRunScript,
QCoreApplication.translate("PythonConsole",
"Run Script"),
self.runScriptCode, 'Shift+Ctrl+E')
QCoreApplication.translate("PythonConsole", "Run Script"),
self.runScriptCode, 'Shift+Ctrl+E')
menu.addSeparator()
undoAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Undo"),
self.undo, QKeySequence.Undo)
redoAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Redo"),
self.redo, 'Ctrl+Shift+Z')
undoAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Undo"),
self.undo, QKeySequence.Undo)
redoAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Redo"),
self.redo, 'Ctrl+Shift+Z')
menu.addSeparator()
findAction = menu.addAction(iconFind,
QCoreApplication.translate("PythonConsole",
"Find Text"),
self.showFindWidget)
QCoreApplication.translate("PythonConsole", "Find Text"),
self.showFindWidget)
menu.addSeparator()
cutAction = menu.addAction(iconCut,
QCoreApplication.translate("PythonConsole",
"Cut"),
self.cut,
QKeySequence.Cut)
QCoreApplication.translate("PythonConsole", "Cut"),
self.cut, QKeySequence.Cut)
copyAction = menu.addAction(iconCopy,
QCoreApplication.translate("PythonConsole",
"Copy"),
self.copy,
QKeySequence.Copy)
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(iconPaste,
QCoreApplication.translate("PythonConsole",
"Paste"),
self.paste, QKeySequence.Paste)
QCoreApplication.translate("PythonConsole", "Paste"),
self.paste, QKeySequence.Paste)
menu.addSeparator()
commentCodeAction = menu.addAction(iconCommentEditor,
QCoreApplication.translate("PythonConsole",
"Comment"),
self.parent.pc.commentCode, 'Ctrl+3')
QCoreApplication.translate("PythonConsole", "Comment"),
self.parent.pc.commentCode, 'Ctrl+3')
uncommentCodeAction = menu.addAction(iconUncommentEditor,
QCoreApplication.translate("PythonConsole",
"Uncomment"),
self.parent.pc.uncommentCode,
'Shift+Ctrl+3')
QCoreApplication.translate("PythonConsole", "Uncomment"),
self.parent.pc.uncommentCode, 'Shift+Ctrl+3')
menu.addSeparator()
codePadAction = menu.addAction(iconCodePad,
QCoreApplication.translate("PythonConsole",
"Share on codepad"),
self.codepad)
QCoreApplication.translate("PythonConsole", "Share on codepad"),
self.codepad)
menu.addSeparator()
showCodeInspection = menu.addAction(iconObjInsp,
QCoreApplication.translate("PythonConsole",
"Hide/Show Object Inspector"),
self.objectListEditor)
QCoreApplication.translate("PythonConsole", "Hide/Show Object Inspector"),
self.objectListEditor)
menu.addSeparator()
selectAllAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Select All"),
self.selectAll,
QKeySequence.SelectAll)
selectAllAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Select All"),
self.selectAll, QKeySequence.SelectAll)
menu.addSeparator()
settingsDialog = menu.addAction(iconSettings,
QCoreApplication.translate("PythonConsole",
"Settings"),
self.parent.pc.openSettings)
QCoreApplication.translate("PythonConsole", "Settings"),
self.parent.pc.openSettings)
syntaxCheck.setEnabled(False)
pasteAction.setEnabled(False)
codePadAction.setEnabled(False)
Expand Down Expand Up @@ -977,20 +962,26 @@ def contextMenuEvent(self, e):
cW = self.widget(self.idx)
menu = QMenu(self)
menu.addSeparator()
newTabAction = menu.addAction("New Editor",
self.newTabEditor)
newTabAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "New Editor"),
self.newTabEditor)
menu.addSeparator()
closeTabAction = menu.addAction("Close Tab",
cW.close)
closeAllTabAction = menu.addAction("Close All",
self.closeAll)
closeOthersTabAction = menu.addAction("Close Others",
self.closeOthers)
closeTabAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Close Tab"),
cW.close)
closeAllTabAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Close All"),
self.closeAll)
closeOthersTabAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Close Others"),
self.closeOthers)
menu.addSeparator()
saveAction = menu.addAction("Save",
cW.save)
saveAsAction = menu.addAction("Save As",
self.saveAs)
saveAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Save"),
cW.save)
saveAsAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Save As"),
self.saveAs)
closeTabAction.setEnabled(False)
closeAllTabAction.setEnabled(False)
closeOthersTabAction.setEnabled(False)
Expand Down
31 changes: 22 additions & 9 deletions python/console/console_history_dlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<property name="horizontalSpacing">
<number>6</number>
</property>
<item row="2" column="1">
<item row="2" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -39,14 +39,7 @@
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="reloadHistory">
<property name="text">
<string>Reload</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<item row="0" column="0" colspan="3">
<widget class="QListView" name="listView">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
Expand All @@ -60,6 +53,26 @@
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="reloadHistory">
<property name="text">
<string>Reload</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QPushButton" name="saveHistory">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
<string>Save</string>
</property>
</widget>
</item>
</layout>
Expand Down
42 changes: 18 additions & 24 deletions python/console/console_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,38 +206,32 @@ def contextMenuEvent(self, e):
iconHideTool = QgsApplication.getThemeIcon("console/iconHideToolConsole.png")
iconSettings = QgsApplication.getThemeIcon("console/iconSettingsConsole.png")
hideToolBar = menu.addAction(iconHideTool,
QCoreApplication.translate("PythonConsole",
"Hide/Show Toolbar"),
self.hideToolBar)
QCoreApplication.translate("PythonConsole", "Hide/Show Toolbar"),
self.hideToolBar)
menu.addSeparator()
showEditorAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Show Editor"),
self.showEditor)
showEditorAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Show Editor"),
self.showEditor)
menu.addSeparator()
runAction = menu.addAction(iconRun,
QCoreApplication.translate("PythonConsole",
"Enter Selected"),
self.enteredSelected,
QKeySequence(Qt.CTRL + Qt.Key_E))
QCoreApplication.translate("PythonConsole", "Enter Selected"),
self.enteredSelected,
QKeySequence(Qt.CTRL + Qt.Key_E))
clearAction = menu.addAction(iconClear,
QCoreApplication.translate("PythonConsole",
"Clear console"),
self.clearConsole)
QCoreApplication.translate("PythonConsole", "Clear console"),
self.clearConsole)
menu.addSeparator()
copyAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Copy"),
self.copy,
QKeySequence.Copy)
copyAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
menu.addSeparator()
selectAllAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Select All"),
self.selectAll,
QKeySequence.SelectAll)
selectAllAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Select All"),
self.selectAll, QKeySequence.SelectAll)
menu.addSeparator()
settingsDialog = menu.addAction(iconSettings,
QCoreApplication.translate("PythonConsole",
"Settings"),
self.parent.openSettings)
QCoreApplication.translate("PythonConsole", "Settings"),
self.parent.openSettings)
runAction.setEnabled(False)
clearAction.setEnabled(False)
copyAction.setEnabled(False)
Expand Down
52 changes: 34 additions & 18 deletions python/console/console_sci.py
Original file line number Diff line number Diff line change
Expand Up @@ -476,28 +476,28 @@ def contextMenuEvent(self, e):
subMenu = QMenu(menu)
titleHistoryMenu = QCoreApplication.translate("PythonConsole", "Command History")
subMenu.setTitle(titleHistoryMenu)
showHistoryAction = subMenu.addAction(QCoreApplication.translate("PythonConsole",
"Show"),
self.showHistory, 'Ctrl+Shift+SPACE')
showHistoryAction = subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Show"),
self.showHistory, 'Ctrl+Shift+SPACE')
subMenu.addSeparator()
saveHistoryAction = subMenu.addAction(QCoreApplication.translate("PythonConsole",
"Save"),
self.writeHistoryFile)
saveHistoryAction = subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Save"),
self.writeHistoryFile)
subMenu.addSeparator()
clearHistoryAction = subMenu.addAction(QCoreApplication.translate("PythonConsole",
"Clear File"),
self.clearHistory)
clearSessHistoryAction = subMenu.addAction(QCoreApplication.translate("PythonConsole",
"Clear Session"),
self.clearHistorySession)
clearHistoryAction = subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Clear File"),
self.clearHistory)
clearSessHistoryAction = subMenu.addAction(
QCoreApplication.translate("PythonConsole", "Clear Session"),
self.clearHistorySession)
menu.addMenu(subMenu)
menu.addSeparator()
copyAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(QCoreApplication.translate("PythonConsole",
"Paste"),
self.paste, QKeySequence.Paste)
copyAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Copy"),
self.copy, QKeySequence.Copy)
pasteAction = menu.addAction(
QCoreApplication.translate("PythonConsole", "Paste"),
self.paste, QKeySequence.Paste)
copyAction.setEnabled(False)
pasteAction.setEnabled(False)
if self.hasSelectedText():
Expand Down Expand Up @@ -629,13 +629,19 @@ def __init__(self, parent):

self._reloadHistory()

self.deleteScut = QShortcut(QKeySequence(Qt.Key_Delete), self)
self.deleteScut.activated.connect(self._deleteItem)
self.listView.doubleClicked.connect(self._runHistory)
self.reloadHistory.clicked.connect(self._reloadHistory)
self.saveHistory.clicked.connect(self._saveHistory)

def _runHistory(self, item):
cmd = item.data(Qt.DisplayRole)
self.parent.runCommand(unicode(cmd))

def _saveHistory(self):
self.parent.writeHistoryFile(True)

def _reloadHistory(self):
self.model.clear()
for i in self.parent.history:
Expand All @@ -646,3 +652,13 @@ def _reloadHistory(self):

self.listView.setModel(self.model)
self.listView.scrollToBottom()

def _deleteItem(self):
itemsSelected = self.listView.selectionModel().selectedIndexes()
if itemsSelected:
item = itemsSelected[0].row()
## Remove item from the command history (just for the current session)
self.parent.history.pop(item)
self.parent.historyIndex -= 1
## Remove row from the command history dialog
self.model.removeRow(item)
8 changes: 4 additions & 4 deletions python/console/console_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ def saveSettings(self):
settings.setValue("pythonConsole/caretLineColor", self.caretLineColor.color())
settings.setValue("pythonConsole/caretLineColorEditor", self.caretLineColorEditor.color())
settings.setValue("pythonConsole/stderrFontColor", self.stderrFontColor.color())

settings.setValue("pythonConsole/singleQuoteFontColor", self.singleQuoteFontColor.color())
settings.setValue("pythonConsole/singleQuoteFontColorEditor", self.singleQuoteFontColorEditor.color())
settings.setValue("pythonConsole/doubleQuoteFontColor", self.doubleQuoteFontColor.color())
Expand All @@ -215,7 +215,7 @@ def saveSettings(self):
settings.setValue("pythonConsole/tripleSingleQuoteFontColorEditor", self.tripleSingleQuoteFontColorEditor.color())
settings.setValue("pythonConsole/tripleDoubleQuoteFontColor", self.tripleDoubleQuoteFontColor.color())
settings.setValue("pythonConsole/tripleDoubleQuoteFontColorEditor", self.tripleDoubleQuoteFontColorEditor.color())

def restoreSettings(self):
settings = QSettings()
self.spinBox.setValue(settings.value("pythonConsole/fontsize", 10, type=int))
Expand Down Expand Up @@ -285,7 +285,7 @@ def restoreSettings(self):
self.cursorColor.setColor(QColor(settings.value("pythonConsole/cursorColor", QColor(Qt.black))))
self.cursorColorEditor.setColor(QColor(settings.value("pythonConsole/cursorColorEditor", QColor(Qt.black))))
self.stderrFontColor.setColor(QColor(settings.value("pythonConsole/stderrFontColor", QColor(Qt.red))))

self.singleQuoteFontColor.setColor(settings.value("pythonConsole/singleQuoteFontColor", QColor(Qt.blue)))
self.singleQuoteFontColorEditor.setColor(settings.value("pythonConsole/singleQuoteFontColorEditor", QColor(Qt.blue)))
self.doubleQuoteFontColor.setColor(settings.value("pythonConsole/doubleQuoteFontColor", QColor(Qt.blue)))
Expand All @@ -311,7 +311,7 @@ def _resetFontColor(self):
self.doubleQuoteFontColor.setColor(QColor(Qt.blue))
self.tripleSingleQuoteFontColor.setColor(QColor(Qt.blue))
self.tripleDoubleQuoteFontColor.setColor(QColor(Qt.blue))


def _resetFontColorEditor(self):
self.defaultFontColorEditor.setColor(QColor(Qt.black))
Expand Down
16 changes: 13 additions & 3 deletions python/core/composer/qgscomposition.sip
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,17 @@ class QgsComposition : QGraphicsScene
void setSnapToGridEnabled( bool b );
bool snapToGridEnabled() const;

void setGridVisible( bool b );
bool gridVisible() const;

/**Toggles state of smart guides*/
void setSmartGuidesEnabled( bool b );
/**Returns true if smart guides are enabled*/
bool smartGuidesEnabled() const;

/**Removes all snap lines*/
void clearSnapLines();

void setSnapGridResolution( double r );
double snapGridResolution() const;

Expand Down Expand Up @@ -139,9 +150,6 @@ class QgsComposition : QGraphicsScene
QgsComposerMap* worldFileMap();
void setWorldFileMap( QgsComposerMap* map );

double selectionTolerance() const;
void setSelectionTolerance( double tol );

/**Returns pointer to map renderer of qgis map canvas*/
QgsMapRenderer* mapRenderer();

Expand Down Expand Up @@ -223,6 +231,8 @@ class QgsComposition : QGraphicsScene
// QGraphicsLineItem* nearestSnapLine( bool horizontal, double x, double y, double tolerance, QList< QPair< QgsComposerItem*, QgsComposerItem::ItemPositionMode > >& snappedItems );
/**Hides / shows custom snap lines*/
void setSnapLinesVisible( bool visible );
/**Returns visibility of custom snap lines*/
bool snapLinesVisible() const;

/**Allocates new item command and saves initial state in it
@param item target item
Expand Down
3 changes: 3 additions & 0 deletions python/core/qgis.sip
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,6 @@ const double DEFAULT_LINE_WIDTH;
/** default snapping tolerance for segments (@note added in 1.8) */
const double DEFAULT_SEGMENT_EPSILON;

/** KEEP IN SYNC WITH qgssize defined in qgis.h! */
typedef unsigned long long qgssize;

2 changes: 1 addition & 1 deletion python/core/qgsexpression.sip
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class QgsExpression
Additional substitutions can be passed through the substitutionMap
parameter
*/
static QString replaceExpressionText( QString action, QgsFeature &feat,
static QString replaceExpressionText( QString action, const QgsFeature *feat,
QgsVectorLayer* layer,
const QMap<QString, QVariant> *substitutionMap = 0 );
//
Expand Down
2 changes: 2 additions & 0 deletions python/core/qgsfeaturerequest.sip
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ class QgsFeatureRequest
explicit QgsFeatureRequest( QgsFeatureId fid );
//! construct a request with rectangle filter
explicit QgsFeatureRequest( const QgsRectangle& rect );
//! construct a request with a filter expression
explicit QgsFeatureRequest( const QgsExpression& expression );

FilterType filterType() const;

Expand Down
5 changes: 5 additions & 0 deletions python/core/qgspluginlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,9 @@ class QgsPluginLayer : QgsMapLayer
QString pluginLayerType();

void setExtent( const QgsRectangle &extent );

//! return a list of symbology items for the legend
//! (defult implementation returns nothing)
//! @note Added in v2.1
virtual QgsLegendSymbologyList legendSymbologyItems( const QSize& iconSize );
};
4 changes: 4 additions & 0 deletions python/core/qgspluginlayerregistry.sip
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ class QgsPluginLayerRegistry

~QgsPluginLayerRegistry();

/** list all known layer types
* \note added in v2.1 */
QStringList pluginLayerTypes();

/** add plugin layer type (take ownership) and return true on success */
bool addPluginLayerType( QgsPluginLayerType* pluginLayerType /Transfer/ );

Expand Down
5 changes: 5 additions & 0 deletions python/core/qgspoint.sip
Original file line number Diff line number Diff line change
Expand Up @@ -126,4 +126,9 @@ class QgsPoint
PyErr_SetString(PyExc_IndexError, msg.toAscii().constData());
}
%End

long __hash__() const;
%MethodCode
sipRes = qHash( *sipCpp );
%End
}; // class QgsPoint
2 changes: 1 addition & 1 deletion python/core/raster/qgspalettedrasterrenderer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class QgsPalettedRasterRenderer : QgsRasterRenderer
%End
public:
/**Renderer owns color array*/
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QColor* colorArray /Array,Transfer/, int nColors /ArraySize/ );
QgsPalettedRasterRenderer( QgsRasterInterface* input, int bandNumber, QColor* colorArray /Array,Transfer/, int nColors /ArraySize/, const QVector<QString> labels = QVector<QString>() );
~QgsPalettedRasterRenderer();
QgsRasterInterface * clone() const /Factory/;
static QgsRasterRenderer* create( const QDomElement& elem, QgsRasterInterface* input ) /Factory/;
Expand Down
2 changes: 1 addition & 1 deletion python/core/raster/qgsrasterbandstats.sip
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class QgsRasterBandStats

/** \brief The number of not no data cells in the band. */
// TODO: check if no data are excluded in stats calculation
size_t elementCount;
qgssize elementCount;

/** \brief The maximum cell value in the raster band. NO_DATA values
* are ignored. This does not use the gdal GetMaximmum function. */
Expand Down
14 changes: 7 additions & 7 deletions python/core/raster/qgsrasterblock.sip
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class QgsRasterBlock
* returned value is undefined.
* @param index data matrix index
* @return value */
double value( size_t index ) const;
double value( qgssize index ) const;

/** \brief Read a single color
* @param row row index
Expand All @@ -98,7 +98,7 @@ class QgsRasterBlock
/** \brief Read a single value
* @param index data matrix index
* @return color */
QRgb color( size_t index ) const;
QRgb color( qgssize index ) const;

/** \brief Check if value at position is no data
* @param row row index
Expand All @@ -109,7 +109,7 @@ class QgsRasterBlock
/** \brief Check if value at position is no data
* @param index data matrix index
* @return true if value is no data */
bool isNoData( size_t index );
bool isNoData( qgssize index );

/** \brief Set value on position
* @param row row index
Expand All @@ -122,7 +122,7 @@ class QgsRasterBlock
* @param index data matrix index
* @param value the value to be set
* @return true on success */
bool setValue( size_t index, double value );
bool setValue( qgssize index, double value );

/** \brief Set color on position
* @param row row index
Expand All @@ -135,7 +135,7 @@ class QgsRasterBlock
* @param index data matrix index
* @param color the color to be set, QRgb value
* @return true on success */
bool setColor( size_t index, QRgb color );
bool setColor( qgssize index, QRgb color );

/** \brief Set no data on pixel
* @param row row index
Expand All @@ -146,7 +146,7 @@ class QgsRasterBlock
/** \brief Set no data on pixel
* @param index data matrix index
* @return true on success */
bool setIsNoData( size_t index );
bool setIsNoData( qgssize index );

/** \brief Set the whole block to no data
* @return true on success */
Expand All @@ -169,7 +169,7 @@ class QgsRasterBlock
* @return pointer to data
* @note not available in python bindings
*/
// char * bits( size_t index );
// char * bits( qgssize index );

/** \brief Get pointer to data
* @return pointer to data
Expand Down
100 changes: 100 additions & 0 deletions python/core/symbology-ng/qgsfillsymbollayerv2.sip
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,106 @@ class QgsSimpleFillSymbolLayerV2 : QgsFillSymbolLayerV2
QgsSymbolV2::OutputUnit outputUnit() const;
};

class QgsGradientFillSymbolLayerV2 : QgsFillSymbolLayerV2
{
%TypeHeaderCode
#include <qgsfillsymbollayerv2.h>
%End

public:

enum GradientColorType
{
SimpleTwoColor,
ColorRamp
};

enum GradientType
{
Linear,
Radial,
Conical
};

enum GradientCoordinateMode
{
Feature,
Viewport
};

enum GradientSpread
{
Pad,
Reflect,
Repeat
};

QgsGradientFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR,
QColor color2 = Qt::white,
GradientColorType gradientColorType = SimpleTwoColor,
GradientType gradientType = Linear,
GradientCoordinateMode coordinateMode = Feature,
GradientSpread gradientSpread = Pad );

// static stuff

static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() ) /Factory/;

// implemented from base classes

QString layerType() const;

void startRender( QgsSymbolV2RenderContext& context );

void stopRender( QgsSymbolV2RenderContext& context );

void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );

QgsStringMap properties() const;

QgsSymbolLayerV2* clone() const /Factory/;

GradientType gradientType() const;
void setGradientType( GradientType gradientType );

GradientColorType gradientColorType() const;
void setGradientColorType( GradientColorType gradientColorType );

QgsVectorColorRampV2* colorRamp();
void setColorRamp( QgsVectorColorRampV2* ramp );

QColor color2() const;
void setColor2( QColor color2 );

GradientCoordinateMode coordinateMode() const;
void setCoordinateMode( GradientCoordinateMode coordinateMode );

GradientSpread gradientSpread() const;
void setGradientSpread( GradientSpread gradientSpread );

void setReferencePoint1( QPointF referencePoint );
QPointF referencePoint1() const;

void setReferencePoint1IsCentroid( bool isCentroid );
bool referencePoint1IsCentroid() const;

void setReferencePoint2( QPointF referencePoint );
QPointF referencePoint2() const;

void setReferencePoint2IsCentroid( bool isCentroid );
bool referencePoint2IsCentroid() const;

void setAngle( double angle );
double angle() const;

void setOffset( QPointF offset );
QPointF offset() const;

void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
QgsSymbolV2::OutputUnit offsetUnit() const;

};

/**Base class for polygon renderers generating texture images*/
class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2
{
Expand Down
2 changes: 2 additions & 0 deletions python/gui/editorwidgets/qgseditorwidgetwrapper.sip
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ class QgsEditorWidgetWrapper : QObject
protected:
virtual QWidget* createWidget( QWidget* parent ) = 0 /Factory/;

virtual void initWidget( QWidget* editor );

signals:
void valueChanged( const QVariant& value );

Expand Down
1 change: 1 addition & 0 deletions python/gui/qgisinterface.sip
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ class QgisInterface : QObject
virtual QAction *actionZoomToLayer() = 0;
virtual QAction *actionZoomToSelected() = 0;
virtual QAction *actionZoomLast() = 0;
virtual QAction *actionZoomNext() = 0;
virtual QAction *actionZoomActualSize() = 0;
virtual QAction *actionMapTips() = 0;
virtual QAction *actionNewBookmark() = 0;
Expand Down
4 changes: 2 additions & 2 deletions python/gui/qgsmaptoolidentify.sip
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

class QgsMapToolIdentify : QgsMapTool
{
%TypeHeaderCode
Expand All @@ -12,7 +11,8 @@ class QgsMapToolIdentify : QgsMapTool
DefaultQgsSetting = -1,
ActiveLayer,
TopDownStopAtFirst,
TopDownAll
TopDownAll,
LayerSelection
};

enum LayerType
Expand Down
2 changes: 2 additions & 0 deletions python/gui/qgsmaptooltouch.sip
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ class QgsMapToolTouch : QgsMapTool
virtual void canvasDoubleClickEvent( QMouseEvent * e );

virtual bool isTransient();

bool gestureEvent( QGestureEvent *event );
};
%End
3 changes: 2 additions & 1 deletion python/gui/qgsrubberband.sip
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class QgsRubberBand: QgsMapCanvasItem
ICON_CROSS,
ICON_X,
ICON_BOX,
ICON_CIRCLE
ICON_CIRCLE,
ICON_FULL_BOX
};

QgsRubberBand( QgsMapCanvas* mapCanvas /TransferThis/, QGis::GeometryType geometryType = QGis::Line );
Expand Down
7 changes: 4 additions & 3 deletions python/plugins/GdalTools/GdalTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
import qgis.utils

# Initialize Qt resources from file resources_rc.py
import resources_rc
Expand All @@ -39,7 +40,7 @@
# if the plugin is shipped with QGis catch the exception and
# display an error message
import os.path
qgisUserPluginPath = os.path.abspath( os.path.join( unicode( QgsApplication.qgisSettingsDirPath() ), "python") )
qgisUserPluginPath = qgis.utils.home_plugin_path
if not os.path.dirname(__file__).startswith( qgisUserPluginPath ):
title = QCoreApplication.translate( "GdalTools", "Plugin error" )
message = QCoreApplication.translate( "GdalTools", u'Unable to load {0} plugin. \nThe required "{1}" module is missing. \nInstall it and try again.' )
Expand Down Expand Up @@ -68,8 +69,8 @@ def __init__( self, iface ):

if QGis.QGIS_VERSION[0:3] < "1.5":
# For i18n support
userPluginPath = QFileInfo( QgsApplication.qgisUserDbFilePath() ).path() + "/python/plugins/GdalTools"
systemPluginPath = QgsApplication.prefixPath() + "/python/plugins/GdalTools"
userPluginPath = qgis.utils.home_plugin_path + "/GdalTools"
systemPluginPath = qgis.utils.sys_plugin_path + "/GdalTools"

overrideLocale = QSettings().value( "locale/overrideFlag", False, type=bool )
if not overrideLocale:
Expand Down
1 change: 1 addition & 0 deletions python/plugins/GdalTools/tools/doExtractProj.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ def updateProgress( self ):

def processingFinished( self ):
self.stopProcessing()
QMessageBox.information(self, self.tr( "Finished" ), self.tr( "Processing completed." ) )

def processingInterrupted( self ):
self.restoreGui()
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/GdalTools/tools/extentSelector.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def __init__(self, canvas):
QgsMapToolEmitPoint.__init__(self, self.canvas)

self.rubberBand = QgsRubberBand( self.canvas, QGis.Polygon )
self.rubberBand.setColor( Qt.red )
self.rubberBand.setWidth( 1 )
self.rubberBand.setColor( QColor(255, 0, 0, 100) )
self.rubberBand.setWidth( 2 )

self.reset()

Expand Down
207 changes: 117 additions & 90 deletions python/plugins/db_manager/db_plugins/postgis/connector.py

Large diffs are not rendered by default.

10 changes: 6 additions & 4 deletions python/plugins/fTools/tools/doGeometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,11 @@ def updateGui( self ):
if self.chkWriteShapefile.isChecked():
self.lineEdit.setEnabled( True )
self.toolOut.setEnabled( True )
self.addToCanvasCheck.setEnabled( True )
else:
self.lineEdit.setEnabled( False )
self.toolOut.setEnabled( False )
self.addToCanvasCheck.setEnabled( False )

def populateLayers( self ):
self.inShape.clear()
Expand Down Expand Up @@ -565,11 +567,11 @@ def export_geometry_info( self ):
if self.writeShape:
outFeat.setGeometry( inGeom )
atMap = inFeat.attributes()
maxIndex = index1 if index1>index2 else index2
if maxIndex>len(atMap):
atMap += [ "" ] * ( index2+1 - len(atMap) )
maxIndex = index1 if index1 > index2 else index2
if maxIndex >= len(atMap):
atMap += [ "" ] * ( index2+1 - len(atMap) )
atMap[ index1 ] = attr1
if index1!=index2:
if index1 != index2:
atMap[ index2 ] = attr2
outFeat.setAttributes( atMap )
writer.addFeature( outFeat )
Expand Down
8 changes: 4 additions & 4 deletions python/plugins/processing/algs/SaveSelectedFeatures.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,8 @@ def processAlgorithm(self, progress):
# toolbox. The self.crs variable has to be changed in case this
# is not true, or in case there are no input layer from which
# the output crs can be infered


provider = vectorLayer.dataProvider()

writer = output.getVectorWriter(provider.fields(),
Expand All @@ -131,12 +131,12 @@ def processAlgorithm(self, progress):
# Now we take the selected features and add them to the output
# layer
features = vector.features(vectorLayer)
total = len(features)
total = len(features)
for (i, feat) in enumerate(features):
writer.addFeature(feat)

# We use the progress object to communicate with the user
progress.setPercentage(100 * i / float(total))
progress.setPercentage(100 * i / float(total))
del writer

# There is nothing more to do here. We do not have to open the
Expand Down
16 changes: 8 additions & 8 deletions python/plugins/processing/algs/ftools/ExtractByLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@
class ExtractByLocation(GeoAlgorithm):

INPUT = 'INPUT'
INTERSECT = 'INTERSECT'
INTERSECT = 'INTERSECT'
OUTPUT = 'OUTPUT'

def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Extract by location'
self.group = 'Vector selection tools'
self.addParameter(ParameterVector(self.INPUT, 'Layer to select from',
Expand All @@ -55,7 +55,7 @@ def processAlgorithm(self, progress):
filename = self.getParameterValue(self.INTERSECT)
selectLayer = dataobjects.getObjectFromUri(filename)
index = vector.spatialindex(layer)

geom = QgsGeometry()
selectedSet = []
current = 0
Expand All @@ -70,15 +70,15 @@ def processAlgorithm(self, progress):
feat = layer.getFeatures(request).next()
tmpGeom = QgsGeometry(feat.geometry())
if geom.intersects(tmpGeom):
selectedSet.append(feat.id())
selectedSet.append(feat.id())
progress.setPercentage(int(current * total))

output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())

for (i, feat) in enumerate(features):
if feat.id() in selectedSet:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
12 changes: 6 additions & 6 deletions python/plugins/processing/algs/ftools/RandomExtract.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class RandomExtract(GeoAlgorithm):

METHODS = ['Number of selected features',
'Percentage of selected features']
def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Random extract'
self.group = 'Vector selection tools'

Expand All @@ -69,7 +69,7 @@ def processAlgorithm(self, progress):

features = vector.features(layer)
featureCount = len(features)
value = int(self.getParameterValue(self.NUMBER))
value = int(self.getParameterValue(self.NUMBER))

if method == 0:
if value > featureCount:
Expand All @@ -85,12 +85,12 @@ def processAlgorithm(self, progress):

selran = random.sample(xrange(0, featureCount), value)

output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())

for (i, feat) in enumerate(features):
if i in selran:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ class RandomExtractWithinSubsets(GeoAlgorithm):
METHODS = ['Number of selected features',
'Percentage of selected features']

def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Random extract within subsets'
self.group = 'Vector selection tools'

Expand All @@ -72,12 +72,12 @@ def processAlgorithm(self, progress):
layer = dataobjects.getObjectFromUri(filename)
field = self.getParameterValue(self.FIELD)
method = self.getParameterValue(self.METHOD)

index = layer.fieldNameIndex(field)

features = vector.features(layer)
featureCount = len(features)
unique = vector.getUniqueValues(layer, index)
unique = vector.getUniqueValues(layer, index)
value = int(self.getParameterValue(self.NUMBER))
if method == 0:
if value > featureCount:
Expand All @@ -92,11 +92,11 @@ def processAlgorithm(self, progress):
value = value / 100.0


output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())
selran = []

selran = []
current = 0
total = 100.0 / float(featureCount * len(unique))
features = vector.features(layer)
Expand Down Expand Up @@ -129,6 +129,6 @@ def processAlgorithm(self, progress):
features = vector.features(layer)
for (i, feat) in enumerate(features):
if i in selran:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
2 changes: 1 addition & 1 deletion python/plugins/processing/algs/ftools/SelectByLocation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def processAlgorithm(self, progress):

oldSelection = set(inputLayer.selectedFeaturesIds())
index = vector.spatialindex(inputLayer)

geom = QgsGeometry()
selectedSet = []
current = 0
Expand Down
18 changes: 9 additions & 9 deletions python/plugins/processing/algs/mmqgisx/MMQGISXAlgorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,7 +1098,7 @@ def processAlgorithm(self, progress):

layer.setSelectedFeatures(selected)
self.setOutputValue(self.RESULT, filename)

class mmqgisx_extract_algorithm(GeoAlgorithm):

LAYERNAME = 'LAYERNAME'
Expand All @@ -1107,7 +1107,7 @@ class mmqgisx_extract_algorithm(GeoAlgorithm):
COMPARISON = 'COMPARISON'
RESULT = 'RESULT'

def defineCharacteristics(self):
def defineCharacteristics(self):
self.name = 'Extract by attribute'
self.group = 'Vector selection tools'

Expand Down Expand Up @@ -1142,19 +1142,19 @@ def processAlgorithm(self, progress):
comparisonvalue = self.getParameterValue(self.COMPARISONVALUE)

selected = select(layer, attribute, comparison, comparisonvalue, progress)

features = vector.features(layer)
featureCount = len(features)
output = self.getOutputFromName(self.OUTPUT)
output = self.getOutputFromName(self.OUTPUT)
writer = output.getVectorWriter(layer.fields(),
layer.geometryType(), layer.crs())
for (i, feat) in enumerate(features):
if feat.id() in selected:
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer
writer.addFeature(feat)
progress.setPercentage(100 * i / float(featureCount))
del writer

def select(layer, attribute, comparison, comparisonvalue, progress):
def select(layer, attribute, comparison, comparisonvalue, progress):
selectindex = layer.dataProvider().fieldNameIndex(attribute)
selectType = layer.dataProvider().fields()[selectindex].type()
selectionError = False
Expand Down Expand Up @@ -1263,7 +1263,7 @@ def select(layer, attribute, comparison, comparisonvalue, progress):
selected.append(feature.id())

progress.setPercentage(float(readcount) / totalcount * 100)

return selected

class mmqgisx_text_to_float_algorithm(GeoAlgorithm):
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/core/GeoAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def __init__(self):
# appear in the toolbox or modeler
self.showInToolbox = True
self.showInModeler = True
#if true, will show only loaded layers in parameters dialog.
#Also, if True, the algorithm does not run on the modeler
#if true, will show only loaded layers in parameters dialog.
#Also, if True, the algorithm does not run on the modeler
#or batch ptocessing interface
self.allowOnlyOpenedLayers = False

Expand Down
2 changes: 1 addition & 1 deletion python/plugins/processing/core/SilentProgress.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SilentProgress:

def error(self, msg):
print msg

def setText(self, text):
pass

Expand Down
94 changes: 94 additions & 0 deletions python/plugins/processing/gdal/ColorRelief.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
ColorRelief.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Alexander Bruy'
__date__ = 'October 2013'
__copyright__ = '(C) 2013, Alexander Bruy'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'


from PyQt4.QtGui import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.parameters.ParameterRaster import ParameterRaster
from processing.parameters.ParameterBoolean import ParameterBoolean
from processing.parameters.ParameterNumber import ParameterNumber
from processing.parameters.ParameterFile import ParameterFile
from processing.parameters.ParameterSelection import ParameterSelection
from processing.outputs.OutputRaster import OutputRaster
from processing.gdal.GdalUtils import GdalUtils
from processing.tools.system import *


class ColorRelief(GeoAlgorithm):

INPUT = 'INPUT'
BAND = 'BAND'
COMPUTE_EDGES = 'COMPUTE_EDGES'
COLOR_TABLE = 'COLOR_TABLE'
MATCH_MODE = 'MATCH_MODE'
OUTPUT = 'OUTPUT'

MATCHING_MODES = ['"0,0,0,0" RGBA', 'Exact color', 'Nearest color']

#def getIcon(self):
# filepath = os.path.dirname(__file__) + '/icons/dem.png'
# return QIcon(filepath)

def defineCharacteristics(self):
self.name = 'Color relief'
self.group = '[GDAL] Analysis'
self.addParameter(ParameterRaster(self.INPUT, 'Input layer'))
self.addParameter(ParameterNumber(self.BAND, 'Band number', 1, 99, 1))
self.addParameter(ParameterBoolean(self.COMPUTE_EDGES, 'Compute edges',
False))
self.addParameter(ParameterFile(self.COLOR_TABLE,
'Color configuration file', optional=False))
self.addParameter(ParameterSelection(self.MATCH_MODE,
'Matching mode', self.MATCHING_MODES, 0))

self.addOutput(OutputRaster(self.OUTPUT, 'Output file'))

def processAlgorithm(self, progress):
arguments = ['color-relief']
arguments.append(unicode(self.getParameterValue(self.INPUT)))
arguments.append(unicode(self.getParameterValue(self.COLOR_TABLE)))
#filePath = unicode(self.getParameterValue(self.COLOR_TABLE))
#if filePath is None or filePath == '':
# filePath = os.path.join(os.path.dirname(__file__), 'terrain.txt')
#arguments.append(filePath)
arguments.append(unicode(self.getOutputValue(self.OUTPUT)))

arguments.append('-b')
arguments.append(str(self.getParameterValue(self.BAND)))

if self.getParameterValue(self.COMPUTE_EDGES):
arguments.append('-compute_edges')

mode = self.getParameterValue(self.MATCH_MODE)
if mode == 1:
arguments.append('-exact_color_entry')
elif mode == 2:
arguments.append('-nearest_color_entry')

GdalUtils.runGdal(['gdaldem',
GdalUtils.escapeAndJoin(arguments)], progress)
14 changes: 14 additions & 0 deletions python/plugins/processing/gdal/GdalOgrAlgorithmProvider.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@
from processing.gdal.fillnodata import fillnodata
from processing.gdal.extractprojection import ExtractProjection
from processing.gdal.gdal2xyz import gdal2xyz
from processing.gdal.hillshade import hillshade
from processing.gdal.slope import slope
from processing.gdal.aspect import aspect
from processing.gdal.tri import tri
from processing.gdal.tpi import tpi
from processing.gdal.roughness import roughness
from processing.gdal.ColorRelief import ColorRelief
from processing.gdal.GridInvDist import GridInvDist
from processing.gdal.GridAverage import GridAverage
from processing.gdal.GridNearest import GridNearest
from processing.gdal.GridDataMetrics import GridDataMetrics

from processing.gdal.ogr2ogr import Ogr2Ogr
from processing.gdal.ogrinfo import OgrInfo
Expand Down Expand Up @@ -105,6 +116,9 @@ def createAlgsList(self):
rgb2pct(), pct2rgb(), merge(), polygonize(), gdaladdo(),
ClipByExtent(), ClipByMask(), contour(), rasterize(), proximity(),
sieve(), fillnodata(), ExtractProjection(), gdal2xyz(),
hillshade(), slope(), aspect(), tri(), tpi(), roughness(),
ColorRelief(), GridInvDist(), GridAverage(), GridNearest(),
GridDataMetrics(),
# ----- OGR tools -----
OgrInfo(), Ogr2Ogr(), OgrSql(),
]
Expand Down
101 changes: 101 additions & 0 deletions python/plugins/processing/gdal/GridAverage.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
GridAverage.py
---------------------
Date : October 2013
Copyright : (C) 2013 by Alexander Bruy
Email : alexander dot bruy at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************
"""

__author__ = 'Alexander Bruy'
__date__ = 'October 2013'
__copyright__ = '(C) 2013, Alexander Bruy'

# This will get replaced with a git SHA1 when you do a git archive

__revision__ = '$Format:%H$'


from PyQt4.QtGui import *

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.parameters.ParameterVector import ParameterVector
from processing.parameters.ParameterTableField import ParameterTableField
from processing.parameters.ParameterNumber import ParameterNumber
from processing.outputs.OutputRaster import OutputRaster
from processing.gdal.GdalUtils import GdalUtils
from processing.tools.system import *


class GridAverage(GeoAlgorithm):

INPUT = 'INPUT'
Z_FIELD = 'Z_FIELD'
RADIUS_1 = 'RADIUS_1'
RADIUS_2 = 'RADIUS_2'
MIN_POINTS = 'MIN_POINTS'
ANGLE = 'ANGLE'
NODATA = 'NODATA'
OUTPUT = 'OUTPUT'

#def getIcon(self):
# filepath = os.path.dirname(__file__) + '/icons/dem.png'
# return QIcon(filepath)

def defineCharacteristics(self):
self.name = 'Grid (Moving average)'
self.group = '[GDAL] Analysis'
self.addParameter(ParameterVector(self.INPUT, 'Input layer',
[ParameterVector.VECTOR_TYPE_POINT]))
self.addParameter(ParameterTableField(self.Z_FIELD, 'Z field',
self.INPUT, ParameterTableField.DATA_TYPE_NUMBER,
True))
self.addParameter(ParameterNumber(self.RADIUS_1, 'Radius 1',
0.0, 99999999.999999, 0.0))
self.addParameter(ParameterNumber(self.RADIUS_2, 'Radius 2',
0.0, 99999999.999999, 0.0))
self.addParameter(ParameterNumber(self.MIN_POINTS, 'Min points',
0.0, 99999999.999999, 0.0))
self.addParameter(ParameterNumber(self.ANGLE, 'Angle',
0.0, 359.0, 0.0))
self.addParameter(ParameterNumber(self.NODATA, 'Nodata',
0.0, 99999999.999999, 0.0))

self.addOutput(OutputRaster(self.OUTPUT, 'Output file'))

def processAlgorithm(self, progress):
arguments = ['-l']
arguments.append(
os.path.basename(os.path.splitext(
unicode(self.getParameterValue(self.INPUT)))[0]))

fieldName = self.getParameterValue(self.Z_FIELD)
if fieldName is not None and fieldName != '':
arguments.append('-zfield')
arguments.append(fieldName)

params = 'average'
params += ':radius1=%s' % self.getParameterValue(self.RADIUS_1)
params += ':radius2=%s' % self.getParameterValue(self.RADIUS_2)
params += ':angle=%s' % self.getParameterValue(self.ANGLE)
params += ':min_points=%s' % self.getParameterValue(self.MIN_POINTS)
params += ':nodata=%s' % self.getParameterValue(self.NODATA)

arguments.append('-a')
arguments.append(params)

arguments.append(unicode(self.getParameterValue(self.INPUT)))
arguments.append(unicode(self.getOutputValue(self.OUTPUT)))

GdalUtils.runGdal(['gdal_grid',
GdalUtils.escapeAndJoin(arguments)], progress)
Loading