Skip to content

Commit

Permalink
(#185) capsul engine sync with mia pref
Browse files Browse the repository at this point in the history
      - Sync from Mia pref to Capsul config: OK
  • Loading branch information
servoz committed Mar 23, 2022
1 parent b2a225c commit e164eb5
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
6 changes: 5 additions & 1 deletion python/populse_mia/software_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,11 @@ def setBackgroundColor(self, color):
self.saveConfig()

def set_capsul_config(self, capsul_config_dict):
"""Set CAPSUL configuration dict into MIA config
"""Set CAPSUL configuration dict into MIA config.
This method is used just (and only) after editing capsul config
(in File > Mia preferences, Pipeline tab, Edit CAPSUL config button),
in order to synchronise the new Capsul config with the Mia preferences.
:param capsul_config_dict: a dict; {'engine': {...},
'engine_modules': [...]}
Expand Down
28 changes: 25 additions & 3 deletions python/populse_mia/user_interface/pop_ups.py
Original file line number Diff line number Diff line change
Expand Up @@ -2677,7 +2677,11 @@ def findChar(self):
index = regex.indexIn(self.editConf.txt.toPlainText(), pos)

def edit_capsul_config(self):
"""capsul engine edition"""
"""Capsul engine edition
This method is used when user hit the Edit CAPSUL config button (File >
MIA preferences, Pipeline tab).
"""

from capsul.api import capsul_engine
from capsul.qt_gui.widgets.settings_editor import SettingsEditor
Expand Down Expand Up @@ -3560,10 +3564,28 @@ def validate_and_save(self, OK_clicked=False):
for i in dict4clean:

if dict4clean[i]:
del c_c['engine']['global']['capsul.engine.module.matlab'][i]
del c_c['engine']['global']['capsul.engine.module.matlab'][i]['executable']

if not config.get_use_matlab_standalone():
pass

try:
keys = c_c['engine']['global']['capsul.engine.module.matlab'].keys()

except KeyError:
pass

else:
dict4clean = dict.fromkeys(keys, False)

for i in keys:

if 'mcr_directory' in c_c['engine']['global']['capsul.engine.module.matlab'][i]:
dict4clean[i] = True

for i in dict4clean:

if dict4clean[i]:
del c_c['engine']['global']['capsul.engine.module.matlab'][i]['mcr_directory']

try:
if not c_c['engine']['global']['capsul.engine.module.matlab']:
Expand Down

0 comments on commit e164eb5

Please sign in to comment.