winIDEA SDK
test_reset.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import os
6from turtledemo.penrose import start
7
8import isystem.connect as ic
9
10
11winidea_id = ''
12
13
14def test_reset():
15 connMgr = ic.ConnectionMgr()
16 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
17 startup_path = 'CORE0/startup.c'
18 startup2_path = 'CORE0/startup2.c'
19 print(f"Creating {startup_path} file copy: {startup2_path}...")
20 docCtrl = ic.CDocumentController(connMgr, startup_path, "r")
21 try:
22 docCtrl.saveCopy(startup2_path)
23 except Warning as wrn:
24 print("File exited and was overwritten!")
25
26 print(f"Resetting {startup2_path} file content...")
27 docCtrl2 = ic.CDocumentController(connMgr, startup2_path, "u")
28 docCtrl2.reset(ic.IConnectIDE.drContent)
29
30 print(f"Closing {startup2_path} file...")
31 docCtrl2.save()
32 docCtrl2.close()
33
34
35if __name__ == "__main__":
36 test_reset()