-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
127 lines (109 loc) · 3.49 KB
/
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
#!/usr/bin/env python3
# Imports
from sys import exit
import pygame
import random
from kivymd.app import MDApp
from kivymd.uix.screen import MDScreen
from kivymd.uix.label import MDLabel
from kivymd.uix.dialog import MDDialog
from kivymd.uix.toolbar.toolbar import MDTopAppBar
from kivymd.uix.slider.slider import MDSlider
from kivymd.uix.button import MDIconButton, MDFlatButton
from kivy.clock import Clock
pygame.mixer.init()
# App Class
class AaughApp(MDApp):
# Opens Github Dialog
def githubOpen(self, *args):
self.Github.open()
# Closes Github Dialog
def githubClose(self, *args):
self.Github.dismiss(force=True)
# Updater
def update(self, *args):
value = int(self.Slider.value)
chnl = random.randint(0,6)
self.Text.text = f"Current Value = {str(value).rjust(5)}"
if value == 0:
pass
elif value == 1:
channel = pygame.mixer.Channel(chnl)
punch = pygame.mixer.Sound(f"Samples/{1}.wav")
channel.play(punch)
else:
channel = pygame.mixer.Channel(chnl)
punch = pygame.mixer.Sound(f"Samples/{value//2}.wav")
channel.play(punch)
# Build method
def build(self):
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = "Orange"
# Home Screen
home = MDScreen()
# Top Toolbar
self.Toolbar = MDTopAppBar(
opposite_colors = True,
title = "Aaaaaaaugh",
pos_hint = {"top": 1},
right_action_items = [
["close-thick", lambda _: exit()]
]
)
# Slider
self.Slider = MDSlider(
size_hint = (.5, .5),
pos_hint = {"center_x": 0.5, "center_y": 0.5},
show_off = True,
value = "0",
step = 2
)
# Text Label
self.Text = MDLabel(
font_style= "H6",
text = "Current Value = 0",
theme_text_color = "Custom",
text_color = "orange",
halign = "center",
size_hint = (0.5, 0.5),
pos_hint = {"center_x": 0.5, "center_y": 0.8},
)
# Github Dialog
self.Github = MDDialog(
title = "Developers",
text = "NetworkDeus: https://github.com/NetworkDeus\nKourva: https://github.com/Kourva",
buttons = [
MDFlatButton(
text = "Close",
theme_text_color = "Custom",
text_color = "orange",
on_press = self.githubClose
)
]
)
self.LIcon = MDIconButton(
icon="emoticon-poop",
theme_text_color = "Custom",
text_color = "orange",
pos_hint={"center_x": 0.22, "center_y": 0.5},
on_press = self.githubOpen
)
self.RIcon = MDIconButton(
icon="emoticon-poop",
theme_text_color = "Custom",
text_color = "orange",
pos_hint={"center_x": 0.78, "center_y": 0.5},
on_press = self.githubOpen
)
# Updater
Clock.schedule_interval(lambda _:self.update(self.Text, self.Slider), .01)
# Add widgets
home.add_widget(self.Toolbar)
home.add_widget(self.Slider)
home.add_widget(self.LIcon)
home.add_widget(self.RIcon)
home.add_widget(self.Text)
# Return home
return home
# Run
AaughApp().run()