feat: show exit reason in the disconnection popup
This commit is contained in:
@ -44,7 +44,7 @@ from . import environment
|
|||||||
|
|
||||||
|
|
||||||
DEPENDENCIES = {
|
DEPENDENCIES = {
|
||||||
("replication", '0.1.13'),
|
("replication", '0.1.15'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -358,6 +358,6 @@ class MainThreadExecutor(Timer):
|
|||||||
|
|
||||||
def execute(self):
|
def execute(self):
|
||||||
while not self.execution_queue.empty():
|
while not self.execution_queue.empty():
|
||||||
function = self.execution_queue.get()
|
function, kwargs = self.execution_queue.get()
|
||||||
logging.debug(f"Executing {function.__name__}")
|
logging.debug(f"Executing {function.__name__}")
|
||||||
function()
|
function(**kwargs)
|
||||||
|
@ -53,8 +53,8 @@ def session_callback(name):
|
|||||||
"""
|
"""
|
||||||
def func_wrapper(func):
|
def func_wrapper(func):
|
||||||
@session.register(name)
|
@session.register(name)
|
||||||
def add_background_task():
|
def add_background_task(**kwargs):
|
||||||
background_execution_queue.put(func)
|
background_execution_queue.put((func, kwargs))
|
||||||
return add_background_task
|
return add_background_task
|
||||||
return func_wrapper
|
return func_wrapper
|
||||||
|
|
||||||
@ -89,7 +89,7 @@ def initialize_session():
|
|||||||
|
|
||||||
|
|
||||||
@session_callback('on_exit')
|
@session_callback('on_exit')
|
||||||
def on_connection_end():
|
def on_connection_end(reason="none"):
|
||||||
"""Session connection finished handler
|
"""Session connection finished handler
|
||||||
"""
|
"""
|
||||||
global delayables, stop_modal_executor
|
global delayables, stop_modal_executor
|
||||||
@ -113,8 +113,8 @@ def on_connection_end():
|
|||||||
for handler in logger.handlers:
|
for handler in logger.handlers:
|
||||||
if isinstance(handler, logging.FileHandler):
|
if isinstance(handler, logging.FileHandler):
|
||||||
logger.removeHandler(handler)
|
logger.removeHandler(handler)
|
||||||
|
if reason != "user":
|
||||||
bpy.ops.session.notify('INVOKE_DEFAULT', message="Disconnected from server")
|
bpy.ops.session.notify('INVOKE_DEFAULT', message=f"Disconnected from session. Reason: {reason}. ")
|
||||||
|
|
||||||
|
|
||||||
# OPERATORS
|
# OPERATORS
|
||||||
@ -704,7 +704,7 @@ class SessionNotifyOperator(bpy.types.Operator):
|
|||||||
|
|
||||||
|
|
||||||
def invoke(self, context, event):
|
def invoke(self, context, event):
|
||||||
return context.window_manager.invoke_popup(self, width=200)
|
return context.window_manager.invoke_popup(self, width=300)
|
||||||
|
|
||||||
|
|
||||||
classes = (
|
classes = (
|
||||||
|
Reference in New Issue
Block a user