Benchmark: tweak opendata link to be centered correctly.

This commit is contained in:
2018-08-08 11:55:29 +02:00
parent f8d385c99f
commit 984a8f1f08

View File

@@ -452,6 +452,14 @@ def benchmark_thread(ctx):
################################################################################
# Panels
def ui_scale_factor(x):
# To position the buttons exactly we add spacing, but there can be
# rounding errors with non-integer DPI scaling. We roughly compensate
# for those here.
ui_scale = bpy.context.user_preferences.system.ui_scale
widget_height = 20 * ui_scale
return x * widget_height / int(widget_height)
class BENCHMARK_PT_main(Panel):
bl_label = "Benchmark"
bl_options = {'HIDE_HEADER'}
@@ -461,8 +469,10 @@ class BENCHMARK_PT_main(Panel):
def draw_link(self, context):
layout = self.layout
layout.separator()
layout.separator()
col = layout.column()
col.scale_y = ui_scale_factor(0.35)
col.label(text="")
col = layout.column()
sub = col.row()
@@ -481,7 +491,7 @@ class BENCHMARK_PT_main(Panel):
col = split.column()
sub = col.row()
sub.scale_y = 64.0
sub.scale_y = ui_scale_factor(64.0)
sub.separator()
compute_device_list_get(None, context)
@@ -518,7 +528,7 @@ class BENCHMARK_PT_main(Panel):
col = split.column()
sub = col.row()
sub.scale_y = 64.0
sub.scale_y = ui_scale_factor(64.0)
sub.separator()
sub = col.row()