Fix pyrna_enum_to_py: current value matches no enum
warnings
This commit is contained in:
parent
dada275e32
commit
b0f7719add
@ -383,18 +383,17 @@ class BlenderCloudPreferences(AddonPreferences):
|
|||||||
icon='TRIA_UP').action = 'PUSH'
|
icon='TRIA_UP').action = 'PUSH'
|
||||||
|
|
||||||
versions = bss.available_blender_versions
|
versions = bss.available_blender_versions
|
||||||
version = bss.version
|
|
||||||
if bss.status in {'NONE', 'IDLE'}:
|
if bss.status in {'NONE', 'IDLE'}:
|
||||||
if not versions or not version:
|
if not versions:
|
||||||
row_pull.operator('pillar.sync',
|
row_pull.operator('pillar.sync',
|
||||||
text='Find version to load',
|
text='Find version to load',
|
||||||
icon='TRIA_DOWN').action = 'REFRESH'
|
icon='TRIA_DOWN').action = 'REFRESH'
|
||||||
else:
|
else:
|
||||||
props = row_pull.operator('pillar.sync',
|
props = row_pull.operator('pillar.sync',
|
||||||
text='Load %s settings' % version,
|
text='Load %s settings' % bss.version,
|
||||||
icon='TRIA_DOWN')
|
icon='TRIA_DOWN')
|
||||||
props.action = 'PULL'
|
props.action = 'PULL'
|
||||||
props.blender_version = version
|
props.blender_version = bss.version
|
||||||
row_pull.operator('pillar.sync',
|
row_pull.operator('pillar.sync',
|
||||||
text='',
|
text='',
|
||||||
icon=SYNC_SELECT_VERSION_ICON).action = 'SELECT'
|
icon=SYNC_SELECT_VERSION_ICON).action = 'SELECT'
|
||||||
@ -450,7 +449,7 @@ class BlenderCloudPreferences(AddonPreferences):
|
|||||||
manager_box = manager_split.row(align=True)
|
manager_box = manager_split.row(align=True)
|
||||||
|
|
||||||
if bcp.status in {'NONE', 'IDLE'}:
|
if bcp.status in {'NONE', 'IDLE'}:
|
||||||
if not bcp.available_managers or not bcp.manager:
|
if not bcp.available_managers:
|
||||||
manager_box.operator('flamenco.managers',
|
manager_box.operator('flamenco.managers',
|
||||||
text='Find Flamenco Managers',
|
text='Find Flamenco Managers',
|
||||||
icon='FILE_REFRESH')
|
icon='FILE_REFRESH')
|
||||||
|
@ -199,18 +199,26 @@ class FLAMENCO_OT_fmanagers(async_loop.AsyncModalOperatorMixin,
|
|||||||
from ..blender import preferences
|
from ..blender import preferences
|
||||||
|
|
||||||
prefs = preferences()
|
prefs = preferences()
|
||||||
|
mypref = self.mypref
|
||||||
|
|
||||||
self.log.info('Going to fetch managers for user %s', self.user_id)
|
self.log.info('Going to fetch managers for user %s', self.user_id)
|
||||||
|
|
||||||
self.mypref.status = 'FETCHING'
|
mypref.status = 'FETCHING'
|
||||||
params = {'where': '{"projects" : "%s"}' % prefs.project.project}
|
params = {'where': '{"projects" : "%s"}' % prefs.project.project}
|
||||||
managers = await pillar_call(Manager.all, params)
|
managers = await pillar_call(Manager.all, params)
|
||||||
|
|
||||||
# We need to convert to regular dicts before storing in ID properties.
|
# We need to convert to regular dicts before storing in ID properties.
|
||||||
# Also don't store more properties than we need.
|
# Also don't store more properties than we need.
|
||||||
as_list = [{'_id': p['_id'], 'name': p['name']} for p in managers['_items']]
|
as_list = [{'_id': man['_id'], 'name': man['name']}
|
||||||
|
for man in managers['_items']]
|
||||||
|
|
||||||
|
current_manager = mypref.manager
|
||||||
|
mypref.available_managers = as_list
|
||||||
|
|
||||||
|
# Prevent warnings about the current manager not being in the EnumProperty items.
|
||||||
|
if as_list and not any(man['_id'] == current_manager for man in as_list):
|
||||||
|
mypref.manager = as_list[0]['_id']
|
||||||
|
|
||||||
self.mypref.available_managers = as_list
|
|
||||||
self.quit()
|
self.quit()
|
||||||
|
|
||||||
def quit(self):
|
def quit(self):
|
||||||
|
@ -114,7 +114,7 @@ def handle_project_update(_=None, _2=None):
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
log.warning('manager %s for this project could not be found', flamenco_manager_id)
|
log.warning('manager %s for this project could not be found', flamenco_manager_id)
|
||||||
elif prefs.flamenco_manager.available_managers:
|
elif prefs.flamenco_manager.available_managers:
|
||||||
prefs.flamenco_manager.manager = prefs.flamenco_manager.available_managers[0]
|
prefs.flamenco_manager.manager = prefs.flamenco_manager.available_managers[0]['_id']
|
||||||
|
|
||||||
|
|
||||||
def store(_=None, _2=None):
|
def store(_=None, _2=None):
|
||||||
|
@ -416,11 +416,20 @@ class PILLAR_OT_sync(pillar.PillarOperatorMixin,
|
|||||||
bss = bpy.context.window_manager.blender_sync_status
|
bss = bpy.context.window_manager.blender_sync_status
|
||||||
bss.available_blender_versions = versions
|
bss.available_blender_versions = versions
|
||||||
|
|
||||||
if versions:
|
if not versions:
|
||||||
# There are versions to sync, so we can remove the status message.
|
# There are versions to sync, so we can remove the status message.
|
||||||
# However, if there aren't any, the status message shows why, and
|
# However, if there aren't any, the status message shows why, and
|
||||||
# shouldn't be erased.
|
# shouldn't be erased.
|
||||||
self.bss_report({'INFO'}, '')
|
return
|
||||||
|
|
||||||
|
# Prevent warnings that the current value of the EnumProperty isn't valid.
|
||||||
|
current_version = '%d.%d' % bpy.app.version[:2]
|
||||||
|
if current_version in versions:
|
||||||
|
bss.version = current_version
|
||||||
|
else:
|
||||||
|
bss.version = versions[0]
|
||||||
|
|
||||||
|
self.bss_report({'INFO'}, '')
|
||||||
|
|
||||||
async def download_settings_file(self, fname: str, temp_dir: str):
|
async def download_settings_file(self, fname: str, temp_dir: str):
|
||||||
config_dir = pathlib.Path(bpy.utils.user_resource('CONFIG'))
|
config_dir = pathlib.Path(bpy.utils.user_resource('CONFIG'))
|
||||||
|
Reference in New Issue
Block a user