bugfix [#23182] Using self.report() inside poll() gives crash

poll() function is now a static method in python, this is more correct, matching C where the operator is not created to run poll.


    def poll(self, context): ...

is now...

    @staticmethod
    def poll(context): ...

Pythons way of doing static methods is a bit odd but cant be helped :|

This does make subclassing poll functions with COMPAT_ENGINES break, so had to modify quite a few scripts for this.
This commit is contained in:
Campbell Barton
2010-08-05 16:05:30 +00:00
parent 5d18274cac
commit 163f6055d2
54 changed files with 845 additions and 368 deletions

View File

@@ -319,7 +319,8 @@ class SequencerButtonsPanel():
def has_sequencer(self, context):
return (context.space_data.view_type == 'SEQUENCER') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
def poll(self, context):
@staticmethod
def poll(context):
return self.has_sequencer(context) and (act_strip(context) is not None)
@@ -330,7 +331,8 @@ class SequencerButtonsPanel_Output():
def has_preview(self, context):
return (context.space_data.view_type == 'PREVIEW') or (context.space_data.view_type == 'SEQUENCER_PREVIEW')
def poll(self, context):
@staticmethod
def poll(context):
return self.has_preview(context)
@@ -384,7 +386,8 @@ class SEQUENCER_PT_edit(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Effect Strip"
def poll(self, context):
@staticmethod
def poll(context):
if not self.has_sequencer(context):
return False
@@ -513,7 +516,8 @@ class SEQUENCER_PT_effect(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Strip Input"
def poll(self, context):
@staticmethod
def poll(context):
if not self.has_sequencer(context):
return False
@@ -587,7 +591,8 @@ class SEQUENCER_PT_input(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Sound"
def poll(self, context):
@staticmethod
def poll(context):
if not self.has_sequencer(context):
return False
@@ -627,7 +632,8 @@ class SEQUENCER_PT_sound(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Scene"
def poll(self, context):
@staticmethod
def poll(context):
if not self.has_sequencer(context):
return False
@@ -651,7 +657,8 @@ class SEQUENCER_PT_scene(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Filter"
def poll(self, context):
@staticmethod
def poll(context):
if not self.has_sequencer(context):
return False
@@ -712,7 +719,8 @@ class SEQUENCER_PT_filter(SequencerButtonsPanel, bpy.types.Panel):
class SEQUENCER_PT_proxy(SequencerButtonsPanel, bpy.types.Panel):
bl_label = "Proxy"
def poll(self, context):
@staticmethod
def poll(context):
if not self.has_sequencer(context):
return False