Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVilem Duha <vilem.duha@gmail.com>2019-05-29 16:01:01 +0300
committerVilem Duha <vilem.duha@gmail.com>2019-06-01 19:49:18 +0300
commit85fd48c32cbdb42f81b26bfb81d411d83e0898b0 (patch)
treebef0f8366dbe1aca4953cad20e87051468c36651 /blenderkit/ui_panels.py
parent88d0e75f1f35af1ea208565a6eb187162ed8451b (diff)
BlenderKit: convert all imports to importlib
+ new Oauth script version (finished in next commit) +split login/signup buttons
Diffstat (limited to 'blenderkit/ui_panels.py')
-rw-r--r--blenderkit/ui_panels.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index 20cba94c..b74e3bbe 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -17,16 +17,15 @@
# ##### END GPL LICENSE BLOCK #####
if "bpy" in locals():
- import imp
-
- imp.reload(paths)
- imp.reload(ratings)
- imp.reload(utils)
- imp.reload(download)
- imp.reload(categories)
- imp.reload(ui)
+ import importlib
+
+ paths = importlib.reload(paths)
+ ratings = importlib.reload(ratings)
+ utils = importlib.reload(utils)
+ download = importlib.reload(download)
+ categories = importlib.reload(categories)
else:
- from blenderkit import paths, ratings, utils, download, categories, ui
+ from blenderkit import paths, ratings, utils, download, categories
from bpy.types import (
Panel
@@ -411,8 +410,7 @@ class VIEW3D_PT_blenderkit_profile(Panel):
if len(user_preferences.api_key) < 20:
if user_preferences.enable_oauth:
- layout.operator("wm.blenderkit_login", text="Login/ Sign up",
- icon='URL')
+ draw_login_buttons(layout)
else:
me = bpy.context.window_manager.get('bkit profile')
if me is not None:
@@ -545,6 +543,13 @@ def draw_panel_brush_ratings(self, context):
op.asset_type = 'BRUSH'
+def draw_login_buttons(layout):
+ layout.operator("wm.blenderkit_login", text="Login",
+ icon='URL').signup = False
+ layout.operator("wm.blenderkit_login", text="Sign up",
+ icon='URL').signup = True
+
+
class VIEW3D_PT_blenderkit_unified(Panel):
bl_category = "BlenderKit"
bl_idname = "VIEW3D_PT_blenderkit_unified"
@@ -581,8 +586,7 @@ class VIEW3D_PT_blenderkit_unified(Panel):
if len(user_preferences.api_key) < 20 and user_preferences.asset_counter > 20:
if user_preferences.enable_oauth:
- layout.operator("wm.blenderkit_login", text="Login/ Sign up",
- icon='URL')
+ draw_login_buttons(layout)
else:
op = layout.operator("wm.url_open", text="Get your API Key",
icon='QUESTION')