-
Notifications
You must be signed in to change notification settings - Fork 2
/
hman.py
65 lines (49 loc) · 1.58 KB
/
hman.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
55
56
57
58
59
60
61
62
63
64
65
import sys
import os
if os.path.dirname(__file__) + "\\libs" not in sys.path:
sys.path.append(os.path.dirname(__file__) + "\\libs")
from PyQt4 import QtGui
from main.MainUi import HmanMainUi
from main.PathPicker import PathPicker
from IO_path import readInitPath
from utils import LogW
'''
Init the path.inf.
Read the path.inf, if no path are set
open the UI to setup path.
Path must be valid install path.
'''
def main(parent=None):
# Check if folder _pytmp exists
pymp = os.path.dirname(__file__) + "\\_pytmp"
if not os.path.exists(pymp):
os.mkdir(pymp)
# Check hman version
version = "version"
with open(version, "r") as v:
version = v.readline()
msg = "INFO: "
msg += "Launching hman version: " + version
LogW.writeLog(None, msg, printout=True)
outDic = readInitPath()
pathResult = [outDic[k] for k in outDic.keys()]
# Taskbar icon fix for windows 7
try:
import ctypes
myappid = u'hman'
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
except ImportError:
pass
app = QtGui.QApplication(sys.argv)
app.setWindowIcon(QtGui.QIcon(os.path.dirname(__file__)+"\\icons\\hman_small.png"))
# If no path found, launch ui
if not any(pathResult):
pathPicker = PathPicker(version, parent)
pathPicker.exec_()
if pathPicker.CANCEL:
return
ui = HmanMainUi(version, parent)
ui.show()
app.exec_()
if __name__ == "__main__":
main()