Skip to content

Commit

Permalink
trying to avoid strange closing of the tools
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@15555 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
brushtyler committed Mar 21, 2011
1 parent 4849321 commit 556290d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 28 deletions.
43 changes: 24 additions & 19 deletions python/plugins/GdalTools/GdalTools.py
Expand Up @@ -230,97 +230,102 @@ def unload( self ):
def doBuildVRT( self ):
from tools.doBuildVRT import GdalToolsDialog as BuildVRT
d = BuildVRT( self.iface )
d.show_()
self.runToolDialog( d )

def doContour( self ):
from tools.doContour import GdalToolsDialog as Contour
d = Contour( self.iface )
d.show_()
self.runToolDialog( d )

def doRasterize( self ):
from tools.doRasterize import GdalToolsDialog as Rasterize
d = Rasterize( self.iface )
d.show_()
self.runToolDialog( d )

def doPolygonize( self ):
from tools.doPolygonize import GdalToolsDialog as Polygonize
d = Polygonize( self.iface )
d.show_()
self.runToolDialog( d )

def doMerge( self ):
from tools.doMerge import GdalToolsDialog as Merge
d = Merge( self.iface )
d.show_()
self.runToolDialog( d )

def doSieve( self ):
from tools.doSieve import GdalToolsDialog as Sieve
d = Sieve( self.iface )
d.show_()
self.runToolDialog( d )

def doProximity( self ):
from tools.doProximity import GdalToolsDialog as Proximity
d = Proximity( self.iface )
d.show_()
self.runToolDialog( d )

def doNearBlack( self ):
from tools.doNearBlack import GdalToolsDialog as NearBlack
d = NearBlack( self.iface )
d.show_()
self.runToolDialog( d )

def doWarp( self ):
from tools.doWarp import GdalToolsDialog as Warp
d = Warp( self.iface )
d.show_()
self.runToolDialog( d )

def doGrid( self ):
from tools.doGrid import GdalToolsDialog as Grid
d = Grid( self.iface )
d.show_()
self.runToolDialog( d )

def doTranslate( self ):
from tools.doTranslate import GdalToolsDialog as Translate
d = Translate( self.iface )
d.show_()
self.runToolDialog( d )

def doInfo( self ):
from tools.doInfo import GdalToolsDialog as Info
d = Info( self.iface )
d.show_()
self.runToolDialog( d )

def doProjection( self ):
from tools.doProjection import GdalToolsDialog as Projection
d = Projection( self.iface )
d.show_()
self.runToolDialog( d )

def doOverview( self ):
from tools.doOverview import GdalToolsDialog as Overview
d = Overview( self.iface )
d.show_()
self.runToolDialog( d )

def doClipper( self ):
from tools.doClipper import GdalToolsDialog as Clipper
d = Clipper( self.iface )
d.show_()
self.runToolDialog( d )

def doPaletted( self ):
from tools.doRgbPct import GdalToolsDialog as RgbPct
d = RgbPct( self.iface )
d.show_()
self.runToolDialog( d )

def doRGB( self ):
from tools.doPctRgb import GdalToolsDialog as PctRgb
d = PctRgb( self.iface )
d.show_()
self.runToolDialog( d )

def doTileIndex( self ):
from tools.doTileIndex import GdalToolsDialog as TileIndex
d = TileIndex( self.iface )
d.show_()
self.runToolDialog( d )

def doDEM( self ):
from tools.doDEM import GdalToolsDialog as DEM
d = DEM( self.iface )
d.show_()
self.runToolDialog( d )

def runToolDialog( self, dlg ):
dlg.show_()
dlg.exec_()
del dlg

def doSettings( self ):
from tools.doSettings import GdalToolsSettingsDialog as Settings
Expand Down
1 change: 1 addition & 0 deletions python/plugins/GdalTools/tools/doOverview.py
Expand Up @@ -22,6 +22,7 @@ def __init__( self, iface ):

# set the default QSpinBoxes and QProgressBar value
self.progressBar.setValue(0)
self.jpegQualitySpin.setValue(80)

self.progressBar.hide()
# we don't need load to canvas functionality
Expand Down
3 changes: 0 additions & 3 deletions python/plugins/GdalTools/tools/widgetOverview.ui
Expand Up @@ -205,9 +205,6 @@ the JPEG quality can be set.</string>
<property name="maximum">
<number>100</number>
</property>
<property name="value">
<number>80</number>
</property>
</widget>
</item>
</layout>
Expand Down
18 changes: 12 additions & 6 deletions python/plugins/GdalTools/tools/widgetPluginBase.py
Expand Up @@ -11,7 +11,9 @@ class GdalToolsBasePluginWidget:

def __init__(self, iface, commandName, helpFileBaseName = None, parent = None):
self.iface = iface
self.initialized = False
self.base = BaseDialog(parent, iface, self, self.windowTitle(), commandName)

self.connect(self.base, SIGNAL("processError(QProcess::ProcessError)"), self.onError)
self.connect(self.base, SIGNAL("processFinished(int, QProcess::ExitStatus)"), self.onFinished)

Expand All @@ -28,15 +30,19 @@ def onLayersChanged(self):
pass

def exec_(self):
self.connect(Utils.LayerRegistry.instance(), SIGNAL("layersChanged"), self.onLayersChanged)
self.layersChanged()
self.someValueChanged()
if not self.initialized:
self.connect(Utils.LayerRegistry.instance(), SIGNAL("layersChanged"), self.onLayersChanged)
self.onLayersChanged()
self.someValueChanged()
self.initialized = True
return self.base.exec_()

def show_(self):
self.connect(Utils.LayerRegistry.instance(), SIGNAL("layersChanged"), self.onLayersChanged)
self.onLayersChanged()
self.someValueChanged()
if not self.initialized:
self.connect(Utils.LayerRegistry.instance(), SIGNAL("layersChanged"), self.onLayersChanged)
self.onLayersChanged()
self.someValueChanged()
self.initialized = True
return self.base.show()

def setCommandViewerEnabled(self, enable):
Expand Down

0 comments on commit 556290d

Please sign in to comment.