Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-22 Thread Tim Sutton
Hi

Big thanks from me too! 

Tim Sutton 
Co-founder of Kartoza 
Ex-QGIS project chairman 

> On 21 Jan 2019, at 11:04, Tom Chadwin  wrote:
> 
> I just wanted to say a big thanks to Richard et al for this - I've very much
> needed it in the past, and this would have made my life a whole lot easier.
> No more external HTTP debuggers.
> 
> Tom
> 
> 
> 
> -
> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
> --
> Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-21 Thread Tom Chadwin
I just wanted to say a big thanks to Richard et al for this - I've very much
needed it in the past, and this would have made my life a whole lot easier.
No more external HTTP debuggers.

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-20 Thread Richard Duivenvoorde
On 1/21/19 1:38 AM, Nyall Dawson wrote:

>> -1- now the plugin creates html-links in the Log Messages Panel, and
>> they are rendered as links, but you cannot CLICK them and open them in a
>> browser. I was hoping to be able to test the links by just clicking on
>> them. Anybody a clue?
> 
> https://github.com/qgis/QGIS/pull/8915

Cool Thanks Nyall!!

> Although -- I wonder if the log panel isn't the most appropriate here.
> Maybe time to resurrect some of Nathan's ideas for a "dev mode"
> switch, which opens a new set of chrome-style dev tools panels showing
> stuff like this.
> 
> Could also integrate
> https://gist.github.com/nyalldawson/6168df740d01ce667fdcf12ef946084d -
> which is ripped from Martin's First Aid plugin and adds a dock showing
> python local variables.
> 
>> -2- it would be nice if you can 'lock' a tab in the Log Messages panels,
>> so if you are looking at one tab, others will not pop up in front of the
>> (in your view) most interesting tab...

Yeah, I was just playing around a little with the possibilities. Logging
clickable links in the Message panels was just easiest to do (after
printing to python console :-) ).

I also tried to add (potentially) more info to the log, eg by showing
headers or the sent data if it is a POST, but my feeling is that a lot
of that isn't passed to either the QtReply or Response classes that we
receive via the signals?

I'm very much open to have a special 'debug' mode with firefox-style ;-)
panel (which potentially makes QGIS slower). And I really like Martin's
First Aid plugin too.

But have to dive into this a lot more then: mix the Python Console with
some advance html for the network logs? Or create our own qt based debug
window/panel?
Maybe create a QEP for it, so we can discuss this further in public? I
can do that (or Nathan if he thinks he already thought about this a lot).

I was hoping that the 3 linse of change in
https://github.com/qgis/QGIS/pull/8907 could be seen as a bug to land in
3.6 :-)
But this plugin is then a first step and can be obsolete when we have
more... for OWS-service users I think this simple setup already is a
cool start.

Thanks all for input and help!

Regards,

Richard Duivenvoorde



___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-20 Thread Nyall Dawson
On Sun, 20 Jan 2019 at 05:46, Richard Duivenvoorde  wrote:
>
> On 1/19/19 5:22 PM, Alessandro Pasotti wrote:
> > Nice plugin though!
> >
> > Try this: https://termbin.com/3y60
>
> Hi Alessandro,
>
> THANKS 
>
> Works flawlessly!
>
> Now you see all WMS/WFS/WMTS/WCS/Locator/version.txt/plugins.xml/plugins
> itself etc etc http requests that QGIS fires to the servers! Much easier
> to copy the url to your browser and test it. Eg in case a
> getLegendRequest of a WMS is failing, or you see no data from a server
> request.
> No More Black Boxes ( NMBB :-) )

Agreed - this should make debugging a lot simpler.

> Two idea's that I hope somebody has an idea for:
>
> -1- now the plugin creates html-links in the Log Messages Panel, and
> they are rendered as links, but you cannot CLICK them and open them in a
> browser. I was hoping to be able to test the links by just clicking on
> them. Anybody a clue?

https://github.com/qgis/QGIS/pull/8915

Although -- I wonder if the log panel isn't the most appropriate here.
Maybe time to resurrect some of Nathan's ideas for a "dev mode"
switch, which opens a new set of chrome-style dev tools panels showing
stuff like this.

