trying to avoid strange closing of the tools

git-svn-id: http://svn.osgeo.org/qgis/trunk@15555 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
brushtyler 2011-03-21 23:54:27 +00:00
parent 48493219be
commit 556290d18c
4 changed files with 37 additions and 28 deletions

View File

@ -230,97 +230,102 @@ class GdalTools:
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

View File

@ -22,6 +22,7 @@ class GdalToolsDialog( QWidget, Ui_Widget, BaseBatchWidget ):
# 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

View File

@ -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>

View File

@ -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)
@ -28,15 +30,19 @@ class GdalToolsBasePluginWidget:
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):