Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Settings --> Dictionaries #6

Open
demisjohn opened this issue Jan 16, 2016 · 1 comment
Open

Settings --> Dictionaries #6

demisjohn opened this issue Jan 16, 2016 · 1 comment

Comments

@demisjohn
Copy link
Owner

Use ordered dictionaries for the settings? Might make very large lists of settings easier to set up.

Example:
Microscope_Calibrations_user_settings.py:

from Collections import OrderedDict as oDict

Cals = oDict( )    # initialize the dictionary
Cals['FluoroScope 5x'] = 100.0
Cals['FluoroScope 20x'] = 25.0
Cals['FluoroScope 100x'] = 5.0
Cals['Nikon DSLR 5x'] = 120.0
Cals['Nikon DSLR 10x'] = 101.0
Cals['Nikon DSLR 50x'] = 76.0

Units = oDict( )    # initialize the dictionary
Units['FluoroScope 5x'] = 'um'
Units['FluoroScope 20x'] = 'um'
Units['FluoroScope 100x'] = 'um'
Units['Nikon DSLR 5x'] = 'um'
Units['Nikon DSLR 10x'] = 'um'
Units['Nikon DSLR 50x'] = 'um'

# Settings for "Draw-Measurement - Line":
LineWidth_Default = 10.0
FontSize_Default = 10.0

LineWidth = oDict( )    # initialize the dictionary
LineWidth['FluoroScope 5x'] = 7.0
LineWidth['FluoroScope 20x'] = 7.0
LineWidth['FluoroScope 100x'] = 7.0
# any items that don't have a value will use the default values.  This way a particular microscope can have custom annotation sizes etc.

Is this more user-friendly that the current method of using Lists? It does add the ability to override defaults only for a select few settings, but does increase the chance of Typo's (in the oDict key name).

@demisjohn
Copy link
Owner Author

demisjohn commented Apr 3, 2018

Maybe something where All settings for a particular calibration are stored at the same time?
Like a dictionary containing another dictionary.

Eg.
Cals = oDict()
Cals[“FluoroScope 5x”] = oDict(
“LengthPerPixel”: 98.93;
“LengthUnits”: “um”;
“LineWidth”: 10; # Override the default
)

(This syntax is definitely not correct, but you get the idea.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant