Browse Source

delete sound warning

info@shuvit.org 2 years ago
parent
commit
c2cc41e29a
5 changed files with 94 additions and 8 deletions
  1. 2
    1
      lib/FSM.py
  2. 2
    0
      lib/StatesProg.py
  3. 5
    3
      lib/menus.py
  4. 85
    0
      lib/sDeleteSound.py
  5. 0
    4
      user/songs/default.sng

+ 2
- 1
lib/FSM.py View File

@@ -96,7 +96,8 @@ class ProgFSM(Char):
96 96
         'About',
97 97
         'SelectFolder',
98 98
         'NewDir', 
99
-        'WifiSSID'
99
+        'WifiSSID',
100
+        'DeleteSound'
100 101
         ]
101 102
         
102 103
         for s in state_list:

+ 2
- 0
lib/StatesProg.py View File

@@ -44,6 +44,8 @@ from sUpdate import Update
44 44
 from sSelectFolder import SelectFolder
45 45
 from sNewDir import NewDir
46 46
 from sWifiSSID import WifiSSID
47
+from sDeleteSound import DeleteSound
48
+
47 49
 #====================================     
48 50
 
49 51
 State = type("State", (object,), {})

+ 5
- 3
lib/menus.py View File

@@ -364,9 +364,11 @@ def menu2_actions_sample(self, o):
364 364
 				o.soundSlots[o.eSound].set_pitch()
365 365
 			
366 366
 		if o.keyState[2] == 1:
367
-			o.soundSlots[o.eSound].file = None
368
-			o.soundSlots[o.eSound].volume = 16
369
-			o.soundSlots[o.eSound].pitch = 0
367
+			# o.soundSlots[o.eSound].file = None
368
+			# o.soundSlots[o.eSound].volume = 16
369
+			# o.soundSlots[o.eSound].pitch = 0
370
+			o.FSM.FSM.ToTransition("toDeleteSound")
371
+
370 372
 		if o.keyState[3] == 1:
371 373
 			o.FSM.FSM.ToTransition("toLoadSound")
372 374
 

+ 85
- 0
lib/sDeleteSound.py View File

@@ -0,0 +1,85 @@
1
+import FSM
2
+import utils as u
3
+import menus as m
4
+#====================================     
5
+
6
+State = type("State", (object,), {})
7
+#====================================     
8
+class State(object):
9
+	def __init__(self, FSM):
10
+		self.FSM = FSM
11
+	def Enter(self):
12
+		pass
13
+	def Execute(self):
14
+		pass
15
+	def Exit(self):
16
+		pass
17
+#====================================     
18
+class DeleteSound(State):
19
+	def __init__(self,FSM):
20
+		super(DeleteSound, self).__init__(FSM)    
21
+		
22
+	def Enter(self):
23
+		o = self.FSM.owner 
24
+		o.header_text = "Delete Sound"
25
+		o.pub.register("beat", self)
26
+		
27
+		if o.keyState[16] > 0 or o.keyState[17] > 0:
28
+			pass
29
+		else:
30
+			u.draw_header(o)
31
+			o.update_display(0)
32
+			self.draw_main(o)
33
+			self.draw_footer(o)
34
+		super(DeleteSound, self).Enter()        
35
+		
36
+	def Execute(self):
37
+		o = self.FSM.owner 
38
+		m.menu1_actions(self, o)
39
+		if o.keyState[16] == 1:
40
+			m.draw_menu1(o)
41
+			o.update_display(0)
42
+		elif o.keyState[16] == 4:
43
+			u.draw_header(o)
44
+			self.draw_main(o)
45
+			self.draw_footer(o)
46
+			o.update_display(0)
47
+
48
+		if o.keyState[0] == 1 or o.keyState[0] == 3 or o.keyState[1] == 1 or o.keyState[1] == 3 or o.keyState[2] == 1 or o.keyState[2] == 3 or o.keyState[3] == 1 or o.keyState[3] == 3:
49
+			u.draw_header(o)
50
+			self.draw_main(o)
51
+			self.draw_footer(o)
52
+			o.update_display(0)	
53
+
54
+		if o.keyState[0] == 1 or o.keyState[1] == 1  or o.keyState[2] == 1  or o.keyState[3] == 1:
55
+			o.soundSlots[o.eSound].file = None
56
+			o.soundSlots[o.eSound].volume = 16
57
+			o.soundSlots[o.eSound].pitch = 0
58
+			o.FSM.FSM.ToTransition("toMain")
59
+	
60
+	def draw_main(self, o):
61
+		o.center_block("You sure?", o.h2, [0, 0, o.width, o.height], o.light_grey)
62
+
63
+	def draw_footer(self, o):
64
+		_iter = 0
65
+		width = o.width
66
+		xpos = 0
67
+		yposa = 135 - 25
68
+		yposb = 135
69
+		opts = ["Delete Sound"]
70
+		while _iter < 1:
71
+			o.draw.rectangle((xpos, yposa, xpos + width, yposb), outline=0, fill=o.blue)			
72
+			if o.keyState[_iter] == 1:
73
+				o.draw.rectangle((xpos, yposa, xpos + width, yposb), outline=0, fill=o.light_grey)
74
+				o.center_block(opts[_iter], o.h2, [xpos,yposa,xpos + width,yposb], o.blue)
75
+			else:
76
+				o.center_block(opts[_iter], o.h2, [xpos,yposa,xpos + width,yposb], o.light_grey)
77
+			xpos += width
78
+			_iter += 1
79
+
80
+	def ReceiveMessage(self, message):
81
+		o = self.FSM.owner 
82
+		u.play_seq(o, message)
83
+		
84
+	def Exit(self):
85
+		self.FSM.owner.pub.unregister("beat", self)        

+ 0
- 4
user/songs/default.sng
File diff suppressed because it is too large
View File


Loading…
Cancel
Save