def __init__(self, iface): QDialog.__init__(self) # Set up the user interface from Designer. self.ui = Ui_SimpleSvg() self.ui.setupUi(self) # little dialog for sizing map self.sizer = MapSizerDialog(self, iface.mapCanvas())
def __init__(self, iface): QDialog.__init__(self) # Set up the user interface from Designer. self.ui = Ui_SimpleSvg () self.ui.setupUi(self) # little dialog for sizing map self.sizer = MapSizerDialog(self, iface.mapCanvas())
class SimpleSvgDialog(QDialog): def __init__(self, iface): QDialog.__init__(self) # Set up the user interface from Designer. self.ui = Ui_SimpleSvg() self.ui.setupUi(self) # little dialog for sizing map self.sizer = MapSizerDialog(self, iface.mapCanvas()) # see http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#connecting-signals-and-slots # without this magic, the on_btnOk_clicked will be called two times: one clicked() and one clicked(bool checked) @pyqtSignature("on_btnBrowse_clicked()") def on_btnBrowse_clicked(self): if QGis.QGIS_VERSION_INT < 10900: # qgis <= 1.8 fileName = unicode( QSettings().value('/simplesvg/lastfile').toString()) else: fileName = QSettings().value( '/simplesvg/lastfile') # already unicode fileName = QFileDialog.getSaveFileName(self, "Save as svg file", fileName, '') # TODO do some checks to be sure there is no extension self.ui.txtFileName.setText(fileName) @pyqtSignature("on_btnResizeMap_clicked()") # show resize dialog (while hiding yourself, come back when resize dialog is closed def on_btnResizeMap_clicked(self): self.sizer.show() self.hide() def on_buttonBox_helpRequested(self): self.emit(SIGNAL("showHelp()")) def on_cbFeaturesInMapcanvasOnly_stateChanged(self): print "CHANGE" self.emit(SIGNAL("cbFeaturesInMapcanvasOnlyChanged"), self.ui.cbFeaturesInMapcanvasOnly.isChecked()) def getFilePath(self): return self.ui.txtFileName.text() def setFilePath(self, path): return self.ui.txtFileName.setText(path)
class SimpleSvgDialog(QDialog): def __init__(self, iface): QDialog.__init__(self) # Set up the user interface from Designer. self.ui = Ui_SimpleSvg () self.ui.setupUi(self) # little dialog for sizing map self.sizer = MapSizerDialog(self, iface.mapCanvas()) # see http://www.riverbankcomputing.com/Docs/PyQt4/pyqt4ref.html#connecting-signals-and-slots # without this magic, the on_btnOk_clicked will be called two times: one clicked() and one clicked(bool checked) @pyqtSignature("on_btnBrowse_clicked()") def on_btnBrowse_clicked(self): if QGis.QGIS_VERSION_INT < 10900: # qgis <= 1.8 fileName = unicode(QSettings().value('/simplesvg/lastfile').toString(), '') else: fileName = unicode(QSettings().value('/simplesvg/lastfile'), '') fileName = QFileDialog.getSaveFileName(self, "Save as svg file", fileName, '') # TODO do some checks to be sure there is no extension self.ui.txtFileName.setText(fileName) @pyqtSignature("on_btnResizeMap_clicked()") # show resize dialog (while hiding yourself, come back when resize dialog is closed def on_btnResizeMap_clicked(self): self.sizer.show() self.hide() def on_buttonBox_helpRequested(self): self.emit(SIGNAL("showHelp()") ) def on_cbFeaturesInMapcanvasOnly_stateChanged(self): print "CHANGE" self.emit(SIGNAL("cbFeaturesInMapcanvasOnlyChanged"), self.ui.cbFeaturesInMapcanvasOnly.isChecked()) def getFilePath(self): return self.ui.txtFileName.text() def setFilePath(self, path): return self.ui.txtFileName.setText(path)