feat: show exit reason in the disconnection popup

This commit is contained in:
Swann 2020-11-26 11:37:51 +01:00
parent 4a4cd5db50
commit 7e25ca4c84
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
3 changed files with 9 additions and 9 deletions

View File

@ -44,7 +44,7 @@ from . import environment
DEPENDENCIES = {
("replication", '0.1.13'),
("replication", '0.1.15'),
}

View File

@ -358,6 +358,6 @@ class MainThreadExecutor(Timer):
def execute(self):
while not self.execution_queue.empty():
function = self.execution_queue.get()
function, kwargs = self.execution_queue.get()
logging.debug(f"Executing {function.__name__}")
function()
function(**kwargs)

View File

@ -53,8 +53,8 @@ def session_callback(name):
"""
def func_wrapper(func):
@session.register(name)
def add_background_task():
background_execution_queue.put(func)
def add_background_task(**kwargs):
background_execution_queue.put((func, kwargs))
return add_background_task
return func_wrapper
@ -89,7 +89,7 @@ def initialize_session():
@session_callback('on_exit')
def on_connection_end():
def on_connection_end(reason="none"):
"""Session connection finished handler
"""
global delayables, stop_modal_executor
@ -113,8 +113,8 @@ def on_connection_end():
for handler in logger.handlers:
if isinstance(handler, logging.FileHandler):
logger.removeHandler(handler)
bpy.ops.session.notify('INVOKE_DEFAULT', message="Disconnected from server")
if reason != "user":
bpy.ops.session.notify('INVOKE_DEFAULT', message=f"Disconnected from session. Reason: {reason}. ")
# OPERATORS
@ -704,7 +704,7 @@ class SessionNotifyOperator(bpy.types.Operator):
def invoke(self, context, event):
return context.window_manager.invoke_popup(self, width=200)
return context.window_manager.invoke_popup(self, width=300)
classes = (