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,ListProperty
- from kivy.uix.label import Label
- from kivy.uix.button import Button
- 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.toast import toast
- from kivy.animation import Animation
- from kivy.clock import Clock
- from kivy.uix.recycleview import RecycleView
- from kivymd.uix.list import TwoLineAvatarIconListItem
- from kivy.uix.behaviors import ToggleButtonBehavior
- from kivy.uix.image import Image
- from kivymd.uix.gridlayout import MDGridLayout
- from kivy.uix.scrollview import ScrollView
- Window.size=470,750
- class AnimScrollView(ScrollView):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- time=150
- self.anim = Animation(scroll_y=0, duration=time) + Animation(scroll_y=1, duration=5)
- self.anim.repeat = True
- def animate_scroll(self):
- self.anim.start(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 FontStylescontent(MDGridLayout):
- pass
- 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":'1',"Ka Tukusuute Omulokozi Waffe ":'2','Mumaaso ga Yesu':'3','Tusinze Nnyo Erinnya Lye':'4',
- 'Tumusinze Mukama Waffe':'5',"Mwe Amawanga Ag'oku Nsi":'6','Mukama Gwe Kifo kyaffe':'7','Okukaaba Kwange Owulire':'8',
- 'Gwe Eyanunula':'9','Jjangu Yesu Obe Mu Nze':'10','Bonna basuute Mukama':'11',"Twebaza gwe omuva byonna":'12',"Yesu wasuubiza ffe abantu bo":'13',"Ka ntambule naawe Yesu":'14',
- "Yesu alifuga wonna wonna":'15',"Nkwetaaga ayi Mukama":'16',"Si nze, naye Kristo":'17'
- }
- 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.capitalize() in x['text']]
- class Search_Select_Option(TwoLineAvatarIconListItem):
- def loadhymn(self,text):
- try:
- app = MDApp.get_running_app()
- app.root.get_screen('content').ids.labelhymn.text = self.get_hymn_text3()
- app.root.current = 'content'
- except:
- pass
- #self.ids.label.text=""
- def get_hymn_text3(self):
- self.hymns = {"Gw'oli Mutukuvu": {'tittle':"Gw'oli mutukuvu",'text': "Ennyimbatext/Gw'oli mutukuvu.txt"},
- "Ka Tukusuute Omulokozi Waffe ": {'text': 'Ennyimbatext/hymn2.txt'},
- 'Mumaaso ga Yesu': {'text': 'Ennyimbatext/hymn3.txt' },
- 'Tusinze Nnyo Erinnya Lye': {'text': 'Ennyimbatext/hymn4.txt'},
- 'Tumusinze Mukama Waffe': {'text': 'Ennyimbatext/hymn5.txt'},
- "Mwe Amawanga Ag'oku Nsi": {'text': 'Ennyimbatext/hymn6.txt'},
- 'Mukama Gwe Kifo kyaffe': {'text': 'Ennyimbatext/hymn7.txt'},
- 'Okukaaba Kwange Owulire': {'text': 'Ennyimbatext/hymn8.txt'},
- 'Gwe Eyanunula': {'text': 'Ennyimbatext/hymn9.txt'},
- 'Jjangu Yesu Obe Mu Nze': {'text': 'Ennyimbatext/hymn10.txt'},
- 'Bonna basuute Mukama': {'text': 'Ennyimbatext/hymn11.txt'},
- "Twebaza gwe omuva byonna": {'text': 'Ennyimbatext/hymn12.txt'},
- "Yesu wasuubiza ffe abantu bo": {'text': 'Ennyimbatext/hymn13.txt'},
- "Ka ntambule naawe Yesu": {'text': 'Ennyimbatext/hymn14.txt'},
- "Yesu alifuga wonna wonna": {'text': 'Ennyimbatext/hymn15.txt'},
- "Nkwetaaga ayi Mukama": {'text': 'Ennyimbatext/hymn16.txt'},
- "Si nze, naye Kristo": {'text': 'Ennyimbatext/hymn17.txt'},
- }
- self.page=self.text
- self.t=self.page
- with open(self.hymns[f'{self.t}']['text']) as f:
- return f.read()
- class Searchin(Screen,RV):
- pass
- class ScreenManager(ScreenManager):
- def __init__(self,**kwargs):
- super(screenmanager).__init__(**kwargs)
- self.transition=RiseInTransition()
- class HomeScreen(Screen):
- fontname='fonts/popins.ttf'
- 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 remove(self):
- gt5 = self.ids.label.text
- gt5=gt5[:-1]
- self.ids.label.text=gt5
- def searchrecycle(self):
- self.manager.current='serchscreen'
- def go_to_page(self):
- self.gt5=self.ids.label.text
- self.page = [self.gt5]
- self.hymns = {'1': {'text': "Ennyimbatext/Gw'oli mutukuvu.txt"},
- '2': {'text': 'Ennyimbatext/hymn2.txt'},
- '3': {'text': 'Ennyimbatext/hymn3.txt'},
- '4': {'text': 'Ennyimbatext/hymn4.txt'},
- '5': {'text': 'Ennyimbatext/hymn5.txt'},
- '6': {'text': 'Ennyimbatext/hymn6.txt'},
- '7': {'text': 'Ennyimbatext/hymn7.txt'},
- '8': {'text': 'Ennyimbatext/hymn8.txt'},
- '9': {'text': 'Ennyimbatext/hymn9.txt'},
- '10': {'text': 'Ennyimbatext/hymn10.txt'},
- '11': {'text': 'Ennyimbatext/hymn11.txt'},
- '12': {'text': 'Ennyimbatext/hymn12.txt'},
- '13': {'text': 'Ennyimbatext/hymn13.txt'},
- '14': {'text': 'Ennyimbatext/hymn14.txt'},
- '15': {'text': 'Ennyimbatext/hymn15.txt'},
- '16': {'text': 'Ennyimbatext/hymn16.txt'},
- '17': {'text': 'Ennyimbatext/hymn17.txt'},
- '18': {'text': 'Ennyimbatext/hymn18.txt'},
- '19': {'text': 'Ennyimbatext/hymn19.txt'},
- '20': {'text': 'Ennyimbatext/hymn20.txt'},
- '21': {'text': 'Ennyimbatext/hymn21.txt'},
- '22': {'text': 'Ennyimbatext/hymn22.txt'},
- '23': {'text': 'Ennyimbatext/hymn23.txt'},
- '24': {'text': 'Ennyimbatext/hymn24.txt'}
- }
- try:
- app = MDApp.get_running_app()
- self.manager.get_screen('content').ids.labelhymn.text = self.get_hymn_text(self.gt5)
- self.manager.current = 'content'
- gt5 = self.ids.label.text
- except:
- self.ids.label.text="Not found"
- #self.ids.label.text=""
- def get_hymn_text(self,page):
- self.gt5=self.ids.label.text
- self.page = self.gt5
- with open(self.hymns[f'{self.page}']['text']) as f:
- return f.read()
- def about_callback(self):
- #print("about my app")
- self.dialog = MDDialog(
- title="About:",
- size_hint=[.6, .5],
- type="custom",
- text="This is Ennyimba Za Kkristo "
- " In Luganda version"
- " By L.S.jevix Software Ug",
- buttons=[
- MDFlatButton(
- text="OK"
- ),
- ],
- )
- self.dialog.open()
- class Content(Screen):
- def searchrecycle(self):
- self.manager.current='serchscreen'
- def callback(self):
- self.manager.current=('home')
- class settingsscreen(Screen):
- def __init__(self):
- super().__init__()
- slid=self.ids.slid
- def callback(self):
- self.manager.current=('home')
- def themeshow(self):
- t=MDThemePicker()
- t.open()
- def montague(self,text):
- toast("setting applied")
- self.manager.get_screen('content').ids.labelhymn.font_name='fonts/Montague.ttf'
- def flashgude(self):
- toast("setting applied")
- self.manager.get_screen('content').ids.labelhymn.font_name='fonts/Flashgude.ttf'
- def playball(self):
- toast("setting applied")
- self.manager.get_screen('content').ids.labelhymn.font_name='fonts/Playball.ttf'
- def popins(self):
- toast("setting applied")
- self.manager.get_screen('content').ids.labelhymn.font_name='fonts/popins.ttf'
- def starshield(self):
- toast("setting applied")
- self.manager.get_screen('content').ids.labelhymn.font_name='fonts/Star Shield.ttf'
- def changefont(self,widget):
- size=(str(int(widget.value)))
- self.manager.get_screen('content').ids.labelhymn.font_size=size
- class EnnyimbaApp(MDApp):
- def __init__(self, **kwargs):
- super().__init__(**kwargs)
- self.screens = iter(
- [
- Content,Searchin,settingsscreen
- ])
- 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='sda2.png'
- #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