forked from BlenderCL/weed
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtext_operators.py
More file actions
executable file
·30 lines (23 loc) · 941 Bytes
/
text_operators.py
File metadata and controls
executable file
·30 lines (23 loc) · 941 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
class ExtendWordOperator:
def __init__(self, target_word, additional_data = None, align = "LEFT"):
self.target_word = target_word
self.display_name = target_word
self.additional_data = additional_data
self.align = align
def execute(self, text_block):
text_block.replace_current_word(self.target_word)
class InsertTextOperator:
def __init__(self, name, text):
self.display_name = name
self.insert_text = text
self.align = "CENTER"
def execute(self, text_block):
text_block.insert(self.insert_text)
class DynamicSnippetOperator:
def __init__(self, name, function, additional_data):
self.display_name = name
self.function = function
self.additional_data = additional_data
self.align = "CENTER"
def execute(self, text_block):
self.function(text_block, self.additional_data)