[Qgis-developer] python form validation help

2016-10-10 Thread Andrew
I am trying to write some form validation to work around bug #15050
.  Based on some examples I have found I
think this should work:

from PyQt4.QtCore import *
from PyQt4.QtGui import *

myDialog = None
notesField = None

def formOpen(dialog,layerid,featureid):
global myDialog
global notesField

myDialog = dialog
notesField = dialog.findChild(QPlainTextEdit,"Notes")
buttonBox = dialog.findChild(QDialogButtonBox,"buttonBox")

# Disconnect the signal that QGIS has wired up for the dialog to the
button box.
buttonBox.accepted.disconnect(myDialog.accept)
# Wire up our own signals.
buttonBox.accepted.connect(validate)
#buttonBox.rejected.connect(myDialog.reject)

def validate():
if notesField.document().characterCount() > 1000:
msgBox = QMessageBox()
msgBox.setText("Notes field must be <1000 characters")
msgBox.exec_()
else:
myDialog.accept()

What happens is that I get the message box with the error, but when I click
OK on the message box the form closes and saves anyway and I still lose
text in the multiline field if it exceeds the field length.  How do I keep
the form open to allow the user to fix the error(s)?

Thanks,

Andrew
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] memory-based layers and projects

2016-10-10 Thread Blumentrath, Stefan
Hei Martin,

Do you think of something like a python macro to be run at project start?

Then maybe this helps:
http://gis.stackexchange.com/questions/89903/is-there-a-way-to-run-a-python-script-on-opening-a-qgis-project

Cheers
Stefan


-Original Message-
From: Qgis-developer [mailto:qgis-developer-boun...@lists.osgeo.org] On Behalf 
Of Martin Landa
Sent: 10. oktober 2016 19:20
To: Chris Crook 
Cc: qgis-dev 
Subject: Re: [Qgis-developer] memory-based layers and projects

Hi,

2016-10-10 19:04 GMT+02:00 Chris Crook :
> One option you could use is to install the MemoryLayerSaver plugin.  That 
> saves the data for all memory layers in a project into a file named after the 
> project file.

thanks. But this option is something what I would like to avoid (no new files 
created, regardless format - SQLite Db or mldata). Ideally to provide to QGIS 
information how to load data (python code for running plugin reader) and from 
which file.

Anyway thanks for the feedback! Martin

--
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Show Geotagged Images on Map

2016-10-10 Thread Richard Duivenvoorde
On 18-09-16 22:35, Joshua Quesenberry wrote:
> All,
> 
>  
> 
> I was wondering if anyone knows of a current method for displaying
> geotagged images (or maybe just a thumbnail) directly on the map canvas
> without having to click on one image a time? I saw this thread, but the
> solution seems to be deprecated now:
> http://osgeo-org.1560.x6.nabble.com/Showing-thumbnails-of-geotagged-photos-td5008632.html

Did you check/try some plugins, like:

http://plugins.qgis.org/search/?q=photo
or
https://biodiversityinformatics.amnh.org/open_source/evis/documentation.php

Regards,

Richard

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Abstract GUI base class

2016-10-10 Thread Sandro Mani

Hi Matthias

Personally I think it's okay to force custom apps to adapt to the app 
library changes, the effort of doing so is way smaller than having to 
port the app abstraction from release to release.


As for where the line is drawn: this proposal would mean one can go as 
far as swap the main QMainWindow with a custom implementation. I don't 
know if it makes sense drawing the line at another level?


As for QQgisInterface re-implementation: I'm not sure I see how one 
could swap out the main window with that approach, besides hiding the 
"classic" app main window constructed in main.cpp and killing of any 
signals that may interact with it - am I missing something?


Best
Sandro



On 06.10.2016 16:02, Matthias Kuhn wrote:

Hi Sandro,

This sounds interesting.
What I wonder mostly is how much of the design and concept should be
imposed on customized apps. This forces either

  * custom apps to adjust to api changes in the app libarary
  * the app library to guarantee api stability

Not having to care for api stability in the app library currently allows
for much flexibility and speed in development.

