Created
August 10, 2011 11:33
-
-
Save zeffii/1136610 to your computer and use it in GitHub Desktop.
prepending a button to a header
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
class SetTextPreferences(bpy.types.Operator): | |
bl_label = "" | |
bl_idname = "txt.set_text_prefs" | |
def execute(self, context): | |
st = context.space_data | |
st.show_line_numbers = True | |
st.show_word_wrap = True | |
st.show_syntax_highlight = True | |
st.show_margin = True | |
return {'FINISHED'} | |
class TextHeaderAddition(bpy.types.Header): | |
# bl_label = "Hello World Panel" | |
# bl_idname = "OBJECT_PT_hello" | |
bl_space_type = "TEXT_EDITOR" | |
bl_region_type = "HEADER" | |
def draw(self, context): | |
layout = self.layout | |
row = layout.row() | |
row.operator("txt.set_text_prefs", icon='COLOR') | |
def register(): | |
bpy.utils.register_class(TextHeaderAddition) | |
bpy.utils.register_class(SetTextPreferences) | |
def unregister(): | |
bpy.utils.unregister_class(TextHeaderAddition) | |
bpy.utils.unregister_class(SetTextPreferences) | |
if __name__ == "__main__": | |
register() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment