Hi,

it might be useful for you to have a look at how QgisModelBaker does it:

https://github.com/opengisch/QgisModelBaker/blob/master/QgisModelBaker/libili2db/iliexecutable.py#L139-L185

Regards,

Germán


El dom, 26 sept 2021 a las 5:28, Enzo Cocca (<[email protected]>) escribió:

> I wolud print the result during my script run via Qprocess but nothing
> happen. I thinking I wrote wrong the args into process start but im not
> sure. Some one has an idea? Below my code
>
> class TotalopenstationDialog(QtWidgets.QDialog, FORM_CLASS):
>
>     def __init__(self, parent=None):
>         """Constructor."""
>         super(TotalopenstationDialog, self).__init__(parent)
>         self.setupUi(self)
>
>     def dataReady(self):
>         cursor = self.textEdit.textCursor()
>         cursor.movePosition(cursor.End)
>         cursor.insertText(str(self.process.readAll()))
>         self.textEdit.ensureCursorVisible()
>
>     def callProgram(self):
>         # run the process
>         # `start` takes the exec and a list of arguments
>         python_path = sys.exec_prefix
>         python_version = sys.version[:3]
>         p = '{}\python'.format(python_path)
>         b=QgsApplication.qgisSettingsDirPath().replace("/","\\")#this one 
> works for windows path
>         cmd = os.path.join(os.sep, b, 'python', 'plugins', 
> 'totalopenstationToQgis',
>         'scripts', 'totalopenstation-cli-parser.py')
>         self.process = QProcess(self)
>         # QProcess emits `readyRead` when there is data to be read
>         self.process.readyRead.connect(self.dataReady)
>         self.process.start(p, [cmd, 
> '-i',str(self.lineEdit_input.text()),'-o',str(self.lineEdit_output.text()),'-f',self.comboBox_format.currentText(),'-t',self.comboBox_format2.currentText(),'--overwrite'])
>
>     def on_pushButton_connect_pressed(self):
>         self.callProgram()
>
>
> --
> Enzo Cocca PhD
> in "Science and Technology for Archaeology and Cultural Heritage"
>
> ISMEO
> International Association of Mediterranean and Oriental Studies
>
>
> mail: [email protected]
> cell: +393495087014
>
> _______________________________________________
> QGIS-Developer mailing list
> [email protected]
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>


-- 
-----------
  |\__
(:>__)(
   |/
Soluciones Geoinformáticas Libres
http://geotux.tuxfamily.org/
https://twitter.com/GeoTux2 <http://twitter.com/GeoTux2>
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to