def __init__( self, iface ): QDialog.__init__( self, iface.mainWindow() ) self.iface = iface self.setupUi( self ) self.leGdalBinPath.setText( Utils.getGdalPath() ) self.leGdalHelpPath.setText( Utils.getHelpPath() ) QObject.connect( self.btnSetBinPath, SIGNAL( "clicked()" ), self.setBinPath ) QObject.connect( self.btnSetHelpPath, SIGNAL( "clicked()" ), self.setHelpPath )
def __init__(self, parent, iface, pluginBase, pluginName, pluginCommand): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) self.iface = iface self.process = QProcess(self) gdalPath = Utils.getGdalPath() if not gdalPath.isEmpty(): env = self.process.environment() if env.isEmpty(): #env << "PATH=" + gdalPath os.putenv("PATH", str(gdalPath)) else: if platform.system() == "Windows": env.replaceInStrings( QRegExp("^PATH=(.*)", Qt.CaseInsensitive), "PATH=\\1;" + gdalPath) else: env.replaceInStrings( QRegExp("^PATH=(.*)", Qt.CaseInsensitive), "PATH=\\1:" + gdalPath) self.process.setEnvironment(env) self.connect(self.process, SIGNAL("error(QProcess::ProcessError)"), self.processError) self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"), self.processFinished) self.setupUi(self) self.arguments = QStringList() self.editCmdBtn.setIcon(QIcon(":/icons/edit.png")) self.connect(self.editCmdBtn, SIGNAL("toggled(bool)"), self.editCommand) self.resetCmdBtn.setIcon(QIcon(":/icons/reset.png")) self.connect(self.resetCmdBtn, SIGNAL("clicked()"), self.resetCommand) self.editCommand(False) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept) self.connect(self.buttonBox, SIGNAL("helpRequested()"), self.help) self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True) self.plugin = pluginBase self.connect(self.plugin, SIGNAL("valuesChanged(const QStringList &)"), self.refreshArgs) self.pluginLayout.addWidget(self.plugin) self.plugin.setFocus() self.setWindowTitle(pluginName) self.setPluginCommand(pluginCommand)
def __init__(self, iface): QDialog.__init__(self, iface.mainWindow()) self.setAttribute(Qt.WA_DeleteOnClose) self.iface = iface self.setupUi(self) self.leGdalBinPath.setText(Utils.getGdalPath()) self.leGdalHelpPath.setText(Utils.getHelpPath()) QObject.connect(self.btnSetBinPath, SIGNAL("clicked()"), self.setBinPath) QObject.connect(self.btnSetHelpPath, SIGNAL("clicked()"), self.setHelpPath)
def __init__(self, parent, iface, pluginBase, pluginName, pluginCommand): QDialog.__init__(self, parent) self.iface = iface self.process = QProcess(self) gdalPath = Utils.getGdalPath() if not gdalPath.isEmpty(): env = self.process.environment() if env.isEmpty(): #env << "PATH=" + gdalPath os.putenv( "PATH", str( gdalPath ) ) else: if platform.system() == "Windows": env.replaceInStrings( QRegExp( "^PATH=(.*)", Qt.CaseInsensitive ), "PATH=\\1;" + gdalPath ) else: env.replaceInStrings( QRegExp( "^PATH=(.*)", Qt.CaseInsensitive ), "PATH=\\1:" + gdalPath ) self.process.setEnvironment( env ) self.connect(self.process, SIGNAL("error(QProcess::ProcessError)"), self.processError) self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"), self.processFinished) self.setupUi(self) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept) self.connect(self.buttonBox, SIGNAL("helpRequested()"), self.help) self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True) self.plugin = pluginBase self.connect(self.plugin, SIGNAL("valuesChanged(const QStringList &)"), self.refreshArgs) self.pluginLayout.addWidget(self.plugin) self.plugin.setFocus() self.setWindowTitle(pluginName) # on Windows replace the .py with .bat extension if platform.system() == "Windows" and pluginCommand[-3:] == ".py": self.command = pluginCommand[:-3] + ".bat" else: self.command = pluginCommand if pluginCommand[-3:] == ".py": self.helpFileName = pluginCommand[:-3] + ".html" else: self.helpFileName = pluginCommand + ".html" self.arguments = QStringList()
def __init__(self, parent, iface, pluginBase, pluginName, pluginCommand): QDialog.__init__(self, parent) self.setAttribute(Qt.WA_DeleteOnClose) self.iface = iface self.process = QProcess(self) gdalPath = Utils.getGdalPath() if not gdalPath.isEmpty(): env = self.process.environment() if env.isEmpty(): #env << "PATH=" + gdalPath os.putenv( "PATH", str( gdalPath ) ) else: if platform.system() == "Windows": env.replaceInStrings( QRegExp( "^PATH=(.*)", Qt.CaseInsensitive ), "PATH=\\1;" + gdalPath ) else: env.replaceInStrings( QRegExp( "^PATH=(.*)", Qt.CaseInsensitive ), "PATH=\\1:" + gdalPath ) self.process.setEnvironment( env ) self.connect(self.process, SIGNAL("error(QProcess::ProcessError)"), self.processError) self.connect(self.process, SIGNAL("finished(int, QProcess::ExitStatus)"), self.processFinished) self.setupUi(self) self.arguments = QStringList() self.editCmdBtn.setIcon( QIcon(":/icons/edit.png") ) self.connect(self.editCmdBtn, SIGNAL("toggled(bool)"), self.editCommand) self.resetCmdBtn.setIcon( QIcon(":/icons/reset.png") ) self.connect(self.resetCmdBtn, SIGNAL("clicked()"), self.resetCommand) self.editCommand( False ) self.connect(self.buttonBox, SIGNAL("rejected()"), self.reject) self.connect(self.buttonBox, SIGNAL("accepted()"), self.accept) self.connect(self.buttonBox, SIGNAL("helpRequested()"), self.help) self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True) self.plugin = pluginBase self.connect(self.plugin, SIGNAL("valuesChanged(const QStringList &)"), self.refreshArgs) self.pluginLayout.addWidget(self.plugin) self.plugin.setFocus() self.setWindowTitle(pluginName) self.setPluginCommand(pluginCommand)