From 1a74e18798b966aadc971bd48a81b0c599ae3185 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vil=C3=A9m=20Duha?= <vilda.novak@gmail.com>
Date: Wed, 12 May 2021 17:11:17 +0200
Subject: [PATCH] BlenderKit: small UI fixes

main problem was doubling of asset name first letter due to a typo
---
 blenderkit/ratings.py       | 11 ++++++++---
 blenderkit/ratings_utils.py |  2 ++
 blenderkit/ui.py            |  2 +-
 blenderkit/ui_panels.py     | 28 ++++++++++++++++------------
 4 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/blenderkit/ratings.py b/blenderkit/ratings.py
index 851e93607..443c30578 100644
--- a/blenderkit/ratings.py
+++ b/blenderkit/ratings.py
@@ -177,7 +177,11 @@ class UploadRatingOperator(bpy.types.Operator):
 
 def draw_ratings_menu(self, context, layout):
     pcoll = icons.icon_collections["main"]
-    layout.scale_y=1
+
+    profile_name = ''
+    profile = bpy.context.window_manager.get('bkit profile')
+    if profile:
+        profile_name = ' ' + profile['user']['firstName']
 
     col = layout.column()
     # layout.template_icon_view(bkit_ratings, property, show_labels=False, scale=6.0, scale_popup=5.0)
@@ -190,7 +194,8 @@ def draw_ratings_menu(self, context, layout):
     row.prop(self, 'rating_quality_ui', expand=True, icon_only=True, emboss=False)
     if self.rating_quality>0:
         # row = col.row()
-        row.label(text='    Thanks!', icon = 'FUND')
+
+        row.label(text=f'    Thanks{profile_name}!', icon = 'FUND')
     # row.label(text=str(self.rating_quality))
     col.separator()
     col.separator()
@@ -229,7 +234,7 @@ def draw_ratings_menu(self, context, layout):
 
     if self.rating_work_hours>0:
         row = col.row()
-        row.label(text='Thanks, you are amazing!', icon='FUND')
+        row.label(text=f'Thanks{profile_name}, you are amazing!', icon='FUND')
 
 class FastRateMenu(Operator, ratings_utils.RatingsProperties):
     """Rating of the assets , also directly from the asset bar - without need to download assets"""
diff --git a/blenderkit/ratings_utils.py b/blenderkit/ratings_utils.py
index ea005dfcc..22b1ec40f 100644
--- a/blenderkit/ratings_utils.py
+++ b/blenderkit/ratings_utils.py
@@ -86,6 +86,8 @@ def update_ratings_quality(self, context):
         url = paths.get_api_url() + f'assets/{self.asset_id}/rating/'
 
     if bkit_ratings.rating_quality > 0.1:
+
+
         ratings = [('quality', bkit_ratings.rating_quality)]
         tasks_queue.add_task((send_rating_to_thread_quality, (url, ratings, headers)), wait=2.5, only_last=True)
 
diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index 14eccb24d..febf37b1d 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -382,7 +382,7 @@ def draw_tooltip_with_author(asset_data, x, y):
                 gimg = utils.get_hidden_image(a['gravatarImg'], a['gravatarHash'])
 
     aname = asset_data['displayName']
-    aname = aname[0].capitalize() + aname[0:]
+    aname = aname[0].upper() + aname[1:]
     if len(aname)>36:
         aname = f"{aname[:33]}..."
 
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index f5758ffd6..b17f72781 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -1463,7 +1463,7 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
         box.scale_y = 0.8
         box.label(text='Properties')
         if self.asset_data.get('license') == 'cc_zero':
-            t = 'CC Zero'
+            t = 'CC Zero          '
             icon = pcoll['cc0']
 
         else:
@@ -1510,24 +1510,28 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
 
                                )
         # resolution/s
-        # fs = self.asset_data['files']
-        #
-        # if fs and len(fs) > 2:
-        #     resolutions = ''
-        #     list.sort(fs, key=lambda f: f['fileType'])
-        #     for f in fs:
-        #         if f['fileType'].find('resolution') > -1:
-        #             resolutions += f['fileType'][11:] + ' '
-        #     resolutions = resolutions.replace('_', '.')
-        #     self.draw_property(box, 'Resolutions:', resolutions)
         resolution = utils.get_param(self.asset_data, 'textureResolutionMax')
+
         if resolution is not None:
+            fs = self.asset_data['files']
+
+
             ress = f"{int(round(resolution / 1024, 0))}K"
             self.draw_property(box, 'Resolution', ress,
                                tooltip='Maximal resolution of textures in this asset.\n' \
                                        'Most texture asset have also lower resolutions generated.\n' \
                                        'Go to BlenderKit add-on import settings to set default resolution')
 
+
+            if fs and len(fs) > 2 and utils.profile_is_validator():
+                resolutions = ''
+                list.sort(fs, key=lambda f: f['fileType'])
+                for f in fs:
+                    if f['fileType'].find('resolution') > -1:
+                        resolutions += f['fileType'][11:] + ' '
+                resolutions = resolutions.replace('_', '.')
+                self.draw_property(box, 'Generated:', resolutions)
+
         self.draw_asset_parameter(box, key='designer', pretext='Designer')
         self.draw_asset_parameter(box, key='manufacturer', pretext='Manufacturer')  # TODO make them clickable!
         self.draw_asset_parameter(box, key='designCollection', pretext='Collection')
@@ -1758,7 +1762,7 @@ class AssetPopupCard(bpy.types.Operator, ratings_utils.RatingsProperties):
         top_row = layout.row()
         top_drag_bar = top_row.box()
         aname = asset_data['displayName']
-        aname = aname[0].capitalize() + aname[0:]
+        aname = aname[0].upper() + aname[1:]
         top_drag_bar.label(text=aname)
 
         # left side
-- 
GitLab