Something else is where the line between "custom" and "generic" is
drawn. QField (or roam which I don't know very well) are also custom
interfaces. I guess each one of these will draw their line at a
different level. For QField for example, anything that involves things
from the QtWidgets library is out of scope.

Another approach would be to reimplement the QgisInterface instead of
the app. This specifically documents to be meant for 3rd party apps to
be reimplemented.
https://github.com/sourcepole/kadas-albireo/blob/master/src/gui/qgisinterface.h#L58-L62

Could you potentially split this up into multiple levels of
abstractions? Telling plugin developers that they can only use
functionality from the QgisTinyInterface if they want to be compatible
with everyone or use the QgisFullBlastInterface if it should be
fine-tuned for the QGIS classic app?

If it helps to improve the channel from your developments back to
upstream, that will be much appreciated.

All the best
Matthias

On 10/06/2016 02:50 PM, Sandro Mani wrote:

Hi

We are considering porting our abstract GUI class from KADAS Albireo to
QGIS 3.0, basically what was done here [1][2]. Summary is that qgisapp
contains all functionalities which are gui-logic independent and
qgsclassicapp contains the logic tying functionalities to the gui
implementation.

The advantages of this are, besides better code separation (which IMO
qgisapp could benefit from since it's become a bit of a dumping ground),
that it easier for people to write custom guis for QGIS (i.e. very
application specific GUIs exposing only certain functionalities etc)
while sharing the codebase with upstream.

QGIS 3.0 would be a good moment to perform such refactoring. So I'd like
to hear a short feedback whether people would welcome such a change in
principle before moving on to drafting a QEP.

Thanks
Sandro

[1]
https://github.com/sourcepole/kadas-albireo/blob/master/src/app/qgisapp.h
[2]
https://github.com/sourcepole/kadas-albireo/blob/master/src/app/qgsclassicapp.h


___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer


___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

[Qgis-developer] Fwd: [GSoC Mentors] Announcing Google Summer of Code 2017 and Google Code-in 2016

2016-10-10 Thread Alexander Bruy
Hi devs,

Google announced GSoC 2017, so it is time to start thinking about
project ideas for next year.

I will create/update corresponding wiki pages once hub will recover.


-- Forwarded message --
From: 'sttaylor' via Google Summer of Code Mentors List

Date: 2016-10-10 20:11 GMT+03:00
Subject: [GSoC Mentors] Announcing Google Summer of Code 2017 and
Google Code-in 2016
To: Google Summer of Code Mentors List



Hello all,


We are pleased to announce Google Summer of Code 2017, the 13th
straight year of the program.


The GSoC 2017 timeline has been updated with next year's important
dates. More information including some changes to the Program Rules
will be updated in early November on the program site.


Organizations -- If you would like to apply for the 2017 program
please start thinking about the projects you would like students to
work on and also reach out to your community members to ask if they
would like to be mentors for the program.


We are looking forward to another exciting year of GSoC!


Today we also announced the Google Code-in 2016 contest that will be
open for past GSoC mentoring organizations to apply to be a part of
this exciting 7 week contest bringing teenagers into the open source
community. Organization applications are open for GCI from October
24th - November 7th.  GCI opens for student participants on November
28th!


For any questions about the programs please email us at gsoc-supp...@google.com


Best,

Google OSPO team


-- 
Alexander Bruy
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] memory-based layers and projects

2016-10-10 Thread Martin Landa
Hi,

2016-10-10 19:04 GMT+02:00 Chris Crook :
> One option you could use is to install the MemoryLayerSaver plugin.  That 
> saves the data for all memory layers in a project into a file named after the 
> project file.

thanks. But this option is something what I would like to avoid (no
new files created, regardless format - SQLite Db or mldata). Ideally
to provide to QGIS information how to load data (python code for
running plugin reader) and from which file.

Anyway thanks for the feedback! Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

[Qgis-developer] memory-based layers and projects

2016-10-10 Thread Martin Landa
Hi,

I have plugin which creates memory based layer and loads data into
this layer using its own reader.

"""
class MyLayer(QgsVectorLayer):
def __init__(self, name):
super(MyLayer, self).__init__('Point?crs=epsg:4326',
name,
'memory')

def load(self, reader):
for f in reader:
self._process_row(f) # add features to the map layer
"""

The problem occures when user stores such layer in the project. Then
the project file contains only:

"""
 
memory?geometry=Pointcrs=EPSG:4326field=ader_microSvh:(0,0)...
"""

So after loading the project, empty layer appears (with defined
attributes), but with no points loaded. Is there any way how to define
for such layer python code which would perform loading points using
plugin reader when opening a project?

Of course plugin could store (export) loaded data eg. into SQLite DB,
but this is not the way I would like to go.

Thanks in advance for any pointers, Martin

-- 
Martin Landa
http://geo.fsv.cvut.cz/gwiki/Landa
http://gismentors.cz/mentors/landa
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

[Qgis-developer] SSL connection does not update Cert Authorities. call for verification.

2016-10-10 Thread Luigi Pirelli
Hi

I filed the following issue: https://hub.qgis.org/issues/15687
Would be fine to have more confirmation on different Windows versions
or othere OSs.

thi sis the text of the issue:

***
I found a misalignement in SSL Root Certificate Authorities (CAs)
caching at least in WIN. This bug has been found developing a solution
to: https://hub.qgis.org/issues/15617

ABSTRACT
A brief description of the bug(?) and after a detailed step procedure
to reproduce it:
Any SO has a SSL conf has a list of CAs. These are used to setup the
ssl communication to verify if peer cert can be trusted or not. If the
system CAs list change this would affect the subsequent connection.
I found that if I remove or add a CA, next connections "remember" the
previous CA list for a while (some minutes).

to reproduce the error I tryied to connect to
https://qgis.boundlessgeo.com that is signed by:
"AddTrust CA External CA Root"

By default AddTrust is not present in Windows CAs. But.
- if it is present it can be removed using "certmgr.msc"
- if not present y can be automatically added by OS just browsing in a
windows keystore capable browser (no Firefox) tghe following
link:https://qgis.boundlessgeo.com/plugins/plugins.xml
The OS will check the URL CA and will check if it can be trusted, and
if so, it will be added in the keystore.

PREMISE:
To generate sslError I ued to connect to a erroneous OWS service, eg
WMS or WFS. The reason is to use only pure c++ code.

The steps to reproduce the errors are on WIN7 (but should be the same
on any win OS):
- remove AddTrust CA if present
- in QGIS trying to connect to
https://qgis.boundlessgeo.com/plugins/plugins.xml using wms service
(=> only c++ code)
- => sslError dialog will be opened. !!! ABort it and not push the
Ignore button !!!
- load https://qgis.boundlessgeo.com/plugins/plugins.xml in Explorer
and verify that "AddTrust" has been added in certmgr.msc
- executing the following python code in console
QgsAuthManager.instance().rebuildCaCertsCache()
QgsAuthManager.instance().rebuildCertTrustCache()
QgsAuthManager.instance().rebuildTrustedCaCertsCache()
QgsAuthManager.instance().rebuildIgnoredSslErrorCache()
You can verify that new CA is updated in qgis in
settings->options->authentication->Manage Certificates->Authorities
- tryed to reconnect to
https://qgis.boundlessgeo.com/plugins/plugins.xml using wms service
- !!!continuing!!! to have sslError dialog
- waiting a while (5'?) I'm able to receive a WMS error => no more sslError

The procedure to reproduce the bug can be also inverted:
- started qgis having the CA AddTrust installed (no sslerror)
- connect to wms service
https://qgis.boundlessgeo.com/plugins/plugins.xml => wms error but not
sslError dialog
- removed AddTrust
- executed the following python code in console
QgsAuthManager.instance().rebuildCaCertsCache()
QgsAuthManager.instance().rebuildCertTrustCache()
QgsAuthManager.instance().rebuildTrustedCaCertsCache()
QgsAuthManager.instance().rebuildIgnoredSslErrorCache()
You can verify that CA is removed in qgis in
settings->options->authentication->Manage Certificates->Authorities
- connect to WMS => still wms error but not sslError dialog
- after a while the sslError come back connecting to WMS service

Luigi Pirelli

**
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS:
https://www.packtpub.com/application-development/mastering-qgis
**
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Documentation proposals - Was: Discussion on the QGIS grant proposals

2016-10-10 Thread Luigi Pirelli
On 8 October 2016 at 22:13, Anita Graser  wrote:
> Hi,
>
> On Thu, Sep 22, 2016 at 8:14 AM, Neumann, Andreas 
> wrote:
>>
>> Now, the documentation items:
>>
>> 1) 2.16 Documentation
>>
>> 16) PyQGIS Developer Cookbook update and maintenance
>>
>> 15) PyQGIS Cookbook Review
>>
>
> Do we already have a plan how to proceed with the documentation items? I'd
> suggest a focus on LTR docs for end users as well as PyQGIS. What do you
> think?

