mirror of
				https://github.com/liberatedsystems/Sideband_CE.git
				synced 2024-09-03 04:13:27 +02:00 
			
		
		
		
	Improved dialogs and buttons
This commit is contained in:
		
							parent
							
								
									7b7903be8d
								
							
						
					
					
						commit
						cef44c2189
					
				@ -479,7 +479,7 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
    def announce_now_action(self, sender=None):
 | 
					    def announce_now_action(self, sender=None):
 | 
				
			||||||
        self.sideband.lxmf_announce()
 | 
					        self.sideband.lxmf_announce()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
 | 
					        yes_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        dialog = MDDialog(
 | 
					        dialog = MDDialog(
 | 
				
			||||||
            title="Announce Sent",
 | 
					            title="Announce Sent",
 | 
				
			||||||
@ -563,12 +563,12 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
        if self.root.ids.screen_manager.current == "messages_screen":
 | 
					        if self.root.ids.screen_manager.current == "messages_screen":
 | 
				
			||||||
            if self.outbound_mode_propagation and self.sideband.message_router.get_outbound_propagation_node() == None:
 | 
					            if self.outbound_mode_propagation and self.sideband.message_router.get_outbound_propagation_node() == None:
 | 
				
			||||||
                self.messages_view.send_error_dialog = MDDialog(
 | 
					                self.messages_view.send_error_dialog = MDDialog(
 | 
				
			||||||
                    text="Error: Propagated delivery was requested, but no active LXMF propagation nodes were found. Cannot send message. Wait for a Propagation Node to announce on the network, or manually specify one in the settings.",
 | 
					                    title="Error",
 | 
				
			||||||
 | 
					                    text="Propagated delivery was requested, but no active LXMF propagation nodes were found. Cannot send message.\n\nWait for a Propagation Node to announce on the network, or manually specify one in the settings.",
 | 
				
			||||||
                    buttons=[
 | 
					                    buttons=[
 | 
				
			||||||
                        MDFlatButton(
 | 
					                        MDRectangleFlatButton(
 | 
				
			||||||
                            text="OK",
 | 
					                            text="OK",
 | 
				
			||||||
                            theme_text_color="Custom",
 | 
					                            font_size=dp(18),
 | 
				
			||||||
                            text_color=self.theme_cls.primary_color,
 | 
					 | 
				
			||||||
                            on_release=self.messages_view.close_send_error_dialog
 | 
					                            on_release=self.messages_view.close_send_error_dialog
 | 
				
			||||||
                        )
 | 
					                        )
 | 
				
			||||||
                    ],
 | 
					                    ],
 | 
				
			||||||
@ -586,12 +586,12 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
                    self.jobs(0)
 | 
					                    self.jobs(0)
 | 
				
			||||||
                else:
 | 
					                else:
 | 
				
			||||||
                    self.messages_view.send_error_dialog = MDDialog(
 | 
					                    self.messages_view.send_error_dialog = MDDialog(
 | 
				
			||||||
                        text="Error: Could not send the message",
 | 
					                        title="Error",
 | 
				
			||||||
 | 
					                        text="Could not send the message",
 | 
				
			||||||
                        buttons=[
 | 
					                        buttons=[
 | 
				
			||||||
                            MDFlatButton(
 | 
					                            MDRectangleFlatButton(
 | 
				
			||||||
                                text="OK",
 | 
					                                text="OK",
 | 
				
			||||||
                                theme_text_color="Custom",
 | 
					                                font_size=dp(18),
 | 
				
			||||||
                                text_color=self.theme_cls.primary_color,
 | 
					 | 
				
			||||||
                                on_release=self.messages_view.close_send_error_dialog
 | 
					                                on_release=self.messages_view.close_send_error_dialog
 | 
				
			||||||
                            )
 | 
					                            )
 | 
				
			||||||
                        ],
 | 
					                        ],
 | 
				
			||||||
@ -723,8 +723,8 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
            self.sideband.setpersistent("lxmf.syncretrying", False)
 | 
					            self.sideband.setpersistent("lxmf.syncretrying", False)
 | 
				
			||||||
            self.sideband.request_lxmf_sync(limit=sl)
 | 
					            self.sideband.request_lxmf_sync(limit=sl)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            close_button = MDRectangleFlatButton(text="Close",font_size=sp(18))
 | 
					            close_button = MDRectangleFlatButton(text="Close",font_size=dp(18))
 | 
				
			||||||
            stop_button = MDRectangleFlatButton(text="Stop",font_size=sp(18), theme_text_color="Custom", line_color=self.color_reject, text_color=self.color_reject)
 | 
					            stop_button = MDRectangleFlatButton(text="Stop",font_size=dp(18), theme_text_color="Custom", line_color=self.color_reject, text_color=self.color_reject)
 | 
				
			||||||
            dialog_content = MsgSync()
 | 
					            dialog_content = MsgSync()
 | 
				
			||||||
            dialog = MDDialog(
 | 
					            dialog = MDDialog(
 | 
				
			||||||
                title="LXMF Sync via "+RNS.prettyhexrep(self.sideband.message_router.get_outbound_propagation_node()),
 | 
					                title="LXMF Sync via "+RNS.prettyhexrep(self.sideband.message_router.get_outbound_propagation_node()),
 | 
				
			||||||
@ -763,8 +763,8 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
                font_size=dp(20),
 | 
					                font_size=dp(20),
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            cancel_button = MDRectangleFlatButton(text="Cancel",font_size=sp(18))
 | 
					            cancel_button = MDRectangleFlatButton(text="Cancel",font_size=dp(18))
 | 
				
			||||||
            create_button = MDRectangleFlatButton(text="Create",font_size=sp(18), theme_text_color="Custom", line_color=self.color_accept, text_color=self.color_accept)
 | 
					            create_button = MDRectangleFlatButton(text="Create",font_size=dp(18), theme_text_color="Custom", line_color=self.color_accept, text_color=self.color_accept)
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
            dialog_content = NewConv()
 | 
					            dialog_content = NewConv()
 | 
				
			||||||
            dialog = MDDialog(
 | 
					            dialog = MDDialog(
 | 
				
			||||||
@ -1338,7 +1338,7 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
        try:
 | 
					        try:
 | 
				
			||||||
            mote = Clipboard.paste()
 | 
					            mote = Clipboard.paste()
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
 | 
					            yes_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
 | 
				
			||||||
            dialog = MDDialog(
 | 
					            dialog = MDDialog(
 | 
				
			||||||
                title="Import Failed",
 | 
					                title="Import Failed",
 | 
				
			||||||
                text="Could not read data from your clipboard, please check your system permissions.",
 | 
					                text="Could not read data from your clipboard, please check your system permissions.",
 | 
				
			||||||
@ -1385,7 +1385,7 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            if self.hardware_rnode_validate():
 | 
					            if self.hardware_rnode_validate():
 | 
				
			||||||
                self.hardware_rnode_save()
 | 
					                self.hardware_rnode_save()
 | 
				
			||||||
                yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
 | 
					                yes_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
 | 
				
			||||||
                dialog = MDDialog(
 | 
					                dialog = MDDialog(
 | 
				
			||||||
                    title="Configuration Imported",
 | 
					                    title="Configuration Imported",
 | 
				
			||||||
                    text="The config mote was imported and saved as your active configuration.",
 | 
					                    text="The config mote was imported and saved as your active configuration.",
 | 
				
			||||||
@ -1400,7 +1400,7 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
                raise ValueError("Invalid mote")
 | 
					                raise ValueError("Invalid mote")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        except Exception as e:
 | 
					        except Exception as e:
 | 
				
			||||||
            yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
 | 
					            yes_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
 | 
				
			||||||
            dialog = MDDialog(
 | 
					            dialog = MDDialog(
 | 
				
			||||||
                title="Import Failed",
 | 
					                title="Import Failed",
 | 
				
			||||||
                text="The read data did not contain a valid config mote. If any data was decoded, you may try to correct it by editing the relevant fields. The reported error was:\n\n"+str(e),
 | 
					                text="The read data did not contain a valid config mote. If any data was decoded, you may try to correct it by editing the relevant fields. The reported error was:\n\n"+str(e),
 | 
				
			||||||
@ -1431,7 +1431,7 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        if mote != None:
 | 
					        if mote != None:
 | 
				
			||||||
            Clipboard.copy(mote)
 | 
					            Clipboard.copy(mote)
 | 
				
			||||||
            yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
 | 
					            yes_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
 | 
				
			||||||
            dialog = MDDialog(
 | 
					            dialog = MDDialog(
 | 
				
			||||||
                title="Configuration Exported",
 | 
					                title="Configuration Exported",
 | 
				
			||||||
                text="The config mote was created and copied to your clipboard.",
 | 
					                text="The config mote was created and copied to your clipboard.",
 | 
				
			||||||
@ -1443,7 +1443,7 @@ class SidebandApp(MDApp):
 | 
				
			|||||||
            yes_button.bind(on_release=dl_yes)
 | 
					            yes_button.bind(on_release=dl_yes)
 | 
				
			||||||
            dialog.open()
 | 
					            dialog.open()
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
 | 
					            yes_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
 | 
				
			||||||
            dialog = MDDialog(
 | 
					            dialog = MDDialog(
 | 
				
			||||||
                title="Export Failed",
 | 
					                title="Export Failed",
 | 
				
			||||||
                text="The config mote could not be created, please check your settings.",
 | 
					                text="The config mote could not be created, please check your settings.",
 | 
				
			||||||
 | 
				
			|||||||
@ -85,7 +85,7 @@ class Announces():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                def gen_info(ts, dest, name, dtype):
 | 
					                def gen_info(ts, dest, name, dtype):
 | 
				
			||||||
                    def x(sender):
 | 
					                    def x(sender):
 | 
				
			||||||
                        yes_button = MDRectangleFlatButton(text="OK",font_size=sp(18))
 | 
					                        yes_button = MDRectangleFlatButton(text="OK",font_size=dp(18))
 | 
				
			||||||
                        
 | 
					                        
 | 
				
			||||||
                        if dtype == "lxmf.delivery":
 | 
					                        if dtype == "lxmf.delivery":
 | 
				
			||||||
                            ad_text = "[size=22dp]LXMF Peer[/size]\n\nReceived: "+ts+"\nAnnounced Name: "+name+"\nAddress: "+RNS.prettyhexrep(dest)
 | 
					                            ad_text = "[size=22dp]LXMF Peer[/size]\n\nReceived: "+ts+"\nAnnounced Name: "+name+"\nAddress: "+RNS.prettyhexrep(dest)
 | 
				
			||||||
@ -127,8 +127,8 @@ class Announces():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                def gen_del(dest, item):
 | 
					                def gen_del(dest, item):
 | 
				
			||||||
                    def x():
 | 
					                    def x():
 | 
				
			||||||
                        yes_button = MDRectangleFlatButton(text="Yes",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
 | 
					                        yes_button = MDRectangleFlatButton(text="Yes",font_size=dp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
 | 
				
			||||||
                        no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
 | 
					                        no_button = MDRectangleFlatButton(text="No",font_size=dp(18))
 | 
				
			||||||
                        dialog = MDDialog(
 | 
					                        dialog = MDDialog(
 | 
				
			||||||
                            title="Delete announce?",
 | 
					                            title="Delete announce?",
 | 
				
			||||||
                            buttons=[ yes_button, no_button ],
 | 
					                            buttons=[ yes_button, no_button ],
 | 
				
			||||||
 | 
				
			|||||||
@ -95,8 +95,8 @@ class Conversations():
 | 
				
			|||||||
                            disp_name = self.app.sideband.raw_display_name(dest)
 | 
					                            disp_name = self.app.sideband.raw_display_name(dest)
 | 
				
			||||||
                            is_trusted = self.app.sideband.is_trusted(dest)
 | 
					                            is_trusted = self.app.sideband.is_trusted(dest)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                            yes_button = MDRectangleFlatButton(text="Save",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_accept, text_color=self.app.color_accept)
 | 
					                            yes_button = MDRectangleFlatButton(text="Save",font_size=dp(18), theme_text_color="Custom", line_color=self.app.color_accept, text_color=self.app.color_accept)
 | 
				
			||||||
                            no_button = MDRectangleFlatButton(text="Cancel",font_size=sp(18))
 | 
					                            no_button = MDRectangleFlatButton(text="Cancel",font_size=dp(18))
 | 
				
			||||||
                            dialog_content = ConvSettings(disp_name=disp_name, context_dest=RNS.hexrep(dest, delimit=False), trusted=is_trusted)
 | 
					                            dialog_content = ConvSettings(disp_name=disp_name, context_dest=RNS.hexrep(dest, delimit=False), trusted=is_trusted)
 | 
				
			||||||
                            dialog = MDDialog(
 | 
					                            dialog = MDDialog(
 | 
				
			||||||
                                title="Edit Conversation",
 | 
					                                title="Edit Conversation",
 | 
				
			||||||
@ -145,8 +145,8 @@ class Conversations():
 | 
				
			|||||||
                def gen_clear(dest, item):
 | 
					                def gen_clear(dest, item):
 | 
				
			||||||
                    def x():
 | 
					                    def x():
 | 
				
			||||||
                        dest = self.conversation_dropdown.context_dest
 | 
					                        dest = self.conversation_dropdown.context_dest
 | 
				
			||||||
                        yes_button = MDRectangleFlatButton(text="Yes",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
 | 
					                        yes_button = MDRectangleFlatButton(text="Yes",font_size=dp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
 | 
				
			||||||
                        no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
 | 
					                        no_button = MDRectangleFlatButton(text="No",font_size=dp(18))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                        dialog = MDDialog(
 | 
					                        dialog = MDDialog(
 | 
				
			||||||
                            title="Clear all messages in conversation?",
 | 
					                            title="Clear all messages in conversation?",
 | 
				
			||||||
@ -167,8 +167,8 @@ class Conversations():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                def gen_del(dest, item):
 | 
					                def gen_del(dest, item):
 | 
				
			||||||
                    def x():
 | 
					                    def x():
 | 
				
			||||||
                        yes_button = MDRectangleFlatButton(text="Yes",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
 | 
					                        yes_button = MDRectangleFlatButton(text="Yes",font_size=dp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
 | 
				
			||||||
                        no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
 | 
					                        no_button = MDRectangleFlatButton(text="No",font_size=dp(18))
 | 
				
			||||||
                        dialog = MDDialog(
 | 
					                        dialog = MDDialog(
 | 
				
			||||||
                            title="Delete conversation?",
 | 
					                            title="Delete conversation?",
 | 
				
			||||||
                            buttons=[ yes_button, no_button ],
 | 
					                            buttons=[ yes_button, no_button ],
 | 
				
			||||||
 | 
				
			|||||||
@ -162,8 +162,8 @@ class Messages():
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                def gen_del(mhash, item):
 | 
					                def gen_del(mhash, item):
 | 
				
			||||||
                    def x():
 | 
					                    def x():
 | 
				
			||||||
                        yes_button = MDRectangleFlatButton(text="Yes",font_size=sp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
 | 
					                        yes_button = MDRectangleFlatButton(text="Yes",font_size=dp(18), theme_text_color="Custom", line_color=self.app.color_reject, text_color=self.app.color_reject)
 | 
				
			||||||
                        no_button = MDRectangleFlatButton(text="No",font_size=sp(18))
 | 
					                        no_button = MDRectangleFlatButton(text="No",font_size=dp(18))
 | 
				
			||||||
                        dialog = MDDialog(
 | 
					                        dialog = MDDialog(
 | 
				
			||||||
                            title="Delete message?",
 | 
					                            title="Delete message?",
 | 
				
			||||||
                            buttons=[ yes_button, no_button ],
 | 
					                            buttons=[ yes_button, no_button ],
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user