Could also integrate
https://gist.github.com/nyalldawson/6168df740d01ce667fdcf12ef946084d -
which is ripped from Martin's First Aid plugin and adds a dock showing
python local variables.

Nyall


> -2- it would be nice if you can 'lock' a tab in the Log Messages panels,
> so if you are looking at one tab, others will not pop up in front of the
> (in your view) most interesting tab...
>
> Anyway, Thanks Alessandro! I'll do a Pull Request ASAP.
>
> Regards,
>
> Richard Duivenvoorde
>
>
>
>
>
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-19 Thread Richard Duivenvoorde
On 1/19/19 5:22 PM, Alessandro Pasotti wrote:
> Nice plugin though!
> 
> Try this: https://termbin.com/3y60

Hi Alessandro,

THANKS 

Works flawlessly!

Now you see all WMS/WFS/WMTS/WCS/Locator/version.txt/plugins.xml/plugins
itself etc etc http requests that QGIS fires to the servers! Much easier
to copy the url to your browser and test it. Eg in case a
getLegendRequest of a WMS is failing, or you see no data from a server
request.
No More Black Boxes ( NMBB :-) )

Two idea's that I hope somebody has an idea for:

-1- now the plugin creates html-links in the Log Messages Panel, and
they are rendered as links, but you cannot CLICK them and open them in a
browser. I was hoping to be able to test the links by just clicking on
them. Anybody a clue?

-2- it would be nice if you can 'lock' a tab in the Log Messages panels,
so if you are looking at one tab, others will not pop up in front of the
(in your view) most interesting tab...

Anyway, Thanks Alessandro! I'll do a Pull Request ASAP.

Regards,

Richard Duivenvoorde






___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-19 Thread Alessandro Pasotti
Nice plugin though!

Try this: https://termbin.com/3y60

On Sat, Jan 19, 2019 at 3:51 PM Richard Duivenvoorde 
wrote:

> On 1/18/19 10:56 PM, Nyall Dawson wrote:
> > On Fri, 18 Jan 2019 at 21:19, Richard Duivenvoorde 
> wrote:
> >>
> >> On 1/18/19 12:13 PM, Alessandro Pasotti wrote:
> >>
> >>> I didn't look at the code but maybe it's because the NAM instance is
> >>> per-thread and WMS/WFS downloaders run within threads.
> >>
> >> Yeah, that is what I'm afraid of...
> >> I just do QgsNetworkAccessManager.instance() which get's it from current
> >> thread.
> >>
> >> And (from what I understand) most providers do not keep an handle to
> >> some NAM :-(
> >>
> >> There is no way to QgsNetworkAccessManager what instances are running in
> >> different threads?
> >
> > It'd need to be a change made in the core code -- the signals from the
> > background threads would need to be "bubbled up" to the main thread
> > instance of the manager.
>
> Meaning (?), that wherever now a signal of the nam
> (NetworkAccessManager) is connected to some local method, it is also to
> be connected to the nam of the parent/application thread?
>
> I had a look into some providers, but do not understand where this
> connection between signals is to be made?
>
> Is it in the application main thread when you create some
> downloader-class that you add some extra 'connect'-calls?
>
> Or is it in the downloader-class that you can fetch the
> parent/application thread and then get the nam-instance from there and
> do the connection?
>
> Or should I not even try :-)
>
> Regards,
>
> Richard Duivenvoorde
>
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



-- 
Alessandro Pasotti
w3:   www.itopen.it
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-19 Thread Richard Duivenvoorde
On 1/18/19 10:56 PM, Nyall Dawson wrote:
> On Fri, 18 Jan 2019 at 21:19, Richard Duivenvoorde  
> wrote:
>>
>> On 1/18/19 12:13 PM, Alessandro Pasotti wrote:
>>
>>> I didn't look at the code but maybe it's because the NAM instance is
>>> per-thread and WMS/WFS downloaders run within threads.
>>
>> Yeah, that is what I'm afraid of...
>> I just do QgsNetworkAccessManager.instance() which get's it from current
>> thread.
>>
>> And (from what I understand) most providers do not keep an handle to
>> some NAM :-(
>>
>> There is no way to QgsNetworkAccessManager what instances are running in
>> different threads?
> 
> It'd need to be a change made in the core code -- the signals from the
> background threads would need to be "bubbled up" to the main thread
> instance of the manager.

Meaning (?), that wherever now a signal of the nam
(NetworkAccessManager) is connected to some local method, it is also to
be connected to the nam of the parent/application thread?

I had a look into some providers, but do not understand where this
connection between signals is to be made?

Is it in the application main thread when you create some
downloader-class that you add some extra 'connect'-calls?

Or is it in the downloader-class that you can fetch the
parent/application thread and then get the nam-instance from there and
do the connection?

Or should I not even try :-)

