-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathgui.py
126 lines (110 loc) · 4.65 KB
/
gui.py
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
import bpy
class SEQUENCER_PT_audacity_tools(bpy.types.Panel):
bl_space_type = "SEQUENCE_EDITOR"
bl_region_type = "UI"
bl_idname = "SEQUENCER_PT_audacity_tools"
bl_label = "Audacity Tools"
bl_category = "Audacity Tools"
@classmethod
def poll(cls, context):
return (
context.space_data.view_type == "SEQUENCER"
or context.space_data.view_type == "SEQUENCER_PREVIEW"
)
def draw(self, context):
scene = context.scene
props = scene.audacity_tools_props
screen = context.screen
layout = self.layout
# pipe infos
pipe = context.window_manager.audacity_tools_pipe_available
box = layout.box()
row = box.row(align=True)
if pipe:
row.label(text = "Pipe available", icon = "CHECKMARK")
else:
row.label(text = "Pipe unavailable", icon = "ERROR")
row.operator("sequencer.refresh_audacity_pipe", text = "", icon = "FILE_REFRESH")
layout.prop(props, "audacity_mode", text="")
col = layout.column(align=(False))
# STRIP MODE
if props.audacity_mode == "STRIP":
col.operator("sequencer.send_strip_to_audacity", icon="EXPORT")
col.operator(
"sequencer.receive_from_audacity", text="Receive", icon="IMPORT"
)
col.separator()
row = col.row(align=False)
if not screen.is_animation_playing:
row.operator(
"sequencer.play_stop_in_audacity", text="Play", icon="PLAY"
)
else:
row.operator(
"sequencer.play_stop_in_audacity", text="Stop", icon="SNAP_FACE"
)
if scene.use_audio:
row.prop(scene, "use_audio", text="",icon="PLAY_SOUND", emboss = False)
else:
row.prop(scene, "use_audio", text="",icon="OUTLINER_OB_SPEAKER", emboss = False)
# SEQUENCE or SELECTION MODE
elif props.audacity_mode == "SEQUENCE" or props.audacity_mode == "SELECTION":
col.separator()
col.operator(
"sequencer.send_project_to_audacity",
text="Send "+(props.audacity_mode).title(),
icon="EXPORT",
)
col.operator(
"sequencer.receive_from_audacity", text="Receive Mixdown", icon="IMPORT"
)
col.separator()
row = col.row(align=False)
if not screen.is_animation_playing:
row.operator(
"sequencer.play_stop_in_audacity", text="Play", icon="PLAY"
)
else:
row.operator(
"sequencer.play_stop_in_audacity", text="Stop", icon="SNAP_FACE"
)
if scene.use_audio:
row.prop(scene, "use_audio", text="",icon="PLAY_SOUND", emboss = False)
else:
row.prop(scene, "use_audio", text="",icon="OUTLINER_OB_SPEAKER", emboss = False)
# RECORD MODE
elif props.audacity_mode == "RECORD":
sub = col.column()
if not screen.is_animation_playing or (props.record_end !=-1 and props.record_start !=-1):
col.operator(
"sequencer.record_in_audacity", text="Record", icon="RADIOBUT_ON"
)
elif props.record_start != -1:
col.operator(
"sequencer.play_stop_in_audacity", text="Stop", icon="SNAP_FACE"
)
sub = col.column()
sub.active = not props.record_start == -1
sub.operator(
"sequencer.receive_from_audacity", text="Receive", icon="IMPORT"
)
if props.record_start != -1 and props.record_end != -1:
col.separator()
row = col.row(align=False)
if not screen.is_animation_playing:
row.operator(
"sequencer.play_stop_in_audacity", text="Play", icon="PLAY"
)
else:
row.operator(
"sequencer.play_stop_in_audacity", text="Stop", icon="SNAP_FACE"
)
if scene.use_audio:
row.prop(scene, "use_audio", text="",icon="PLAY_SOUND", emboss = False)
else:
row.prop(scene, "use_audio", text="",icon="OUTLINER_OB_SPEAKER", emboss = False)
### REGISTER ---
def register():
bpy.utils.register_class(SEQUENCER_PT_audacity_tools)
def unregister():
bpy.utils.unregister_class(SEQUENCER_PT_audacity_tools)