/
zynthian_gui_main.py
129 lines (93 loc) · 3.6 KB
/
zynthian_gui_main.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
127
128
129
#!/usr/bin/python3
# -*- coding: utf-8 -*-
#******************************************************************************
# ZYNTHIAN PROJECT: Zynthian GUI
#
# Zynthian GUI Main Menu Class
#
# Copyright (C) 2015-2020 Fernando Moyano <jofemodo@zynthian.org>
#
#******************************************************************************
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of
# the License, or any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# For a full copy of the GNU General Public License see the LICENSE.txt file.
#
#******************************************************************************
import logging
# Zynthian specific modules
from . import zynthian_gui_selector
from zyngui import zynthian_gui_config
from zynlibs.zynseq import zynseq
#------------------------------------------------------------------------------
# Zynthian App Selection GUI Class
#------------------------------------------------------------------------------
class zynthian_gui_main(zynthian_gui_selector):
def __init__(self):
super().__init__('Main', True)
def fill_list(self):
self.list_data=[]
# Main Apps
self.list_data.append((self.layers,0,"Layers"))
self.list_data.append((self.step_sequencer,0,"Sequencer"))
self.list_data.append((self.alsa_mixer,0,"Audio Levels"))
self.list_data.append((self.audio_recorder,0,"Audio Recorder"))
self.list_data.append((self.midi_recorder,0,"MIDI Recorder"))
if "autoeq" in zynthian_gui_config.experimental_features:
self.list_data.append((self.auto_eq,0,"Auto EQ (alpha)"))
# Snapshot Management
self.list_data.append((None,0,"-----------------------------"))
self.list_data.append((self.snapshots,0,"Snapshots"))
if len(self.zyngui.screens['layer'].layers)>0:
self.list_data.append((self.clean_all,0,"CLEAN ALL"))
self.list_data.append((None,0,"-----------------------------"))
self.list_data.append((self.admin,0,"Admin"))
super().fill_list()
def select_action(self, i, t='S'):
if self.list_data[i][0]:
self.last_action=self.list_data[i][0]
self.last_action()
def layers(self):
logging.info("Layers")
self.zyngui.show_screen("layer")
def snapshots(self):
logging.info("Snapshots")
self.zyngui.show_modal("snapshot")
def clean_all(self):
self.zyngui.show_confirm("Do you really want to clean all?", self.clean_all_confirmed)
def clean_all_confirmed(self, params=None):
if len(self.zyngui.screens['layer'].layers)>0:
self.zyngui.screens['snapshot'].save_last_state_snapshot()
self.zyngui.screens['layer'].reset()
if zynseq.libseq:
zynseq.load("")
self.zyngui.show_screen('layer')
def audio_recorder(self):
logging.info("Audio Recorder")
self.zyngui.show_modal("audio_recorder")
def midi_recorder(self):
logging.info("MIDI Recorder")
self.zyngui.show_modal("midi_recorder")
def alsa_mixer(self):
logging.info("ALSA Mixer")
self.zyngui.show_modal("alsa_mixer")
def auto_eq(self):
logging.info("Auto EQ")
self.zyngui.show_modal('autoeq')
def step_sequencer(self):
logging.info("Step Sequencer")
self.zyngui.show_modal('stepseq')
def admin(self):
logging.info("Admin")
self.zyngui.show_modal("admin")
def set_select_path(self):
self.select_path.set("Main")
#------------------------------------------------------------------------------