Regards,

Richard Duivenvoorde

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-18 Thread Nyall Dawson
On Fri, 18 Jan 2019 at 21:19, Richard Duivenvoorde  wrote:
>
> On 1/18/19 12:13 PM, Alessandro Pasotti wrote:
>
> > I didn't look at the code but maybe it's because the NAM instance is
> > per-thread and WMS/WFS downloaders run within threads.
>
> Yeah, that is what I'm afraid of...
> I just do QgsNetworkAccessManager.instance() which get's it from current
> thread.
>
> And (from what I understand) most providers do not keep an handle to
> some NAM :-(
>
> There is no way to QgsNetworkAccessManager what instances are running in
> different threads?

It'd need to be a change made in the core code -- the signals from the
background threads would need to be "bubbled up" to the main thread
instance of the manager.

Nyall

>
> Richard
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-18 Thread Richard Duivenvoorde
On 1/18/19 12:13 PM, Alessandro Pasotti wrote:

> I didn't look at the code but maybe it's because the NAM instance is
> per-thread and WMS/WFS downloaders run within threads.

Yeah, that is what I'm afraid of...
I just do QgsNetworkAccessManager.instance() which get's it from current
thread.

And (from what I understand) most providers do not keep an handle to
some NAM :-(

There is no way to QgsNetworkAccessManager what instances are running in
different threads?

Richard
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-18 Thread Alessandro Pasotti
On Fri, Jan 18, 2019 at 12:10 PM Richard Duivenvoorde 
wrote:

> Hi Devs,
>
> I'm doing a simple small proof of concept of a minimal plugin which
> connects to the QgsNetworkAccesManager.instance()'s signals to log the
> requests that are fired and show them in de message panel.
>
> https://github.com/rduivenvoorde/qgisnetworklogger
>
> This is going fine for wms and wfs requests or python stuff which uses
> the same instance.
>
> But other parts of QGIS apparently use another instances?
> Or can there another reason I do not connect to their signals?
>

> Eg for a WMS I see the GetCapabilities en GetLegendGraphic, but not the
> actual WMS requests, while you can see them in the debug messages if you
> have debug enabled.
>
> Same with WFS and WMTS tile requests.
>

I didn't look at the code but maybe it's because the NAM instance is
per-thread and WMS/WFS downloaders run within threads.

-- 
Alessandro Pasotti
w3:   www.itopen.it
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] connecting to QgsNetworkAccessManagers signals

2019-01-18 Thread Richard Duivenvoorde
Hi Devs,

I'm doing a simple small proof of concept of a minimal plugin which
connects to the QgsNetworkAccesManager.instance()'s signals to log the
requests that are fired and show them in de message panel.

https://github.com/rduivenvoorde/qgisnetworklogger

This is going fine for wms and wfs requests or python stuff which uses
the same instance.

But other parts of QGIS apparently use another instances?
Or can there another reason I do not connect to their signals?

Eg for a WMS I see the GetCapabilities en GetLegendGraphic, but not the
actual WMS requests, while you can see them in the debug messages if you
have debug enabled.

Same with WFS and WMTS tile requests.

I think for the average OGC-service-user it would be good to be able to
see /try out the requests that are fired.

Or is my poc too simple :-)

Regards,

Richard Duivenvoorde

ps WFS is showing the following in the Qt message tab:

WARNINGQObject: Cannot create children for a parent that is in a
different thread.
 (Parent is QgsWFSFeatureIterator(0x7f46ac05c7d0), parent's
thread is QThread(0x5610810f5860), current thread is QThread(0x5610890dadb0)


___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer