-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscb.py
44 lines (37 loc) · 1.58 KB
/
scb.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
#!/usr/bin/env python3
PROGRAM = 'SCBsnake'
VERSION = 'v0.0.1'
import os
import platform
import sys
def set_enviorment_variables():
"""
# * == set None for default value
"""
os.environ['PROGRAM_NAME'] = PROGRAM
os.environ['DATABASE_FILENAME'] = PROGRAM.replace(' ', '_') + '_database.sqlite'
os.environ['DATABASE_FOLDER'] = '/home/plutonergy/Documents' # must exist, else: program-folder *
os.environ['DATABASE_SUBFOLDER'] = PROGRAM # if preset, will be added to DATABASE_FOLDER *
os.environ['TMP_DIR'] = '/mnt/ramdisk' # must exist, else: systems tmp-folder *
os.environ['INI_FILENAME'] = 'settings.ini' # program-folder
os.environ['VERSION'] = VERSION
def set_program_root_folder_in_eviorment():
"""
also changes dir to __file__ directory
"""
if __file__[-1] not in ['/', '\\']:
if platform.system() == "Windows":
os.chdir(os.path.realpath(__file__)[0:os.path.realpath(__file__).rfind('\\')])
INI_FILE_DIR = os.path.realpath(__file__)[0:os.path.realpath(__file__).rfind('\\') + 1]
else:
os.chdir(os.path.realpath(__file__)[0:os.path.realpath(__file__).rfind('/')])
INI_FILE_DIR = os.path.realpath(__file__)[0:os.path.realpath(__file__).rfind('/') + 1]
os.environ['INI_FILE_DIR'] = INI_FILE_DIR
set_enviorment_variables()
set_program_root_folder_in_eviorment()
from bscripts.main import SCBMain
from PyQt5 import QtWidgets
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
window = SCBMain()
app.exec_()