biolab/orange3 — pull request #70 by janezd (2014-07-17 22:49:34+00:00)
Title: Widgets with context settings now get properly initialized Context

I encountered this problem when refactoring the scatter plot widget: when the widget is initialized, the context handler expects the context to include attribute `attributes`, which is not there since the `current_context` was initialized by `self.current_context = settings.Context()`, which is not enough for contexts belonging to domain context handlers.

There was also an unrelated error (I believe) in the call to `self.encode_setting`.

I don't know how other widgets that use context settings survived this (are there any, actually?).

@astaric, you were probably the last who played with settings, could you please check that the fix is OK?

Second, `WidgetMetaClass` now does

if isinstance(self.settingsHandler, ContextHandler):
self.current_context = self.settingsHandler.new_context()

This could be avoided by calling `new_context` from `ContextSettingsHandler.initialize`. With this we'd avoid using `isinstance`, but `ContextSettingsHandler.initialize` is about initialization of the widget instance, not about initialization of the context. I can't decide about this.