winIDEA SDK
test_workspace_save.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import os
6import isystem.connect as ic
7
8
9winidea_id = ''
10
11
12def test_save():
13 connMgr = ic.ConnectionMgr()
14 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
15
16 wksCtrl = ic.CWorkspaceController(connMgr)
17 wksFolderPath = ic.CIDEController(connMgr).getPath(ic.CIDEController.WORKSPACE_DIR)
18
19 print(f"Saving currently opened workspace (overwriting original file)...")
20 wksCtrl.save()
21
22 print(f"Saving currently opened workspace as a copy...")
23 wksCtrl.saveAs("wksCopy.xjrf")
24 filePath = os.path.join(wksFolderPath, "wksCopy.xjrf")
25 print(f"\tDone: {filePath}")
26
27 print("Reopening original workspace...")
28 wksFilePath = os.path.join(wksFolderPath, "SampleSTM32.xjrf")
29 wksCtrl.open(wksFilePath)
30
31
32if __name__ == "__main__":
33 test_save()