Open ivoflipse opened 10 years ago
Very much a work in progress, but when its finished you should be able to change the settings from within the application and hopefully backup your settings in a sensible way:
While its still a bit barebones, you can at least edit some of the important settings. Next I'll try to make sure every widget that relies on it, actually updates itself
PySide has a class QSettings: http://srinikom.github.io/pyside-docs/PySide/QtCore/QSettings.html for keeping track of application settings. So I think I'm going to rewrite configuration.py to inherit from this class and see how I can keep it up to date and back it up.
Some keyboard shortcuts have alternatives. Either we nuke the option, since you can change them through the settings. Or change it so people can fill in multiple shortcuts, for example by separating them using ';'
Looking at the settings.ini file that PySide creates, it seems it doesn't like dictionaries as objects:
[General]
folders=@Variant(\0\0\0\b\0\0\0\x3\0\0\0$\0m\0\x65\0\x61\0s\0u\0r\0\x65\0m\0\x65\0n\0t\0_\0\x66\0o\0l\0\x64\0\x65\0r\0\0\0\n\0\0\0\x86\0\x43\0:\0\\\0\x44\0r\0o\0p\0\x62\0o\0x\0\\\0\x44\0\x65\0v\0\x65\0l\0o\0p\0m\0\x65\0n\0t\0\\\0P\0\x61\0w\0l\0\x61\0\x62\0\x65\0l\0i\0n\0g\0\\\0p\0\x61\0w\0l\0\x61\0\x62\0\x65\0l\0i\0n\0g\0\\\0s\0\x61\0m\0p\0l\0\x65\0s\0\\\0M\0\x65\0\x61\0s\0u\0r\0\x65\0m\0\x65\0n\0t\0s\0\0\0\x1e\0\x64\0\x61\0t\0\x61\0\x62\0\x61\0s\0\x65\0_\0\x66\0o\0l\0\x64\0\x65\0r\0\0\0\n\0\0\0\x14\0.\0\\\0\x64\0\x61\0t\0\x61\0\x62\0\x61\0s\0\x65\0\0\0\x1a\0\x64\0\x61\0t\0\x61\0\x62\0\x61\0s\0\x65\0_\0\x66\0i\0l\0\x65\0\0\0\n\0\0\0~\0\x43\0:\0\\\0\x44\0r\0o\0p\0\x62\0o\0x\0\\\0\x44\0\x65\0v\0\x65\0l\0o\0p\0m\0\x65\0n\0t\0\\\0P\0\x61\0w\0l\0\x61\0\x62\0\x65\0l\0i\0n\0g\0\\\0p\0\x61\0w\0l\0\x61\0\x62\0\x65\0l\0i\0n\0g\0\\\0\x64\0\x61\0t\0\x61\0\x62\0\x61\0s\0\x65\0\\\0\x64\0\x61\0t\0\x61\0.\0h\0\x35)
I fear that I'll have to adjust the format to what their documentation prescribes:
settings.setValue("mainwindow/size", win.size()) settings.setValue("mainwindow/fullScreen", win.isFullScreen()) settings.setValue("outputpanel/visible", panel.isVisible())
I haven't fixed the format described in the previous post yet, but at least now you can save settings and at least some parts of the software will automatically reload whatever values come from the settings.
Most other parts are created when new data arises, for example track_contacts calls settings dynamically whenever its called, so it will pick up whatever settings the application has at that moment.
One side-effect of this is that objects that have already been created (with possibly different settings) won't be affected by new changes, unless we recompute things. I can imagine that if you're not happy with the thresholds for a particular subject, that you want to be able to change them and see what contacts you get now.
I reckon this means I'll have to add support for recomputing everything.
While the settings aren't entirely complete just yet, I'm satisfied with what I have so far. There are still some options to add, but I don't expect any major problems with creating those, given the other parts work, so I'm closing this one.
Clearly some values should be added to the Settings tab, because they're a bit of a pain to change if you don't know where you're looking.
There also seems to be a problem where reading settings from the settings.ini file changes them to unicode, so they never pass the isinstance test.
I'm trying to adjust the size of the entire plate and contacts widgets, but I'm not sure whether it really has effect, as they are already being scaled when the window resizes
To allow resizing the widgets, I think I need to adjust their size and add them to the layout again. Have a look at how that would work.
Wasn't sure where to put this but setting custom colours for the contacts would be handy - red and green could cause colour-blind people issues.
Good point @lynforster I'll see how I can add a color picker for changing to colors (and make sure that actually gets used throughout the application)
I suggest adding a button where the important settings are loaded from config.yaml or config_example.yaml and lets you change it to sane input values.
Perhaps perform some validation in case the values fall outside of acceptable ranges and allow for resetting them to default.