From 4e12e65a601d2471060575645f5cdaf204362d67 Mon Sep 17 00:00:00 2001 From: Mateus Abelli Date: Sat, 20 Jul 2024 13:08:58 -0300 Subject: [PATCH 1/3] Addon: add dynamic tooltip on submit button when no job type is selected --- addon/flamenco/operators.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addon/flamenco/operators.py b/addon/flamenco/operators.py index 3dd30561..6dca241e 100644 --- a/addon/flamenco/operators.py +++ b/addon/flamenco/operators.py @@ -122,6 +122,14 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator): log = _log.getChild(bl_idname) + @classmethod + def description(cls, context: bpy.types.Context, properties) -> str: + tip_text = cls.bl_description + job_type = job_types.active_job_type(context.scene) + if job_type is not None: + return tip_text + return tip_text + "\nA job type must be selected first" + @classmethod def poll(cls, context: bpy.types.Context) -> bool: # Only allow submission when there is a job type selected. -- 2.30.2 From 02414d87437930b12a59f040a971d04180651ae1 Mon Sep 17 00:00:00 2001 From: Mateus Abelli Date: Mon, 22 Jul 2024 19:39:07 -0300 Subject: [PATCH 2/3] Addon: refactor dynamic tooltip function on submit button --- addon/flamenco/operators.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/addon/flamenco/operators.py b/addon/flamenco/operators.py index 6dca241e..24bfb454 100644 --- a/addon/flamenco/operators.py +++ b/addon/flamenco/operators.py @@ -122,18 +122,11 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator): log = _log.getChild(bl_idname) - @classmethod - def description(cls, context: bpy.types.Context, properties) -> str: - tip_text = cls.bl_description - job_type = job_types.active_job_type(context.scene) - if job_type is not None: - return tip_text - return tip_text + "\nA job type must be selected first" - @classmethod def poll(cls, context: bpy.types.Context) -> bool: # Only allow submission when there is a job type selected. job_type = job_types.active_job_type(context.scene) + cls.poll_message_set("A job type must be selected first") return job_type is not None def execute(self, context: bpy.types.Context) -> set[str]: -- 2.30.2 From 1abcf06031efebfc4e1b1ed4c3415e760c31f6d9 Mon Sep 17 00:00:00 2001 From: Mateus Abelli Date: Tue, 23 Jul 2024 19:43:38 -0300 Subject: [PATCH 3/3] Addon: update text in the dynamic tooltip function on submit button --- addon/flamenco/operators.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addon/flamenco/operators.py b/addon/flamenco/operators.py index 24bfb454..98c557e8 100644 --- a/addon/flamenco/operators.py +++ b/addon/flamenco/operators.py @@ -126,7 +126,7 @@ class FLAMENCO_OT_submit_job(FlamencoOpMixin, bpy.types.Operator): def poll(cls, context: bpy.types.Context) -> bool: # Only allow submission when there is a job type selected. job_type = job_types.active_job_type(context.scene) - cls.poll_message_set("A job type must be selected first") + cls.poll_message_set("No job type selected") return job_type is not None def execute(self, context: bpy.types.Context) -> set[str]: -- 2.30.2