-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWXListView.py
51 lines (39 loc) · 1.72 KB
/
WXListView.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
#coding:utf-8
import wx.lib.newevent
from ObjectListView import ObjectListView, ColumnDefn, OLVEvent
OvlCheckEvent, EVT_OVL_CHECK_EVENT = wx.lib.newevent.NewEvent()
class ListCtrlView(ObjectListView):
def SetCheckState(self, modelObject, state):
"""
This is the same code, just added the event inside
"""
if self.checkStateColumn is None:
return None
else:
r = self.checkStateColumn.SetCheckState(modelObject, state)
# Just added the event here ===================================
e = OvlCheckEvent(object=modelObject, value=state)
wx.PostEvent(self, e)
# =============================================================
return r
def _HandleLeftDownOnImage(self, rowIndex, subItemIndex):
"""
This is the same code, just added the event inside
"""
column = self.columns[subItemIndex]
if not column.HasCheckState():
return
self._PossibleFinishCellEdit()
modelObject = self.GetObjectAt(rowIndex)
if modelObject is not None:
column.SetCheckState(modelObject, not column.GetCheckState(modelObject))
# Just added the event here ===================================
e = OvlCheckEvent(object=modelObject, value=column.GetCheckState(modelObject))
wx.PostEvent(self, e)
# =============================================================
self.RefreshIndex(rowIndex, modelObject)
#获取右击菜单内容
menuList1 = [u"复制 key",u"复制 +key"]
MenuTitleDict1 = {}
for title in menuList1:
MenuTitleDict1[wx.wx.NewId()] = title