diff --git a/src/screencast_keys/gpu_utils/imm.py b/src/screencast_keys/gpu_utils/imm.py index 9f95378..e7848f5 100644 --- a/src/screencast_keys/gpu_utils/imm.py +++ b/src/screencast_keys/gpu_utils/imm.py @@ -211,7 +211,8 @@ def immEnd(): scissor_box = inst.get_scissor() # TODO: Other than OpenGL backend, scissor is not supported. # Temporary turn off when gpu.state.scissor_set is implemented. - if hasattr(gpu.platform, "backend_type_get") and \ + if hasattr(gpu, "hasattr") and \ + hasattr(gpu.platform, "backend_type_get") and \ gpu.platform.backend_type_get() != 'OPENGL': scissor_box = None diff --git a/src/screencast_keys/gpu_utils/shader.py b/src/screencast_keys/gpu_utils/shader.py index a4692d3..6781336 100644 --- a/src/screencast_keys/gpu_utils/shader.py +++ b/src/screencast_keys/gpu_utils/shader.py @@ -47,7 +47,8 @@ class ShaderManager: @classmethod def register_shaders(cls): - if hasattr(gpu.platform, "backend_type_get") and \ + if hasattr(gpu, "platform") and \ + hasattr(gpu.platform, "backend_type_get") and \ gpu.platform.backend_type_get() != 'OPENGL': return @@ -75,7 +76,8 @@ def register_shaders(cls): @classmethod def unregister_shaders(cls): - if hasattr(gpu.platform, "backend_type_get") and \ + if hasattr(gpu, "platform") and \ + hasattr(gpu.platform, "backend_type_get") and \ gpu.platform.backend_type_get() != 'OPENGL': return @@ -85,7 +87,8 @@ def unregister_shaders(cls): @classmethod def get_shader(cls, shader_name): - if hasattr(gpu.platform, "backend_type_get") and \ + if hasattr(gpu, "platform") and \ + hasattr(gpu.platform, "backend_type_get") and \ gpu.platform.backend_type_get() != 'OPENGL': return None diff --git a/src/screencast_keys/utils/compatibility.py b/src/screencast_keys/utils/compatibility.py index 9701da1..48a8704 100644 --- a/src/screencast_keys/utils/compatibility.py +++ b/src/screencast_keys/utils/compatibility.py @@ -70,7 +70,7 @@ def add_if_exist(cls_name, space_name, space_types): def blf_size(font_id, font_size, dpi): - if check_version(3, 4, 0) >= 0: + try: blf.size(font_id, font_size) - else: + except TypeError: blf.size(font_id, font_size, dpi)