taurus-org / taurus

Moved to https://gitlab.com/taurus-org/taurus
http://taurus-scada.org
43 stars 46 forks source link

Collecting model information from ini file #1055

Closed AlejandroAMarin closed 4 years ago

AlejandroAMarin commented 4 years ago

I was looking at a macroexecutor problem with @reszelaz , where using loadsettings() in the macroexecutor code after changing the macroserver in the macroexecutor gui, would go into conflict with the next execution of the macroexecutor. This happens because the parameters used in the macroexecutor command are different from the ones saved in the ini file by the previous change.

To solve this we agreed to compare the ini file model with the given command line model. In order to do so, we extract the ini file model with the following code:

    settings = macroExecutor.getQSettings()
    taurus_config_raw = settings.value("TaurusConfig")
    import pickle
    taurus_config = pickle.loads(taurus_config_raw.data())
    oldmodel = taurus_config['__itemConfigurations__']['model']

We are asking for advise on a better way to extract this information. If this is the optimal way just close the issue.

cpascual commented 4 years ago

For a programmatic approach, that is exactly how I would have done it.

For a higher level approach in the case of TaurusGUI-based GUIs, you can use the Config Editor GUI to view and edit the .ini file. This can be launched with the taurus config command (or taurusconfigbrowser if you are using taurus <4.6)