mirror of
				https://github.com/liberatedsystems/Sideband_CE.git
				synced 2024-09-03 04:13:27 +02:00 
			
		
		
		
	Added auto sync interval to settings. Improved settings layout.
This commit is contained in:
		
							parent
							
								
									6c19fc85b9
								
							
						
					
					
						commit
						d5231da5bb
					
				| @ -508,7 +508,7 @@ class SidebandApp(MDApp): | |||||||
|     def message_send_action(self, sender=None): |     def message_send_action(self, sender=None): | ||||||
|         if self.root.ids.message_text.text == "": |         if self.root.ids.message_text.text == "": | ||||||
|             return |             return | ||||||
|              | 
 | ||||||
|         def cb(dt): |         def cb(dt): | ||||||
|             self.message_send_dispatch(sender) |             self.message_send_dispatch(sender) | ||||||
|         Clock.schedule_once(cb, 0.20) |         Clock.schedule_once(cb, 0.20) | ||||||
| @ -837,6 +837,25 @@ class SidebandApp(MDApp): | |||||||
|                 self.sideband.config["lxmf_sync_limit"] = self.root.ids.settings_lxmf_sync_limit.active |                 self.sideband.config["lxmf_sync_limit"] = self.root.ids.settings_lxmf_sync_limit.active | ||||||
|                 self.sideband.save_configuration() |                 self.sideband.save_configuration() | ||||||
| 
 | 
 | ||||||
|  |             def save_lxmf_periodic_sync(sender=None, event=None, save=True): | ||||||
|  |                 if self.root.ids.settings_lxmf_periodic_sync.active: | ||||||
|  |                     self.widget_hide(self.root.ids.lxmf_syncslider_container, False) | ||||||
|  |                 else: | ||||||
|  |                     self.widget_hide(self.root.ids.lxmf_syncslider_container, True) | ||||||
|  | 
 | ||||||
|  |                 if save: | ||||||
|  |                     self.sideband.config["lxmf_periodic_sync"] = self.root.ids.settings_lxmf_periodic_sync.active | ||||||
|  |                     self.sideband.save_configuration() | ||||||
|  | 
 | ||||||