really hard to decide about LTR PyQGIS... probably a community poll
can be useful with a (short term) discussion. My reason to explain why
it is hard to decide are:
1) I would invest and push developer to dev and port 3.0 plugins
2) pyqgis dev knowledge is almost covered also by StackExchange... I
agree that wouldn't be the way to document, but we are facing
transition to 3
3) LTR will will terminate afgter 3.0 release and it's documentation
will become strongly obsolete with 3.0 transition.
For this reason I wouldn't invest in ltr pyqgis doc.

Luigi Pirelli

**
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS:
https://www.packtpub.com/application-development/mastering-qgis
**
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] Show Geotagged Images on Map

2016-10-10 Thread kimaidou
Hi,

Sorry, my previous message was a bit "dry". Here are the steps:

* Open the vector layer properties dialog
* Go to the Style tab
* Use "Single symbol renderer"
* Choose "SVG Symbol"
* In the text input with the path to SVG, instead of using the "..." button
to choose a file, click instead of the button right next to it, to be able
to enter an expression. Choose "Edit"
* It opens a new dialog, with 2 tabs : Expression and Function  editor ->
Go to the latest "Function editor" tab.
* You can here create a "New file" via the button at the top
* Then choose a name, and then you can copy/paste the whole text you found
in the URL https://gist.github.com/mdouchin/d66191ccfadd74cff3f0
* Then you can go back to the first tab "Expression", and use an expression
such as

