info@shuvit.org 2 years ago
parent
commit
8ce4ab4ea2

+ 1
- 1
.gitignore View File

47
 *__pycache__/
47
 *__pycache__/
48
 lib/__pycache__/
48
 lib/__pycache__/
49
 lib/*.pyc
49
 lib/*.pyc
50
-
50
+config.txt

+ 0
- 6
config.txt View File

1
-default_song = Roland_TR-808
2
-theme = default
3
-title = default
4
-bpm = 90
5
-volume = 10
6
-song_dir = /home/pi/zpc_ct/user/songs/drum_machines/

+ 0
- 6
defender_scores.sco View File

1
-name1 = zilla
2
-name2 = robzilla
3
-name3 = zilla
4
-score1 = 1950
5
-score2 = 2050
6
-score3 = 2050

+ 1
- 37
lib/StatesDefender.py View File

142
 		self.o.draw.rectangle(((self.posx - hw), (self.posy - hh), (self.posx + hw), (self.posy + hh)), outline=self.o.light_grey, fill=self.o.light_grey)
142
 		self.o.draw.rectangle(((self.posx - hw), (self.posy - hh), (self.posx + hw), (self.posy + hh)), outline=self.o.light_grey, fill=self.o.light_grey)
143
 		self.o.draw.rectangle(((self.posx - (hw/4)), (self.posy - self.height), (self.posx + (hw/4)), (self.posy + hh)), outline=self.o.light_grey, fill=self.o.light_grey)
143
 		self.o.draw.rectangle(((self.posx - (hw/4)), (self.posy - self.height), (self.posx + (hw/4)), (self.posy + hh)), outline=self.o.light_grey, fill=self.o.light_grey)
144
 
144
 
145
-
146
 	def check_keys(self, delta):
145
 	def check_keys(self, delta):
147
 		if self.o.keyState[0] == 2:
146
 		if self.o.keyState[0] == 2:
148
 			if self.posx > 0:
147
 			if self.posx > 0:
153
 
152
 
154
 		elif self.o.keyState[1] == 1 or self.o.keyState[2] == 1:
153
 		elif self.o.keyState[1] == 1 or self.o.keyState[2] == 1:
155
 			self.game.bullets.append(Bullet(self.o, self.game, self.posx))
154
 			self.game.bullets.append(Bullet(self.o, self.game, self.posx))
156
-
157
-
158
 			self.o.defender_sounds[0].set_volume(self.o.volume / 16)
155
 			self.o.defender_sounds[0].set_volume(self.o.volume / 16)
159
 			pygame.mixer.Sound.play(self.o.defender_sounds[0])
156
 			pygame.mixer.Sound.play(self.o.defender_sounds[0])
160
 
157
 
161
-
162
-
163
-			# if self.file != None:
164
-			# 	if vol != 0:
165
-			# 		vol = (vol / 16) * (self.volume / 16) * (self.o.volume / 16)
166
-			# 		self.mixerSound.set_volume(vol)
167
-			# 	pygame.mixer.Sound.play(self.mixerSound)  
168
-
169
 class Bullet:
158
 class Bullet:
170
 	def __init__(self, o, game, x):
159
 	def __init__(self, o, game, x):
171
 		self.o = o
160
 		self.o = o
274
 		self.o.draw.rectangle(((c4[0] - hw), (c4[1] - hh), (c4[0] + hw), (c4[1] + hh)), outline=0, fill=self.o.light_grey)		
263
 		self.o.draw.rectangle(((c4[0] - hw), (c4[1] - hh), (c4[0] + hw), (c4[1] + hh)), outline=0, fill=self.o.light_grey)		
275
 
264
 
276
 	def update(self):
265
 	def update(self):
277
-		#self.posy -= self.game.bullet_speed * self.game.delta
278
 		self.gap += self.game.explode_speed * self.game.delta
266
 		self.gap += self.game.explode_speed * self.game.delta
279
 		self.width -= self.scale_speed * self.game.delta
267
 		self.width -= self.scale_speed * self.game.delta
280
 		self.height -= self.scale_speed * self.game.delta
268
 		self.height -= self.scale_speed * self.game.delta
281
 		if self.gap > 20:
269
 		if self.gap > 20:
282
 			self.game.explodes.remove(self)
270
 			self.game.explodes.remove(self)
283
-			print('killing explosion ', len(self.game.explodes))
284
 		self.draw()
271
 		self.draw()
285
 
272
 
286
 	def check_collision(self):
273
 	def check_collision(self):
331
 		super(Startup, self).Enter()        
318
 		super(Startup, self).Enter()        
332
 		
319
 		
333
 	def Execute(self):
320
 	def Execute(self):
334
-		print('defender startup state')
335
 		self.FSM.ToTransition('toIntro')
321
 		self.FSM.ToTransition('toIntro')
336
 		
322
 		
337
 	def Exit(self):
323
 	def Exit(self):
353
 		
339
 		
354
 	def Execute(self):
340
 	def Execute(self):
355
 		if (time.perf_counter() - self.birth) > 2:
341
 		if (time.perf_counter() - self.birth) > 2:
356
-			print('time is up')
357
 			self.FSM.queued_state = "toMain"
342
 			self.FSM.queued_state = "toMain"
358
 			self.FSM.ToTransition('toBlueFade')
343
 			self.FSM.ToTransition('toBlueFade')
359
 
344
 
369
 		super(Main, self).__init__(FSM)    
354
 		super(Main, self).__init__(FSM)    
370
 		
355
 		
371
 	def Enter(self):
356
 	def Enter(self):
372
-		print('hello defender main')
373
 		o = self.FSM.owner 
357
 		o = self.FSM.owner 
374
 		o.draw.rectangle((0, 0, o.width, o.height), outline=0, fill=o.blue)
358
 		o.draw.rectangle((0, 0, o.width, o.height), outline=0, fill=o.blue)
375
 		o.update_display(0)
359
 		o.update_display(0)
376
 		self.game = Game(o)
360
 		self.game = Game(o)
377
 		o.game = self.game
361
 		o.game = self.game
378
-
379
 		super(Main, self).Enter()        
362
 		super(Main, self).Enter()        
380
 		
363
 		
381
 	def Execute(self):
364
 	def Execute(self):
419
 				ns = self.FSM.queued_state 
402
 				ns = self.FSM.queued_state 
420
 				self.FSM.queued_state = None
403
 				self.FSM.queued_state = None
421
 				self.FSM.ToTransition(ns)	
404
 				self.FSM.ToTransition(ns)	
405
+
422
 	def Exit(self):
406
 	def Exit(self):
423
 		pass
407
 		pass
424
 
408
 
438
 		self.y = self.o.height / 2
422
 		self.y = self.o.height / 2
439
 		self.xsize = 0.0
423
 		self.xsize = 0.0
440
 		self.ysize = 0.0
424
 		self.ysize = 0.0
441
-
442
 		super(GreyFade, self).Enter()        
425
 		super(GreyFade, self).Enter()        
443
 		
426
 		
444
 	def Execute(self):
427
 	def Execute(self):
470
 		self.FSM.stateLife = 1
453
 		self.FSM.stateLife = 1
471
 		self.o = self.FSM.owner 
454
 		self.o = self.FSM.owner 
472
 		self.birth = pygame.time.get_ticks()
455
 		self.birth = pygame.time.get_ticks()
473
-
474
 		self.o.draw.rectangle((0, 0, self.o.width, self.o.height), outline=0, fill=self.o.blue)
456
 		self.o.draw.rectangle((0, 0, self.o.width, self.o.height), outline=0, fill=self.o.blue)
475
 		self.o.center_block("Game Over", self.o.h2, [0, 0, self.o.width, self.o.height], self.o.light_grey)
457
 		self.o.center_block("Game Over", self.o.h2, [0, 0, self.o.width, self.o.height], self.o.light_grey)
476
 		self.o.center_block("Score: " + str(self.o.game.score), self.o.h2, [0, 20, self.o.width, self.o.height + 20], self.o.light_grey)
458
 		self.o.center_block("Score: " + str(self.o.game.score), self.o.h2, [0, 20, self.o.width, self.o.height + 20], self.o.light_grey)
477
 		self.o.update_display(0)
459
 		self.o.update_display(0)
478
-
479
 		super(GameOver, self).Enter()        
460
 		super(GameOver, self).Enter()        
480
 		
461
 		
481
 	def Execute(self):
462
 	def Execute(self):
485
 
466
 
486
 		if (pygame.time.get_ticks() - self.birth) > 3000:
467
 		if (pygame.time.get_ticks() - self.birth) > 3000:
487
 			if self.o.game.score > self.o.game.hs_s1:
468
 			if self.o.game.score > self.o.game.hs_s1:
488
-				print('this is a new high score')
489
 				self.FSM.queued_state = "toNewHighScore"
469
 				self.FSM.queued_state = "toNewHighScore"
490
 			else:
470
 			else:
491
-				print('not a new high score')				
492
-			
493
 				self.FSM.queued_state = "toHighScore"
471
 				self.FSM.queued_state = "toHighScore"
494
 			self.FSM.ToTransition('toBlueFade')
472
 			self.FSM.ToTransition('toBlueFade')
495
 
473
 
556
 		
534
 		
557
 	def Enter(self):
535
 	def Enter(self):
558
 		o = self.FSM.owner 
536
 		o = self.FSM.owner 
559
-	
560
 		self.input_string = ""
537
 		self.input_string = ""
561
-		
562
 		self.last_action = pygame.time.get_ticks()
538
 		self.last_action = pygame.time.get_ticks()
563
 		self.caps = False
539
 		self.caps = False
564
 		self.cur_but = 18
540
 		self.cur_but = 18
565
 		self.cur_letter = ""
541
 		self.cur_letter = ""
566
-
567
 		self.skips = [7, 3, 11, 12, 13, 14, 15]
542
 		self.skips = [7, 3, 11, 12, 13, 14, 15]
568
 		
543
 		
569
 		self.lc_labels = [["p", "q", "r", "s"], ["t", "u", "v"], ["w", "x", "y", "z"], ["C", "A", "P", "S"], 
544
 		self.lc_labels = [["p", "q", "r", "s"], ["t", "u", "v"], ["w", "x", "y", "z"], ["C", "A", "P", "S"], 
581
 		for l in self.labels:
556
 		for l in self.labels:
582
 			self.cycles.append(cycle(l))
557
 			self.cycles.append(cycle(l))
583
 
558
 
584
-
585
-
586
 		self.draw(o)
559
 		self.draw(o)
587
 		o.update_display(0)
560
 		o.update_display(0)
588
 		super(EnterText, self).Enter()        
561
 		super(EnterText, self).Enter()        
595
 				o.game.hs_name = self.input_string
568
 				o.game.hs_name = self.input_string
596
 
569
 
597
 				if o.game.score > o.game.hs_s3:
570
 				if o.game.score > o.game.hs_s3:
598
-					print('new first')
599
 					o.game.hs_s1 = o.game.hs_s2
571
 					o.game.hs_s1 = o.game.hs_s2
600
 					o.game.hs_n1 = o.game.hs_n2
572
 					o.game.hs_n1 = o.game.hs_n2
601
 					o.game.hs_s2 = o.game.hs_s3
573
 					o.game.hs_s2 = o.game.hs_s3
604
 					o.game.hs_n3 = o.game.hs_name
576
 					o.game.hs_n3 = o.game.hs_name
605
 
577
 
606
 				elif o.game.score > o.game.hs_s2:
578
 				elif o.game.score > o.game.hs_s2:
607
-					print('new second')
608
 					o.game.hs_s1 = o.game.hs_s2
579
 					o.game.hs_s1 = o.game.hs_s2
609
 					o.game.hs_n1 = o.game.hs_n2
580
 					o.game.hs_n1 = o.game.hs_n2
610
 					o.game.hs_s2 = o.game.score
581
 					o.game.hs_s2 = o.game.score
611
 					o.game.hs_n2 = o.game.hs_name
582
 					o.game.hs_n2 = o.game.hs_name
612
 				else:
583
 				else:
613
-					print('new third')
614
 					o.game.hs_s1 = o.game.score
584
 					o.game.hs_s1 = o.game.score
615
 					o.game.hs_n1 = o.game.hs_name
585
 					o.game.hs_n1 = o.game.hs_name
616
 
586
 
617
-				print('new high score saving')
618
 				self.FSM.queued_state = 'toHighScore'		
587
 				self.FSM.queued_state = 'toHighScore'		
619
 				self.FSM.ToTransition('toBlueFade')		
588
 				self.FSM.ToTransition('toBlueFade')		
620
 				o.game.save_highscore()
589
 				o.game.save_highscore()
634
 						o.center_block(self.input_string + self.cur_letter, o.h2, [0, 0, o.width, y_size], o.light_grey)
603
 						o.center_block(self.input_string + self.cur_letter, o.h2, [0, 0, o.width, y_size], o.light_grey)
635
 
604
 
636
 					if _iter == 7:
605
 					if _iter == 7:
637
-						
638
 						self.input_string = self.input_string[:-1]
606
 						self.input_string = self.input_string[:-1]
639
-						print('deleting')
640
 						self.last_action = 100000000
607
 						self.last_action = 100000000
641
 						self.draw(o)
608
 						self.draw(o)
642
 						o.center_block(self.input_string, o.h2, [0, 0, o.width, y_size], o.light_grey)
609
 						o.center_block(self.input_string, o.h2, [0, 0, o.width, y_size], o.light_grey)
643
 
610
 
644
 					elif _iter == 3:
611
 					elif _iter == 3:
645
-						print('caps')
646
 						if self.caps:
612
 						if self.caps:
647
 							self.caps = False
613
 							self.caps = False
648
 							self.labels = self.lc_labels
614
 							self.labels = self.lc_labels
649
-
650
 						else:
615
 						else:
651
 							self.caps = True
616
 							self.caps = True
652
 							self.labels = self.uc_labels
617
 							self.labels = self.uc_labels
666
 			self.last_action = 100000000
631
 			self.last_action = 100000000
667
 			self.reset_cycles()
632
 			self.reset_cycles()
668
 			self.draw(o)
633
 			self.draw(o)
669
-
670
 			o.center_block(self.input_string, o.h2, [0, 0, o.width, y_size], o.light_grey)
634
 			o.center_block(self.input_string, o.h2, [0, 0, o.width, y_size], o.light_grey)
671
 			o.update_display(0)
635
 			o.update_display(0)
672
 
636
 

+ 2
- 53
lib/menus.py View File

27
 			o.center_block("File", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
27
 			o.center_block("File", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
28
 		if _id == 5:
28
 		if _id == 5:
29
 			o.center_block("Util", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
29
 			o.center_block("Util", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
30
-		# if _id == 6:
31
-		# 	o.center_block("Bank-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
32
-		# if _id == 7:
33
-		# 	o.center_block("Bank+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
34
 		if _id == 8:
30
 		if _id == 8:
35
 			o.center_block("Vol-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
31
 			o.center_block("Vol-", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
36
 		if _id == 9:
32
 		if _id == 9:
37
 			o.center_block("Vol+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
33
 			o.center_block("Vol+", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
38
-		#if _id == 11:
39
-			#o.center_block("", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
40
 		if _id == 12:
34
 		if _id == 12:
41
 			o.center_block("Play", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
35
 			o.center_block("Play", o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
42
 		if _id == 13:
36
 		if _id == 13:
245
 
239
 
246
 def menu1_actions(self, o):
240
 def menu1_actions(self, o):
247
 	if o.keyState[8] == 4 or o.keyState[8] == 3:
241
 	if o.keyState[8] == 4 or o.keyState[8] == 3:
248
-		#print('reset repeat from menu')
249
 		o.button_repeater(1,[])
242
 		o.button_repeater(1,[])
250
 
243
 
251
 	if o.keyState[9] == 4 or o.keyState[9] == 3:
244
 	if o.keyState[9] == 4 or o.keyState[9] == 3:
252
-		#print('reset repeat from menu')
253
 		o.button_repeater(1,[])
245
 		o.button_repeater(1,[])
254
 
246
 
255
 	if o.keyState[16] == 2:
247
 	if o.keyState[16] == 2:
256
-		#print('key 8 ', o.keyState[8])
257
-		#o.button_repeater(0, [8,9,14,15])
258
-
259
 		if o.keyState[0] == 1:
248
 		if o.keyState[0] == 1:
260
 			self.FSM.ToTransition('toMain')
249
 			self.FSM.ToTransition('toMain')
261
 		elif o.keyState[1] == 1:
250
 		elif o.keyState[1] == 1:
303
 				o.volume += 1
292
 				o.volume += 1
304
 				u.text_center(o, "Master Volume", str(o.volume))
293
 				u.text_center(o, "Master Volume", str(o.volume))
305
 				o.update_display(0)
294
 				o.update_display(0)
306
-		if o.keyState[11] == 1:
307
-			#o.save_song()
308
 
295
 
296
+		if o.keyState[11] == 1:
309
 			pass
297
 			pass
310
 
298
 
311
 		if o.keyState[10] == 2:
299
 		if o.keyState[10] == 2:
345
 
333
 
346
 def menu2_actions_sample(self, o):
334
 def menu2_actions_sample(self, o):
347
 	if o.keyState[6] == 4 or o.keyState[6] == 3:
335
 	if o.keyState[6] == 4 or o.keyState[6] == 3:
348
-		#print('reset repeat from menu')
349
 		o.button_repeater(1,[])
336
 		o.button_repeater(1,[])
350
 
337
 
351
 	if o.keyState[7] == 4 or o.keyState[7] == 3:
338
 	if o.keyState[7] == 4 or o.keyState[7] == 3:
352
-		#print('reset repeat from menu')
353
 		o.button_repeater(1,[])
339
 		o.button_repeater(1,[])
354
 
340
 
355
 	if o.keyState[8] == 4 or o.keyState[8] == 3:
341
 	if o.keyState[8] == 4 or o.keyState[8] == 3:
356
-		#print('reset repeat from menu')
357
 		o.button_repeater(1,[])
342
 		o.button_repeater(1,[])
358
 
343
 
359
 	if o.keyState[9] == 4 or o.keyState[9] == 3:
344
 	if o.keyState[9] == 4 or o.keyState[9] == 3:
360
-		#print('reset repeat from menu')
361
 		o.button_repeater(1,[])
345
 		o.button_repeater(1,[])
362
 
346
 
363
 	if o.keyState[10] == 4 or o.keyState[10] == 3:
347
 	if o.keyState[10] == 4 or o.keyState[10] == 3:
364
-		#print('reset repeat from menu')
365
 		o.button_repeater(1,[])
348
 		o.button_repeater(1,[])
366
 
349
 
367
 	if o.keyState[11] == 4 or o.keyState[11] == 3:
350
 	if o.keyState[11] == 4 or o.keyState[11] == 3:
368
-		#print('reset repeat from menu')
369
 		o.button_repeater(1,[])
351
 		o.button_repeater(1,[])
370
 
352
 
371
 	if o.keyState[17] == 2:
353
 	if o.keyState[17] == 2:
372
 		if o.keyState[0] == 1:
354
 		if o.keyState[0] == 1:
373
 			if o.soundSlots[o.eSound].volume > 0:
355
 			if o.soundSlots[o.eSound].volume > 0:
374
-				#print('copy')
375
 				o.soundClipboard = [o.soundSlots[o.eSound].file, o.soundSlots[o.eSound].volume, o.soundSlots[o.eSound].pitch]
356
 				o.soundClipboard = [o.soundSlots[o.eSound].file, o.soundSlots[o.eSound].volume, o.soundSlots[o.eSound].pitch]
376
-				#print(o.soundClipboard)
377
 
357
 
378
 		if o.keyState[1] == 1:
358
 		if o.keyState[1] == 1:
379
 			if o.soundClipboard != []:
359
 			if o.soundClipboard != []:
380
-				#print('pasting ', o.soundClipboard)				
381
 				o.soundSlots[o.eSound].file = o.soundClipboard[0]
360
 				o.soundSlots[o.eSound].file = o.soundClipboard[0]
382
 				o.soundSlots[o.eSound].volume = o.soundClipboard[1]
361
 				o.soundSlots[o.eSound].volume = o.soundClipboard[1]
383
 				o.soundSlots[o.eSound].pitch = o.soundClipboard[2]
362
 				o.soundSlots[o.eSound].pitch = o.soundClipboard[2]
385
 				o.soundSlots[o.eSound].set_pitch()
364
 				o.soundSlots[o.eSound].set_pitch()
386
 			
365
 			
387
 		if o.keyState[2] == 1:
366
 		if o.keyState[2] == 1:
388
-			#print('delete sound ', o.eSound)
389
 			o.soundSlots[o.eSound].file = None
367
 			o.soundSlots[o.eSound].file = None
390
 			o.soundSlots[o.eSound].volume = 16
368
 			o.soundSlots[o.eSound].volume = 16
391
 			o.soundSlots[o.eSound].pitch = 0
369
 			o.soundSlots[o.eSound].pitch = 0
392
 		if o.keyState[3] == 1:
370
 		if o.keyState[3] == 1:
393
-			#print('load')
394
 			o.FSM.FSM.ToTransition("toLoadSound")
371
 			o.FSM.FSM.ToTransition("toLoadSound")
395
 
372
 
396
-
397
 		if o.keyState[4] == 1:
373
 		if o.keyState[4] == 1:
398
 			o.prev = not o.prev
374
 			o.prev = not o.prev
399
 			draw_menu2_sample(o)
375
 			draw_menu2_sample(o)
468
 					o.update_display(0)
444
 					o.update_display(0)
469
 				o.repeater_states[10] = pygame.time.get_ticks()
445
 				o.repeater_states[10] = pygame.time.get_ticks()
470
 
446
 
471
-
472
 		if o.keyState[10] == 1:
447
 		if o.keyState[10] == 1:
473
 			if o.soundSlots[o.eSound].pitch > -10:
448
 			if o.soundSlots[o.eSound].pitch > -10:
474
 				o.soundSlots[o.eSound].pitch -= 1
449
 				o.soundSlots[o.eSound].pitch -= 1
498
 		if o.keyState[12] == 1:
473
 		if o.keyState[12] == 1:
499
 			o.odub = not o.odub
474
 			o.odub = not o.odub
500
 			o.undo_buf = []
475
 			o.undo_buf = []
501
-			#print('odub now is ', o.odub)
502
 			draw_menu2_sample(o)
476
 			draw_menu2_sample(o)
503
 			o.update_display(0)
477
 			o.update_display(0)
504
 
478
 
505
 		if o.keyState[13] == 1:
479
 		if o.keyState[13] == 1:
506
-			#print('undo something')
507
 			for i in o.undo_buf:
480
 			for i in o.undo_buf:
508
 				o.soundSlots[i[0]].notes[i[1]][i[2]][0] = 0
481
 				o.soundSlots[i[0]].notes[i[1]][i[2]][0] = 0
509
 				o.soundSlots[i[0]].notes[i[1]][i[2]][1] = 0
482
 				o.soundSlots[i[0]].notes[i[1]][i[2]][1] = 0
512
 		if o.keyState[14] == 1:
485
 		if o.keyState[14] == 1:
513
 			o.erase = not o.erase
486
 			o.erase = not o.erase
514
 			o.erase_buf = []
487
 			o.erase_buf = []
515
-			#print('erase now is ', o.erase)
516
 			if o.erase:
488
 			if o.erase:
517
 				o.mute = False
489
 				o.mute = False
518
 				o.mute_buf = []
490
 				o.mute_buf = []
522
 		if o.keyState[15] == 1:
494
 		if o.keyState[15] == 1:
523
 			o.mute = not o.mute
495
 			o.mute = not o.mute
524
 			o.mute_buf = []
496
 			o.mute_buf = []
525
-			#print('mute now is ', o.mute)
526
 			if o.mute:
497
 			if o.mute:
527
 				o.erase = False
498
 				o.erase = False
528
 				o.erase_buf = []
499
 				o.erase_buf = []
532
 def menu2_actions_pattern(self, o):
503
 def menu2_actions_pattern(self, o):
533
 	if o.keyState[17] == 2:
504
 	if o.keyState[17] == 2:
534
 		if o.keyState[0] == 1:
505
 		if o.keyState[0] == 1:
535
-			#print('copy')
536
 			o.patternClipboard = []
506
 			o.patternClipboard = []
537
 			for s in o.soundSlots:
507
 			for s in o.soundSlots:
538
 				notes = []
508
 				notes = []
539
 				for i in s.notes[o.ePattern]:
509
 				for i in s.notes[o.ePattern]:
540
 					notes.append([i[0], i[1]])
510
 					notes.append([i[0], i[1]])
541
 				o.patternClipboard.append(notes)
511
 				o.patternClipboard.append(notes)
542
-				#print('adding to clip ', notes)
543
 			
512
 			
544
 		elif o.keyState[1] == 1:
513
 		elif o.keyState[1] == 1:
545
-			#print('paste')
546
 			if o.patternClipboard != []:
514
 			if o.patternClipboard != []:
547
 				p = 0
515
 				p = 0
548
 				for s in o.soundSlots:
516
 				for s in o.soundSlots:
551
 						i[0] = o.patternClipboard[p][n][0]
519
 						i[0] = o.patternClipboard[p][n][0]
552
 						i[1] = o.patternClipboard[p][n][1]
520
 						i[1] = o.patternClipboard[p][n][1]
553
 						n += 1
521
 						n += 1
554
-					#print('added ', o.patternClipboard[p])
555
 					p += 1
522
 					p += 1
556
 			else:
523
 			else:
557
 				pass
524
 				pass
558
-				#print('nothing to paste')
559
 			
525
 			
560
 		elif o.keyState[2] == 1:
526
 		elif o.keyState[2] == 1:
561
-			#print('clear')
562
-			#print(o.soundSlots[o.eSound].notes[o.ePattern])
563
 			for s in o.soundSlots:
527
 			for s in o.soundSlots:
564
 				for i in s.notes[o.ePattern]:
528
 				for i in s.notes[o.ePattern]:
565
 					i[0] = 0
529
 					i[0] = 0
605
 			if o.pat_perf:
569
 			if o.pat_perf:
606
 				o.pat_buf = o.song
570
 				o.pat_buf = o.song
607
 				o.song = []
571
 				o.song = []
608
-				print('song is now ', o.song)
609
 			else:
572
 			else:
610
 				o.song = o.pat_buf
573
 				o.song = o.pat_buf
611
-				print('song is now ', o.song)
612
 
574
 
613
 			draw_menu2_pattern(o)
575
 			draw_menu2_pattern(o)
614
 			o.update_display(0)		
576
 			o.update_display(0)		
626
 				o.pat_bank += 1
588
 				o.pat_bank += 1
627
 				u.text_center(o, "Pattern Bank", str(o.pat_bank))
589
 				u.text_center(o, "Pattern Bank", str(o.pat_bank))
628
 				o.update_display(0)		
590
 				o.update_display(0)		
629
-				
630
-
631
-				
632
-
591
+			
633
 def menu2_actions_note(self, o):
592
 def menu2_actions_note(self, o):
634
 	if o.keyState[8] == 4 or o.keyState[8] == 3:
593
 	if o.keyState[8] == 4 or o.keyState[8] == 3:
635
-		#print('reset repeat from menu')
636
 		o.button_repeater(1,[])
594
 		o.button_repeater(1,[])
637
 
595
 
638
 	if o.keyState[9] == 4 or o.keyState[9] == 3:
596
 	if o.keyState[9] == 4 or o.keyState[9] == 3:
639
-		#print('reset repeat from menu')
640
 		o.button_repeater(1,[])
597
 		o.button_repeater(1,[])
641
 
598
 
642
 	if o.keyState[17] == 2:
599
 	if o.keyState[17] == 2:
643
-		
644
-
645
 		if o.keyState[8] == 2:
600
 		if o.keyState[8] == 2:
646
 			if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)):
601
 			if (o.repeater_states[8] != None and ((pygame.time.get_ticks() - o.repeater_states[8]) > 500)):
647
 				if o.note_vol > 0:
602
 				if o.note_vol > 0:
677
 				o.patternFollow = False
632
 				o.patternFollow = False
678
 			else:
633
 			else:
679
 				o.patternFollow = True
634
 				o.patternFollow = True
680
-
681
-			#print('pattern follow is ', o.patternFollow)
682
 			draw_menu2_note(o)
635
 			draw_menu2_note(o)
683
 			o.update_display(0)			
636
 			o.update_display(0)			
684
 					
637
 					
686
 def menu2_actions_saveas(self, o):
639
 def menu2_actions_saveas(self, o):
687
 	if o.keyState[17] == 2:
640
 	if o.keyState[17] == 2:
688
 		if o.keyState[12] == 1:
641
 		if o.keyState[12] == 1:
689
-			#print('select folder')
690
 			self.FSM.ToTransition('toSelectFolder')	
642
 			self.FSM.ToTransition('toSelectFolder')	
691
 		elif o.keyState[14] == 1:
643
 		elif o.keyState[14] == 1:
692
-			#print('new folder')
693
 			self.FSM.ToTransition('toNewDir')	
644
 			self.FSM.ToTransition('toNewDir')	
694
 
645
 
695
-
696
 def util_command(self, o, command):
646
 def util_command(self, o, command):
697
 	if command == "Clock":
647
 	if command == "Clock":
698
 		self.FSM.ToTransition('toClock')		
648
 		self.FSM.ToTransition('toClock')		
725
 			o.save_song()
675
 			o.save_song()
726
 		else:
676
 		else:
727
 			pass
677
 			pass
728
-			#print('cant save over blank')
729
 	
678
 	
730
 	elif command == "Open":
679
 	elif command == "Open":
731
 		self.FSM.ToTransition('toOpenSong')	
680
 		self.FSM.ToTransition('toOpenSong')	

+ 0
- 18
lib/sBall.py View File

58
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
58
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
59
 			pass
59
 			pass
60
 		else:			
60
 		else:			
61
-			#now = datetime.now()
62
-			#current_time = time.strftime("%-I:%M %p")
63
-
64
-
65
 			if self.ballx < (0 + self.ball_size):
61
 			if self.ballx < (0 + self.ball_size):
66
 				self.ball_x_dir = 1
62
 				self.ball_x_dir = 1
67
 			if self.ballx > (o.width - self.ball_size):
63
 			if self.ballx > (o.width - self.ball_size):
72
 			if self.bally > (o.height - self.ball_size):
68
 			if self.bally > (o.height - self.ball_size):
73
 				self.ball_y_dir = -1
69
 				self.ball_y_dir = -1
74
 
70
 
75
-			# if self.ballx > (o.width - self.ball_size) or self.ballx < (0 + self.ball_size):
76
-			# 	self.ball_x_dir *= -1
77
-			# if self.bally > (o.height - self.ball_size) or self.bally < (0 + self.ball_size):
78
-			# 	self.ball_y_dir *= -1
79
-
80
 			self.ballx += self.ball_speed * self.ball_x_dir
71
 			self.ballx += self.ball_speed * self.ball_x_dir
81
 			self.bally += self.ball_speed * self.ball_y_dir
72
 			self.bally += self.ball_speed * self.ball_y_dir
82
 
73
 
83
-
84
 			if self.ball2x < (0 + self.ball_size):
74
 			if self.ball2x < (0 + self.ball_size):
85
 				self.ball2_x_dir = 1
75
 				self.ball2_x_dir = 1
86
 				self.xmult = random.uniform(.6, 1.2)
76
 				self.xmult = random.uniform(.6, 1.2)
93
 			if self.ball2y > (o.height - self.ball_size):
83
 			if self.ball2y > (o.height - self.ball_size):
94
 				self.ball2_y_dir = -1			
84
 				self.ball2_y_dir = -1			
95
 
85
 
96
-
97
-			# if self.ball2x > (o.width - self.ball_size) or self.ball2x < (0 + self.ball_size):
98
-			# 	self.ball2_x_dir *= -1
99
-			# 	self.xmult = random.uniform(.8, 1.2)
100
-			# if self.ball2y > (o.height - self.ball_size) or self.ball2y < (0 + self.ball_size):
101
-			# 	self.ball2_y_dir *= -1
102
-
103
 			self.ball2x += (self.ball_speed * self.ball2_x_dir) * self.xmult
86
 			self.ball2x += (self.ball_speed * self.ball2_x_dir) * self.xmult
104
 			self.ball2y += (self.ball_speed * self.ball2_y_dir) 
87
 			self.ball2y += (self.ball_speed * self.ball2_y_dir) 
105
 
88
 
107
 			
90
 			
108
 			o.draw.ellipse((self.ballx - self.ball_size, self.bally - self.ball_size, self.ballx + self.ball_size, self.bally + self.ball_size), fill = o.light_grey, outline =o.light_grey)
91
 			o.draw.ellipse((self.ballx - self.ball_size, self.bally - self.ball_size, self.ballx + self.ball_size, self.bally + self.ball_size), fill = o.light_grey, outline =o.light_grey)
109
 			o.draw.ellipse((self.ball2x - self.ball_size, self.ball2y - self.ball_size, self.ball2x + self.ball_size, self.ball2y + self.ball_size), fill = o.light_grey, outline =o.light_grey)
92
 			o.draw.ellipse((self.ball2x - self.ball_size, self.ball2y - self.ball_size, self.ball2x + self.ball_size, self.ball2y + self.ball_size), fill = o.light_grey, outline =o.light_grey)
110
-			#o.center_block(current_time, o.h3, [0,0,o.width,o.height], o.pink)
111
 			o.update_display(0)
93
 			o.update_display(0)
112
 		
94
 		
113
 	def ReceiveMessage(self, message):
95
 	def ReceiveMessage(self, message):

+ 5
- 13
lib/sCalculator.py View File

64
 
64
 
65
 	def append_num(self, num):
65
 	def append_num(self, num):
66
 		ops = ['+', '-', '*', '/']
66
 		ops = ['+', '-', '*', '/']
67
-		print('appending num ', num)
68
 		if num in ops:
67
 		if num in ops:
69
 			if self.num1 != '':
68
 			if self.num1 != '':
70
 				self.op = num
69
 				self.op = num
71
 				self.num2 = ''
70
 				self.num2 = ''
72
 				self.result = ''
71
 				self.result = ''
73
 		elif num == '=':
72
 		elif num == '=':
74
-			print('this is that')
75
 			if self.num2 != '':
73
 			if self.num2 != '':
76
 				if self.result == '':
74
 				if self.result == '':
77
 					if self.op == '+':
75
 					if self.op == '+':
109
 				self.result = ''
107
 				self.result = ''
110
 			if self.op == '':
108
 			if self.op == '':
111
 				self.num1 += num
109
 				self.num1 += num
112
-				print('---append ', num)
113
 			else:
110
 			else:
114
 				self.num2 += num
111
 				self.num2 += num
115
-				print('---append ', num)
116
 
112
 
117
 	def check_keys(self, o):
113
 	def check_keys(self, o):
118
 		_iter = 0
114
 		_iter = 0
157
 			_iter += 1
153
 			_iter += 1
158
 
154
 
159
 	def draw_main(self, o):
155
 	def draw_main(self, o):
160
-		print('drawing ', self.num1)
161
 		x_size = o.width / 4
156
 		x_size = o.width / 4
162
 		y_size = o.height / 5
157
 		y_size = o.height / 5
163
 		og_x = 0
158
 		og_x = 0
167
 		
162
 		
168
 		_id = 0
163
 		_id = 0
169
 		while _id < 20:
164
 		while _id < 20:
170
-			# lab = ""
171
-			# for i in self.labels[_id]:
172
-			# 	lab += i
173
-
165
+			
174
 			lab = self.labels[_id]
166
 			lab = self.labels[_id]
175
 
167
 
176
 			o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.blue)
168
 			o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.blue)
181
 			if _id % 4 == 0:
173
 			if _id % 4 == 0:
182
 				o_y -= y_size
174
 				o_y -= y_size
183
 				o_x = og_x
175
 				o_x = og_x
184
-		#o.draw.rectangle((0, 0, o.width, y_size), outline=0, fill=o.blue)
176
+
185
 		o.draw.rectangle((0, 0, x_size * 3, y_size), outline=0, fill=o.blue)
177
 		o.draw.rectangle((0, 0, x_size * 3, y_size), outline=0, fill=o.blue)
186
 		o.draw.rectangle((x_size * 3, 0, o.width, y_size), outline=0, fill=o.blue)
178
 		o.draw.rectangle((x_size * 3, 0, o.width, y_size), outline=0, fill=o.blue)
187
 		o.center_block("Clear", o.h2, [x_size * 3, 0, o.width, y_size], o.light_grey)
179
 		o.center_block("Clear", o.h2, [x_size * 3, 0, o.width, y_size], o.light_grey)
188
-		#o.center_block('where is my fucking text', o.h2, [0, 0, o.width, y_size], o.light_grey)
180
+
189
 		if self.num1 != '':
181
 		if self.num1 != '':
190
 			if self.result != '':
182
 			if self.result != '':
191
 				o.center_block(str(self.result), o.h2, [0, 0, x_size * 3, y_size], o.light_grey)
183
 				o.center_block(str(self.result), o.h2, [0, 0, x_size * 3, y_size], o.light_grey)
195
 				o.center_block(str(self.op), o.h2, [0, 0, x_size * 3, y_size], o.light_grey)
187
 				o.center_block(str(self.op), o.h2, [0, 0, x_size * 3, y_size], o.light_grey)
196
 			else:
188
 			else:
197
 				o.center_block(str(self.num1), o.h2, [0, 0, x_size * 3, y_size], o.light_grey)
189
 				o.center_block(str(self.num1), o.h2, [0, 0, x_size * 3, y_size], o.light_grey)
198
-			print('fucking do something')
190
+
199
 		else:
191
 		else:
200
-			print('num1 is empty')
192
+			pass
201
 		o.update_display(0)
193
 		o.update_display(0)
202
 
194
 
203
 	def ReceiveMessage(self, message):
195
 	def ReceiveMessage(self, message):

+ 1
- 9
lib/sDefender.py View File

20
 		super(Defender, self).__init__(FSM)    
20
 		super(Defender, self).__init__(FSM)    
21
 		
21
 		
22
 	def Enter(self):
22
 	def Enter(self):
23
-		o = self.FSM.owner 
24
-		
23
+		o = self.FSM.owner 		
25
 		self.gameFSM = FSM.DefenderFSM(o)
24
 		self.gameFSM = FSM.DefenderFSM(o)
26
-
27
 		super(Defender, self).Enter()        
25
 		super(Defender, self).Enter()        
28
 		
26
 		
29
 	def Execute(self):
27
 	def Execute(self):
33
 			m.draw_menu1(o)
31
 			m.draw_menu1(o)
34
 			o.update_display(0)
32
 			o.update_display(0)
35
 		elif o.keyState[16] == 4:
33
 		elif o.keyState[16] == 4:
36
-			#u.draw_header(o)
37
-			#self.draw_footer(o)
38
-			#self.draw_main(o)
39
-			#o.update_display(0)		
40
 			pass
34
 			pass
41
 
35
 
42
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
36
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
43
-
44
-		#if o.keyState[16] > 0:
45
 			pass
37
 			pass
46
 		else:
38
 		else:
47
 			self.gameFSM.Execute()
39
 			self.gameFSM.Execute()

+ 0
- 5
lib/sEnterText.py View File

99
 			u.draw_header(o)
99
 			u.draw_header(o)
100
 			self.draw(o)
100
 			self.draw(o)
101
 			o.update_display(0)
101
 			o.update_display(0)
102
-
103
-		# 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:
104
-		# 	u.draw_header(o)
105
-		# 	self.draw(o)
106
-		# 	o.update_display(0)	
107
 			
102
 			
108
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
103
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
109
 			pass
104
 			pass

+ 1
- 5
lib/sMain.py View File

33
 			u.draw_header(o)
33
 			u.draw_header(o)
34
 			self.draw_square()
34
 			self.draw_square()
35
 			u.text_box1(o, "Pat", str(o.curPattern))
35
 			u.text_box1(o, "Pat", str(o.curPattern))
36
-			#u.text_box1(o, "Vol", str(o.soundSlots[o.eSound].volume))
37
 			u.text_box2(o, "BPM", str(o.bpm))
36
 			u.text_box2(o, "BPM", str(o.bpm))
38
 			u.text_box4(o, "Bank", str(o.note_bank))
37
 			u.text_box4(o, "Bank", str(o.note_bank))
39
 			u.text_box3(o, "Pitch", str(o.soundSlots[o.eSound].pitch))
38
 			u.text_box3(o, "Pitch", str(o.soundSlots[o.eSound].pitch))
60
 		elif o.keyState[16] == 4:
59
 		elif o.keyState[16] == 4:
61
 			u.draw_header(o)
60
 			u.draw_header(o)
62
 			self.draw_square()
61
 			self.draw_square()
63
-			#u.text_box1(o, "Vol", str(o.soundSlots[o.eSound].volume))
64
 			u.text_box1(o, "Pat", str(o.curPattern))
62
 			u.text_box1(o, "Pat", str(o.curPattern))
65
 			u.text_box2(o, "BPM", str(o.bpm))
63
 			u.text_box2(o, "BPM", str(o.bpm))
66
 			u.text_box4(o, "Bank", str(o.note_bank))
64
 			u.text_box4(o, "Bank", str(o.note_bank))
74
 		elif o.keyState[17] == 4:
72
 		elif o.keyState[17] == 4:
75
 			u.draw_header(o)
73
 			u.draw_header(o)
76
 			self.draw_square()
74
 			self.draw_square()
77
-			#u.text_box1(o, "Vol", str(o.soundSlots[o.eSound].volume))
78
 			u.text_box1(o, "Pat", str(o.curPattern))
75
 			u.text_box1(o, "Pat", str(o.curPattern))
79
 			u.text_box2(o, "BPM", str(o.bpm))
76
 			u.text_box2(o, "BPM", str(o.bpm))
80
 			u.text_box4(o, "Bank", str(o.note_bank))
77
 			u.text_box4(o, "Bank", str(o.note_bank))
127
 			u.draw_header(o)            
124
 			u.draw_header(o)            
128
 			self.draw_square()   
125
 			self.draw_square()   
129
 			u.text_box1(o, "Pat", str(o.curPattern))
126
 			u.text_box1(o, "Pat", str(o.curPattern))
130
-			#u.text_box1(o, "SVol", str(o.soundSlots[o.eSound].volume))
131
 			u.text_box2(o, "BPM", str(o.bpm))
127
 			u.text_box2(o, "BPM", str(o.bpm))
132
 			u.text_box4(o, "Bank", str(o.note_bank))
128
 			u.text_box4(o, "Bank", str(o.note_bank))
133
 			u.text_box3(o, "Pitch", str(o.soundSlots[o.eSound].pitch))			         
129
 			u.text_box3(o, "Pitch", str(o.soundSlots[o.eSound].pitch))			         
134
 			o.update_display(0)
130
 			o.update_display(0)
131
+
135
 		if self.record_queue != []:
132
 		if self.record_queue != []:
136
 			cur_time = pygame.time.get_ticks()
133
 			cur_time = pygame.time.get_ticks()
137
 			note_pos = (cur_time - self.record_queue) - (o.half_bpm / 2)
134
 			note_pos = (cur_time - self.record_queue) - (o.half_bpm / 2)
151
 						o.soundSlots[o.eSound].notes[message[0]][message[1]][0] = 1
148
 						o.soundSlots[o.eSound].notes[message[0]][message[1]][0] = 1
152
 						o.soundSlots[o.eSound].notes[message[0]][message[1]][1] = o.note_vol
149
 						o.soundSlots[o.eSound].notes[message[0]][message[1]][1] = o.note_vol
153
 						o.undo_buf.append([o.eSound, message[0], message[1]])
150
 						o.undo_buf.append([o.eSound, message[0], message[1]])
154
-
155
 		self.record_queue = []
151
 		self.record_queue = []
156
 
152
 
157
 	def draw_square(self):
153
 	def draw_square(self):

+ 2
- 10
lib/sNewDir.py View File

95
 		elif o.keyState[17] == 4:
95
 		elif o.keyState[17] == 4:
96
 			u.draw_header(o)
96
 			u.draw_header(o)
97
 			self.draw(o)
97
 			self.draw(o)
98
-			o.update_display(0)
99
-
100
-		# 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:
101
-		# 	u.draw_header(o)
102
-		# 	self.draw(o)
103
-		# 	#self.draw_main(o)
104
-		# 	o.update_display(0)	
105
-			
98
+			o.update_display(0)			
106
 
99
 
107
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
100
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
108
 			pass
101
 			pass
165
 		o_x = og_x
158
 		o_x = og_x
166
 		o_y = o.height
159
 		o_y = o.height
167
 		text_padding = 6
160
 		text_padding = 6
168
-		
169
 		_id = 0
161
 		_id = 0
162
+		
170
 		while _id < 16:
163
 		while _id < 16:
171
 			lab = ""
164
 			lab = ""
172
 			for i in self.labels[_id]:
165
 			for i in self.labels[_id]:
174
 
167
 
175
 			if _id == 8:
168
 			if _id == 8:
176
 				lab = "_12"
169
 				lab = "_12"
177
-
178
 			o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.blue)
170
 			o.draw.rectangle((o_x, o_y, o_x + x_size, o_y - y_size), outline=0, fill=o.blue)
179
 			o.center_block(lab, o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
171
 			o.center_block(lab, o.h2, [o_x, o_y, o_x + x_size, o_y - y_size], o.light_grey)
180
 
172
 

+ 0
- 2
lib/sPing.py View File

45
 			self.draw_main(o)
45
 			self.draw_main(o)
46
 			o.update_display(0)	
46
 			o.update_display(0)	
47
 			
47
 			
48
-		
49
 	def draw_main(self, o):
48
 	def draw_main(self, o):
50
 		o.center_block(self.pinging, o.h2, [0, 0, o.width, o.height], o.light_grey)
49
 		o.center_block(self.pinging, o.h2, [0, 0, o.width, o.height], o.light_grey)
51
 
50
 
52
 	def check_ping(self):
51
 	def check_ping(self):
53
 		hostname = "8.8.8.8"
52
 		hostname = "8.8.8.8"
54
 		response = os.system("ping -c 1 " + hostname)
53
 		response = os.system("ping -c 1 " + hostname)
55
-		# and then check the response...
56
 		if response == 0:
54
 		if response == 0:
57
 			pingstatus = "Network Active "
55
 			pingstatus = "Network Active "
58
 		else:
56
 		else:

+ 1
- 6
lib/sSelTheme.py View File

36
 			_id = self.names.index(o.mconf['theme'])
36
 			_id = self.names.index(o.mconf['theme'])
37
 			self.cur_el = _id
37
 			self.cur_el = _id
38
 		else:
38
 		else:
39
-			print('nope ', o.mconf['theme'], ' - ', self.globbed)
39
+			pass
40
 		self.menu = self.names
40
 		self.menu = self.names
41
 
41
 
42
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
42
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
65
 			self.draw_footer(o)
65
 			self.draw_footer(o)
66
 			self.draw_main(o)
66
 			self.draw_main(o)
67
 			o.update_display(0)	
67
 			o.update_display(0)	
68
-			print('draw butt')				
69
 
68
 
70
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
69
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
71
 			pass
70
 			pass
77
 					o.save_config()
76
 					o.save_config()
78
 					o.load_config()
77
 					o.load_config()
79
 					o.apply_theme()
78
 					o.apply_theme()
80
-					print('cur el down is ', self.cur_el)
81
 
79
 
82
 			if o.keyState[1] == 1:
80
 			if o.keyState[1] == 1:
83
 				if self.cur_el < (len(self.menu) - 1):
81
 				if self.cur_el < (len(self.menu) - 1):
86
 					o.save_config()
84
 					o.save_config()
87
 					o.load_config()
85
 					o.load_config()
88
 					o.apply_theme()
86
 					o.apply_theme()
89
-					print('cur el up is ', self.cur_el)
90
-					print('loading theme ', self.menu[self.cur_el], '-- ', o.mconf['theme'])
91
 
87
 
92
 			if o.keyState[3] == 1:
88
 			if o.keyState[3] == 1:
93
 				m.util_command(self, o, self.menu[self.cur_el])
89
 				m.util_command(self, o, self.menu[self.cur_el])
150
 			xpos += width
146
 			xpos += width
151
 			_iter += 1
147
 			_iter += 1
152
 		
148
 		
153
-
154
 	def ReceiveMessage(self, message):
149
 	def ReceiveMessage(self, message):
155
 		o = self.FSM.owner 
150
 		o = self.FSM.owner 
156
 		u.play_seq(o, message)
151
 		u.play_seq(o, message)

+ 3
- 49
lib/sSelectFolder.py View File

33
 		files = u.get_files(o.song_dir, '.zzz')
33
 		files = u.get_files(o.song_dir, '.zzz')
34
 		files_trimmed = [os.path.basename(x) for x in files]
34
 		files_trimmed = [os.path.basename(x) for x in files]
35
 		files_trimmed = [os.path.splitext(x)[0] for x in files_trimmed]
35
 		files_trimmed = [os.path.splitext(x)[0] for x in files_trimmed]
36
-		print('files trimmed ', files_trimmed)
37
 		files_trimmed.insert(0, '..')
36
 		files_trimmed.insert(0, '..')
38
 		self.menu = files_trimmed
37
 		self.menu = files_trimmed
39
 		if '_blank' in self.menu:
38
 		if '_blank' in self.menu:
49
 		super(SelectFolder, self).Enter()    
48
 		super(SelectFolder, self).Enter()    
50
 
49
 
51
 	def Execute(self):
50
 	def Execute(self):
52
-
53
-		#print('doing select folder')
54
 		o = self.FSM.owner 
51
 		o = self.FSM.owner 
55
-		#u.draw_header(o)
56
-		#o.update_display(0)
57
 		m.menu1_actions(self, o)
52
 		m.menu1_actions(self, o)
58
 		if o.keyState[16] == 1:
53
 		if o.keyState[16] == 1:
59
 			m.draw_menu1(o)
54
 			m.draw_menu1(o)
74
 			u.draw_header(o)
69
 			u.draw_header(o)
75
 			self.draw_footer(o)
70
 			self.draw_footer(o)
76
 			self.draw_main(o)
71
 			self.draw_main(o)
77
-			o.update_display(0)	
78
-			
72
+			o.update_display(0)				
79
 
73
 
80
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
74
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
81
-
82
 			pass
75
 			pass
83
 		else:
76
 		else:
84
 			u.scroll_ud(o, self)
77
 			u.scroll_ud(o, self)
85
-			# if o.keyState[0] == 1:
86
-			# 	if self.cur_el > 0:
87
-			# 		self.cur_el -= 1
88
-			# 		print('cur el down is ', self.cur_el)
89
-
90
-			# if o.keyState[1] == 1:
91
-			# 	if self.cur_el < (len(self.menu) - 1):
92
-			# 		self.cur_el += 1
93
-			# 		print('cur el up is ', self.cur_el)
94
 
78
 
95
 			if o.keyState[2] == 1:
79
 			if o.keyState[2] == 1:
96
-				print('old song dir is ', o.song_dir)
97
-				print('new song dir is ', self.menu[self.cur_el])
98
 				self.FSM.ToTransition('toEnterText')
80
 				self.FSM.ToTransition('toEnterText')
99
 
81
 
100
 			if o.keyState[3] == 1:
82
 			if o.keyState[3] == 1:
101
 				if self.menu[self.cur_el] == '..':
83
 				if self.menu[self.cur_el] == '..':
102
-					print('move up dir')
103
 					if o.song_dir == o.base_song_dir:
84
 					if o.song_dir == o.base_song_dir:
104
 						pass
85
 						pass
105
 					else:
86
 					else:
106
-						print('old song dir ', o.song_dir)
107
 						o.song_dir = os.path.dirname(os.path.dirname(o.song_dir))
87
 						o.song_dir = os.path.dirname(os.path.dirname(o.song_dir))
108
 						o.song_dir += '/'
88
 						o.song_dir += '/'
109
-						print('new song dir ', o.song_dir)
110
 						files = u.get_files(o.song_dir, '.zzz')
89
 						files = u.get_files(o.song_dir, '.zzz')
111
 						files_trimmed = [os.path.basename(x) for x in files]
90
 						files_trimmed = [os.path.basename(x) for x in files]
112
 						files_trimmed = [os.path.splitext(x)[0] for x in files_trimmed]
91
 						files_trimmed = [os.path.splitext(x)[0] for x in files_trimmed]
113
-						print('files trimmed ', files_trimmed)
114
 						files_trimmed.insert(0, '..')
92
 						files_trimmed.insert(0, '..')
115
 						self.menu = files_trimmed
93
 						self.menu = files_trimmed
116
 						if '_blank' in self.menu:
94
 						if '_blank' in self.menu:
123
 
101
 
124
 				elif os.path.isdir(o.song_dir + self.menu[self.cur_el]):
102
 				elif os.path.isdir(o.song_dir + self.menu[self.cur_el]):
125
 					o.song_dir += self.menu[self.cur_el] + '/'
103
 					o.song_dir += self.menu[self.cur_el] + '/'
126
-					print('new song dir is ', o.song_dir)
127
-					
128
 					files = u.get_files(o.song_dir, '.zzz')
104
 					files = u.get_files(o.song_dir, '.zzz')
129
 					files_trimmed = [os.path.basename(x) for x in files]
105
 					files_trimmed = [os.path.basename(x) for x in files]
130
 					files_trimmed = [os.path.splitext(x)[0] for x in files_trimmed]
106
 					files_trimmed = [os.path.splitext(x)[0] for x in files_trimmed]
131
-					print('files trimmed ', files_trimmed)
132
 					files_trimmed.insert(0, '..')
107
 					files_trimmed.insert(0, '..')
133
 					self.menu = files_trimmed
108
 					self.menu = files_trimmed
134
 					if '_blank' in self.menu:
109
 					if '_blank' in self.menu:
135
 						self.menu.remove('_blank')
110
 						self.menu.remove('_blank')
136
 					u.draw_header(o)
111
 					u.draw_header(o)
137
-					
138
 					self.draw_footer(o)
112
 					self.draw_footer(o)
139
 					self.draw_main(o)
113
 					self.draw_main(o)
140
 					o.update_display(0)			
114
 					o.update_display(0)			
141
-
142
 				else:
115
 				else:
143
 					pass
116
 					pass
144
-					#o.mconf['default_song'] = self.menu[self.cur_el]
145
-					#o.save_config()
146
-					#o.load_song()
147
 
117
 
148
 	def draw_main(self, o):
118
 	def draw_main(self, o):
149
 		al = []
119
 		al = []
150
 		ypos = 30
120
 		ypos = 30
151
 
121
 
152
-
153
 		if self.cur_el > (len(self.menu) - 1):
122
 		if self.cur_el > (len(self.menu) - 1):
154
 			self.cur_el = 0
123
 			self.cur_el = 0
155
 		if self.cur_el == 0:
124
 		if self.cur_el == 0:
159
 					al.append(self.menu[_iter])
128
 					al.append(self.menu[_iter])
160
 				_iter += 1
129
 				_iter += 1
161
 
130
 
162
-		# print('cur el ', self.cur_el)
163
-		# if self.cur_el > (len(self.menu) - 1):
164
-		# 	self.cur_el = 0
165
-		# if self.cur_el == 0:
166
-		# 	_iter = 0
167
-		# 	while _iter < 4:
168
-		# 		if _iter < (len(self.menu)):
169
-		# 			al.append(self.menu[_iter])
170
-				
171
-		#		_iter += 1
172
 		elif self.cur_el == 1:
131
 		elif self.cur_el == 1:
173
 			al.append(self.menu[self.cur_el - 1])
132
 			al.append(self.menu[self.cur_el - 1])
174
 			al.append(self.menu[self.cur_el])
133
 			al.append(self.menu[self.cur_el])
193
 		for i in al:
152
 		for i in al:
194
 			
153
 			
195
 			if i == self.menu[self.cur_el]:
154
 			if i == self.menu[self.cur_el]:
196
-			#if _iter == self.cur_el:
197
 				if os.path.isdir(o.song_dir + i):
155
 				if os.path.isdir(o.song_dir + i):
198
 					i += "/"
156
 					i += "/"
199
 				o.draw.rectangle((0, ypos, o.width, ypos + 20), outline=0, fill=o.light_grey)
157
 				o.draw.rectangle((0, ypos, o.width, ypos + 20), outline=0, fill=o.light_grey)
220
 				o.draw.rectangle((xpos, yposa, xpos + width, yposb), outline=0, fill=o.light_grey)
178
 				o.draw.rectangle((xpos, yposa, xpos + width, yposb), outline=0, fill=o.light_grey)
221
 				o.center_block(opts[_iter], o.h2, [xpos,yposa,xpos + width,yposb], o.blue)
179
 				o.center_block(opts[_iter], o.h2, [xpos,yposa,xpos + width,yposb], o.blue)
222
 			else:
180
 			else:
223
-				o.center_block(opts[_iter], o.h2, [xpos,yposa,xpos + width,yposb], o.light_grey)
224
-			
181
+				o.center_block(opts[_iter], o.h2, [xpos,yposa,xpos + width,yposb], o.light_grey)			
225
 			xpos += width
182
 			xpos += width
226
 			_iter += 1
183
 			_iter += 1
227
 		
184
 		
228
-
229
 	def ReceiveMessage(self, message):
185
 	def ReceiveMessage(self, message):
230
 		o = self.FSM.owner 
186
 		o = self.FSM.owner 
231
 		u.play_seq(o, message)
187
 		u.play_seq(o, message)
232
 		
188
 		
233
 	def Exit(self):
189
 	def Exit(self):
234
-		print('why the fuck are we leaving')
235
-		self.FSM.owner.pub.unregister("beat", self)
236
-
190
+		self.FSM.owner.pub.unregister("beat", self)

+ 1
- 18
lib/sSelectPattern.py View File

80
 					if k == 1:
80
 					if k == 1:
81
 						if o.pat_perf:
81
 						if o.pat_perf:
82
 							this = o.ePattern = (o.pat_bank * 16) +_id 
82
 							this = o.ePattern = (o.pat_bank * 16) +_id 
83
-							#print('we should play ', this)	
84
 							o.song = [this]
83
 							o.song = [this]
85
 							o.songCycle = cycle(o.song)
84
 							o.songCycle = cycle(o.song)
86
 							o.songStart = this
85
 							o.songStart = this
87
 							if not o.playing:
86
 							if not o.playing:
88
-								
89
-								
90
 								o.start_playback()
87
 								o.start_playback()
91
 								u.play_seq(o, [o.curPattern, 0])
88
 								u.play_seq(o, [o.curPattern, 0])
92
 						o.ePattern = (o.pat_bank * 16) +_id 
89
 						o.ePattern = (o.pat_bank * 16) +_id 
93
-
94
 						u.draw_header(o)
90
 						u.draw_header(o)
95
 						self.draw_square()
91
 						self.draw_square()
96
-						
97
 						u.text_box1(o, "Pat", str(o.ePattern))
92
 						u.text_box1(o, "Pat", str(o.ePattern))
98
 						u.text_box4(o, "Bank", str(o.pat_bank))
93
 						u.text_box4(o, "Bank", str(o.pat_bank))
99
 						o.update_display(0)
94
 						o.update_display(0)
113
 				u.text_box1(o, "Pat", str(o.ePattern))
108
 				u.text_box1(o, "Pat", str(o.ePattern))
114
 				u.text_box4(o, "Bank", str(o.pat_bank))
109
 				u.text_box4(o, "Bank", str(o.pat_bank))
115
 				o.update_display(0)
110
 				o.update_display(0)
116
-			# if o.pat_odub:
117
-			# 	print('add to record queue ', o.song[0])
118
-			# else:
119
-			# 	print('not recording')
120
-		#print(message)
121
 		if o.pat_odub:
111
 		if o.pat_odub:
122
 			if message[1] == 0:
112
 			if message[1] == 0:
123
 				if len(o.song) > 0:
113
 				if len(o.song) > 0:
124
-					#print('adding to rec', o.song[0])
125
 					o.song_in.append(o.song[0])
114
 					o.song_in.append(o.song[0])
126
-					#print('adding to song_in ', o.song_in)
127
 
115
 
128
 	def draw_square(self):
116
 	def draw_square(self):
129
 		o = self.FSM.owner 
117
 		o = self.FSM.owner 
166
 	def Exit(self):
154
 	def Exit(self):
167
 		o = self.FSM.owner 
155
 		o = self.FSM.owner 
168
 		o.pub.unregister("beat", self)
156
 		o.pub.unregister("beat", self)
169
-		# if len(o.song) < 1 and len(o.pat_buf) > 0:
170
-		# 	o.song = o.pat_buf
171
-		# 	o.pat_buf = []
172
 		o.pat_perf = False
157
 		o.pat_perf = False
173
-		
174
 		o.song = o.pat_buf
158
 		o.song = o.pat_buf
175
 		o.pat_buf = []
159
 		o.pat_buf = []
176
 		o.songCycle = cycle(o.song)
160
 		o.songCycle = cycle(o.song)
177
-		o.songStart = o.song[0]
178
-		#print('song is ', o.song)
161
+		o.songStart = o.song[0]

+ 0
- 1
lib/sShutdown.py View File

28
 		o.draw.rectangle((0, 0, o.width, o.height), outline=0, fill=o.blue)			
28
 		o.draw.rectangle((0, 0, o.width, o.height), outline=0, fill=o.blue)			
29
 		o.center_block("shutting down", o.h2, [0, 0, o.width,o.height - 20], o.light_grey)
29
 		o.center_block("shutting down", o.h2, [0, 0, o.width,o.height - 20], o.light_grey)
30
 		o.center_block("(unplug in 20s)", o.h2, [0, 10, o.width,o.height+10], o.light_grey)
30
 		o.center_block("(unplug in 20s)", o.h2, [0, 10, o.width,o.height+10], o.light_grey)
31
-		#o.center_block("thank you for playing", o.h2, [0, 30, o.width,o.height+30], o.light_grey)
32
 		o.update_display(0)
31
 		o.update_display(0)
33
 		command = 'bash -c "sleep 5; sudo shutdown -h now"&'
32
 		command = 'bash -c "sleep 5; sudo shutdown -h now"&'
34
 		os.system(command)
33
 		os.system(command)

+ 1
- 3
lib/sUtil.py View File

33
 			self.draw_footer(o)
33
 			self.draw_footer(o)
34
 			self.draw_main(o)
34
 			self.draw_main(o)
35
 			o.update_display(0)
35
 			o.update_display(0)
36
-
37
 		super(Util, self).Enter()        
36
 		super(Util, self).Enter()        
38
 		
37
 		
39
 	def Execute(self):
38
 	def Execute(self):
52
 			u.draw_header(o)
51
 			u.draw_header(o)
53
 			self.draw_footer(o)
52
 			self.draw_footer(o)
54
 			self.draw_main(o)
53
 			self.draw_main(o)
55
-			o.update_display(0)	
56
-			print('draw butt')				
54
+			o.update_display(0)					
57
 
55
 
58
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
56
 		if o.keyState[16] > 0 or o.keyState[17] > 0:
59
 			pass
57
 			pass

+ 1
- 32
lib/utils.py View File

14
 		if s.notes[message[0]][message[1]][0] == 1:
14
 		if s.notes[message[0]][message[1]][0] == 1:
15
 			if o.erase:
15
 			if o.erase:
16
 				if _id in o.erase_buf:
16
 				if _id in o.erase_buf:
17
-					#pass
18
 					s.notes[message[0]][message[1]][0] = 0
17
 					s.notes[message[0]][message[1]][0] = 0
19
-					print('erasing')
20
-					#o.undo_buf.append(s.notes[message[0]][message[1]][0])
21
 				else:
18
 				else:
22
 					o.notes_on[_id] = 1
19
 					o.notes_on[_id] = 1
23
 					o.soundSlots[_id].play(s.notes[message[0]][message[1]][1])
20
 					o.soundSlots[_id].play(s.notes[message[0]][message[1]][1])
24
 			elif o.mute:
21
 			elif o.mute:
25
 				if _id in o.mute_buf:
22
 				if _id in o.mute_buf:
26
-					#pass
27
-					#s.notes[message[0]][message[1]][0] = 0
28
-					print('muting')
29
-					#o.undo_buf.append(s.notes[message[0]][message[1]][0])
23
+					pass					
30
 				else:
24
 				else:
31
 					o.notes_on[_id] = 1
25
 					o.notes_on[_id] = 1
32
 					o.soundSlots[_id].play(s.notes[message[0]][message[1]][1])
26
 					o.soundSlots[_id].play(s.notes[message[0]][message[1]][1])
33
 			else:
27
 			else:
34
-
35
 				o.notes_on[_id] = 1
28
 				o.notes_on[_id] = 1
36
 				o.soundSlots[_id].play(s.notes[message[0]][message[1]][1])
29
 				o.soundSlots[_id].play(s.notes[message[0]][message[1]][1])
37
 		_id += 1
30
 		_id += 1
38
 
31
 
39
 def erase_note(o, message, pressed):
32
 def erase_note(o, message, pressed):
40
 	_id = 0
33
 	_id = 0
41
-	#o.clear_notes_on()
42
-
43
 	for s in o.soundSlots:
34
 	for s in o.soundSlots:
44
 		if s.notes[message[0]][message[1]][0] == 1:
35
 		if s.notes[message[0]][message[1]][0] == 1:
45
 			o.notes_on[_id] = 1
36
 			o.notes_on[_id] = 1
46
 			o.soundSlots[_id].play(s.notes[message[0]][message[1]][1])
37
 			o.soundSlots[_id].play(s.notes[message[0]][message[1]][1])
47
 		_id += 1
38
 		_id += 1
48
-
49
 			
39
 			
50
 def text_box1(o, a, b):
40
 def text_box1(o, a, b):
51
 	w1 = 0
41
 	w1 = 0
88
 	o.center_block(a, o.h1, [w1,h1,w2,h2], o.light_grey)
78
 	o.center_block(a, o.h1, [w1,h1,w2,h2], o.light_grey)
89
 	o.center_block(b, o.h1, [w1,h1+20,w2,h2+45], o.light_grey)
79
 	o.center_block(b, o.h1, [w1,h1+20,w2,h2+45], o.light_grey)
90
 
80
 
91
-
92
-
93
 def breakup_song_text(song):
81
 def breakup_song_text(song):
94
 	line1 = ""
82
 	line1 = ""
95
 	line2 = ""
83
 	line2 = ""
151
 def get_folders(path):
139
 def get_folders(path):
152
 	globbed = glob.glob(path + "/*/")
