Formatting according to PEP-8 using autopep8
I've added a `setup.cfg` file with `[pep8]` section to make it use the 120-char line length limit we have for all Blender/Python scripts.
This commit is contained in:
@@ -60,7 +60,7 @@ def benchmarkBlenderWatched(command):
|
|||||||
else:
|
else:
|
||||||
logger.DEBUG("Line from stdout: {}" . format(line))
|
logger.DEBUG("Line from stdout: {}" . format(line))
|
||||||
st.update(line)
|
st.update(line)
|
||||||
if st.current_tiles != 0 or st.current_sample != None:
|
if st.current_tiles != 0 or st.current_sample is not None:
|
||||||
elapsed_time = time.time() - start_time
|
elapsed_time = time.time() - start_time
|
||||||
elapsed_time_str = util.humanReadableTimeDifference(elapsed_time)
|
elapsed_time_str = util.humanReadableTimeDifference(elapsed_time)
|
||||||
progress.progress(int(st.getCurrentProgress()),
|
progress.progress(int(st.getCurrentProgress()),
|
||||||
|
@@ -23,47 +23,41 @@ class COLORS_ANSI:
|
|||||||
VERBOSE = False
|
VERBOSE = False
|
||||||
COLORS = COLORS_DUMMY
|
COLORS = COLORS_DUMMY
|
||||||
|
|
||||||
|
|
||||||
class DefaultLoggerProvider:
|
class DefaultLoggerProvider:
|
||||||
def HEADER(self, *args):
|
def HEADER(self, *args):
|
||||||
print(COLORS.HEADER + COLORS.BOLD, end="")
|
print(COLORS.HEADER + COLORS.BOLD, end="")
|
||||||
print(*args, end="")
|
print(*args, end="")
|
||||||
print(COLORS.ENDC)
|
print(COLORS.ENDC)
|
||||||
|
|
||||||
|
|
||||||
def WARNING(self, *args):
|
def WARNING(self, *args):
|
||||||
print(COLORS.WARNING + COLORS.BOLD, end="")
|
print(COLORS.WARNING + COLORS.BOLD, end="")
|
||||||
print(*args, end="")
|
print(*args, end="")
|
||||||
print(COLORS.ENDC)
|
print(COLORS.ENDC)
|
||||||
|
|
||||||
|
|
||||||
def ERROR(self, *args):
|
def ERROR(self, *args):
|
||||||
print(COLORS.FAIL + COLORS.BOLD, end="")
|
print(COLORS.FAIL + COLORS.BOLD, end="")
|
||||||
print(*args, end="")
|
print(*args, end="")
|
||||||
print(COLORS.ENDC)
|
print(COLORS.ENDC)
|
||||||
|
|
||||||
|
|
||||||
def OK(self, *args):
|
def OK(self, *args):
|
||||||
print(COLORS.OKGREEN + COLORS.BOLD, end="")
|
print(COLORS.OKGREEN + COLORS.BOLD, end="")
|
||||||
print(*args, end="")
|
print(*args, end="")
|
||||||
print(COLORS.ENDC)
|
print(COLORS.ENDC)
|
||||||
|
|
||||||
|
|
||||||
def BOLD(self, *args):
|
def BOLD(self, *args):
|
||||||
print(COLORS.BOLD, end="")
|
print(COLORS.BOLD, end="")
|
||||||
print(*args, end="")
|
print(*args, end="")
|
||||||
print(COLORS.ENDC)
|
print(COLORS.ENDC)
|
||||||
|
|
||||||
|
|
||||||
def INFO(self, *args):
|
def INFO(self, *args):
|
||||||
print(*args)
|
print(*args)
|
||||||
|
|
||||||
|
|
||||||
def DEBUG(self, *args):
|
def DEBUG(self, *args):
|
||||||
# TODO(sergey): Add check that debug is enabled.
|
# TODO(sergey): Add check that debug is enabled.
|
||||||
if False:
|
if False:
|
||||||
print(*args)
|
print(*args)
|
||||||
|
|
||||||
|
|
||||||
def FATAL(self, *args):
|
def FATAL(self, *args):
|
||||||
import sys
|
import sys
|
||||||
ERROR(*args)
|
ERROR(*args)
|
||||||
@@ -72,6 +66,7 @@ class DefaultLoggerProvider:
|
|||||||
|
|
||||||
LOGGER_PROVIDER = DefaultLoggerProvider()
|
LOGGER_PROVIDER = DefaultLoggerProvider()
|
||||||
|
|
||||||
|
|
||||||
def HEADER(*args):
|
def HEADER(*args):
|
||||||
LOGGER_PROVIDER.HEADER(*args)
|
LOGGER_PROVIDER.HEADER(*args)
|
||||||
|
|
||||||
|
@@ -3,11 +3,13 @@ import sys
|
|||||||
|
|
||||||
from . import logger
|
from . import logger
|
||||||
|
|
||||||
|
|
||||||
class DefaultProgressProvider:
|
class DefaultProgressProvider:
|
||||||
"""
|
"""
|
||||||
Default progress provider implementation, which draws progress
|
Default progress provider implementation, which draws progress
|
||||||
bar in the console, unless current logging is set to evrbose mode.
|
bar in the console, unless current logging is set to evrbose mode.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def progress(self, count, total, prefix="", suffix=""):
|
def progress(self, count, total, prefix="", suffix=""):
|
||||||
if logger.VERBOSE:
|
if logger.VERBOSE:
|
||||||
return
|
return
|
||||||
@@ -76,12 +78,15 @@ def step(step_name):
|
|||||||
def scene(scene_name):
|
def scene(scene_name):
|
||||||
PROGRESS_PROVIDER.scene(scene_name)
|
PROGRESS_PROVIDER.scene(scene_name)
|
||||||
|
|
||||||
|
|
||||||
def scene_stats(scene_name, stats):
|
def scene_stats(scene_name, stats):
|
||||||
PROGRESS_PROVIDER.scene_stats(scene_name, stats)
|
PROGRESS_PROVIDER.scene_stats(scene_name, stats)
|
||||||
|
|
||||||
|
|
||||||
def render_process(process):
|
def render_process(process):
|
||||||
PROGRESS_PROVIDER.render_process(process)
|
PROGRESS_PROVIDER.render_process(process)
|
||||||
|
|
||||||
|
|
||||||
def is_canceled():
|
def is_canceled():
|
||||||
return PROGRESS_PROVIDER.is_canceled()
|
return PROGRESS_PROVIDER.is_canceled()
|
||||||
|
|
||||||
|
@@ -12,6 +12,7 @@ from .third_party import cpuinfo
|
|||||||
from .third_party import cpu_cores
|
from .third_party import cpu_cores
|
||||||
from .third_party.dateutil import parser
|
from .third_party.dateutil import parser
|
||||||
|
|
||||||
|
|
||||||
def _getBlenderDeviceInfo(ctx):
|
def _getBlenderDeviceInfo(ctx):
|
||||||
PREFIX = "Benchmark Devices: "
|
PREFIX = "Benchmark Devices: "
|
||||||
command = [ctx.blender,
|
command = [ctx.blender,
|
||||||
|
2
benchmark/setup.cfg
Normal file
2
benchmark/setup.cfg
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
[pep8]
|
||||||
|
max-line-length = 120
|
@@ -53,6 +53,7 @@ WELCOME_TEXT = "Run the Quick Benchmark on the selected device to\n" \
|
|||||||
BLURB_TEXT = "Share your results with the world!\n" \
|
BLURB_TEXT = "Share your results with the world!\n" \
|
||||||
"Manage the uploaded benchmark data on your Blender ID."
|
"Manage the uploaded benchmark data on your Blender ID."
|
||||||
|
|
||||||
|
|
||||||
def reset_global_state():
|
def reset_global_state():
|
||||||
global global_result_platform
|
global global_result_platform
|
||||||
global global_progress_status
|
global global_progress_status
|
||||||
@@ -72,14 +73,17 @@ def reset_global_state():
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Draw Utilities.
|
# Draw Utilities.
|
||||||
|
|
||||||
|
|
||||||
font_id = 0
|
font_id = 0
|
||||||
|
|
||||||
|
|
||||||
def viewport_size():
|
def viewport_size():
|
||||||
import bgl
|
import bgl
|
||||||
viewport = bgl.Buffer(bgl.GL_INT, 4)
|
viewport = bgl.Buffer(bgl.GL_INT, 4)
|
||||||
bgl.glGetIntegerv(bgl.GL_VIEWPORT, viewport)
|
bgl.glGetIntegerv(bgl.GL_VIEWPORT, viewport)
|
||||||
return viewport[2], viewport[3]
|
return viewport[2], viewport[3]
|
||||||
|
|
||||||
|
|
||||||
def draw_text_center(text, x, y, shadow=False):
|
def draw_text_center(text, x, y, shadow=False):
|
||||||
dim = blf.dimensions(font_id, text)
|
dim = blf.dimensions(font_id, text)
|
||||||
cx = x - int(dim[0] / 2)
|
cx = x - int(dim[0] / 2)
|
||||||
@@ -93,6 +97,7 @@ def draw_text_center(text, x, y, shadow=False):
|
|||||||
blf.position(font_id, cx, cy, 0)
|
blf.position(font_id, cx, cy, 0)
|
||||||
blf.draw(font_id, text)
|
blf.draw(font_id, text)
|
||||||
|
|
||||||
|
|
||||||
def draw_text_multiline(text, x, y, shadow=False):
|
def draw_text_multiline(text, x, y, shadow=False):
|
||||||
ui_scale = bpy.context.user_preferences.system.ui_scale
|
ui_scale = bpy.context.user_preferences.system.ui_scale
|
||||||
height = int(blf.dimensions(font_id, "Dummy Text")[1])
|
height = int(blf.dimensions(font_id, "Dummy Text")[1])
|
||||||
@@ -109,10 +114,12 @@ def draw_text_multiline(text, x, y, shadow=False):
|
|||||||
blf.draw(font_id, line)
|
blf.draw(font_id, line)
|
||||||
y -= height + space
|
y -= height + space
|
||||||
|
|
||||||
|
|
||||||
def draw_rect(x, y, w, h, color):
|
def draw_rect(x, y, w, h, color):
|
||||||
import gpu
|
import gpu
|
||||||
gpu.draw.rect(x, y, x + w, y + h, color[0], color[1], color[2], color[3])
|
gpu.draw.rect(x, y, x + w, y + h, color[0], color[1], color[2], color[3])
|
||||||
|
|
||||||
|
|
||||||
def draw_image(filepath, x, y, w, h):
|
def draw_image(filepath, x, y, w, h):
|
||||||
global images
|
global images
|
||||||
if filepath not in images:
|
if filepath not in images:
|
||||||
@@ -256,6 +263,7 @@ handle_draw = bpy.types.SpaceBenchmark.draw_handler_add(
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Benchmark foundation integration.
|
# Benchmark foundation integration.
|
||||||
|
|
||||||
|
|
||||||
class ProgressProviderSink:
|
class ProgressProviderSink:
|
||||||
current_progress = 0.0
|
current_progress = 0.0
|
||||||
current_step = ''
|
current_step = ''
|
||||||
@@ -341,18 +349,21 @@ class LoggerProviderSink:
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Benchmark thread.
|
# Benchmark thread.
|
||||||
|
|
||||||
|
|
||||||
def string_strip_trademark(name):
|
def string_strip_trademark(name):
|
||||||
return name.replace("(R)", "").replace("(TM)", "")
|
return name.replace("(R)", "").replace("(TM)", "")
|
||||||
|
|
||||||
|
|
||||||
def correct_device_name(name):
|
def correct_device_name(name):
|
||||||
if (name.startswith("TITAN") or
|
if (name.startswith("TITAN") or
|
||||||
name.startswith("Quadro") or
|
name.startswith("Quadro") or
|
||||||
name.startswith("GeForce")):
|
name.startswith("GeForce")):
|
||||||
return "Nvidia " + name;
|
return "Nvidia " + name
|
||||||
if (name.startswith("Radeon")):
|
if (name.startswith("Radeon")):
|
||||||
return "AMD " + name;
|
return "AMD " + name
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
|
||||||
def get_gpu_names(system_info):
|
def get_gpu_names(system_info):
|
||||||
gpu_names = []
|
gpu_names = []
|
||||||
for device in system_info["devices"]:
|
for device in system_info["devices"]:
|
||||||
@@ -361,12 +372,14 @@ def get_gpu_names(system_info):
|
|||||||
gpu_names.append(correct_device_name(device["name"]))
|
gpu_names.append(correct_device_name(device["name"]))
|
||||||
return gpu_names
|
return gpu_names
|
||||||
|
|
||||||
|
|
||||||
def indent_gpu_names(gpu_names):
|
def indent_gpu_names(gpu_names):
|
||||||
indented_names = []
|
indented_names = []
|
||||||
for name in gpu_names:
|
for name in gpu_names:
|
||||||
indented_names.append(" • " + name)
|
indented_names.append(" • " + name)
|
||||||
return indented_names
|
return indented_names
|
||||||
|
|
||||||
|
|
||||||
def construct_platform_string(system_info):
|
def construct_platform_string(system_info):
|
||||||
"""
|
"""
|
||||||
Construct human readable platform string to show in the interface.
|
Construct human readable platform string to show in the interface.
|
||||||
@@ -385,6 +398,7 @@ def construct_platform_string(system_info):
|
|||||||
result += "\nGPUs:\n{}" . format("\n" . join(indent_gpu_names(gpu_names)))
|
result += "\nGPUs:\n{}" . format("\n" . join(indent_gpu_names(gpu_names)))
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def convert_result_to_json_dict(ctx, results):
|
def convert_result_to_json_dict(ctx, results):
|
||||||
# Convert custom classes to dictionaries for easier JSON dump.
|
# Convert custom classes to dictionaries for easier JSON dump.
|
||||||
json_results = results
|
json_results = results
|
||||||
@@ -414,6 +428,7 @@ def system_info_get(ctx):
|
|||||||
sys.executable = old_executable
|
sys.executable = old_executable
|
||||||
return info
|
return info
|
||||||
|
|
||||||
|
|
||||||
def modify_system_info(system_info):
|
def modify_system_info(system_info):
|
||||||
compute_units = query_opencl_compute_units()
|
compute_units = query_opencl_compute_units()
|
||||||
for device in system_info["devices"]:
|
for device in system_info["devices"]:
|
||||||
@@ -427,6 +442,7 @@ def modify_system_info(system_info):
|
|||||||
del compute_units[index]
|
del compute_units[index]
|
||||||
return system_info
|
return system_info
|
||||||
|
|
||||||
|
|
||||||
def modify_device_info(device_info):
|
def modify_device_info(device_info):
|
||||||
compute_device = bpy.context.scene.compute_device
|
compute_device = bpy.context.scene.compute_device
|
||||||
device_type, device_name, compute_units, device_index = compute_device.split(":")
|
device_type, device_name, compute_units, device_index = compute_device.split(":")
|
||||||
@@ -439,6 +455,7 @@ def modify_device_info(device_info):
|
|||||||
device_info["compute_devices"] = compute_devices
|
device_info["compute_devices"] = compute_devices
|
||||||
return device_info
|
return device_info
|
||||||
|
|
||||||
|
|
||||||
def benchmark_thread(ctx):
|
def benchmark_thread(ctx):
|
||||||
global progress_lock, global_result_platform, global_progress_status
|
global progress_lock, global_result_platform, global_progress_status
|
||||||
global global_cancel
|
global global_cancel
|
||||||
@@ -499,6 +516,7 @@ def ui_scale_factor(x):
|
|||||||
widget_height = 20 * ui_scale
|
widget_height = 20 * ui_scale
|
||||||
return x * widget_height / int(widget_height)
|
return x * widget_height / int(widget_height)
|
||||||
|
|
||||||
|
|
||||||
class BENCHMARK_PT_main(Panel):
|
class BENCHMARK_PT_main(Panel):
|
||||||
bl_label = "Benchmark"
|
bl_label = "Benchmark"
|
||||||
bl_options = {'HIDE_HEADER'}
|
bl_options = {'HIDE_HEADER'}
|
||||||
@@ -616,6 +634,7 @@ def blender_benchmark_data_dir_get():
|
|||||||
else:
|
else:
|
||||||
raise Exception("Needs implementation")
|
raise Exception("Needs implementation")
|
||||||
|
|
||||||
|
|
||||||
def blender_executable_get():
|
def blender_executable_get():
|
||||||
benchmark_data_dir = blender_benchmark_data_dir_get()
|
benchmark_data_dir = blender_benchmark_data_dir_get()
|
||||||
system = platform.system()
|
system = platform.system()
|
||||||
@@ -628,15 +647,18 @@ def blender_executable_get():
|
|||||||
else:
|
else:
|
||||||
raise Exception("Needs implementation")
|
raise Exception("Needs implementation")
|
||||||
|
|
||||||
|
|
||||||
def scenes_dir_get():
|
def scenes_dir_get():
|
||||||
benchmark_data_dir = blender_benchmark_data_dir_get()
|
benchmark_data_dir = blender_benchmark_data_dir_get()
|
||||||
return os.path.join(benchmark_data_dir, "scenes")
|
return os.path.join(benchmark_data_dir, "scenes")
|
||||||
|
|
||||||
|
|
||||||
def configure_script_get():
|
def configure_script_get():
|
||||||
script_directory = os.path.dirname(os.path.realpath(__file__))
|
script_directory = os.path.dirname(os.path.realpath(__file__))
|
||||||
benchmark_script_directory = os.path.dirname(script_directory)
|
benchmark_script_directory = os.path.dirname(script_directory)
|
||||||
return os.path.join(benchmark_script_directory, "configure.py")
|
return os.path.join(benchmark_script_directory, "configure.py")
|
||||||
|
|
||||||
|
|
||||||
class BENCHMARK_OT_run_base(bpy.types.Operator):
|
class BENCHMARK_OT_run_base(bpy.types.Operator):
|
||||||
run_type = 'QUICK' # or 'COMPLETE'
|
run_type = 'QUICK' # or 'COMPLETE'
|
||||||
benchmark_context = None
|
benchmark_context = None
|
||||||
@@ -807,6 +829,7 @@ class BENCHMARK_OT_run_base(bpy.types.Operator):
|
|||||||
if self.thread:
|
if self.thread:
|
||||||
self.thread.join()
|
self.thread.join()
|
||||||
|
|
||||||
|
|
||||||
class BENCHMARK_OT_run_quick(BENCHMARK_OT_run_base):
|
class BENCHMARK_OT_run_quick(BENCHMARK_OT_run_base):
|
||||||
"Run quick Blender benchmark"
|
"Run quick Blender benchmark"
|
||||||
bl_label = "Run Benchmark"
|
bl_label = "Run Benchmark"
|
||||||
@@ -814,6 +837,7 @@ class BENCHMARK_OT_run_quick(BENCHMARK_OT_run_base):
|
|||||||
|
|
||||||
run_type = 'QUICK'
|
run_type = 'QUICK'
|
||||||
|
|
||||||
|
|
||||||
class BENCHMARK_OT_run_complete(BENCHMARK_OT_run_base):
|
class BENCHMARK_OT_run_complete(BENCHMARK_OT_run_base):
|
||||||
"Run complete Blender benchmark (might take 1.5 hours to finish and 4GiB of GPU memory)"
|
"Run complete Blender benchmark (might take 1.5 hours to finish and 4GiB of GPU memory)"
|
||||||
bl_label = "Run Benchmark"
|
bl_label = "Run Benchmark"
|
||||||
@@ -852,6 +876,7 @@ class BENCHMARK_OT_save(bpy.types.Operator):
|
|||||||
def cancel(self, context):
|
def cancel(self, context):
|
||||||
make_buttons_green()
|
make_buttons_green()
|
||||||
|
|
||||||
|
|
||||||
class BENCHMARK_OT_share(bpy.types.Operator):
|
class BENCHMARK_OT_share(bpy.types.Operator):
|
||||||
bl_idname = "benchmark.share"
|
bl_idname = "benchmark.share"
|
||||||
bl_label = "Share Benchmark Result"
|
bl_label = "Share Benchmark Result"
|
||||||
@@ -872,6 +897,7 @@ class BENCHMARK_OT_share(bpy.types.Operator):
|
|||||||
global_results_submitted = True
|
global_results_submitted = True
|
||||||
return {'FINISHED'}
|
return {'FINISHED'}
|
||||||
|
|
||||||
|
|
||||||
class BENCHMARK_OT_opendata_link(bpy.types.Operator):
|
class BENCHMARK_OT_opendata_link(bpy.types.Operator):
|
||||||
bl_idname = "benchmark.opendata_link"
|
bl_idname = "benchmark.opendata_link"
|
||||||
bl_label = "opendata.blender.org"
|
bl_label = "opendata.blender.org"
|
||||||
@@ -883,6 +909,7 @@ class BENCHMARK_OT_opendata_link(bpy.types.Operator):
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Restart benchmark.
|
# Restart benchmark.
|
||||||
|
|
||||||
|
|
||||||
class BENCHMARK_OT_restart(bpy.types.Operator):
|
class BENCHMARK_OT_restart(bpy.types.Operator):
|
||||||
bl_idname = "benchmark.restart"
|
bl_idname = "benchmark.restart"
|
||||||
bl_label = "Go to a home screen and choose another benchmark to run"
|
bl_label = "Go to a home screen and choose another benchmark to run"
|
||||||
@@ -894,6 +921,7 @@ class BENCHMARK_OT_restart(bpy.types.Operator):
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Configuration.
|
# Configuration.
|
||||||
|
|
||||||
|
|
||||||
def cl_query_executable_get():
|
def cl_query_executable_get():
|
||||||
benchmark_data_dir = blender_benchmark_data_dir_get()
|
benchmark_data_dir = blender_benchmark_data_dir_get()
|
||||||
system = platform.system()
|
system = platform.system()
|
||||||
@@ -906,6 +934,7 @@ def cl_query_executable_get():
|
|||||||
else:
|
else:
|
||||||
raise Exception("Needs implementation")
|
raise Exception("Needs implementation")
|
||||||
|
|
||||||
|
|
||||||
def query_opencl_compute_units():
|
def query_opencl_compute_units():
|
||||||
binary = cl_query_executable_get()
|
binary = cl_query_executable_get()
|
||||||
output = subprocess.run([binary], stdout=subprocess.PIPE).stdout
|
output = subprocess.run([binary], stdout=subprocess.PIPE).stdout
|
||||||
@@ -916,6 +945,7 @@ def query_opencl_compute_units():
|
|||||||
compute_units.append((name.decode(), max_compute_units.decode()))
|
compute_units.append((name.decode(), max_compute_units.decode()))
|
||||||
return compute_units
|
return compute_units
|
||||||
|
|
||||||
|
|
||||||
def find_first_device_index(compute_units, device_name):
|
def find_first_device_index(compute_units, device_name):
|
||||||
if not compute_units:
|
if not compute_units:
|
||||||
return -1
|
return -1
|
||||||
@@ -924,6 +954,7 @@ def find_first_device_index(compute_units, device_name):
|
|||||||
return index
|
return index
|
||||||
return -1
|
return -1
|
||||||
|
|
||||||
|
|
||||||
def compute_device_list_get(self, context):
|
def compute_device_list_get(self, context):
|
||||||
global global_cached_system_info
|
global global_cached_system_info
|
||||||
global global_cached_compute_devices
|
global global_cached_compute_devices
|
||||||
@@ -974,9 +1005,12 @@ def compute_device_list_get(self, context):
|
|||||||
################################################################################
|
################################################################################
|
||||||
# Tweak User Preferences
|
# Tweak User Preferences
|
||||||
|
|
||||||
|
|
||||||
default_wcol_tool_inner = None
|
default_wcol_tool_inner = None
|
||||||
default_wcol_tool_inner_sel = None
|
default_wcol_tool_inner_sel = None
|
||||||
default_wcol_tool_outline = None
|
default_wcol_tool_outline = None
|
||||||
|
|
||||||
|
|
||||||
def backup_buttons_colors():
|
def backup_buttons_colors():
|
||||||
global default_wcol_tool_inner
|
global default_wcol_tool_inner
|
||||||
global default_wcol_tool_inner_sel
|
global default_wcol_tool_inner_sel
|
||||||
@@ -987,6 +1021,7 @@ def backup_buttons_colors():
|
|||||||
default_wcol_tool_inner_sel = theme.user_interface.wcol_tool.inner_sel[:]
|
default_wcol_tool_inner_sel = theme.user_interface.wcol_tool.inner_sel[:]
|
||||||
default_wcol_tool_outline = theme.user_interface.wcol_tool.outline[:]
|
default_wcol_tool_outline = theme.user_interface.wcol_tool.outline[:]
|
||||||
|
|
||||||
|
|
||||||
def make_buttons_green():
|
def make_buttons_green():
|
||||||
userpref = bpy.context.user_preferences
|
userpref = bpy.context.user_preferences
|
||||||
theme = userpref.themes[0]
|
theme = userpref.themes[0]
|
||||||
@@ -994,6 +1029,7 @@ def make_buttons_green():
|
|||||||
theme.user_interface.wcol_tool.inner_sel = [0.308, 0.490, 0.029, 1.0]
|
theme.user_interface.wcol_tool.inner_sel = [0.308, 0.490, 0.029, 1.0]
|
||||||
theme.user_interface.wcol_tool.outline = [0.408, 0.590, 0.129]
|
theme.user_interface.wcol_tool.outline = [0.408, 0.590, 0.129]
|
||||||
|
|
||||||
|
|
||||||
def make_buttons_default():
|
def make_buttons_default():
|
||||||
userpref = bpy.context.user_preferences
|
userpref = bpy.context.user_preferences
|
||||||
theme = userpref.themes[0]
|
theme = userpref.themes[0]
|
||||||
@@ -1001,6 +1037,7 @@ def make_buttons_default():
|
|||||||
theme.user_interface.wcol_tool.inner_sel = default_wcol_tool_inner_sel
|
theme.user_interface.wcol_tool.inner_sel = default_wcol_tool_inner_sel
|
||||||
theme.user_interface.wcol_tool.outline = default_wcol_tool_outline
|
theme.user_interface.wcol_tool.outline = default_wcol_tool_outline
|
||||||
|
|
||||||
|
|
||||||
userpref = bpy.context.user_preferences
|
userpref = bpy.context.user_preferences
|
||||||
theme = userpref.themes[0]
|
theme = userpref.themes[0]
|
||||||
userpref.view.use_quit_dialog = False
|
userpref.view.use_quit_dialog = False
|
||||||
|
@@ -41,7 +41,6 @@ else:
|
|||||||
system = sys.platform
|
system = sys.platform
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
|
def user_data_dir(appname=None, appauthor=None, version=None, roaming=False):
|
||||||
r"""Return full path to the user-specific data dir for this application.
|
r"""Return full path to the user-specific data dir for this application.
|
||||||
|
|
||||||
@@ -364,6 +363,7 @@ def user_log_dir(appname=None, appauthor=None, version=None, opinion=True):
|
|||||||
|
|
||||||
class AppDirs(object):
|
class AppDirs(object):
|
||||||
"""Convenience wrapper for getting application dirs."""
|
"""Convenience wrapper for getting application dirs."""
|
||||||
|
|
||||||
def __init__(self, appname, appauthor=None, version=None, roaming=False,
|
def __init__(self, appname, appauthor=None, version=None, roaming=False,
|
||||||
multipath=False):
|
multipath=False):
|
||||||
self.appname = appname
|
self.appname = appname
|
||||||
@@ -479,6 +479,7 @@ def _get_win_folder_with_ctypes(csidl_name):
|
|||||||
|
|
||||||
return buf.value
|
return buf.value
|
||||||
|
|
||||||
|
|
||||||
def _get_win_folder_with_jna(csidl_name):
|
def _get_win_folder_with_jna(csidl_name):
|
||||||
import array
|
import array
|
||||||
from com.sun import jna
|
from com.sun import jna
|
||||||
@@ -505,6 +506,7 @@ def _get_win_folder_with_jna(csidl_name):
|
|||||||
|
|
||||||
return dir
|
return dir
|
||||||
|
|
||||||
|
|
||||||
if system == "win32":
|
if system == "win32":
|
||||||
try:
|
try:
|
||||||
import win32com.shell
|
import win32com.shell
|
||||||
|
Reference in New Issue
Block a user