feat(ui): tri

This commit is contained in:
Swann Martinez
2019-05-09 15:56:30 +02:00
parent 34854f43e5
commit f25f893a83
2 changed files with 12 additions and 2 deletions

View File

@ -38,10 +38,17 @@ def client_list_callback(scene, context):
global client_keys global client_keys
items = [("Common", "Common", "")] items = [("Common", "Common", "")]
username = bpy.context.scene.session_settings.username
if client_keys: if client_keys:
for k in client_keys: for k in client_keys:
if 'Client' in k[0]: if 'Client' in k[0]:
name = k[1] name = k[1]
if name == username:
name += " (self)"
items.append((name, name, "")) items.append((name, name, ""))
return items return items
@ -368,7 +375,7 @@ class session_stop(bpy.types.Operator):
class session_rights(bpy.types.Operator): class session_rights(bpy.types.Operator):
bl_idname = "session.right" bl_idname = "session.right"
bl_label = "close" bl_label = "Change owner to"
bl_description = "stop net service" bl_description = "stop net service"
bl_options = {"REGISTER"} bl_options = {"REGISTER"}

5
ui.py
View File

@ -147,6 +147,8 @@ class SessionUsersPanel(bpy.types.Panel):
row = layout.row() row = layout.row()
def get_client_key(item):
return item[0]
class SessionPropertiesPanel(bpy.types.Panel): class SessionPropertiesPanel(bpy.types.Panel):
"""Creates a Panel in the scene context of the properties editor""" """Creates a Panel in the scene context of the properties editor"""
@ -182,7 +184,8 @@ class SessionPropertiesPanel(bpy.types.Panel):
area_msg.operator("session.refresh", text="", area_msg.operator("session.refresh", text="",
icon="UV_SYNC_SELECT") icon="UV_SYNC_SELECT")
if operators.client_keys and len(operators.client_keys) > 0: if operators.client_keys and len(operators.client_keys) > 0:
for item in operators.client_keys:
for item in sorted(operators.client_keys, key=get_client_key):
owner = 'toto' owner = 'toto'
try: try:
owner = item[1] owner = item[1]