hibtc / madgui

GUI for accelerator simulations using MAD-X
https://hibtc.github.io/madgui
Other
3 stars 2 forks source link

Adding pull down menus for enum parameters #15

Closed DavidSagan closed 7 years ago

DavidSagan commented 7 years ago

Some parameters are enums. For example, a lattice element's tracking_method can be set to "bmad_standard", "symp_lie_ptc", etc.

To Do:

1) Tao's python command needs to be modified to return ENUM for the appropriate parameters. I will do this.

2) The gui needs to be modified to be able to handle enums. That is, to display a drop down list of possibilities.

To avoid breaking the gui, (2) should be done before (1). Thomas: Do you want to tackle (2) or should I put this on my ToDo list?

coldfix commented 7 years ago

I guess it's gonna be more efficient for me to change this since I know the code a lot better. This concerns those fields with ENUM data type and can be implemented using your new commands, right?

The only problem is that I cannot test currently, since my compiler still errors. I will check tomorrow if I can find a simple solution (like renaming the module) or downgrade.

DavidSagan commented 7 years ago

This concerns those fields with ENUM data type and can be implemented using your new commands, right?

Correct. The species is different from the enums in that there is no finite set of possibilities. I could use a data type of SPECIES for parameters that record the species. What do you think?

The only problem is that I cannot test currently, since my compiler still errors. I will check tomorrow if I can find a simple solution (like renaming the module) or downgrade.

I've run into internal compiler errors before and from my experience the easiest route is to downgrade for now. I will take a look when macports provides gcc 7.1. Is there any reason not to downgrade?

coldfix commented 7 years ago

Correct. The species is different from the enums in that there is no finite set of possibilities. I could use a data type of SPECIES for parameters that record the species. What do you think?

Personally, I'd prefer if tao's python API were reading and writing species as STR, then there is no need for more data types, python commands and special cases.

Otherwise, I can handle species as a special case for now. If similar patterns occur in more places, we can still generalize it with its own data type.

coldfix commented 7 years ago

(For me the integer representation is an implementation detail for which I don't see much need knowing about in external applications)

DavidSagan commented 7 years ago

This is done. The species is given as a string.

coldfix commented 7 years ago

Great.

To avoid breaking the gui, (2) should be done before (1). Thomas: Do you want to tackle (2) or should I put this on my ToDo list?

Once you upgrade pytao to the latest commit, there should be no breakage, so you can go ahead adding this now.

Concerning the dropdown menu implementation in madqt: I have pushed a preliminary version to the enum-dropdown branch. This will likely break, but I'll have to test it with the changes in tao first.

I've run into internal compiler errors before and from my experience the easiest route is to downgrade for now. I will take a look when macports provides gcc 7.1. Is there any reason not to downgrade?

I'm hesitant because other binary system packages may implicitly depend on the specific version of runtime libs shipped with gcc and break after installing the downgraded version, in particular for major version upgrades. For example, after upgrading gcc to 7.1, my gcc-6.3 builds of MAD-X and bmad refused to run because of some missing gfortran symbol. (When I have some time, I will install NixOS to be able have isolated environments with different set of packages, even competing versions or conflicting packages on the same system at the same time).

Anyway, I downgraded now. Interestingly, with gcc 6.1 there is another internal compiler error, this time a bit later during the tao build. I'm now on gcc 6.3 and it seems to work so far..

coldfix commented 7 years ago

and it seems to work so far..

Nevermind, my system numpy installation doesn't work anymore, which probably means lots of other things will be broken too, so I'm going back up to gcc 7.1.

DavidSagan commented 7 years ago

[Put in fix for gcc 7 compiler bug.]

Modified Tao python command so that enum parameters are marked as such. madqt runs but no pull down menus are present. for the enum parameters.

coldfix commented 7 years ago

Great thanks for the fix and bug report.

madqt runs but no pull down menus are present. for the enum parameters.

Yes, this is as expected. I have changes only in a separate branch that is not merged into master and furthermore the element boxes are currently still readonly.

coldfix commented 7 years ago

ENUM output missing for spin_tracking_method.

Note: I made some bugfixes in pytao, so please update.

DavidSagan commented 7 years ago

Fixed.