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:
authorraa <roaoao@gmail.com>2017-03-28 17:59:42 +0300
committerraa <roaoao@gmail.com>2017-03-28 17:59:42 +0300
commit9159fac1f5a9f4f29a625feea16b9824a33c59ce (patch)
tree5814d3072d5e341f6a12b9cbc52d2c8517d9af4d /development_icon_get.py
parent6448cdbc2eacaf216cc49ff1f07992d1ced6f76e (diff)
Support new UserPreferencesView.ui_scale property
Diffstat (limited to 'development_icon_get.py')
-rw-r--r--development_icon_get.py21
1 files changed, 16 insertions, 5 deletions
diff --git a/development_icon_get.py b/development_icon_get.py
index 020acd67..c467dfd5 100644
--- a/development_icon_get.py
+++ b/development_icon_get.py
@@ -23,7 +23,7 @@ bl_info = {
"name": "Icon Viewer",
"description": "Click an icon to copy its name to the clipboard",
"author": "roaoao",
- "version": (1, 3, 1),
+ "version": (1, 3, 2),
"blender": (2, 75, 0),
"location": "Spacebar > Icon Viewer, Text Editor > Properties",
"wiki_url": (
@@ -44,6 +44,9 @@ HISTORY = []
def ui_scale():
+ if hasattr(bpy.context.user_preferences.view, "ui_scale"):
+ return bpy.context.user_preferences.view.ui_scale
+
ret = bpy.context.user_preferences.system.dpi / DPI
if bpy.context.user_preferences.system.virtual_pixel_mode == 'DOUBLE':
ret *= 2
@@ -195,10 +198,10 @@ class IV_Preferences(bpy.types.AddonPreferences):
description="Auto focus input field", default=True)
show_panel = bpy.props.BoolProperty(
name="Show Panel",
- description="Show the panel in Text Editor", default=True)
+ description="Show the panel in the Text Editor", default=True)
show_header = bpy.props.BoolProperty(
name="Show Header",
- description="Show the header in Python Console",
+ description="Show the header in the Python Console",
default=True)
def draw(self, context):
@@ -421,14 +424,16 @@ class IV_OT_icons_show(bpy.types.Operator):
col = self.layout
self.draw_header(col)
+ history_num_cols = int(
+ (self.width - POPUP_PADDING) / (ui_scale() * ICON_SIZE))
num_cols = min(
self.get_num_cols(len(pr.popup_icons.filtered_icons)),
- int((self.width - POPUP_PADDING) / (ui_scale() * ICON_SIZE)))
+ history_num_cols)
subcol = col.column(True)
if HISTORY and pr.show_history:
- pr.popup_icons.draw(subcol.box(), num_cols, HISTORY)
+ pr.popup_icons.draw(subcol.box(), history_num_cols, HISTORY)
pr.popup_icons.draw(subcol.box(), num_cols)
@@ -472,8 +477,14 @@ class IV_OT_icons_show(bpy.types.Operator):
def register():
+ if bpy.app.background:
+ return
+
bpy.utils.register_module(__name__)
def unregister():
+ if bpy.app.background:
+ return
+
bpy.utils.unregister_module(__name__)