show_picture( "picture_path_fieldname" )

where "picture_path_filename" is the name of the field containing the path
to the image for each feature. (you can have absolute path, or better,
paths relative to the QGIS project)


This is a bit cumbersome, but should work :)

Regards,
Michaël

2016-10-06 14:41 GMT+02:00 Joshua Quesenberry :

> Hi Michaël,
>
>
>
> Sorry, I missed your reply when it originally came through. Can you
> elaborate further on how to use the code snippet? I’m only very vaguely
> following what you’re saying to do so far.
>
>
>
> Separately, would it be possible to add an image type to the symbol editor
> for shapefiles, etc. that can use the an equation to create the image name
> and then display the image from there?
>
>
>
> Thanks,
>
>
>
> JQ
>
>
>
> *From:* kimaidou [mailto:kimai...@gmail.com]
> *Sent:* Monday, September 19, 2016 3:11 AM
> *To:* Joshua Quesenberry 
> *Cc:* qgis-developer 
> *Subject:* Re: [Qgis-developer] Show Geotagged Images on Map
>
>
>
> ​Hi, you could use this snippets :
> https://gist.github.com/mdouchin/d66191ccfadd74cff3f0
>
> Basically, it loads an image for each feature in a SVG, which can then be
> used as a symbol.
>
> Regards
>
> Michaël
>
>
>
> 2016-09-18 22:35 GMT+02:00 Joshua Quesenberry :
>
> All,
>
>
>
> I was wondering if anyone knows of a current method for displaying
> geotagged images (or maybe just a thumbnail) directly on the map canvas
> without having to click on one image a time? I saw this thread, but the
> solution seems to be deprecated now: http://osgeo-org.1560.x6.
> nabble.com/Showing-thumbnails-of-geotagged-photos-td5008632.html
>
>
>
> Thanks,
>
>
>
> JQ
>
>
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer