refactor: lobby ui
This commit is contained in:
@ -45,7 +45,7 @@ from . import environment, utils
|
|||||||
|
|
||||||
# TODO: remove dependency as soon as replication will be installed as a module
|
# TODO: remove dependency as soon as replication will be installed as a module
|
||||||
DEPENDENCIES = {
|
DEPENDENCIES = {
|
||||||
("replication", '0.0.18'),
|
("replication", '0.0.19'),
|
||||||
("deepdiff", '5.0.1'),
|
("deepdiff", '5.0.1'),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
import copy
|
import copy
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
import traceback
|
||||||
|
|
||||||
import bgl
|
import bgl
|
||||||
import blf
|
import blf
|
||||||
@ -311,7 +312,7 @@ class DrawFactory(object):
|
|||||||
self.d2d_items[client_id] = (position[1], client_id, color)
|
self.d2d_items[client_id] = (position[1], client_id, color)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logging.error(f"Draw client exception: {e}")
|
logging.error(f"Draw client exception: {e} \n {traceback.format_exc()}")
|
||||||
|
|
||||||
def draw3d_callback(self):
|
def draw3d_callback(self):
|
||||||
bgl.glLineWidth(1.5)
|
bgl.glLineWidth(1.5)
|
||||||
|
@ -128,14 +128,18 @@ class SESSION_PT_settings(bpy.types.Panel):
|
|||||||
current_state = cli_state['STATE']
|
current_state = cli_state['STATE']
|
||||||
|
|
||||||
# STATE ACTIVE
|
# STATE ACTIVE
|
||||||
if current_state in [STATE_ACTIVE, STATE_LOBBY]:
|
if current_state in [STATE_ACTIVE]:
|
||||||
row.operator("session.stop", icon='QUIT', text="Exit")
|
row.operator("session.stop", icon='QUIT', text="Exit")
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
if runtime_settings.is_host:
|
if runtime_settings.is_host:
|
||||||
row = row.box()
|
row = row.box()
|
||||||
row.label(text=f"LAN: {runtime_settings.internet_ip}", icon='INFO')
|
row.label(text=f"LAN: {runtime_settings.internet_ip}", icon='INFO')
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
|
if current_state == STATE_LOBBY:
|
||||||
|
row = row.box()
|
||||||
|
row.label(text=f"Waiting the session to start", icon='INFO')
|
||||||
|
row = layout.row()
|
||||||
|
row.operator("session.stop", icon='QUIT', text="Exit")
|
||||||
# CONNECTION STATE
|
# CONNECTION STATE
|
||||||
elif current_state in [STATE_SRV_SYNC,
|
elif current_state in [STATE_SRV_SYNC,
|
||||||
STATE_SYNCING,
|
STATE_SYNCING,
|
||||||
@ -358,6 +362,8 @@ class SESSION_PT_user(bpy.types.Panel):
|
|||||||
if active_user != 0 and active_user.username != settings.username:
|
if active_user != 0 and active_user.username != settings.username:
|
||||||
row = layout.row()
|
row = layout.row()
|
||||||
user_operations = row.split()
|
user_operations = row.split()
|
||||||
|
if operators.client.state['STATE'] == STATE_ACTIVE:
|
||||||
|
|
||||||
user_operations.alert = context.window_manager.session.time_snap_running
|
user_operations.alert = context.window_manager.session.time_snap_running
|
||||||
user_operations.operator(
|
user_operations.operator(
|
||||||
"session.snapview",
|
"session.snapview",
|
||||||
@ -534,9 +540,18 @@ class SESSION_PT_repository(bpy.types.Panel):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def poll(cls, context):
|
def poll(cls, context):
|
||||||
|
session = operators.client
|
||||||
|
settings = utils.get_preferences()
|
||||||
|
admin = False
|
||||||
|
|
||||||
|
if session and hasattr(session,'online_users'):
|
||||||
|
usr = session.online_users.get(settings.username)
|
||||||
|
if usr:
|
||||||
|
admin = usr['admin']
|
||||||
return hasattr(context.window_manager, 'session') and \
|
return hasattr(context.window_manager, 'session') and \
|
||||||
operators.client and \
|
operators.client and \
|
||||||
operators.client.state['STATE'] in [STATE_ACTIVE, STATE_LOBBY]
|
(operators.client.state['STATE'] == STATE_ACTIVE or \
|
||||||
|
operators.client.state['STATE'] == STATE_LOBBY and admin)
|
||||||
|
|
||||||
def draw_header(self, context):
|
def draw_header(self, context):
|
||||||
self.layout.label(text="", icon='OUTLINER_OB_GROUP_INSTANCE')
|
self.layout.label(text="", icon='OUTLINER_OB_GROUP_INSTANCE')
|
||||||
|
Reference in New Issue
Block a user