83
|
1 <ContextMenu>:
|
|
2 cols: 1
|
|
3 size_hint: None, None
|
|
4 spacing: 0, 0
|
|
5 spacer: _spacer
|
|
6 on_visible: self._on_visible(args[1])
|
|
7 on_parent: self._on_visible(self.visible)
|
|
8
|
|
9 Widget:
|
|
10 id: _spacer
|
|
11 size_hint: 1, None
|
84
|
12 height: dp(3)
|
83
|
13 canvas.before:
|
|
14 Color:
|
|
15 rgb: 0.2, 0.71, 0.9
|
|
16 Rectangle:
|
|
17 pos: self.pos
|
|
18 size: self.size
|
|
19
|
|
20
|
|
21 <ContextMenuItem>:
|
|
22 size_hint: None, None
|
|
23 submenu_arrow: _submenu_arrow
|
|
24 on_children: self._check_submenu()
|
|
25 on_parent: self._check_submenu()
|
|
26 canvas.before:
|
|
27 Color:
|
|
28 rgb: (0.15, 0.15, 0.15)
|
|
29 Rectangle:
|
|
30 pos: 0,0
|
|
31 size: self.size
|
|
32
|
|
33 Widget:
|
|
34 id: _submenu_arrow
|
|
35 size_hint: None, None
|
84
|
36 width: dp(6)
|
|
37 height: dp(11)
|
|
38 pos: self.parent.width - self.width - dp(5), (self.parent.height - self.height) / 2
|
83
|
39 canvas.before:
|
|
40 Translate:
|
|
41 xy: self.pos
|
|
42 Color:
|
|
43 rgb: (0.35, 0.35, 0.35) if self.disabled else (1, 1, 1)
|
|
44 Triangle:
|
|
45 points: [0,0, self.width,self.height/2, 0,self.height]
|
|
46 Translate:
|
|
47 xy: (-self.pos[0], -self.pos[1])
|
|
48
|
|
49
|
|
50 <ContextMenuText>:
|
|
51 label: _label
|
|
52 width: self.parent.width if self.parent else 0
|
84
|
53 height: dp(26)
|
|
54 font_size: '15sp'
|
83
|
55
|
|
56 Label:
|
|
57 pos: 0,0
|
|
58 id: _label
|
|
59 text: self.parent.text
|
|
60 color: self.parent.color
|
|
61 font_size: self.parent.font_size
|
84
|
62 padding: dp(10), 0
|
83
|
63 halign: 'left'
|
|
64 valign: 'middle'
|
|
65 size: self.texture_size
|
|
66 size_hint: None, 1
|
|
67
|
|
68
|
|
69 <AbstractMenuItemHoverable>:
|
|
70 on_hovered: self._on_hovered(args[1])
|
|
71 canvas.before:
|
|
72 Color:
|
|
73 rgb: (0.25, 0.25, 0.25) if self.hovered and not self.disabled else (0.15, 0.15, 0.15)
|
|
74 Rectangle:
|
|
75 pos: 0,0
|
|
76 size: self.size
|
|
77
|
|
78
|
|
79 <ContextMenuDivider>:
|
84
|
80 font_size: '10sp'
|
|
81 height: dp(20) if len(self.label.text) > 0 else dp(1)
|
83
|
82 canvas.before:
|
|
83 Color:
|
|
84 rgb: (0.25, 0.25, 0.25)
|
|
85 Rectangle:
|
|
86 pos: 0,self.height - 1
|
|
87 size: self.width, 1
|
|
88
|
|
89
|
|
90 <ContextMenuButton@Button>:
|
|
91 size_hint: None, None
|
84
|
92 font_size: '12sp'
|
|
93 height: dp(20)
|
83
|
94 background_normal: ""
|
|
95 background_down: ""
|
|
96 background_color: 0.2, 0.71, 0.9, 1.0
|
|
97 border: (0, 0, 0, 0)
|
|
98 on_press: self.background_color = 0.10, 0.6, 0.8, 1.0
|
|
99 on_release: self.background_color = 0.2, 0.71, 0.9, 1.0
|
|
100
|
|
101
|
|
102 <ContextMenuToggleButton@ToggleButton>:
|
|
103 size_hint: None, None
|
84
|
104 font_size: '12sp'
|
|
105 size: dp(30), dp(20)
|
83
|
106 background_normal: ""
|
|
107 background_down: ""
|
|
108 background_color: (0.2, 0.71, 0.9, 1.0) if self.state == 'down' else (0.25, 0.25, 0.25, 1.0)
|
|
109 border: (0, 0, 0, 0)
|
|
110 on_press: self.background_color = 0.10, 0.6, 0.8, 1.0
|
|
111 on_release: self.background_color = 0.2, 0.71, 0.9, 1.0
|
|
112
|
|
113
|
|
114 <ContextMenuSmallLabel@Label>:
|
84
|
115 size: self.texture_size[0], dp(18)
|
83
|
116 size_hint: None, None
|
84
|
117 font_size: '12sp'
|
83
|
118
|
|
119
|
|
120 <ContextMenuTextInput@TextInput>:
|
|
121 size_hint: None, None
|
84
|
122 height: dp(22)
|
|
123 font_size: '12sp'
|
|
124 padding: dp(7), dp(3)
|
|
125 multiline: False
|