-
Notifications
You must be signed in to change notification settings - Fork 0
/
launchy.py
executable file
·96 lines (79 loc) · 2.76 KB
/
launchy.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
__author__ = 'churley'
import wx
import mm_menus
import subprocess
from nav import LeftNav
from links import LinkBox
class LeftNavSettings(object):
BUTTONWIDTH = 280
BUTTONHEIGHT = 60
FONTSIZE = 14
WINDOWWIDTH = 300
WINDOWHEIGHT =1000
class LinkSettings(object):
BUTTONWIDTH = 200
BUTTONHEIGHT = 130
FONTSIZE = 15
BUTTONMARGIN = 10
LINEBREAK = 15
class TransMenu(object):
def __init__(self):
self.app = None
self.vert_buffer = 10
self.cats = {}
self.cat_tree, self.cat_order = mm_menus.getAll()
self.link_objects = []
self.width_sub = 560
self.trans = 250
self.mode = 5
def boot(self):
wx.SystemOptions.SetOptionInt("msw.staticbitmap.htclient", 1)
self.app = wx.App(False)
self.data = mm_menus.getAll()
style = ( wx.NO_BORDER )
display_width, display_height = wx.GetDisplaySize()
self.back = LeftNav(None, title='LEFTNAV',
style = style,
pos=(0, 0),
size=(LeftNavSettings.WINDOWWIDTH, display_height),
data= self.data,
settings=LeftNavSettings)
self.back.registerListener(self.change_category)
self.app.MainLoop()
def setMode(self, mode, trans):
self.mode = mode
if mode == 4:
self.width = 860
elif mode == 3:
self.width = 800
elif mode == 5:
self.width = 1060
self.trans = trans
def change_category(self, msg):
self.clear_selection(msg)
style = ( wx.NO_BORDER )
if hasattr(self, 'drilldown') == True:
self.drilldown.Destroy()
display_width, display_height = wx.GetDisplaySize()
self.drilldown = LinkBox(None, style = style, pos=(320, 20), #size=(800,500),
size=(self.width, display_height),
links=self.cat_tree[msg]['items'], mode=(self.mode, self.width),
trans=self.trans,
settings=LinkSettings) #size=(600, display_height),size=(display_width-self.width_sub, display_height),
self.drilldown.SetTransparent(self.trans)
self.drilldown.registerListener(self.launch_app)
def launch_app(self, command):
if '%' in command:
command = command[:command.index('%')]
subprocess.Popen([command], shell=True)
else:
subprocess.Popen([command], shell=True)
self.drilldown.Destroy()
del self.drilldown
def clear_selection(self, msg):
pass
if __name__ == '__main__':
d = TransMenu()
#set Mode num columns, transparency
d.setMode(5,248)
d.boot()