# HG changeset patch # User Goffi # Date 1580845637 -3600 # Node ID d61bbbac416063e77ab31db12fc2bf5fee2488c2 # Parent 415de998b91dcd3bc36d217aac3ac1915bae60ad cagou widget: don't add header_input systematically anymore: header input is often used in CagouWidget for e.g. filtering, but not always, and when it is not, it is weird and confusing to have a TextInput which doesn't do nothing. To avoid that, a new `use_header_input` bool attribute (set to False by default) has been added to CagouWidget. diff -r 415de998b91d -r d61bbbac4160 cagou/core/cagou_widget.py --- a/cagou/core/cagou_widget.py Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/core/cagou_widget.py Tue Feb 04 20:47:17 2020 +0100 @@ -24,6 +24,7 @@ from kivy.uix.boxlayout import BoxLayout from kivy.uix.dropdown import DropDown from kivy.uix.screenmanager import Screen +from kivy.uix.textinput import TextInput from kivy import properties from cagou import G from .common import ActionIcon @@ -86,6 +87,7 @@ main_container = properties.ObjectProperty(None) header_input = properties.ObjectProperty(None) header_box = properties.ObjectProperty(None) + use_header_input = False # set to True if you want to be able to switch between visible widgets of this # class using a carousel collection_carousel = False @@ -104,6 +106,17 @@ break super().__init__(**kwargs) self.selector = HeaderWidgetSelector(self) + if self.use_header_input: + self.header_input = TextInput( + background_normal=G.host.app.expand( + '{media}/misc/borders/border_hollow_light.png'), + multiline=False, + ) + self.header_input.bind( + on_text_validate=lambda *args: self.onHeaderInput(), + text=self.onHeaderInputComplete, + ) + self.header_box.add_widget(self.header_input) @property def screen_manager(self): diff -r 415de998b91d -r d61bbbac4160 cagou/kv/cagou_widget.kv --- a/cagou/kv/cagou_widget.kv Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/kv/cagou_widget.kv Tue Feb 04 20:47:17 2020 +0100 @@ -69,7 +69,6 @@ size: self.size : - header_input: header_input header_box: header_box orientation: "vertical" BoxLayout: @@ -83,9 +82,3 @@ size_hint: None, 1 width: self.height on_release: root.selector.open(self) - TextInput: - id: header_input - background_normal: app.expand('{media}/misc/borders/border_hollow_light.png') - multiline: False - on_text_validate: root.onHeaderInput() - on_text: root.onHeaderInputComplete(*args) diff -r 415de998b91d -r d61bbbac4160 cagou/plugins/plugin_wid_chat.py --- a/cagou/plugins/plugin_wid_chat.py Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/plugins/plugin_wid_chat.py Tue Feb 04 20:47:17 2020 +0100 @@ -383,6 +383,7 @@ message_input = properties.ObjectProperty() messages_widget = properties.ObjectProperty() history_scroll = properties.ObjectProperty() + use_header_input = True global_screen_manager = True collection_carousel = True diff -r 415de998b91d -r d61bbbac4160 cagou/plugins/plugin_wid_contact_list.py --- a/cagou/plugins/plugin_wid_contact_list.py Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/plugins/plugin_wid_contact_list.py Tue Feb 04 20:47:17 2020 +0100 @@ -119,6 +119,7 @@ TouchMenuBehaviour): float_layout = properties.ObjectProperty() layout = properties.ObjectProperty() + use_header_input = True def __init__(self, host, target, profiles): QuickContactList.__init__(self, G.host, profiles) diff -r 415de998b91d -r d61bbbac4160 cagou/plugins/plugin_wid_file_sharing.py --- a/cagou/plugins/plugin_wid_file_sharing.py Tue Feb 04 20:47:17 2020 +0100 +++ b/cagou/plugins/plugin_wid_file_sharing.py Tue Feb 04 20:47:17 2020 +0100 @@ -156,6 +156,7 @@ remote_dir = properties.StringProperty('') remote_entity = properties.StringProperty('') shared_paths = properties.ListProperty() + use_header_input = True signals_registered = False def __init__(self, host, target, profiles):