forked from belangeo/qlive
/
QLive.py
42 lines (37 loc) · 1.16 KB
/
QLive.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
#!/usr/bin/env python
# encoding: utf-8
import wx, sys
from types import ListType
import Resources.QLiveLib as QLiveLib
from Resources.MainWindow import MainWindow
class QLiveApp(wx.App):
def __init__(self, *args, **kwargs):
wx.App.__init__(self, *args, **kwargs)
X, Y = wx.DisplaySize()
sizex, sizey = 1000, 670
if X < 1000:
sizex = X - 40
if Y < 670:
sizey = Y - 40
self.frame = MainWindow(pos=(20, 20), size=(sizex, sizey))
QLiveLib.setVar("MainWindow", self.frame)
if hasattr(self, "filenames"):
self.frame.loadFile(QLiveLib.ensureNFD(self.filenames[0]))
def MacOpenFiles(self, filenames):
if type(filenames) != ListType:
filenames = [filenames]
self.filenames = filenames
def MacReopenApp(self):
try:
self.frame.Raise()
except:
pass
if __name__ == "__main__":
QLiveLib.loadVars()
qlfile = None
if len(sys.argv) > 1:
qlfile = sys.argv[1]
app = QLiveApp()
if qlfile:
wx.CallAfter(app.frame.loadFile, QLiveLib.ensureNFD(qlfile))
app.MainLoop()