fix: avoid to remove inexistant user widget

This commit is contained in:
Swann 2020-10-06 16:10:10 +02:00
parent 1a8bcddb74
commit fc76b2a8e6
No known key found for this signature in database
GPG Key ID: E1D3641A7C43AACB
2 changed files with 12 additions and 8 deletions

View File

@ -305,11 +305,12 @@ class SessionUserSync(Timer):
ui_users = bpy.context.window_manager.online_users
for index, user in enumerate(ui_users):
if user.username not in session_users.keys():
if user.username not in session_users.keys() and \
user.username != self.settings.username:
renderer.remove_widget(f"{user.username}_cam")
renderer.remove_widget(f"{user.username}_select")
renderer.remove_widget(f"{user.username}_name")
ui_users.remove(index)
renderer.remove_widget(f"{user}_cam")
renderer.remove_widget(f"{user}_select")
renderer.remove_widget(f"{user}_name")
break
for user in session_users:
@ -318,9 +319,12 @@ class SessionUserSync(Timer):
new_key.name = user
new_key.username = user
if user != self.settings.username:
renderer.add_widget(f"{user}_cam", UserFrustumWidget(user))
renderer.add_widget(f"{user}_select", UserSelectionWidget(user))
renderer.add_widget(f"{user}_name", UserNameWidget(user))
renderer.add_widget(
f"{user}_cam", UserFrustumWidget(user))
renderer.add_widget(
f"{user}_select", UserSelectionWidget(user))
renderer.add_widget(
f"{user}_name", UserNameWidget(user))
class MainThreadExecutor(Timer):

View File

@ -417,7 +417,7 @@ class DrawFactory(object):
if name in self.widgets:
del self.widgets[name]
else:
logging.info("Widget {name} not existing")
logging.error(f"Widget {name} not existing")
def clear_widgets(self):
self.widgets.clear()