Mercurial > libervia-desktop-kivy
diff 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 |
line wrap: on
line diff
--- a/cagou/kv/widgets_handler.kv Fri Apr 27 16:37:15 2018 +0200 +++ b/cagou/kv/widgets_handler.kv Fri Apr 27 16:45:09 2018 +0200 @@ -14,15 +14,37 @@ # You should have received a copy of the GNU Affero General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. -<WHSplitter>: - border: (3, 3, 3, 3) - horizontal_suff: '_h' if self.horizontal else '' - background_normal: 'atlas://data/images/defaulttheme/splitter{}{}'.format('_disabled' if self.disabled else '', self.horizontal_suff) - background_down: 'atlas://data/images/defaulttheme/splitter_down{}{}'.format('_disabled' if self.disabled else '', self.horizontal_suff) - size_hint: (1, None) if self.horizontal else (None, 1) - size: (100, self.thickness) if self.horizontal else (self.thickness, 100) - Image: - pos: root.pos - size: root.size - allow_stretch: True - source: 'atlas://data/images/defaulttheme/splitter_grip' + root.horizontal_suff +<WHWrapper>: + carousel: carousel + _sp_top_y: self.y + self.height - self.sp_size + padding: self.split_size + self.split_margin, self.split_size + self.split_margin, 0, 0 + + canvas.before: + # 2 lines to indicate the split zones + Color: + rgba: self.split_color if self._split != 'left' else self.split_color_del if self._split_del else self.split_color_move + Rectangle: + pos: self.pos + size: self.split_size, self.height + Color: + rgba: self.split_color if self._split != 'top' else self.split_color_del if self._split_del else self.split_color_move + Rectangle: + pos: self.x, self.y + self.height - self.split_size + size: self.width, self.split_size + # 3 dots to indicate the main split points + Color: + rgba: 0, 0, 0, 1 + Point: + # left + 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 + pointsize: self.sp_size + Point: + # top + 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 + pointsize: self.sp_size + + Carousel: + id: carousel + direction: 'right' + ignore_perpendicular_swipes: True + loop: True