<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">sorry, i correct the link to the code i'm tring.<div>my apologize :-/</div><div><br></div><div>this one should work :</div><div><br></div><div><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><a href="http://www.geofemengineering.it/data/qgistry.py">http://www.geofemengineering.it/data/qgistry.py</a></div></div></blockquote><div><br><div><div>Il giorno 15/set/2010, alle ore 12.21, Massimo Di Stefano ha scritto:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hello All,</div><div><br></div><div><br></div><div>i'm tring to apply the changes you suggest me .. but with no good results</div><div>(again my fault)</div><div><br></div><div>i tried to change the code to :</div><div><br></div><div><a href="http://www.geogemengineering.it/data/qgistry.py">http://www.geogemengineering.it/data/qgistry.py</a></div><div><br></div><div>but i got :&nbsp;</div><div><br></div><div><div>python /qgistry.py</div><div>Traceback (most recent call last):</div><div>&nbsp;&nbsp;File "/qgistry.py", line 68, in &lt;module&gt;</div><div>&nbsp;&nbsp; &nbsp;app = MainApp()</div><div>&nbsp;&nbsp;File "/qgistry.py", line 61, in __init__</div><div>&nbsp;&nbsp; &nbsp;QApplication.__init__(self)</div><div>TypeError: arguments did not match any overloaded call:</div><div>&nbsp;&nbsp;QApplication(list-of-str): not enough arguments</div><div>&nbsp;&nbsp;QApplication(list-of-str, bool): not enough arguments</div><div>&nbsp;&nbsp;QApplication(list-of-str, QApplication.Type): not enough arguments</div></div><div><br></div><div><br></div><div>can you help me to have it running ?</div><div><br></div><div>thanks a lot !!!</div><div><br></div><div>Massimo.</div><div><br></div><br><div><div>Il giorno 10/set/2010, alle ore 02.07, <a href="mailto:qgis-developer-request@lists.osgeo.org">qgis-developer-request@lists.osgeo.org</a> ha scritto:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi Massimo,<br><br>On Fri, Sep 10, 2010 at 12:10 AM, Massimo Di Stefano &lt;<br><a href="mailto:massimodisasha@yahoo.it">massimodisasha@yahoo.it</a>&gt; wrote:<br><br><blockquote type="cite">Hi All,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">i'm tring to start some coding on the qgis api<br></blockquote><blockquote type="cite">i'm on osx 10.6.4 running qgis 1.6<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">following the example from :<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><a href="http://mapserver.sk/~wonder/qgis/html">http://mapserver.sk/~wonder/qgis/html</a>/canvas.html#using-map-tools-with-canvas&lt;<a href="http://mapserver.sk/%7Ewonder/qgis/html/canvas.html#using-map-tools-with-canvas">http://mapserver.sk/%7Ewonder/qgis/html/canvas.html#using-map-tools-with-canvas</a>&gt;<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">it works fine if i call it from a qgis-python shell<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">but i tried to make small changes to have it running as a standalone<br></blockquote><blockquote type="cite">application,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">i eliminated the "layer" from the init line :<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">QMainWindow.__init__(self)<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">used a custom extent :<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">self.canvas.setExtent('15.1845401903089403,40.6214856769878665 :<br></blockquote><blockquote type="cite">15.2339879807105998,40.6477493100907381')<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">and commented out the line :<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">#self.canvas.setLayerSet( [ QgsMapCanvasLayer(layer) ] )<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">then from a standard python shell, i tried :<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">import mywnd<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">dir(mywnd)<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite">['MyWnd', 'QAction', 'QMainWindow', 'QString', 'QgisInterface',<br></blockquote><blockquote type="cite">'QgsAnnotationItem', 'QgsColorButton', 'QgsColorButtonV2',<br></blockquote><blockquote type="cite">'QgsComposerView', 'QgsEncodingFileDialog', 'QgsFormAnnotationItem',<br></blockquote><blockquote type="cite">'QgsGenericProjectionSelector', 'QgsLegendInterface', 'QgsMapCanvas',<br></blockquote><blockquote type="cite">'QgsMapCanvasItem', 'QgsMapCanvasLayer', 'QgsMapCanvasMap',<br></blockquote><blockquote type="cite">'QgsMapCanvasSnapper', 'QgsMapOverviewCanvas', 'QgsMapTip', 'QgsMapTool',<br></blockquote><blockquote type="cite">'QgsMapToolEmitPoint', 'QgsMapToolPan', 'QgsMapToolZoom',<br></blockquote><blockquote type="cite">'QgsMessageViewer', 'QgsProjectBadLayerGuiHandler', 'QgsProjectionSelector',<br></blockquote><blockquote type="cite">'QgsQuickPrint', 'QgsRendererV2PropertiesDialog', 'QgsRendererV2Widget',<br></blockquote><blockquote type="cite">'QgsRubberBand', 'QgsStyleV2ManagerDialog', 'QgsSymbolLayerV2Widget',<br></blockquote><blockquote type="cite">'QgsSymbolV2PropertiesDialog', 'QgsSymbolV2SelectorDialog',<br></blockquote><blockquote type="cite">'QgsTextAnnotationItem', 'QgsVertexMarker', 'Qt', 'SIGNAL', '__builtins__',<br></blockquote><blockquote type="cite">'__doc__', '__file__', '__name__', '__package__']<br></blockquote><blockquote type="cite"><blockquote type="cite"><blockquote type="cite"><blockquote type="cite">w = mywnd.MyWnd()<br></blockquote></blockquote></blockquote></blockquote><blockquote type="cite">QWidget: Must construct a QApplication before a QPaintDevice<br></blockquote><blockquote type="cite">Abort trap<br></blockquote><blockquote type="cite"><br></blockquote>the MyWnd is a QWidget.<br><br>You must create a QApplication instance and only after this you can<br>show widgets within it.<br><br>Here an example (main.py):<br><br><br>from PyQt4.QtGui import QApplication<br>from mywdg import MyWdg<br><br>class MainApp(QApplication):<br>&nbsp;&nbsp;&nbsp;def __init__(self, args):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;QApplication.__init__(self, args)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wdg = MyWdg()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;wdg.show()<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;self.exec_()<br><br>if __name__ == "__main__":<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;import sys<br>&nbsp;&nbsp;&nbsp;app = MainApp(sys.args)<br><br><br>Then open a terminal and run: python main.py<br>and if all went fine you can see your widget.<br><br>Cheers.<br><br><br><blockquote type="cite"><br></blockquote><blockquote type="cite">it give me a python crash ... obviously i'm missing something basilar,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">have you any clue on what i need to change to have the example working<br></blockquote><blockquote type="cite">outside qgis ?<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">thanks a lot !!!<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">regards,<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">Massimo</blockquote></blockquote></div><br></div></blockquote></div><br></div></div></body></html>