diff options
author | Matthias Baumgartner <dev@igsor.net> | 2023-02-17 17:53:03 +0100 |
---|---|---|
committer | Matthias Baumgartner <dev@igsor.net> | 2023-02-17 17:53:03 +0100 |
commit | b6f43e68f864f1c15bd56e9775da8edf5c1ac27b (patch) | |
tree | a7218b213d5f7dd4a683d6c1f1cb6021552edff8 /tagit | |
parent | 1b06707e6cecfd87533c61b77455b6930b341cd8 (diff) | |
download | tagit-b6f43e68f864f1c15bd56e9775da8edf5c1ac27b.tar.gz tagit-b6f43e68f864f1c15bd56e9775da8edf5c1ac27b.tar.bz2 tagit-b6f43e68f864f1c15bd56e9775da8edf5c1ac27b.zip |
filter design update
Diffstat (limited to 'tagit')
-rw-r--r-- | tagit/widgets/filter.kv | 44 | ||||
-rw-r--r-- | tagit/widgets/filter.py | 20 | ||||
-rw-r--r-- | tagit/windows/desktop.kv | 2 |
3 files changed, 50 insertions, 16 deletions
diff --git a/tagit/widgets/filter.kv b/tagit/widgets/filter.kv index df9a678..5407610 100644 --- a/tagit/widgets/filter.kv +++ b/tagit/widgets/filter.kv @@ -8,24 +8,36 @@ spacing: 5 tokens: tokens - BoxLayout: - orientation: 'horizontal' - spacing: 10 - id: tokens + Widget: + size_hint_x: None + width: 5 - # Tokens will be inserted here + ScrollView: + do_scroll_x: True + do_scroll_y: False + size_hint: 1, 1 + + BoxLayout: + orientation: 'horizontal' + spacing: 10 + id: tokens + size_hint: None, None + height: 35 + width: self.minimum_width + # Tokens will be inserted here AddToken: show: 'image', root: root.root - SearchmodeSwitch: - show: 'image', - root: root.root + # FIXME: Temporarily disabled + #SearchmodeSwitch: + # show: 'image', + # root: root.root - SortKey: - show: 'image', - root: root.root + #SortKey: + # show: 'image', + # root: root.root SortOrder: show: 'image', @@ -38,7 +50,8 @@ # space for two buttons width: 2*30 + 5 spacing: 5 - size_hint: None, 1 + size_hint: None, None + height: 35 button_height: 30 button_show: 'image', @@ -51,11 +64,14 @@ <Shingle>: orientation: 'horizontal' label: tlabel + size_hint: None, None + width: self.minimum_width + height: 30 Avatar: id: avatar - text: 'T' size_hint: None, None + text: root.avatar width: self.parent.height height: self.parent.height active: root.active @@ -64,6 +80,8 @@ id: tlabel text: root.text active: root.active + width: (self.texture_size[0] + dp(20)) if self.text != '' else 0 + size_hint_x: None <Addressbar>: multiline: False diff --git a/tagit/widgets/filter.py b/tagit/widgets/filter.py index 15aefd6..76394e3 100644 --- a/tagit/widgets/filter.py +++ b/tagit/widgets/filter.py @@ -123,7 +123,7 @@ class Filter(BoxLayout, ConfigAwareMixin): matches = matcher.Filter() if matches(token, ast.filter.Any(ns.bse.tag, ast.filter.Any(ns.bst.label, matcher.Any()))): # tag token - return self.root.session.filter_to_string(token) + return 'T' if matches(token, matcher.Partial(ast.filter.Is)) or \ matches(token, ast.filter.Or(matcher.Rest(matcher.Partial(ast.filter.Is)))): # exclusive token @@ -140,6 +140,20 @@ class Filter(BoxLayout, ConfigAwareMixin): return token.predicate.predicate.get('fragment', '?').title() return '?' + def tok_label(self, token): + matches = matcher.Filter() + if matches(token, ast.filter.Any(ns.bse.tag, ast.filter.Any(ns.bst.label, matcher.Any()))): + # tag token + return self.root.session.filter_to_string(token) + if matches(token, matcher.Partial(ast.filter.Is)) or \ + matches(token, ast.filter.Not(matcher.Partial(ast.filter.Is))): + return '1' + if matches(token, ast.filter.Or(matcher.Rest(matcher.Partial(ast.filter.Is)))): + return str(len(token)) + if matches(token, ast.filter.Not(ast.filter.Or(matcher.Rest(matcher.Partial(ast.filter.Is))))): + return str(len(token.expr)) + return '' + def show_address_once(self): """Single-shot address mode without changing the search mode.""" self.tokens.clear_widgets() @@ -189,7 +203,8 @@ class Filter(BoxLayout, ConfigAwareMixin): Shingle( tok, active=(tok in self.t_head), - text=self.abbreviate(tok), + avatar=self.abbreviate(tok), + text=self.tok_label(tok), root=self.root )) @@ -235,6 +250,7 @@ class Shingle(BoxLayout): # content active = kp.BooleanProperty(False) text = kp.StringProperty('') + avatar = kp.StringProperty('') # touch behaviour _single_tap_action = None diff --git a/tagit/windows/desktop.kv b/tagit/windows/desktop.kv index 685cc10..8fde41a 100644 --- a/tagit/windows/desktop.kv +++ b/tagit/windows/desktop.kv @@ -25,7 +25,7 @@ id: filter root: root size_hint: 1, None - height: 30 + height: 40 HGuide: height: 20 |