[QGIS-Developer] Popup window within Processing crashes QGIS

C Hamilton adenaculture at gmail.com
Fri Aug 31 05:24:11 PDT 2018


Thanks Nyall!!! Unfortunately I was trying to make this a processing
routine when I shouldn't have. It is good to know the boundaries. This
function really requires user interactivity.

Calvin

On Thu, Aug 30, 2018 at 9:27 PM, Nyall Dawson <nyall.dawson at gmail.com>
wrote:

> On Thu, 30 Aug 2018 at 23:38, C Hamilton <adenaculture at gmail.com> wrote:
> >
> > I have an algorithm that during execution gathers information from the
> data and then pops up a window for the user to select what the user would
> like to do.
> >
> > Is this possible in the Processing framework? I have tried doing this in
> processAlgorithm and it crashes QGIS. Here is how I call the popup window.
>
> No - this is not supported and goes against the very fundamental
> design of Processing. Argggh! ;)
>
> But seriously, Processing was designed with the intention that all
> user choices are made up-front. This allows algorithms to be nicely
> executed inside of models, without the model halting mid-way waiting
> for user input. It also allows algorithms, scripts, models, etc to be
> run from headless environments such as console scripts.
>
> In this case, you're getting a crash because you're trying to create
> GUI components from your algorithm which is being executed in a
> background thread. This is a big no-no in Qt land, and usually results
> in a crash.
>
> Nyall
>
>
> >         fieldsDialog = SelectionDialog(self.tableFeatures)
> >         fieldsDialog.exec_()
> >         items = fieldsDialog.selected
> >
> > Here is the beginning of the SelectionDialong class.
> >
> > class SelectionDialog(QDialog, FIELDS_CLASS):
> >     def __init__(self, feat, parent=None):
> >         super(SelectionDialog, self).__init__(parent)
> >         self.setupUi(self)
> >
> > Prior to Processing I passed in iface.mainWindow() as the parent. Is
> there a proper parent in Processing to pass? Perhaps this is the reason it
> is crashing.
> >
> > class SelectionDialog(QDialog, FIELDS_CLASS):
> >     def __init__(self, iface, feat):
> >         super(SelectionDialog, self).__init__(iface.mainWindow())
> >         self.setupUi(self)
> >
> > Thanks,
> >
> > Calvin
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180831/f2686b84/attachment.html>


More information about the QGIS-Developer mailing list