LemurPwned / VISM

Software for visualising magnetic layers
Other
6 stars 2 forks source link

BetterWidget™ idea #32

Closed pawelkulig1 closed 6 years ago

pawelkulig1 commented 6 years ago

Idea is not to hardcode plugins inside code, and get rid of adding new if statements everywhere if new Widget is added to program, I think we should solve that by making some kind of file with all plugin names etc. and all files using them will be getting that data from some kind of interface(proxy/singleton) and using it dynamically. It's not needed for now but in future may be helpful.

LemurPwned commented 6 years ago

I will join this issue with #35 since it has conjugated issues

pawelkulig1 commented 6 years ago

I think we should do something like that: Every widget has at least two files, one is GUI class to configure it and another class is to show it as widget. If One adds new Widget (installs it by this script, all names are added to some file etc. ). It is from now shown in menu of Widgets (this list of widgets). If One choses widget, it shows configuration window with default configuration (user can change it), and after clicking OK, new widget will be added. This reduces problems with for ex. not selecting plot setting before animation.

We will force user to pick things in order we want them to be picked. I think this kind of thinking will let us simplify app, and get rid of some complicated bugs.

LemurPwned commented 6 years ago

Ok, so what I am preparing right now is a Mediator with proxy that propagates settings from the GUI to itself, verifies it and then manages settings prompting and Canvas or GL object creation. This will not require any blocking since settings are only prompted at creation and will be valid only for the object's lifetime (til deletion).

additionally, I will construct another class that will delegate Widget buildup (checks all files) and will enhance the namespace of the aforementioned settings mediator.

So for example:

I propose that settings should be valid for the whole lifetime of the 3d widget, if user wants to modify it, there is a need to reload it anyway so it wont save much time by modyfiying it i.e. delete and create new. However, for now, settings Mediator will refresh modifications for 2D layers, that's ok.

Tell me what do you think about that.

pawelkulig1 commented 6 years ago

Correct. I think at start of app user should be prompted with some kind of Initial Panel and then asked to provide directory, the rest is as above. For now I will take care of:

I will join you after having my part done.

pawelkulig1 commented 6 years ago

We have to think about putting each Widget in separate directory (I don't think it's necessary), but for sure we must put all widgets in one directory.

pawelkulig1 commented 6 years ago

To be clear this should also shorten main.py file because compose_dict and plotSettingsReceiver will be inside widgetSettings class and choosingWidgetReceiver won't be made of cascade of if statements.

LemurPwned commented 6 years ago

Yes, that's exactly what I have started to do

LemurPwned commented 6 years ago

I think it was completely solved in #39 and #46