Ameobea / orange3

Orange 3 data mining suite: http://orange.biolab.si
Other
1 stars 0 forks source link

Daily Progress Updates #20

Closed ameo-unito-bot closed 8 years ago

ameo-unito-bot commented 8 years ago

┆Issue is synchronized with this Asana task

Ameobea commented 8 years ago

I've been having some issues implementing code generators for the other widgets. Yeah, I know I said it should be easy and that I thought I'd be done by the end of the week with most widgets, but unfortunately I ran into a roadblock.

Currently, I'm getting instances of the widgets to execute the code generator function on by creating a WidgetsScheme and using the widget_for_node function to convert the nodes of the scheme into widgets. The issue with this approach is that the widget instances lack the data (inputs) from the actual scheme. For many code generation approaches, I need access to the input data in order to produce code that doesn't require creating an instance of the widget or copying most of the widget code into the output.

@Kernc do you know of a way that I can access the actual widget instances from the scheme during code generation? If I can't do that, do you have any suggestions of ways to access the data from the input/output channels from the widgets during code generation?

I've spent many hours trying to figure this out these past few days but I've been unable to come up with a solution.

Sorry for giving false expectations on the easiness of the task; I hope to come up with a solution soon to make get this working as soon as possible.

Pelonza commented 8 years ago

I'm wary of depending too heavily on actually using the widgets to do the computations. If the point is to be able to be more flexible in the parameters and setting that the particular widget implements, by using the actual orange data mining library, relying on the instances of the widgets seems counter productive... but maybe I am misunderstanding how much access a given widget has to actual library parameters. Is the gui hiding interface capabilities?

Ameobea commented 8 years ago

I'm not looking to use the widgets, I'm looking to access the data that the widgets have. I'm trying to avoid having to create widget instances in the output script by giving the code generator more information to work with in the form of the inputs to each of the widgets in the scheme.

kernc commented 8 years ago

@Ameobea Can you give an example of such widget where you need this?

Ameobea commented 8 years ago

Hi. Sorry for the long, long silence; I was out of town in a place with no internet, no cell reception without a computer. I only arrived home last night.

Anyway, I thought about this a long time (even going as far as to write some ideas on paper during my week away) and realized that a much more elegant solution exists than manually plugging data into new widget instances. If there were a way to give the root code generator function access to the actual widget objects present in the scheme rather than having to create new instances, this would eliminate the need to manually plug in data by giving access to all the widget internals.

However, the problem with this is that I can see no way to actually access this data. I'm currently creating a new WidgetManager and populating it with the nodes from the DAG. This in turn produces new, empty, and disconnected widget objects.

Is it possible to access the WidgetManager for the main scheme in order to access the live instances and, if so, how can I accomplish this?

I'll keep looking myself for ways to do it, but I'd greatly appreciate some help from a professional :)

By the way, @kernc, thank you so much for your ongoing support with this. I'm sure it must be frustrating dealing with a newbie with the project like myself, but I really appreciate your patience and ongoing assistance.

Pelonza commented 8 years ago

Perhaps the otherway to think about it... Should the code generator simply be housed IN the WidgetManager? i.e. an 'output' function that is actually part of that code-base. Then the "save as python script" would call the output function from the widgetmanager, which could conceivably call other functions that generate code.

Note: This comment is without me looking at any code or having any idea what's in the widgetmanager stuff :)

Ameobea commented 8 years ago

I actually just looked through some old code I wrote as I was just starting out with the project, and it turns out that there was already a WidgetManager installed on the scheme and I was overwriting it with a blank one for some reason! I didn't know that it already had one and was essentially erasing it and resetting it with a blank one.

That was such a crazy easy fix, I'm pretty embarrased. Well, at least that means I can finally get to doing some serious coding! (for real this time)