Mercurial > libervia-desktop-kivy
comparison cagou/kv/widgets_handler.kv @ 154:a5e8833184c6
widget handler: refactoring:
- replaced proof of concept implementation with cleaner one based on custom layout
- removed proof of concept big bars in favor of thin line to separate widgets, with a 3 dots area in the center where user can touch/click more easily
- when in delete zone, the line + half circle become red, so user knows that she's about to delete a widget
- carousel is now created in kv
- ignore perpendicular swipes. This was not working before but is know working well, and the swipe is far more easy to do on desktop or mobile
- each new widget of the handler has an id (its creation number), which is displayed in debug logs on touch
- handler's widgets keep track of which widgets are on sides (left, top, right, bottom)
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 27 Apr 2018 16:45:09 +0200 |
parents | cd99f70ea592 |
children | 1b835bcfa663 |
comparison
equal
deleted
inserted
replaced
153:e0985834f8eb | 154:a5e8833184c6 |
---|---|
12 # GNU Affero General Public License for more details. | 12 # GNU Affero General Public License for more details. |
13 | 13 |
14 # You should have received a copy of the GNU Affero General Public License | 14 # You should have received a copy of the GNU Affero General Public License |
15 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 | 16 |
17 <WHSplitter>: | 17 <WHWrapper>: |
18 border: (3, 3, 3, 3) | 18 carousel: carousel |
19 horizontal_suff: '_h' if self.horizontal else '' | 19 _sp_top_y: self.y + self.height - self.sp_size |
20 background_normal: 'atlas://data/images/defaulttheme/splitter{}{}'.format('_disabled' if self.disabled else '', self.horizontal_suff) | 20 padding: self.split_size + self.split_margin, self.split_size + self.split_margin, 0, 0 |
21 background_down: 'atlas://data/images/defaulttheme/splitter_down{}{}'.format('_disabled' if self.disabled else '', self.horizontal_suff) | 21 |
22 size_hint: (1, None) if self.horizontal else (None, 1) | 22 canvas.before: |
23 size: (100, self.thickness) if self.horizontal else (self.thickness, 100) | 23 # 2 lines to indicate the split zones |
24 Image: | 24 Color: |
25 pos: root.pos | 25 rgba: self.split_color if self._split != 'left' else self.split_color_del if self._split_del else self.split_color_move |
26 size: root.size | 26 Rectangle: |
27 allow_stretch: True | 27 pos: self.pos |
28 source: 'atlas://data/images/defaulttheme/splitter_grip' + root.horizontal_suff | 28 size: self.split_size, self.height |
29 Color: | |
30 rgba: self.split_color if self._split != 'top' else self.split_color_del if self._split_del else self.split_color_move | |
31 Rectangle: | |
32 pos: self.x, self.y + self.height - self.split_size | |
33 size: self.width, self.split_size | |
34 # 3 dots to indicate the main split points | |
35 Color: | |
36 rgba: 0, 0, 0, 1 | |
37 Point: | |
38 # left | |
39 points: self.x + self.sp_size, self.y + self.height / 2 - self.sp_size - self.sp_space, self.x + self.sp_size, self.y + self.height / 2, self.x + self.sp_size, self.y + self.height / 2 + self.sp_size + self.sp_space | |
40 pointsize: self.sp_size | |
41 Point: | |
42 # top | |
43 points: self.x + self.width / 2 - self.sp_size - self.sp_space, root._sp_top_y, self.x + self.width / 2, root._sp_top_y, self.x + self.width / 2 + self.sp_size + self.sp_space, root._sp_top_y | |
44 pointsize: self.sp_size | |
45 | |
46 Carousel: | |
47 id: carousel | |
48 direction: 'right' | |
49 ignore_perpendicular_swipes: True | |
50 loop: True |