Re: [Qgis-developer] How to get renderComplete painter reference

2014-04-07 Thread Anita Graser
On Mon, Apr 7, 2014 at 2:36 AM, Mathieu Pellerin nirvn.a...@gmail.com wrote:
 May I suggest a small improvement? You should calculate the time it took, in
 ms, to render canvas and deduce that ms value from the animationFrameLength
 ms value in your singleShot call:

Good point. I thought of it, but haven't implemented it yet since I
would have to keep track of the rendering time.
Please file a feature request so this idea does not get lost.

I'm still looking for a solution to the main topic of this thread
(painter refrence) because I think it could help solve the latest
issue concerning the timestamp label.

Best wishes,
Anita
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] How to get renderComplete painter reference

2014-04-07 Thread Martin Dobias
Hi Anita

On Sun, Apr 6, 2014 at 6:08 PM, Anita Graser anitagra...@gmx.at wrote:
 I need the painter from the renderComplete signal? Could you help me with
 the correct syntax?
 I have:


 self.iface.mapCanvas().renderComplete.connect(self.waitAfterRenderComplete)

 and

def waitAfterRenderComplete(self, painter):

Try

QObject.connect(self.iface.mapCanvas(),SIGNAL(renderComplete(QPainter*)),
self.waitAfterRenderComplete)

Cheers
Martin
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] How to get renderComplete painter reference

2014-04-07 Thread Nathan Woodrow
Martin,

Both those signals are the same and work the same. The newer .connect
method is the better way.

- Nathan



On Mon, Apr 7, 2014 at 7:31 PM, Martin Dobias wonder...@gmail.com wrote:

 Hi Anita

 On Sun, Apr 6, 2014 at 6:08 PM, Anita Graser anitagra...@gmx.at wrote:
  I need the painter from the renderComplete signal? Could you help me with
  the correct syntax?
  I have:
 
 
 
 self.iface.mapCanvas().renderComplete.connect(self.waitAfterRenderComplete)
 
  and
 
 def waitAfterRenderComplete(self, painter):

 Try

 QObject.connect(self.iface.mapCanvas(),SIGNAL(renderComplete(QPainter*)),
 self.waitAfterRenderComplete)

 Cheers
 Martin
 ___
 Qgis-developer mailing list
 Qgis-developer@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-developer

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

Re: [Qgis-developer] How to get renderComplete painter reference

2014-04-07 Thread Jürgen E . Fischer
Hi Nathan,

On Mon, 07. Apr 2014 at 19:37:35 +1000, Nathan Woodrow wrote:
 Both those signals are the same and work the same. The newer .connect method
 is the better way.

Maybe that was to rule out something else.

Apropos does either connect actually return True?


Jürgen

-- 
Jürgen E. Fischer norBIT GmbH   Tel. +49-4931-918175-31
Dipl.-Inf. (FH)   Rheinstraße 13Fax. +49-4931-918175-50
Software Engineer D-26506 Norden   http://www.norbit.de
QGIS PSC member (RM)  Germany  IRC: jef on FreeNode 


-- 
norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502

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


Re: [Qgis-developer] How to get renderComplete painter reference

2014-04-07 Thread Martin Dobias
Hi Jürgen

On Mon, Apr 7, 2014 at 11:42 AM, Jürgen E. j...@norbit.de wrote:
 Hi Nathan,

 On Mon, 07. Apr 2014 at 19:37:35 +1000, Nathan Woodrow wrote:
 Both those signals are the same and work the same. The newer .connect method
 is the better way.

 Maybe that was to rule out something else.

Yeah, anyway I checked again and even original Anita's statement
worked for me. This is what I did in python console:

from PyQt4.QtCore import *
class A(QObject):
  def __init__(self): QObject.__init__(self)
  def f(self, painter): import sys; sys.__stdout__.write(hello\n)
a = A()
iface.mapCanvas().renderComplete.connect(a.f)

when moving the map, it will output hello to the system console from
where I started QGIS... so problem is probably somewhere else, not
with connection itself.


 Apropos does either connect actually return True?

I have learned not to trust the return value of connect() at all, for example:

 QObject.connect(iface.mapCanvas(), SIGNAL(abracadabra()), a.f)
True

I'm pretty sure map canvas cannot do this kind of magic!

Cheers
Martin
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] How to get renderComplete painter reference

2014-04-07 Thread Anita Graser

Am 07.04.2014, 11:57 Uhr, schrieb Martin Dobias wonder...@gmail.com:

Yeah, anyway I checked again and even original Anita's statement
worked for me. This is what I did in python console:

from PyQt4.QtCore import *
class A(QObject):
  def __init__(self): QObject.__init__(self)
  def f(self, painter): import sys; sys.__stdout__.write(hello\n)
a = A()
iface.mapCanvas().renderComplete.connect(a.f)

when moving the map, it will output hello to the system console from
where I started QGIS... so problem is probably somewhere else, not
with connection itself.



From what I could figure out so far, I only get the painter into  
playAnimation() if I do the following trick with lambda:


QTimer.singleShot(self.animationFrameLength, lambda:  
self.playAnimation(painter))


But even then, the exported images are without label ...

Best wishes,
Anita

--
anitagraser.com
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer


Re: [Qgis-developer] How to get renderComplete painter reference

2014-04-06 Thread G. Garibaldi

On 4/6/2014 11:08 AM, Anita Graser wrote:

Hi,

I need the painter from the renderComplete signal? Could you help me 
with the correct syntax?

I have:

self.iface.mapCanvas().renderComplete.connect(self.waitAfterRenderComplete)

and

def waitAfterRenderComplete(self, painter):

but waitAfterRenderComplete does not receive a painter.

Thanks and best wishes,
Anita


Good to see development on this plugin. Many thanks from someone that 
uses Time Manger.


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

Re: [Qgis-developer] How to get renderComplete painter reference

2014-04-06 Thread Mathieu Pellerin
Anita, just saw you commited a fix. Thanks!

May I suggest a small improvement? You should calculate the time it took,
in ms, to render canvas and deduce that ms value from the
animationFrameLength ms value in your singleShot call:

QTimer.singleShot(self.animationFrameLength,self.playAnimation)

Currently if you have a 1000ms frame length and canvas rendering takes
500ms, each frame will last 1500ms. Deducing the 500ms canvas rendering
time from frame length will fix this.  If rendering ms  frame length ms,
that'd allow you to skip singleShot and render next frame immediately.

Cheers and thanks again.

Math
On 6 Apr 2014 23:08, Anita Graser anitagra...@gmx.at wrote:

 Hi,

 I need the painter from the renderComplete signal? Could you help me with
 the correct syntax?
 I have:

self.iface.mapCanvas().renderComplete.connect(self.
 waitAfterRenderComplete)

 and

def waitAfterRenderComplete(self, painter):

 but waitAfterRenderComplete does not receive a painter.

 Thanks and best wishes,
 Anita


 --
 anitagraser.com
 ___
 Qgis-developer mailing list
 Qgis-developer@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/qgis-developer

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