Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.core.audio import SoundLoader
- from kivy.factory import Factory
- from kivy.core.window import Window
- from kivy.properties import StringProperty, ObjectProperty
- from kivy.uix.label import Label
- from kivy.uix.popup import Popup
- from kivy.uix.screenmanager import ScreenManager, Screen,WipeTransition,RiseInTransition
- from kivy.uix.widget import Widget
- from kivymd.app import MDApp
- from kivymd.uix.button import MDFlatButton
- from kivymd.uix.dialog import MDDialog
- from kivymd.uix.menu import MDDropdownMenu
- from kivymd.uix.picker import MDThemePicker
- from kivymd.uix.boxlayout import MDBoxLayout
- from kivymd.uix.bottomsheet import MDListBottomSheet
- from kivymd.toast import toast
- from kivy.animation import Animation
- import os
- from kivy.clock import Clock
- from kivy.uix.recycleview import RecycleView
- from kivymd.uix.list import TwoLineAvatarIconListItem
- from kivy.properties import ListProperty
- from kivymd.uix.textfield import MDTextField
- from kivy.uix.behaviors import ToggleButtonBehavior
- from kivy.uix.image import Image
- from kivy.uix.scrollview import ScrollView
- Window.size=470,700
- class AnimScrollView(ScrollView):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- time=170
- self.anim = Animation(scroll_y=0, duration=time) + Animation(scroll_y=1, duration=5)
- self.anim.repeat = True
- def animate_scroll(self, toggle_state):
- if toggle_state == 'down':
- self.anim.start(self)
- else:
- self.anim.stop(self)
- class PlayButton(ToggleButtonBehavior, Image):
- def __init__(self, **kwargs):
- super(PlayButton, self).__init__(**kwargs)
- self.source = 'play icon.png'
- self.background_color=1,1,0,1
- def on_state(self, widget, value):
- if value == 'down':
- self.source = 'Pause-Button.png'
- self.sound=SoundLoader.load('piano/holy.mp3')
- self.sound.play()
- toast('playing.....')
- #self.sound.loop=True
- else:
- self.source = 'play icon.png'
- toast('stoped')
- self.sound.stop()
- class PlayButton2(ToggleButtonBehavior, Image):
- def __init__(self, **kwargs):
- super(PlayButton2, self).__init__(**kwargs)
- self.source = 'play icon.png'
- self.background_color=1,1,0,1
- def on_state(self, widget, value):
- if value == 'down':
- self.source = 'Pause-Button.png'
- self.sound=SoundLoader.load('piano/katukusute.mp3')
- self.sound.play()
- toast('playing.....')
- else:
- self.source = 'play icon.png'
- toast('stoped')
- self.sound.stop()
- class PlayButton3(ToggleButtonBehavior, Image):
- def __init__(self, **kwargs):
- super(PlayButton3, self).__init__(**kwargs)
- self.source = 'play icon.png'
- self.background_color=1,1,0,1
- def on_state(self, widget, value):
- if value == 'down':
- self.source = 'Pause-Button.png'
- self.sound=SoundLoader.load('piano/mumaaso ga yesu.mp3')
- self.sound.play()
- toast('playing.....')
- else:
- self.source = 'play icon.png'
- toast('stoped')
- self.sound.stop()
- class PlayButton4(ToggleButtonBehavior, Image):
- def __init__(self, **kwargs):
- super(PlayButton4, self).__init__(**kwargs)
- self.source = 'play icon.png'
- self.background_color=1,1,0,1
- def on_state(self, widget, value):
- if value == 'down':
- self.source = 'Pause-Button.png'
- self.sound=SoundLoader.load('piano/4.mp3')
- self.sound.play()
- toast('playing.....')
- else:
- self.source = 'play icon.png'
- toast('stoped')
- self.sound.stop()
- class RV(RecycleView):
- def on_kv_post(self, base_widget):
- self.init_data()
- def init_data(self):
- # initialize the data for the recycleview
- self.ennyimba=[
- "Gw'oli Mutukuvu","Ka Tukusuute Omulokozi Waffe ",'Mumaaso ga Yesu','Tusinze Nnyo Erinnya Lye',
- 'Tumusinze Mukama Waffe',"Mwe Amawanga Ag'oku Nsi",'Mukama Gwe Kifo kyaffe','Okukaaba Kwange Owulire',
- 'Gwe Eyanunula','Jjangu Yesu Obe Mu Nze','Bonna basuute Mukama',"Twebaza gwe omuva byonna","Yesu wasuubiza ffe abantu bo","Ka ntambule naawe Yesu",
- "Yesu alifuga wonna wonna","Nkwetaaga ayi Mukama","Si nze, naye Kristo"
- ]
- self.data = [{'text': f'{i}'} for i in self.ennyimba]
- def search_rv(self, text):
- if not text:
- self.init_data()
- else:
- self.data = [x for x in self.data if text in x['text']]
- class Search_Select_Option(TwoLineAvatarIconListItem):
- pass
- class Searchin(Screen,RV):
- pass
- class ScreenManager(ScreenManager):
- def __init__(self,**kwargs):
- super(screenmanager).__init__(**kwargs)
- self.transition=RiseInTransition()
- class HomeScreen(Screen):
- def on_start(self,instance):
- self.dropdown_list=[
- { "viewclass":"OneLineListItem",
- "text":"contact",
- "on_release":lambda x ="contact":self.contact_callback()
- },
- {
- "viewclass": "OneLineListItem",
- "text": "Color Theme",
- "on_release": lambda x="Color Theme": self.themeshow()
- },
- {
- "viewclass": "OneLineListItem",
- "text": "About",
- "on_release": lambda x="About": self.about_callback()
- },
- {
- "viewclass": "OneLineListItem",
- "text": "Exite",
- "on_release": lambda x="Exite": EnnyimbaApp().stop()
- },
- {
- "viewclass": "OneLineListItem",
- "text": "Close",
- "on_release": lambda x="Close": self.dropdown.dismiss()
- }
- ]
- self.dropdown=MDDropdownMenu(
- items=self.dropdown_list,
- width_mult=3,
- background_color=(1,.4,0,1),
- )
- self.dropdown.caller=instance
- self.dropdown.open()
- def themeshow(self):
- t=MDThemePicker()
- t.open()
- def contact_callback(self):
- dialog=ObjectProperty(None)
- self.dialog = MDDialog(
- title="Contact:",
- type="custom",
- size_hint=[.4,.3],
- text="Contact the developer: "
- " Email: samueljevix234@gmail.com "
- " mobile: +256754045576",
- buttons=[
- MDFlatButton(
- text="OK"
- ),
- ],
- )
- self.dialog.open()
- def about_callback(self):
- #print("about my app")
- self.dialog = MDDialog(
- title="About:",
- size_hint=[.4, .3],
- type="custom",
- text="This is Ennyimba Za Kkristo "
- " version: 2.0.0"
- " Origin:Uganda(Buganda)"
- " By Lugya samuel jevix.",
- buttons=[
- MDFlatButton(
- text="OK"
- ),
- ],
- )
- self.dialog.open()
- def theme_callback(self):
- print("theme")
- def button_pressed(self, button):
- gt5 = self.ids.label.text
- if gt5 == '0':
- self.ids.label.text = ''
- self.ids.label.text = f'{button}'
- else:
- self.ids.label.text = f'{gt5}'f'{button}'
- def go_button(self):
- gt5 = self.ids.label.text
- try:
- if self.ids.label.text=='1':
- self.manager.current="Gw'oli Mutukuvu"
- if self.ids.label.text=='2':
- self.manager.current="Ka Tukusuute Omulokozi Waffe "
- if self.ids.label.text=='3':
- self.manager.current="Mumaaso ga Yesu"
- if self.ids.label.text=='4':
- self.manager.current="Tusinze Nnyo Erinnya Lye"
- if self.ids.label.text=='5':
- self.manager.current="Tumusinze Mukama Waffe"
- if self.ids.label.text=='6':
- self.manager.current="Mwe Amawanga Ag'oku Nsi"
- if self.ids.label.text=='7':
- self.manager.current='Mukama Gwe Kifo kyaffe'
- if self.ids.label.text=='8':
- self.manager.current="Okukaaba Kwange Owulire"
- if self.ids.label.text=='9':
- self.manager.current="Gwe Eyanunula"
- if self.ids.label.text=='10':
- self.manager.current="Jjangu Yesu Obe Mu Nze"
- if self.ids.label.text=='11':
- self.manager.current="Bonna basuute Mukama"
- if self.ids.label.text=='12':
- self.manager.current="Twebaza gwe omuva byonna"
- if self.ids.label.text=='13':
- self.manager.current="Yesu wasuubiza ffe abantu bo"
- if self.ids.label.text=='14':
- self.manager.current="Ka ntambule naawe Yesu"
- if self.ids.label.text=='15':
- self.manager.current="Yesu alifuga wonna wonna"
- if self.ids.label.text=='16':
- self.manager.current="Nkwetaaga ayi Mukama"
- if self.ids.label.text=='17':
- self.manager.current="Si nze, naye Kristo"
- except:
- self.ids.label.text="Not found"
- self.ids.label.text=""
- def remove(self):
- gt5 = self.ids.label.text
- gt5=gt5[:-1]
- self.ids.label.text=gt5
- def searchrecycle(self):
- self.manager.current='searchscreen'
- class MainInterface1(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- if self.ids.play.state=='down':
- self.ids.play.sound.stop()
- self.ids.play.source = 'play icon.png'
- def callback(self):
- self.manager.current=(str(0))
- if self.ids.play.state=='down':
- self.ids.play.sound.stop()
- self.ids.play.source = 'play icon.png'
- class MainInterface2(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- if self.ids.play2.state=='down':
- self.ids.play2.sound.stop()
- self.ids.play2.source = 'play icon.png'
- def callback(self):
- self.manager.current=(str(0))
- if self.ids.play2.state=='down':
- self.ids.play2.sound.stop()
- self.ids.play2.source = 'play icon.png'
- class MainInterface3(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- if self.ids.play3.state=='down':
- self.ids.play3.sound.stop()
- self.ids.play3.source = 'play icon.png'
- def callback(self):
- self.manager.current=(str(0))
- if self.ids.play3.state=='down':
- self.ids.play3.sound.stop()
- self.ids.play3.source = 'play icon.png'
- class MainInterface4(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- if self.ids.play4.state=='down':
- self.ids.play4.sound.stop()
- self.ids.play4.source = 'play icon.png'
- def callback(self):
- self.manager.current=(str(0))
- if self.ids.play4.state=='down':
- self.ids.play4.sound.stop()
- self.ids.play4.source = 'play icon.png'
- class MainInterface5(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface6(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface7(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface8(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface9(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface10(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface11(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface12(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface13(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface14(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface15(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface16(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class MainInterface17(Screen):
- def searchrecycle(self):
- self.manager.current='searchscreen'
- def callback(self):
- self.manager.current=(str(0))
- class EnnyimbaApp(MDApp):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- self.screens = iter(
- [
- MainInterface1, MainInterface2, MainInterface3, MainInterface4, MainInterface5, MainInterface6, MainInterface7,
- MainInterface8,MainInterface9,MainInterface10,Searchin,MainInterface11,MainInterface12,MainInterface13,MainInterface14,MainInterface15,MainInterface16,
- MainInterface17
- ])
- def build(self):
- self.theme_cls.theme_style = 'Light'
- self.theme_cls.primary_palette="Amber" #['Red', 'Pink', 'Purple', 'DeepPurple', 'Indigo', 'Blue', 'LightBlue', 'Cyan', 'Teal', 'Green', 'LightGreen', 'Lime', '', 'Amber', 'Orange', 'DeepOrange', 'Brown', 'Gray', 'BlueGray']
- self.theme_cls.accent_hue='400'
- self.title='Ennyimbs za Kkristo'
- self.theme_cls.accent_palette='Amber'
- self.icon='sda1.jpg'
- Window.borderless=True
- def on_start(self):
- Clock.schedule_once(self.load_screens, 1)
- def load_screens(self, dt):
- for s in self.screens:
- # instance and add Screen
- self.root.add_widget(s())
- Clock.schedule_once(self.load_screens)
- print(f'Screen {s} loaded')
- return
- def bottom(self):
- print('bottom')
- EnnyimbaApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement