Get the latest Blender, older versions, or experimental builds.
Stay up-to-date with the new features in the latest Blender releases.
Access production assets and knowledge from the open movies.
Documentation on the usage and features in Blender.
Latest development updates, by Blender developers.
Guidelines, release notes and development docs.
A platform to collect and share results of the Blender Benchmark.
The yearly event that brings the community together.
Support core development with a monthly contribution.
Perform a single donation with more payment options available.
Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.
# SPDX-License-Identifier: GPL-2.0-or-later
from __future__ import annotations
from bpy.types import Operator
class SPREADSHEET_OT_toggle_pin(Operator):
"""Turn on or off pinning"""
bl_idname = "spreadsheet.toggle_pin"
bl_label = "Toggle Pin"
bl_options = {'REGISTER'}
@classmethod
def poll(cls, context):
space = context.space_data
return space and space.type == 'SPREADSHEET'
def execute(self, context):
if space.is_pinned:
self.unpin(context)
else:
self.pin(context)
return {'FINISHED'}
def pin(self, context):
space.is_pinned = True
def unpin(self, context):
space.is_pinned = False
classes = (
SPREADSHEET_OT_toggle_pin,
)
if __name__ == "__main__": # Only for live edit.
from bpy.utils import register_class
for cls in classes:
register_class(cls)