ZeroPhone / ZPUI

Official ZeroPhone UI framework, based on pyLCI
http://zpui.rtfd.org/
Apache License 2.0
79 stars 19 forks source link

Easier view mixin declaration for new UI element classes #109

Open CRImier opened 5 years ago

CRImier commented 5 years ago

Say, there's a new class based off Menu, i.e. MessagesMenu. Let's imagine it needs a single view function redefined. As it stands now, you need to:

I have a better idea that requires less code to be written, especially as people want to use their own views:

During initialization, say, when get_view_dict is called, it would get the view dict of the parent class, then child classes of all the relevant views would be constructed using the element-specific mixin. Basically, things like these will no longer be necessary.

Problems:

CRImier commented 5 years ago

Pushed the initial implementation to devel. It does address the "not all views need mixins" problem, but doesn't address the "mixin chain" problem.

CRImier commented 5 years ago

Another problem I thought of - how do we handle view errors that occur at any stage? What if a custom view's __init__() fails? What if a custom view's refresh() fails? Is it easier to break things with such a setup?