feat: initial notification popup

This commit is contained in:
Swann 2020-11-25 22:53:38 +01:00
parent 7f19d45b71
commit 4a4cd5db50
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB

View File

@ -114,6 +114,8 @@ def on_connection_end():
if isinstance(handler, logging.FileHandler):
logger.removeHandler(handler)
bpy.ops.session.notify('INVOKE_DEFAULT', message="Disconnected from server")
# OPERATORS
class SessionStartOperator(bpy.types.Operator):
@ -651,7 +653,7 @@ class ApplyArmatureOperator(bpy.types.Operator):
stop_modal_executor = False
class ClearCache(bpy.types.Operator):
class SessionClearCache(bpy.types.Operator):
"Clear local session cache"
bl_idname = "session.clear_cache"
bl_label = "Modal Executor Operator"
@ -679,6 +681,31 @@ class ClearCache(bpy.types.Operator):
row = self.layout
row.label(text=f" Do you really want to remove local cache ? ")
class SessionNotifyOperator(bpy.types.Operator):
"""Dialog only operator"""
bl_idname = "session.notify"
bl_label = "Notification"
message: bpy.props.StringProperty()
@classmethod
def poll(cls, context):
return True
def execute(self, context):
return {'FINISHED'}
def draw(self, context):
layout = self.layout
title = layout.row()
title = title.label(text="Multi-user", icon='INFO')
message = layout.row()
message.label(text=self.message)
def invoke(self, context, event):
return context.window_manager.invoke_popup(self, width=200)
classes = (
SessionStartOperator,
@ -692,7 +719,8 @@ classes = (
ApplyArmatureOperator,
SessionKickOperator,
SessionInitOperator,
ClearCache,
SessionClearCache,
SessionNotifyOperator,
)