feat: request (with bug)

This commit is contained in:
Fabian 2021-07-22 10:55:18 +02:00
parent 07252d62df
commit 6f77337832
3 changed files with 22 additions and 4 deletions

@ -1 +1 @@
Subproject commit ff8872599187b5b65dc679aed3ab6441fc717c40
Subproject commit b8bb7d221e0249756c9963f0ece1899e4d7b35a9

View File

@ -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,
)

View File

@ -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)