From 6f773378328f54d8140c0dcbd22dfb982c3d9e9c Mon Sep 17 00:00:00 2001 From: Fabian Date: Thu, 22 Jul 2021 10:55:18 +0200 Subject: [PATCH] feat: request (with bug) --- multi_user/libs/replication | 2 +- multi_user/operators.py | 18 +++++++++++++++++- multi_user/ui.py | 6 ++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/multi_user/libs/replication b/multi_user/libs/replication index ff88725..b8bb7d2 160000 --- a/multi_user/libs/replication +++ b/multi_user/libs/replication @@ -1 +1 @@ -Subproject commit ff8872599187b5b65dc679aed3ab6441fc717c40 +Subproject commit b8bb7d221e0249756c9963f0ece1899e4d7b35a9 diff --git a/multi_user/operators.py b/multi_user/operators.py index a089e0a..d7c1771 100644 --- a/multi_user/operators.py +++ b/multi_user/operators.py @@ -877,7 +877,6 @@ class SessionStopAutoSaveOperator(bpy.types.Operator): return {'FINISHED'} - class SessionLoadSaveOperator(bpy.types.Operator, ImportHelper): bl_idname = "session.load" bl_label = "Load session save" @@ -1091,6 +1090,22 @@ class SessionPresetServerRemove(bpy.types.Operator): return {'FINISHED'} +class SessionGetInfo(bpy.types.Operator): + bl_idname = "session.get_info" + bl_label = "Get session info" + bl_description = "Get session info" + + target_server: bpy.props.StringProperty(default="127.0.0.1:5555") + + @classmethod + def poll(cls, context): + return (session.state != STATE_ACTIVE) + + def execute(self, context): + infos = porcelain.request_session_info(self.target_server, timeout=100) + logging.info(f"Session info: {infos}") + + return {'FINISHED'} class GetDoc(bpy.types.Operator): """Get the documentation of the addon""" @@ -1152,6 +1167,7 @@ classes = ( SessionPresetServerAdd, SessionPresetServerEdit, SessionPresetServerRemove, + SessionGetInfo, GetDoc, FirstLaunch, ) diff --git a/multi_user/ui.py b/multi_user/ui.py index 355e440..e3844ee 100644 --- a/multi_user/ui.py +++ b/multi_user/ui.py @@ -143,7 +143,7 @@ class SESSION_PT_settings(bpy.types.Panel): split.label(text="Online") col = row.column(align=True) - col.operator("session.preset_server_add", icon="FILE_REFRESH", text="") # TODO : Replace add by refresh operator + col.operator("session.get_info", icon="FILE_REFRESH", text="") # TODO : Replace add by refresh operator row = layout.row() col = row.column(align=True) @@ -156,7 +156,7 @@ class SESSION_PT_settings(bpy.types.Panel): connectopcol.operator("session.connect", text="Connect") col = row.column(align=True) - col.operator("session.preset_server_add", icon="ADD", text="") # TODO : Replace add by refresh operator + col.operator("session.preset_server_add", icon="ADD", text="") row_visible = col.row(align=True) col_visible = row_visible.column(align=True) col_visible.enabled = is_server_selected @@ -669,6 +669,8 @@ class SESSION_UL_network(bpy.types.UIList): # Session status # TODO : if session online : vert else rouge # TODO : ping + + from multi_user import icons server_status = icons.icons_col["server_offline"] split.label(icon_value=server_status.icon_id)