140
 	globbed = glob.glob(path + "/*/")
153
 	globbed.sort()
141
 	globbed.sort()
154
-
155
-
156
-		# dirs = os.listdir(o.load_sound_dir)
157
-		# dirs.sort()
158
-		# for i in dirs:
159
-		# 	if os.path.isdir(o.load_sound_dir + i):
160
-		# 		i += "/asdfasdfasf"
161
-		# 		print(i, ' is a directory')
162
-		# 	else:
163
-		# 		print(i, ' is not a directory')
164
-		# print(dirs)
165
-		# return dirs
166
-
167
-
168
-
169
 	return globbed
142
 	return globbed
170
 
143
 
171
 def get_files(path, ext):
144
 def get_files(path, ext):
173
 	out = []
146
 	out = []
174
 	files = os.listdir(path)
147
 	files = os.listdir(path)
175
 	files.sort()
148
 	files.sort()
176
-	print('from utils ', files)
177
 	for file in files:
149
 	for file in files:
178
 	    if os.path.isdir(path + file):
150
 	    if os.path.isdir(path + file):
179
 	        out.append(file)
151
 	        out.append(file)
180
 	    else:
152
 	    else:
181
 	    	pass
153
 	    	pass
182
-
183
 	for file in files:
154
 	for file in files:
184
 	    if file.lower().endswith(ext):
155
 	    if file.lower().endswith(ext):
185
 	    	if os.path.isdir(path + file):
156
 	    	if os.path.isdir(path + file):
188
 	        	out.append(file)
159
 	        	out.append(file)
189
 	    else:	 
160
 	    else:	 
190
 	    	pass
161
 	    	pass
191
-	
192
 	out2 = []
162
 	out2 = []
193
 	for f in out:
163
 	for f in out:
194
 		if f[0] == '.':
164
 		if f[0] == '.':
195
 			pass
165
 			pass
196
 		else:
166
 		else:
197
 			out2.append(f)
167
 			out2.append(f)
198
-
199
 	return out2
168
 	return out2
200
 
169
 
201
 def scroll_ud(o, self):
170
 def scroll_ud(o, self):

BIN
user/sounds/drum_machines/Roland_CR-1000/.goutputstream-FH11C1 View File


Loading…
Cancel
Save