forked from actlaboratory/LAMP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view_manager.py
33 lines (26 loc) · 1007 Bytes
/
view_manager.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
import wx
import globalVars
import context_menus
# イベントバインド関数
def listViewSetting(lc):
lc.AppendColumn("")
lc.SetDropTarget(fileDrop(lc))
lc.Bind(wx.EVT_LIST_ITEM_ACTIVATED, globalVars.eventProcess.listActivate)
lc.Bind(wx.EVT_LIST_KEY_DOWN, globalVars.eventProcess.listViewKeyEvent)
lc.Bind(wx.EVT_CONTEXT_MENU, context_menus.contextMenuOnListView)
#自動リサイズ
lc.SetColumnWidth(0, wx.LIST_AUTOSIZE_USEHEADER)
lc.Bind(wx.EVT_SIZE, resizeEvent)
def resizeEvent(evt): #リサイズイベント処理
evt.GetEventObject().SetColumnWidth(0, wx.LIST_AUTOSIZE_USEHEADER)
# ドラッグアンドドロップクラス
class fileDrop(wx.FileDropTarget):
def __init__(self, window):
super().__init__()
self.window = window
def OnDropFiles(self, x, y, files):
if self.window == globalVars.app.hMainView.playlistView:
globalVars.playlist.addFiles(files)
elif self.window == globalVars.app.hMainView.queueView:
globalVars.queue.addFiles(files)
return True