11"""Settings panel widgets."""
22from typing import Any , Dict
3+ import webbrowser
34
45from kivy .app import App
56from kivy .config import Config
4849]
4950"""
5051
52+ SETTINGS_PRIVACY = """[
53+ {
54+ "type": "title",
55+ "title": "PythonHere is intended for use as-is with no warranty of any kind."
56+ },
57+ {
58+ "type": "show_policy_button"
59+ }
60+ ]
61+ """
62+
5163
5264class PasswordLabel (Label ):
5365 """Label wit a hidden text."""
@@ -89,6 +101,14 @@ def on_release(self):
89101 app .root .switch_screen (ScreenName .here )
90102
91103
104+ class ShowPolicySettingButton (SettingButton ):
105+ """Button to show privacy policy."""
106+
107+ def on_release (self ):
108+ """Show the policy."""
109+ webbrowser .open ("https://herethere.me/privacy_policy.html" )
110+
111+
92112class SettingsHere (Settings ):
93113 """Customized settings panel."""
94114
@@ -99,12 +119,14 @@ def __init__(self, *args, **kargs):
99119 self .interface .menu .remove_widget (self .interface .menu .ids .button )
100120 self .register_type ("password" , SettingPassword )
101121 self .register_type ("start_server_button" , StartServerSettingButton )
122+ self .register_type ("show_policy_button" , ShowPolicySettingButton )
102123
103124 Config .setdefaults (
104125 "pythonhere" , {"username" : "here" , "password" : "" , "port" : 8022 }
105126 )
106127 self .add_json_panel ("PythonHere" , Config , data = SETTINGS_HERE )
107128 self .add_kivy_panel ()
129+ self .add_json_panel ("Privacy Policy" , Config , data = SETTINGS_PRIVACY )
108130
109131 def get_pythonhere_config (self ) -> Dict [str , Any ]:
110132 """Extract server parts of the config."""
0 commit comments