This repository has been archived by the owner on Sep 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
caloriestracker_autotest.py
54 lines (43 loc) · 2.06 KB
/
caloriestracker_autotest.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
from PyQt5.QtWidgets import QDialog
from caloriestracker.ui.frmAccess import frmAccess
from caloriestracker.mem import MemCaloriestracker
import caloriestracker.images.caloriestracker_rc #Images of frmAccess were not loaded without this
from os import system, environ
from PyQt5 import QtWebEngineWidgets # To avoid error must be imported before QCoreApplication
dir(QtWebEngineWidgets)
print ("This script needs PGPASSWORD to be set")
password=environ['PGPASSWORD']
system("dropdb -U postgres -h 127.0.0.1 caloriestracker_autotest")
print("Emulating caloriestracker_init main function")
mem=MemCaloriestracker()
mem.run()
mem.frmAccess=frmAccess("caloriestracker", "frmAccess")
mem.frmAccess.setResources(":/caloriestracker/caloriestracker.png", ":/caloriestracker/caloriestracker.png")
mem.frmAccess.setLabel(mem.tr("Please login to the Calories Tracker database"))
mem.frmAccess.txtDB.setText("caloriestracker_autotest")
mem.frmAccess.txtPass.setText(password)
mem.frmAccess.on_cmdDatabaseNew_released()
print("You must select yes and ok to message")
print ("Emulating caloriestracker main function")
del mem
mem=MemCaloriestracker()
mem.run()
mem.frmAccess=frmAccess("caloriestracker", "frmAccess")
mem.frmAccess.setResources(":/caloriestracker/caloriestracker.png", ":/caloriestracker/caloriestracker.png")
mem.frmAccess.setLabel(mem.tr("Please login to the Calories Tracker database"))
mem.frmAccess.txtDB.setText("caloriestracker_autotest")
mem.frmAccess.txtPass.setText(password)
mem.frmAccess.on_cmdYN_accepted()
if mem.frmAccess.result()==QDialog.Accepted:
mem.con=mem.frmAccess.con
mem.settings=mem.frmAccess.settings
mem.setLocalzone()#Needs settings in mem
if mem.args.products_maintainer==True:
from caloriestracker.ui.frmMainProductsMaintainer import frmMainProductsMaintainer
mem.setProductsMaintainerMode(True)
mem.frmAccess.languages.cambiar("en", "caloriestracker")
mem.frmMain = frmMainProductsMaintainer(mem)
else:
from caloriestracker.ui.frmMain import frmMain
mem.frmMain=frmMain(mem)
mem.frmMain.show()