[QGIS-Developer] QGIS3 plugin migration issue
André William
wss.andre at gmail.com
Tue Apr 3 12:29:26 PDT 2018
Thank you Nyall, I understand.
The reason I needed to resize the window was to better fit some image
content in my HTML help.
Taking the opportunity, I'm a C++ and Python developer and I would love to
contribute on the project. Is there any need for help in the Processing
Framework (since I'm already a bit familiar with it) or in others areas? I
would probably need some guidance at first but I've been using QGIS and
developing plugins for some time now, so I guess it wouldn't be too big a
learning curve.
André
2018-04-03 0:29 GMT-03:00 Nyall Dawson <nyall.dawson at gmail.com>:
> On 31 March 2018 at 14:06, André William <wss.andre at gmail.com> wrote:
> > After some digging, I found that while the textShortHelp object is not
> > directly available in the AlgorithmDialog class anymore, i was able to
> > access it like this:
> >>
> >> shortHelpObj = dlg.findChild(QTextBrowser, 'textShortHelp')
> >
> > Is this the expected behavior?
>
> None of this is in stable API, so can change between QGIS versions
> (including within minor versions/patch releases).
>
> Stable API for processing is:
> - the classes within the core library (unless they are explicitly
> marked as non-stable, e.g. the modeler related classes)
> - the base GUI "WidgetWrapper" class (NOT any of its subclasses)
> - some methods from the processing namespace:
> - processing.algorithmHelp()
> - processing.run()
> - processing.runAndLoadResults()
> - processing.createAlgorithmDialog()
> - processing.execAlgorithmDialog()
>
> So, in short, unfortunately this approach is always going to be
> fragile. Better wrap it in a big try block! ;)
>
> I gather you're trying to force the "help" panel to resize when the
> dialog is opened. Is there a particular reason why you need to do
> this?
>
> Nyall
>
>
> >
> > André W.
> >
> > 2018-03-30 18:54 GMT-03:00 André William <wss.andre at gmail.com>:
> >>
> >> Hi all,
> >>
> >> I'm porting an existing Geoprocessing Algorithm plugin to QGIS 3 and I'm
> >> having some trouble customizing the default dialog.
> >> On QGIS 2.x the following code worked:
> >>
> >>> class TestAlgorithm(GeoAlgorithm):
> >>> INPUT = 'INPUT'
> >>> OUTPUT = 'OUTPUT'
> >>>
> >>>
> >>>
> >>> def getCustomParametersDialog(self):
> >>> customDialog = AlgorithmDialog(self)
> >>> customDialog.textShortHelp.setFixedWidth(450)
> >>> return customDialog
> >>
> >>
> >> On QGIS 3 however, the getCustomParametersDialog() method is gone. I
> >> assumed it was replaced by the new createCustomParametersWidget(), but
> >> unfortunately this method doesn't seem to get called by the parent
> class:
> >>
> >>> def createCustomParametersWidget(self, parent):
> >>> customDialog = AlgorithmDialog(self)
> >>> customDialog.textShortHelp.setFixedWidth(450)
> >>> return customDialog
> >>
> >>
> >> I also tried manually creating the dialog, but I get a message saying
> that
> >> the 'AlgorithmDialog' object has no attribute 'textShortHelp'.
> >>
> >>> alg =
> >>> QgsApplication.processingRegistry().algorithmById('test:
> testAlgorithm')
> >>> dlg = AlgorithmDialog(alg)
> >>> dlg.textShortHelp.setFixedWidth(450)
> >>> dlg.show()
> >>
> >>
> >> Any thoughts?
> >>
> >> Thanks in advance!
> >> André
> >
> >
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180403/329d6094/attachment.html>
More information about the QGIS-Developer
mailing list