1#***************************************************************************
2#* SPDX-FileCopyrightText: 2021 S. MANKOWSKI stephane@mankowski.fr
3#* SPDX-FileCopyrightText: 2021 G. DE BURE support@mankowski.fr
4#* SPDX-License-Identifier: GPL-3.0-or-later
5#***************************************************************************
6import os
7import shutil
8from sikuli.Sikuli import *
9
10def openFile(fileName):
11	print("Opening "+fileName)
12	type("o", KEY_CTRL)
13	if exists("1446152114435.png"):
14		click("1446152575740.png")
15	paste(Pattern("1446149387754.png").similar(0.59), fileName)
16	click("1446152645440.png")
17
18def openAllPages():
19	type("1", KEY_CTRL)
20	type("2", KEY_CTRL)
21	type("3", KEY_CTRL)
22	type("4", KEY_CTRL)
23	type("5", KEY_CTRL)
24	type("6", KEY_CTRL)
25	type("7", KEY_CTRL)
26	type("8", KEY_CTRL)
27	type("9", KEY_CTRL)
28	type("0", KEY_CTRL+KEY_ALT)
29	type("1", KEY_CTRL+KEY_ALT)
30	type("2", KEY_CTRL+KEY_ALT)
31	type("3", KEY_CTRL+KEY_ALT)
32
33def closeCurrentPage():
34	type("w", KEY_CTRL)
35
36def initSimple():
37	print("Initialisation with "+Env.getSikuliVersion())
38	App.open("skrooge  > /dev/null 2>&1")
39	sleep(5)
40	#click("1446152344094.png")
41
42def initAllPlugins():
43	initSimple()
44	openFile(os.getenv('IN')+"all_plugins.skg")
45	sleep(5)
46	click("1446152986402.png")
47
48def close():
49	App.close("skrooge")
50
51def undo():
52    type("z", KEY_CTRL)
53
54def redo():
55    type("z", KEY_CTRL+KEY_SHIFT)
56
57def openSettings():
58	click("Setting.png")
59	click("gunfigureSrg.png")
60	click("Vox.png")
61
62def createAccount(bankName, accountName):
63	type("2", KEY_CTRL)
64	paste("1383133694348.png", bankName)
65	paste("1383133566859.png", accountName)
66	sleep(1)
67	type(Key.ENTER, KEY_CTRL)
68
69	closeCurrentPage()
70
71def openReport():
72	type("r", KEY_META)
73
74def generateErrorCapture(name):
75    img=capture(SCREEN)
76    errorCapture=os.path.join(os.getenv('OUT'), name+"/error.png")
77    shutil.move(img, errorCapture)
78    print "Capture at failure:"+errorCapture
79