diff --git a/multi_user/operators.py b/multi_user/operators.py index 81fe2d7..ca936ce 100644 --- a/multi_user/operators.py +++ b/multi_user/operators.py @@ -1084,13 +1084,11 @@ class RefreshServerStatus(bpy.types.Operator): settings = utils.get_preferences() for server in settings.server_preset: - infos = porcelain.request_session_info(f"{server.ip}:{server.port}", timeout=1000) + infos = porcelain.request_session_info(f"{server.ip}:{server.port}", timeout=500) # TODO: timeout in a settings server.is_online = True if infos else False if server.is_online: server.is_private = infos.get("private") - logging.info(f"{server.server_name} status: {infos}") - return {'FINISHED'} class GetDoc(bpy.types.Operator): @@ -1123,8 +1121,7 @@ class FirstLaunch(bpy.types.Operator): assert(context) settings = utils.get_preferences() settings.is_first_launch = False - for i in range(len(settings.server_preset)): # TODO: Try to empty the server list preset in a cleaner way - settings.server_preset.remove(i) + settings.server_preset.clear() prefs = bpy.context.preferences.addons[__package__].preferences prefs.generate_default_presets() return {'FINISHED'} diff --git a/multi_user/preferences.py b/multi_user/preferences.py index 7023205..c818860 100644 --- a/multi_user/preferences.py +++ b/multi_user/preferences.py @@ -113,7 +113,7 @@ class ReplicatedDatablock(bpy.types.PropertyGroup): class ServerPreset(bpy.types.PropertyGroup): server_name: bpy.props.StringProperty(default="") - ip: bpy.props.StringProperty(default="127.0.0.1") + ip: bpy.props.StringProperty(default="127.0.0.1", update=update_ip) port: bpy.props.IntProperty(default=5555) use_server_password: bpy.props.BoolProperty(default=False) server_password: bpy.props.StringProperty(default="", subtype = "PASSWORD") @@ -191,12 +191,12 @@ class SessionPrefs(bpy.types.AddonPreferences): name="server_index", description="index of the server", ) + # User host session settings host_port: bpy.props.IntProperty( name="host_port", description='Distant host port', default=5555 ) - # User host session settings host_use_server_password: bpy.props.BoolProperty( name="use_server_password", description='Use session password', @@ -210,16 +210,17 @@ class SessionPrefs(bpy.types.AddonPreferences): host_use_admin_password: bpy.props.BoolProperty( name="use_admin_password", description='Use admin password', - default=False + default=True ) host_admin_password: bpy.props.StringProperty( name="admin_password", description='Admin password', - subtype='PASSWORD' + subtype='PASSWORD', + default='admin' ) # Other is_first_launch: bpy.props.BoolProperty( - name="is_first_launch", + name="is_fnirst_launch", description="First time lauching the addon", default=True )