diff options
author | Vilém Duha <vilda.novak@gmail.com> | 2021-03-10 18:52:34 +0300 |
---|---|---|
committer | Vilém Duha <vilda.novak@gmail.com> | 2021-03-16 19:12:18 +0300 |
commit | a1fbcb6108dc3d434465076c93a1894421184b18 (patch) | |
tree | 1750619abfd90ad6fa70d34e80b1e0dfb1c46382 /blenderkit | |
parent | 7164debdd6cea41807e5bdc160f05175f1a1d804 (diff) |
BlenderKit: UI cleanup - minor tweaks to UI
Diffstat (limited to 'blenderkit')
-rw-r--r-- | blenderkit/__init__.py | 4 | ||||
-rw-r--r-- | blenderkit/search.py | 53 | ||||
-rw-r--r-- | blenderkit/ui.py | 12 | ||||
-rw-r--r-- | blenderkit/upload.py | 2 | ||||
-rw-r--r-- | blenderkit/utils.py | 6 |
5 files changed, 47 insertions, 30 deletions
diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py index fc81c0f0..8f1fd0c6 100644 --- a/blenderkit/__init__.py +++ b/blenderkit/__init__.py @@ -335,7 +335,7 @@ class BlenderKitUIProps(PropertyGroup): asset_type: EnumProperty( name="BlenderKit Active Asset Type", items=asset_type_callback, - description="Activate asset in UI", + description="", default=None, update=switch_search_results ) @@ -533,7 +533,7 @@ class BlenderKitCommonSearchProps(object): ('UPLOADING', 'Uploading', 'Uploading'), ('UPLOADED', 'Uploaded', 'Uploaded'), ('READY', 'Ready for V.', 'Ready for validation (deprecated since 2.8)'), - ('VALIDATED', 'Validated', 'Calidated'), + ('VALIDATED', 'Validated', 'Validated'), ('ON_HOLD', 'On Hold', 'On Hold'), ('REJECTED', 'Rejected', 'Rejected'), ('DELETED', 'Deleted', 'Deleted'), diff --git a/blenderkit/search.py b/blenderkit/search.py index 87148f9a..8699314c 100644 --- a/blenderkit/search.py +++ b/blenderkit/search.py @@ -553,7 +553,7 @@ def writeblockm(tooltip, mdata, key='', pretext=None, width=40): # for longer t def fmt_length(prop): - prop = str(round(prop, 2)) + 'm' + prop = str(round(prop, 2)) return prop @@ -590,9 +590,9 @@ def generate_tooltip(mdata): for b in bools_data: if mdata.get(b) and mdata[b]: mdata['tags'].append(b) - t = writeblockm(t, mparams, key='designer', pretext='designer', width=col_w) - t = writeblockm(t, mparams, key='manufacturer', pretext='manufacturer', width=col_w) - t = writeblockm(t, mparams, key='designCollection', pretext='design collection', width=col_w) + t = writeblockm(t, mparams, key='designer', pretext='Designer', width=col_w) + t = writeblockm(t, mparams, key='manufacturer', pretext='Manufacturer', width=col_w) + t = writeblockm(t, mparams, key='designCollection', pretext='Design collection', width=col_w) # t = writeblockm(t, mparams, key='engines', pretext='engine', width = col_w) # t = writeblockm(t, mparams, key='model_style', pretext='style', width = col_w) @@ -601,21 +601,22 @@ def generate_tooltip(mdata): # t = writeblockm(t, mparams, key='condition', pretext='condition', width = col_w) # t = writeblockm(t, mparams, key='productionLevel', pretext='production level', width = col_w) if has(mdata, 'purePbr'): - t = writeblockm(t, mparams, key='pbrType', pretext='pbr', width=col_w) + t = writeblockm(t, mparams, key='pbrType', pretext='Pbr', width=col_w) - t = writeblockm(t, mparams, key='designYear', pretext='design year', width=col_w) + t = writeblockm(t, mparams, key='designYear', pretext='Design year', width=col_w) if has(mparams, 'dimensionX'): - t += 'size: %s, %s, %s\n' % (fmt_length(mparams['dimensionX']), + t += 'Size: %s x %s x %sm\n' % (fmt_length(mparams['dimensionX']), fmt_length(mparams['dimensionY']), fmt_length(mparams['dimensionZ'])) if has(mparams, 'faceCount'): - t += 'face count: %s, render: %s\n' % (mparams['faceCount'], mparams['faceCountRender']) + t += 'Face count: %s\n' % (mparams['faceCount']) + # t += 'face count: %s, render: %s\n' % (mparams['faceCount'], mparams['faceCountRender']) # write files size - this doesn't reflect true file size, since files size is computed from all asset files, including resolutions. - if mdata.get('filesSize'): - fs = utils.files_size_to_text(mdata['filesSize']) - t += f'files size: {fs}\n' + # if mdata.get('filesSize'): + # fs = utils.files_size_to_text(mdata['filesSize']) + # t += f'files size: {fs}\n' # t = writeblockm(t, mparams, key='meshPolyType', pretext='mesh type', width = col_w) # t = writeblockm(t, mparams, key='objectCount', pretext='nubmber of objects', width = col_w) @@ -624,36 +625,44 @@ def generate_tooltip(mdata): # t = writeblockm(t, mparams, key='modifiers', width = col_w) # t = writeblockm(t, mparams, key='shaders', width = col_w) - if has(mparams, 'textureSizeMeters'): - t += 'texture size: %s\n' % fmt_length(mparams['textureSizeMeters']) + # if has(mparams, 'textureSizeMeters'): + # t += 'Texture size: %s m\n' % fmt_length(mparams['textureSizeMeters']) if has(mparams, 'textureResolutionMax') and mparams['textureResolutionMax'] > 0: if not mparams.get('textureResolutionMin'): # for HDR's t = writeblockm(t, mparams, key='textureResolutionMax', pretext='Resolution', width=col_w) elif mparams.get('textureResolutionMin') == mparams['textureResolutionMax']: - t = writeblockm(t, mparams, key='textureResolutionMin', pretext='texture resolution', width=col_w) + t = writeblockm(t, mparams, key='textureResolutionMin', pretext='Texture resolution', width=col_w) else: - t += 'tex resolution: %i - %i\n' % (mparams.get('textureResolutionMin'), mparams['textureResolutionMax']) + t += 'Tex resolution: %i - %i\n' % (mparams.get('textureResolutionMin'), mparams['textureResolutionMax']) if has(mparams, 'thumbnailScale'): - t = writeblockm(t, mparams, key='thumbnailScale', pretext='preview scale', width=col_w) + t = writeblockm(t, mparams, key='thumbnailScale', pretext='Preview scale', width=col_w) # t += 'uv: %s\n' % mdata['uv'] # t += '\n' - t = writeblockm(t, mdata, key='license', width=col_w) + if mdata.get('license') == 'cc_zero': + t+= 'license: CC Zero' + else: + t+= 'license: Royalty free' + # t = writeblockm(t, mdata, key='license', width=col_w) fs = mdata.get('files') if utils.profile_is_validator(): - if fs: - resolutions = 'resolutions:' + if fs and len(fs) > 2: + resolutions = 'Resolutions:' + list.sort(fs, key=lambda f: f['fileType']) for f in fs: if f['fileType'].find('resolution') > -1: resolutions += f['fileType'][11:] + ' ' resolutions += '\n' - t += resolutions + t += resolutions.replace('_', '.') - t = writeblockm(t, mdata, key='isFree', width=col_w) + if mdata['isFree']: + t += 'FREE plan\n' + else: + t += 'FULL plan\n' else: if fs: for f in fs: @@ -670,7 +679,7 @@ def generate_tooltip(mdata): # if adata != None: # t += generate_author_textblock(adata) - # t += '\n' + t += '\n' rc = mdata.get('ratingsCount') if rc: t+='\n' diff --git a/blenderkit/ui.py b/blenderkit/ui.py index b8e8ceac..71eb5e32 100644 --- a/blenderkit/ui.py +++ b/blenderkit/ui.py @@ -379,6 +379,7 @@ def draw_tooltip(x, y, text='', author='', img=None, gravatar=None): tsize = font_height else: fsize = font_height + if l[:4] == 'Tip:' or l[:11] == 'Please rate': tcol = textcol_strong fsize = font_height + 1 @@ -389,6 +390,7 @@ def draw_tooltip(x, y, text='', author='', img=None, gravatar=None): xtext += int(isizex / ncolumns) column_lines = 1 + i=0 for l in alines: if gravatar is not None: if column_lines == 1: @@ -397,15 +399,21 @@ def draw_tooltip(x, y, text='', author='', img=None, gravatar=None): xtext -= gsize + textmargin ytext = y - column_lines * line_height - nameline_height - ttipmargin - textmargin - isizey + texth - if i == 0: + if False:#i == 0: ytext = y - name_height + 5 - isizey + texth - textmargin elif i == len(lines) - 1: ytext = y - (nlines - 1) * line_height - nameline_height - ttipmargin * 2 - isizey + texth tcol = textcol tsize = font_height + if (i> 0 and alines[i-1][:7] == 'Author:'): + tcol = textcol_strong + fsize = font_height + 2 else: fsize = font_height - if l[:4] == 'Tip:' or l[:11] == 'Please rate': + tcol = textcol + + print (i) + if l[:4] == 'Tip:' or l[:11] == 'Please rate' : tcol = textcol_strong fsize = font_height + 1 diff --git a/blenderkit/upload.py b/blenderkit/upload.py index 110994e3..2065ce08 100644 --- a/blenderkit/upload.py +++ b/blenderkit/upload.py @@ -685,7 +685,7 @@ class FastMetadata(bpy.types.Operator): args=(self.asset_id, mdict, user_preferences.api_key)) thread.start() tasks_queue.add_task((ui.add_report, (f'Uploading metadata for {self.name}. ' - f'Refreash search results to see that changes applied correctly.', 8,))) + f'Refresh search results to see that changes applied correctly.', 8,))) return {'FINISHED'} diff --git a/blenderkit/utils.py b/blenderkit/utils.py index 26ace999..d45ac1f5 100644 --- a/blenderkit/utils.py +++ b/blenderkit/utils.py @@ -366,12 +366,12 @@ def get_thumbnail(name): def files_size_to_text(size): - fsmb = size // (1024 * 1024) + fsmb = size / (1024 * 1024) fskb = size % 1024 if fsmb == 0: - return f'{fskb}KB' + return f'{round(fskb)}KB' else: - return f'{fsmb}MB {fskb}KB' + return f'{round(fsmb, 1)}MB' def get_brush_props(context): |