GregValiant 1,115
Ok @ahoeben I'm trying to get back across the autobahn.
I'm working on a post-processor and I want to use the extruder_count to enable/disable a setting upon load.
This requires getting the extruder_count before the settings load and then something like:
"enabled": extruder_count >1 ".
I have made numerous tries. I believe am now familiar with every error code that Python and QML can throw. What I have not been able to do is to disable the @#$% checkbox if there is only 1 extruder.
Any help would be appreciated.
Recommended Posts
ahoeben 1,850
Try this:
from UM.Application import Application Application.getInstance().getPreferences().getValue("cura/currency")
Preferences is the class, Application.getInstance().getPreferences() returns the single instance of that class that Cura creates. In python, if you call a method of an instance, python "inserts" a reference to the instance as the first argument. Running getValue directly on the class instead of on an instance of the class means that the reference to the class ("self") does not get passed to the method, and instead the string "cura/currency" gets passed as the argument for "self".
Will you be able to get back to your side of the street later? Or are you planning to stay on this side?
Link to post
Share on other sites
GregValiant 1,115
Thank you kind sir. That did it. I can rest quietly on this bench now.
As for re-crossing I may require help. I had thought I was crossing Python Street when in reality it is a freakin' 16 lane boulevard and I'm wearing a blindfold.
The fore-slash in the name just wasn't fair.
Link to post
Share on other sites