Forum Archive

Custom views in ui builder?

JonB

Has anyone gotten a custom view which is not the main view to work in the ui builder? I'm running 1.5 on ios 7.

There is a custom view widget, which lets you insert a custom view class... I've made sure to define the class before calling load_view, but the custom view object is never instantiated, instead only a vanilla _ui.View.

If I set a custom view for the main view, and load_view, it does produce an object of the custom class... Just not for widgets added using the Custom View button.

polymerchm

Check out my chordcalc script. The fretboard is a custom view. I create in in the builder.

JonB

Ok, it appears that the custom class cannot be in another module.

For instance, if try to specify myModule.someclass in ui builder, and have the following code

import myModule
import ui
ui.load_view('myView')

I get

Warning: Custom class 'myModule.someclass' could not be found.

But, if I import someclass directly, and just specify someclass In the builder

from myModule import someclass
import ui

works ok.