1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 from pyjamas import DOM
16 from pyjamas import Factory
17 from PopupPanel import PopupPanel
18
21 self.item = item
22 kwargs['Widget'] = item
23 PopupPanel.__init__(self, True, **kwargs)
24
26
27 self.setPopupPosition(x, y)
28 self.item.onShow()
29 self.show()
30
32 type = DOM.eventGetType(event)
33 if type == "click":
34 target = DOM.eventGetTarget(event)
35 parentMenuElement = self.item.getElement()
36 if DOM.isOrHasChild(parentMenuElement, target):
37 if self.item.onBrowserEvent(event):
38 self.hide()
39 return True
40
41 return PopupPanel.onEventPreview(self, event)
42
43 Factory.registerClass('pyjamas.ui.ContextMenuPopupPanel', ContextMenuPopupPanel)
44