|  |             def sync_interval_change(sender=None, event=None, save=True): | ||||||
|  |                 interval = (self.root.ids.settings_lxmf_sync_interval.value//300)*300 | ||||||
|  |                 interval_text = RNS.prettytime(interval) | ||||||
|  |                 pre = self.root.ids.settings_lxmf_sync_periodic.text | ||||||
|  |                 self.root.ids.settings_lxmf_sync_periodic.text = "Auto sync every "+interval_text | ||||||
|  |                 if pre != self.root.ids.settings_lxmf_sync_periodic.text: | ||||||
|  |                     if save: | ||||||
|  |                         self.sideband.save_configuration() | ||||||
|  | 
 | ||||||
|             self.root.ids.settings_lxmf_address.text = RNS.hexrep(self.sideband.lxmf_destination.hash, delimit=False) |             self.root.ids.settings_lxmf_address.text = RNS.hexrep(self.sideband.lxmf_destination.hash, delimit=False) | ||||||
| 
 | 
 | ||||||
|             self.root.ids.settings_display_name.text = self.sideband.config["display_name"] |             self.root.ids.settings_display_name.text = self.sideband.config["display_name"] | ||||||
| @ -861,6 +880,15 @@ class SidebandApp(MDApp): | |||||||
|             self.root.ids.settings_lxmf_delivery_by_default.active = self.sideband.config["propagation_by_default"] |             self.root.ids.settings_lxmf_delivery_by_default.active = self.sideband.config["propagation_by_default"] | ||||||
|             self.root.ids.settings_lxmf_delivery_by_default.bind(active=save_lxmf_delivery_by_default) |             self.root.ids.settings_lxmf_delivery_by_default.bind(active=save_lxmf_delivery_by_default) | ||||||
| 
 | 
 | ||||||
|  |             self.root.ids.settings_lxmf_periodic_sync.active = self.sideband.config["lxmf_periodic_sync"] | ||||||
|  |             self.root.ids.settings_lxmf_periodic_sync.bind(active=save_lxmf_periodic_sync) | ||||||
|  |             save_lxmf_periodic_sync(save=False) | ||||||
|  | 
 | ||||||
|  |             self.root.ids.settings_lxmf_sync_interval.bind(value=sync_interval_change) | ||||||
|  |             self.root.ids.settings_lxmf_sync_interval.value = self.sideband.config["lxmf_sync_interval"] | ||||||
|  |             sync_interval_change(save=False) | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|             if self.sideband.config["lxmf_sync_limit"] == None or self.sideband.config["lxmf_sync_limit"] == False: |             if self.sideband.config["lxmf_sync_limit"] == None or self.sideband.config["lxmf_sync_limit"] == False: | ||||||
|                 sync_limit = False |                 sync_limit = False | ||||||
|             else: |             else: | ||||||
|  | |||||||
| @ -169,6 +169,8 @@ class SidebandCore(): | |||||||
|         self.config["lxmf_propagation_node"] = None |         self.config["lxmf_propagation_node"] = None | ||||||
|         self.config["lxmf_sync_limit"] = None |         self.config["lxmf_sync_limit"] = None | ||||||
|         self.config["lxmf_sync_max"] = 3 |         self.config["lxmf_sync_max"] = 3 | ||||||
|  |         self.config["lxmf_periodic_sync"] = False | ||||||
|  |         self.config["lxmf_sync_interval"] = 43200 | ||||||
|         self.config["last_lxmf_propagation_node"] = None |         self.config["last_lxmf_propagation_node"] = None | ||||||
|         self.config["nn_home_node"] = None |         self.config["nn_home_node"] = None | ||||||
|         # Connectivity |         # Connectivity | ||||||
| @ -212,6 +214,10 @@ class SidebandCore(): | |||||||
|         # Migration actions from earlier config formats |         # Migration actions from earlier config formats | ||||||
|         if not "dark_ui" in self.config: |         if not "dark_ui" in self.config: | ||||||
|             self.config["dark_ui"] = True |             self.config["dark_ui"] = True | ||||||
|  |         if not "lxmf_periodic_sync" in self.config: | ||||||
|  |             self.config["lxmf_periodic_sync"] = False | ||||||
|  |         if not "lxmf_sync_interval" in self.config: | ||||||
|  |             self.config["lxmf_sync_interval"] = 43200 | ||||||
| 
 | 
 | ||||||
|         # Make sure we have a database |         # Make sure we have a database | ||||||
|         if not os.path.isfile(self.db_path): |         if not os.path.isfile(self.db_path): | ||||||
|  | |||||||
| @ -779,144 +779,191 @@ MDNavigationLayout: | |||||||
| 
 | 
 | ||||||
|                     MDBoxLayout: |                     MDBoxLayout: | ||||||
|                         orientation: "vertical" |                         orientation: "vertical" | ||||||
|                         spacing: "24dp" |                         spacing: 0 | ||||||
|                         size_hint_y: None |                         size_hint_y: None | ||||||
|                         height: self.minimum_height |                         height: self.minimum_height | ||||||
|                         padding: [dp(28), dp(16), dp(28), dp(16)] |                         padding: [0, 0, 0, 0] | ||||||
|                          |  | ||||||
| 
 |  | ||||||
|                         MDLabel: |  | ||||||
|                             text: "" |  | ||||||
|                             font_style: "H6" |  | ||||||
| 
 |  | ||||||
|                         MDLabel: |  | ||||||
|                             text: "User Options" |  | ||||||
|                             font_style: "H6" |  | ||||||
| 
 |  | ||||||
|                         MDTextField: |  | ||||||
|                             id: settings_display_name |  | ||||||
|                             hint_text: "Display Name" |  | ||||||
|                             text: "" |  | ||||||
|                             max_text_length: 128 |  | ||||||
|                             font_size: dp(24) |  | ||||||
| 
 |  | ||||||
|                         MDTextField: |  | ||||||
|                             id: settings_lxmf_address |  | ||||||
|                             hint_text: "Your LXMF Address" |  | ||||||
|                             text: "" |  | ||||||
|                             disabled: False |  | ||||||
|                             max_text_length: 32 |  | ||||||
|                             font_size: dp(24) |  | ||||||
| 
 |  | ||||||
|                         MDTextField: |  | ||||||
|                             id: settings_propagation_node_address |  | ||||||
|                             hint_text: "LXMF Propagation Node" |  | ||||||
|                             disabled: False |  | ||||||
|                             text: "" |  | ||||||
|                             max_text_length: 32 |  | ||||||
|                             font_size: dp(24) |  | ||||||
| 
 |  | ||||||
|                         MDTextField: |  | ||||||
|                             id: settings_home_node_address |  | ||||||
|                             hint_text: "Nomad Network Home Node" |  | ||||||
|                             disabled: False |  | ||||||
|                             text: "" |  | ||||||
|                             max_text_length: 32 |  | ||||||
|                             font_size: dp(24) |  | ||||||
| 
 | 
 | ||||||
|                         MDBoxLayout: |                         MDBoxLayout: | ||||||
|                             orientation: "horizontal" |                             orientation: "vertical" | ||||||
|  |                             spacing: "16dp" | ||||||
|                             size_hint_y: None |                             size_hint_y: None | ||||||
|                             padding: [0,0,dp(24),0] |                             height: self.minimum_height | ||||||
|                             height: dp(48) |                             padding: [dp(28), dp(16), dp(28), dp(16)] | ||||||
|                              |                              | ||||||
|  | 
 | ||||||
|                             MDLabel: |                             MDLabel: | ||||||
|                                 text: "Dark Mode UI" |                                 text: "" | ||||||
|                                 font_style: "H6" |                                 font_style: "H6" | ||||||
| 
 | 
 | ||||||
|                             MDSwitch: |  | ||||||
|                                 id: settings_dark_ui |  | ||||||
|                                 pos_hint: {"center_y": 0.3} |  | ||||||
|                                 active: False |  | ||||||
| 
 |  | ||||||
|                         MDBoxLayout: |  | ||||||
|                             orientation: "horizontal" |  | ||||||
|                             size_hint_y: None |  | ||||||
|                             padding: [0,0,dp(24),0] |  | ||||||
|                             height: dp(48) |  | ||||||
|                              |  | ||||||
|                             MDLabel: |                             MDLabel: | ||||||
|                                 text: "Announce At App Startup" |                                 text: "User Options" | ||||||
|                                 font_style: "H6" |                                 font_style: "H6" | ||||||
| 
 | 
 | ||||||
|                             MDSwitch: |                             MDTextField: | ||||||
|                                 id: settings_start_announce |                                 id: settings_display_name | ||||||
|                                 pos_hint: {"center_y": 0.3} |                                 hint_text: "Display Name" | ||||||
|                                 active: False |                                 text: "" | ||||||
|  |                                 max_text_length: 128 | ||||||
|  |                                 font_size: dp(24) | ||||||
| 
 | 
 | ||||||
|                         MDBoxLayout: |                             MDTextField: | ||||||
|                             orientation: "horizontal" |                                 id: settings_lxmf_address | ||||||
|                             size_hint_y: None |                                 hint_text: "Your LXMF Address" | ||||||
|                             padding: [0,0,dp(24),0] |                                 text: "" | ||||||
|                             height: dp(48) |  | ||||||
|                              |  | ||||||
|                             MDLabel: |  | ||||||
|                                 text: "Send via Propagation Node by default" |  | ||||||
|                                 font_style: "H6" |  | ||||||
| 
 |  | ||||||
|                             MDSwitch: |  | ||||||
|                                 id: settings_lxmf_delivery_by_default |  | ||||||
|                                 pos_hint: {"center_y": 0.3} |  | ||||||
|                                 disabled: False |                                 disabled: False | ||||||
|                                 active: False |                                 max_text_length: 32 | ||||||
|  |                                 font_size: dp(24) | ||||||
| 
 | 
 | ||||||
|                         MDBoxLayout: |                             MDTextField: | ||||||
|                             orientation: "horizontal" |                                 id: settings_propagation_node_address | ||||||
|                             size_hint_y: None |                                 hint_text: "LXMF Propagation Node" | ||||||
|                             padding: [0,0,dp(24),0] |  | ||||||
|                             height: dp(48) |  | ||||||
|                              |  | ||||||
|                             MDLabel: |  | ||||||
|                                 text: "Limit each sync to 3 messages" |  | ||||||
|                                 font_style: "H6" |  | ||||||
| 
 |  | ||||||
|                             MDSwitch: |  | ||||||
|                                 id: settings_lxmf_sync_limit |  | ||||||
|                                 pos_hint: {"center_y": 0.3} |  | ||||||
|                                 disabled: False |                                 disabled: False | ||||||
|                                 active: False |                                 text: "" | ||||||
|  |                                 max_text_length: 32 | ||||||
|  |                                 font_size: dp(24) | ||||||
|  | 
 | ||||||
|  |                             MDTextField: | ||||||
|  |                                 id: settings_home_node_address | ||||||
|  |                                 hint_text: "Nomad Network Home Node" | ||||||
|  |                                 disabled: False | ||||||
|  |                                 text: "" | ||||||
|  |                                 max_text_length: 32 | ||||||
|  |                                 font_size: dp(24) | ||||||
|  | 
 | ||||||
| 
 | 
 | ||||||
|                         MDBoxLayout: |                         MDBoxLayout: | ||||||
|                             orientation: "horizontal" |                             orientation: "vertical" | ||||||
|  |                             # spacing: "24dp" | ||||||
|                             size_hint_y: None |                             size_hint_y: None | ||||||
|                             padding: [0,0,dp(24),0] |                             height: self.minimum_height | ||||||
|                             height: dp(48) |                             padding: [dp(28), dp(16), dp(28), dp(16)] | ||||||
|                              |  | ||||||
|                             MDLabel: |  | ||||||
|                                 text: "Use Home Node as Broadcast Repeater" |  | ||||||
|                                 font_style: "H6" |  | ||||||
| 
 | 
 | ||||||
|                             MDSwitch: |                             MDBoxLayout: | ||||||
|                                 id: settings_home_node_as_broadcast_repeater |                                 orientation: "horizontal" | ||||||
|                                 pos_hint: {"center_y": 0.3} |                                 size_hint_y: None | ||||||
|                                 active: False |                                 padding: [0,0,dp(24),dp(0)] | ||||||
|                                 disabled: True |                                 height: dp(48) | ||||||
|  |                                  | ||||||
|  |                                 MDLabel: | ||||||
|  |                                     text: "Dark Mode UI" | ||||||
|  |                                     font_style: "H6" | ||||||
| 
 | 
 | ||||||
|                         MDBoxLayout: |                                 MDSwitch: | ||||||
|                             orientation: "horizontal" |                                     id: settings_dark_ui | ||||||
|                             size_hint_y: None |                                     pos_hint: {"center_y": 0.3} | ||||||
|                             padding: [0,0,dp(24),0] |                                     active: False | ||||||
|                             height: dp(48) |  | ||||||
|                              |  | ||||||
|                             MDLabel: |  | ||||||
|                                 text: "Send Telemetry to Home Node" |  | ||||||
|                                 font_style: "H6" |  | ||||||
| 
 | 
 | ||||||
|                             MDSwitch: |                             MDBoxLayout: | ||||||
|                                 id: settings_telemetry_to_home_node |                                 orientation: "horizontal" | ||||||
|                                 pos_hint: {"center_y": 0.3} |                                 size_hint_y: None | ||||||
|                                 disabled: True |                                 padding: [0,0,dp(24),dp(0)] | ||||||
|                                 active: False |                                 height: dp(48) | ||||||
|  |                                  | ||||||
|  |                                 MDLabel: | ||||||
|  |                                     text: "Announce At App Startup" | ||||||
|  |                                     font_style: "H6" | ||||||
|  | 
 | ||||||
|  |                                 MDSwitch: | ||||||
|  |                                     id: settings_start_announce | ||||||
|  |                                     pos_hint: {"center_y": 0.3} | ||||||
|  |                                     active: False | ||||||
|  | 
 | ||||||
|  |                             MDBoxLayout: | ||||||
|  |                                 orientation: "horizontal" | ||||||
|  |                                 size_hint_y: None | ||||||
|  |                                 padding: [0,0,dp(24),dp(0)] | ||||||
|  |                                 height: dp(48) | ||||||
|  |                                  | ||||||
|  |                                 MDLabel: | ||||||
|  |                                     text: "Send via Propagation Node by default" | ||||||
|  |                                     font_style: "H6" | ||||||
|  | 
 | ||||||
|  |                                 MDSwitch: | ||||||
|  |                                     id: settings_lxmf_delivery_by_default | ||||||
|  |                                     pos_hint: {"center_y": 0.3} | ||||||
|  |                                     disabled: False | ||||||
|  |                                     active: False | ||||||
|  | 
 | ||||||
|  |                             MDBoxLayout: | ||||||
|  |                                 orientation: "horizontal" | ||||||
|  |                                 size_hint_y: None | ||||||
|  |                                 padding: [0,0,dp(24),dp(0)] | ||||||
|  |                                 height: dp(48) | ||||||
|  |                                  | ||||||
|  |                                 MDLabel: | ||||||
|  |                                     text: "Limit each sync to 3 messages" | ||||||
|  |                                     font_style: "H6" | ||||||
|  | 
 | ||||||
|  |                                 MDSwitch: | ||||||
|  |                                     id: settings_lxmf_sync_limit | ||||||
|  |                                     pos_hint: {"center_y": 0.3} | ||||||
|  |                                     disabled: False | ||||||
|  |                                     active: False | ||||||
|  | 
 | ||||||
|  |                             MDBoxLayout: | ||||||
|  |                                 orientation: "horizontal" | ||||||
|  |                                 size_hint_y: None | ||||||
|  |                                 padding: [0,0,dp(24),dp(0)] | ||||||
|  |                                 height: dp(48) | ||||||
|  |                                  | ||||||
|  |                                 MDLabel: | ||||||
|  |                                     id: settings_lxmf_sync_periodic | ||||||
|  |                                     text: "Sync with Propagation Node periodically" | ||||||
|  |                                     font_style: "H6" | ||||||
|  | 
 | ||||||
|  |                                 MDSwitch: | ||||||
|  |                                     id: settings_lxmf_periodic_sync | ||||||
|  |                                     pos_hint: {"center_y": 0.3} | ||||||
|  |                                     disabled: False | ||||||
|  |                                     active: False | ||||||
|  | 
 | ||||||
|  |                             MDBoxLayout: | ||||||
|  |                                 id: lxmf_syncslider_container | ||||||
|  |                                 orientation: "vertical" | ||||||
|  |                                 size_hint_y: None | ||||||
|  |                                 padding: [0,0,dp(0),0] | ||||||
|  |                                 height: dp(68) | ||||||
|  | 
 | ||||||
|  |                                 MDSlider | ||||||
|  |                                     min: 300 | ||||||
|  |                                     max: 172800 | ||||||
|  |                                     value: 43200 | ||||||
|  |                                     id: settings_lxmf_sync_interval | ||||||
|  |                                     sensitivity: "all" | ||||||
|  |                                     hint: False | ||||||
|  | 
 | ||||||
|  |                             MDBoxLayout: | ||||||
|  |                                 orientation: "horizontal" | ||||||
|  |                                 size_hint_y: None | ||||||
|  |                                 padding: [0,0,dp(24),dp(0)] | ||||||
|  |                                 height: dp(48) | ||||||
|  |                                  | ||||||
|  |                                 MDLabel: | ||||||
|  |                                     text: "Use Home Node as Broadcast Repeater" | ||||||
|  |                                     font_style: "H6" | ||||||
|  | 
 | ||||||
|  |                                 MDSwitch: | ||||||
|  |                                     id: settings_home_node_as_broadcast_repeater | ||||||
|  |                                     pos_hint: {"center_y": 0.3} | ||||||
|  |                                     active: False | ||||||
|  |                                     disabled: True | ||||||
|  | 
 | ||||||
|  |                             MDBoxLayout: | ||||||
|  |                                 orientation: "horizontal" | ||||||
|  |                                 size_hint_y: None | ||||||
|  |                                 padding: [0,0,dp(24),dp(0)] | ||||||
|  |                                 height: dp(48) | ||||||
|  |                                  | ||||||
|  |                                 MDLabel: | ||||||
|  |                                     text: "Send Telemetry to Home Node" | ||||||
|  |                                     font_style: "H6" | ||||||
|  | 
 | ||||||
|  |                                 MDSwitch: | ||||||
|  |                                     id: settings_telemetry_to_home_node | ||||||
|  |                                     pos_hint: {"center_y": 0.3} | ||||||
|  |                                     disabled: True | ||||||
|  |                                     active: False | ||||||
|          |          | ||||||
| 
 | 
 | ||||||
|     MDNavigationDrawer: |     MDNavigationDrawer: | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user