コード例 #1
0
ファイル: dialogs.py プロジェクト: ir1110/noforese
def card(content, title=None, background_color=None, size=(0.7, 0.5)):
    """Вывод диалоговых окон с кастомным контентом."""

    if not background_color:
        background_color = [1.0, 1.0, 1.0, 1]

    card = MDCard(size_hint=(1, 1),
                  padding=5)  # , background_color=background_color)

    if title:
        box = BoxLayout(orientation="vertical", padding=dp(8))
        box.add_widget(
            MDLabel(
                text=title,
                theme_text_color="Secondary",
                font_style="Title",
                size_hint_y=None,
                height=dp(36),
            ))
        box.add_widget(MDSeparator(height=dp(1)))
        box.add_widget(content)
        card.add_widget(box)
    else:
        card.add_widget(content)

    dialog = ModalView(size_hint=size, background_color=[0, 0, 0, 0.2])
    dialog.add_widget(card)
    # dialog.open()

    return dialog
コード例 #2
0
    def no_sessions_grid(self, msg, layout):
        new_card_layout = MDFloatLayout()  # for centering

        excCard = MDCard(
            spacing=15,
            radius=[80],
            orientation="vertical",
            size_hint=(0.87, 0.7),
            padding=[
                11, 16, 0, 25
            ],  # [padding_left, padding_top,padding_right, padding_bottom].
            pos_hint={
                "center_y": 0.5,
                "center_x": 0.5
            },
            background="resources/card_back.png",
            elevation=1)
        workout_name = MDLabel(text=msg,
                               halign='center',
                               font_style="Subtitle2",
                               size_hint=(1, 0.1),
                               theme_text_color="Custom",
                               text_color=self.app.text_color)

        excCard.add_widget(workout_name)
        new_card_layout.add_widget(excCard)
        try:
            if self.ids.sets_grid == layout:
                dict_of_row_height = {0: 250}
                layout.rows_minimum = dict_of_row_height
        except:
            pass
        layout.clear_widgets()
        layout.add_widget(new_card_layout)
コード例 #3
0
    def ui_layout(self):

        start_game_button_anchor = AnchorLayout(
            anchor_x='center',
            anchor_y='bottom',
            padding=[dp(25), dp(25), dp(25), dp(25)])

        self.start_game_button = MDFloatingActionButton(icon='play',
                                                        size=[dp(56),
                                                              dp(56)])
        self.start_game_button.md_bg_color = App.get_running_app(
        ).theme_cls.primary_color
        self.start_game_button.text_color = [1, 1, 1, 1]

        if platform not in ['ios', 'android']:
            self.start_game_button.bind(on_press=lambda x: self.start_game())

        start_game_button_anchor.add_widget(self.start_game_button)

        game_card = MDCard(padding=dp(24),
                           spacing=dp(24),
                           orientation='vertical',
                           size_hint_x=0.85,
                           size_hint_y=0.7,
                           pos_hint={
                               'top': 0.85,
                               'center_x': 0.5
                           })
        rules = """You probably already know how to play Tic-Tac-Toe. It's a really simple game, right? That's what most people think. But if you really wrap your brain around it, you'll discover that Tic-Tac-Toe isn't quite as simple as you think!
        
        1. The game is played on a grid that's 3 squares by 3 squares.

        2. You are X, your friend (or the computer in this case) is O. Players take turns putting their marks in empty squares.

        3. The first player to get 3 of her marks in a row (up, down, across, or diagonally) is the winner.

        4. When all 9 squares are full, the game is over. If no player has 3 marks in a row, the game ends in a tie."""
        game_label = MDLabel(text=rules,
                             font_style='Body1',
                             halign='center',
                             size_hint=(1, 0.5))
        game_label.theme_text_color = 'Custom'
        game_label.text_color = [1, 1, 1, 1]
        game_card.add_widget(game_label)
        game_card.md_bg_color = App.get_running_app().theme_cls.accent_color
        game_card.elevation = 15

        self.add_widget(game_card)
        self.add_widget(start_game_button_anchor)

        # Nav Bar
        self.nav_bar = MyNavigationLayout()
        self.nav_bar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        self.nav_bar_anchor.add_widget(self.nav_bar)
        self.add_widget(self.nav_bar_anchor)
コード例 #4
0
ファイル: Snakes.py プロジェクト: vaibhav-setia/arcade-games
    def ui_layout(self):

        start_game_button_anchor = AnchorLayout(
            anchor_x='center',
            anchor_y='bottom',
            padding=[dp(25), dp(25), dp(25), dp(25)])

        self.start_game_button = MDFloatingActionButton(icon='play',
                                                        size=[dp(56),
                                                              dp(56)])
        self.start_game_button.md_bg_color = App.get_running_app(
        ).theme_cls.primary_color
        self.start_game_button.text_color = [1, 1, 1, 1]

        if platform not in ['ios', 'android']:
            self.start_game_button.bind(on_press=lambda x: self.start_game())

        start_game_button_anchor.add_widget(self.start_game_button)

        game_card = MDCard(padding=dp(24),
                           spacing=dp(24),
                           orientation='vertical',
                           size_hint_x=0.85,
                           size_hint_y=0.7,
                           pos_hint={
                               'top': 0.85,
                               'center_x': 0.5
                           })
        rules = """Snakes and ladders is a game to play with your friends. Navigate your piece from start to finish, avoid the snakes, and take shortcuts going up the ladders.


How to play:

Each player starts from base. Both players alternatively roll the dice and move the respective pawns.
If your pawn lands at the bottom of a ladder, you can move up to the top of the ladder.
If your pawn lands on the head of a snake, you must slide down to the bottom of the snake.
The first player to get to the last tile numbered '100'  is the winner."""
        game_label = MDLabel(text=rules,
                             font_style='Body1',
                             halign='center',
                             size_hint=(1, 0.5))
        game_label.theme_text_color = 'Custom'
        game_label.text_color = [1, 1, 1, 1]
        game_card.add_widget(game_label)
        game_card.md_bg_color = App.get_running_app().theme_cls.accent_color
        game_card.elevation = 15

        self.add_widget(game_card)
        self.add_widget(start_game_button_anchor)

        # Nav Bar
        self.nav_bar = MyNavigationLayout()
        self.nav_bar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        self.nav_bar_anchor.add_widget(self.nav_bar)
        self.add_widget(self.nav_bar_anchor)
コード例 #5
0
ファイル: Ships.py プロジェクト: vaibhav-setia/arcade-games
    def ui_layout(self):

        start_game_button_anchor = AnchorLayout(
            anchor_x='center',
            anchor_y='bottom',
            padding=[dp(25), dp(25), dp(25), dp(25)])

        self.start_game_button = MDFloatingActionButton(icon='play',
                                                        size=[dp(56),
                                                              dp(56)])
        self.start_game_button.md_bg_color = App.get_running_app(
        ).theme_cls.primary_color
        self.start_game_button.text_color = [1, 1, 1, 1]

        if platform not in ['ios', 'android']:
            self.start_game_button.bind(on_press=lambda x: self.start_game())

        start_game_button_anchor.add_widget(self.start_game_button)

        game_card = MDCard(padding=dp(24),
                           spacing=dp(24),
                           orientation='vertical',
                           size_hint_x=0.85,
                           size_hint_y=0.7,
                           pos_hint={
                               'top': 0.85,
                               'center_x': 0.5
                           })
        rules = """Catch em all is a game where you have to catch the ever escaping target.
With a limited amount you need to catch the target as fast as you can..

How to play:
A random target appears all over the screen
Click on it before it disappears and moves to another target
Collect the target 10 times before the timer runs out to finish the game.
Clicking on any obstacle or any area outside the ground gives a penalty of 4 seconds"""
        game_label = MDLabel(text=rules,
                             font_style='Body1',
                             halign='center',
                             size_hint=(1, 0.5))
        game_label.theme_text_color = 'Custom'
        game_label.text_color = [1, 1, 1, 1]
        game_card.add_widget(game_label)
        game_card.md_bg_color = App.get_running_app().theme_cls.accent_color
        game_card.elevation = 15

        self.add_widget(game_card)
        self.add_widget(start_game_button_anchor)

        # Nav Bar
        self.nav_bar = MyNavigationLayout()
        self.nav_bar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        self.nav_bar_anchor.add_widget(self.nav_bar)
        self.add_widget(self.nav_bar_anchor)
コード例 #6
0
    def ui_layout(self):
        calibration_card = MDCard(padding=dp(24),
                                  spacing=dp(24),
                                  orientation='vertical',
                                  size_hint=(0.75, 0.45),
                                  pos_hint={
                                      'top': 0.75,
                                      'center_x': 0.5
                                  })

        calibration_label = MDLabel(text='Calibrate Audio Input',
                                    font_style='H4',
                                    halign='center')
        calibration_label.theme_text_color = 'Custom'
        calibration_label.text_color = [1, 1, 1, 1]

        self.slider = Slider(size_hint=(0.75, None),
                             pos_hint={'center_x': 0.5})
        self.slider.bind(value=self.on_value_change)

        helper_box = BoxLayout(orientation='horizontal')
        left_label = MDLabel(text='Less Sensitive', font_style='Caption')
        left_label.theme_text_color = 'Custom'
        left_label.text_color = [1, 1, 1, 1]
        right_label = MDLabel(text='More Sensitive', font_style='Caption')
        right_label.theme_text_color = 'Custom'
        right_label.text_color = [1, 1, 1, 1]

        helper_box.add_widget(Widget())
        helper_box.add_widget(left_label)
        helper_box.add_widget(Widget())
        helper_box.add_widget(Widget())
        helper_box.add_widget(Widget())
        helper_box.add_widget(right_label)
        helper_box.add_widget(Widget())

        calibration_card.add_widget(calibration_label)
        calibration_card.add_widget(Widget())
        calibration_card.add_widget(Widget())
        calibration_card.add_widget(self.slider)
        calibration_card.add_widget(helper_box)
        calibration_card.add_widget(Widget())

        toolbar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        toolbar = MDToolbar(title='Add Contact', anchor_title='center')
        toolbar.md_bg_color = App.get_running_app().theme_cls.primary_color
        toolbar.left_action_items = [[
            'arrow-left', lambda x: self.change_screen('welcome')
        ]]
        toolbar_anchor.add_widget(toolbar)

        self.add_widget(calibration_card)
        self.add_widget(toolbar_anchor)
コード例 #7
0
ファイル: main.py プロジェクト: wilsenmuts/LandBroker
    def show_more(self, nap):
        self.ids.box.clear_widgets()
        cnx = mysql.connector.connect(user='******',
                                      password='******',
                                      database='landbroker')
        cursor = cnx.cursor()
        query = (
            "SELECT id, reside, size, amount, mode_whole, mode_part, ownership, map_scan, distance FROM landbroker_sell WHERE is_active=True "
        )
        cursor.execute(query)
        for (id, reside, size, amount, mode_whole, mode_part, ownership,
             map_scan, distance) in cursor:
            '''
            card = MDCardPost(source="./black.jpg",tile_text=title, text_post="Date:"+str(date_as_is)+"\nAbout:"+about+"\nNotes:"+notes,card_size=(300,300) , with_image=True,callback=self.callback(value=self.isinstance.title_text), swipe=True)
            self.ids.box.add_widget(card,len(self.children))
            '''
            if mode_part is 1:
                mode = 'True'
            else:
                mode = 'False'
            a = str(id)
            layout = MDCard(orientation='horizontal',
                            size_hint=(1, None),
                            height=240,
                            elevation=8)
            layout.add_widget(
                AsyncImage(source="http://127.0.0.1:8000/media/" + map_scan,
                           keep_ratio=False,
                           allow_stretch=True,
                           size_hint=(.7, 1)))
            layout1 = GridLayout(cols=1, padding=5)
            layout1.add_widget(MDLabel(text='Land ID:' + a))
            layout1.add_widget(MDLabel(text='Location: ' + reside))
            layout1.add_widget(MDLabel(text='Size: ' + size))
            layout1.add_widget(MDLabel(text='Amount: ' + amount))
            layout1.add_widget(MDLabel(text='Ownership: ' + ownership))
            layout1.add_widget(MDLabel(text='Distance: ' + distance))
            layout1.add_widget(MDLabel(text='Selling in Parts: ' + mode))
            layout1.add_widget(
                MDRaisedButton(text='Express Interest',
                               md_bg_color=(.7, .2, .2, 1),
                               increment_width=100,
                               on_press=self.printer))
            layout.add_widget(layout1)
            #print(a +'\n'+ b + '\n'+p)

            self.ids.box.add_widget(layout, len(self.children))

        cursor.close()
        cnx.close()
コード例 #8
0
    def ui_layout(self):

        start_game_button_anchor = AnchorLayout(
            anchor_x='center',
            anchor_y='bottom',
            padding=[dp(25), dp(25), dp(25), dp(25)])

        self.start_game_button = MDFloatingActionButton(icon='play',
                                                        size=[dp(56),
                                                              dp(56)])
        self.start_game_button.md_bg_color = App.get_running_app(
        ).theme_cls.primary_color
        self.start_game_button.text_color = [1, 1, 1, 1]

        if platform not in ['ios', 'android']:
            self.start_game_button.bind(on_press=lambda x: self.start_game())

        start_game_button_anchor.add_widget(self.start_game_button)

        game_card = MDCard(padding=dp(24),
                           spacing=dp(24),
                           orientation='vertical',
                           size_hint_x=0.85,
                           size_hint_y=0.7,
                           pos_hint={
                               'top': 0.85,
                               'center_x': 0.5
                           })
        rules = """Hit the blocks popping up before they disappear!
Hit the blocks a specific number of times to win the game! Keep in mind, you just have limited chances to hit the blocks. So buckle up for some exciting fun! """
        game_label = MDLabel(text=rules,
                             font_style='Body1',
                             halign='center',
                             size_hint=(1, 0.5))
        game_label.theme_text_color = 'Custom'
        game_label.text_color = [1, 1, 1, 1]
        game_card.add_widget(game_label)
        game_card.md_bg_color = App.get_running_app().theme_cls.accent_color
        game_card.elevation = 15

        self.add_widget(game_card)
        self.add_widget(start_game_button_anchor)

        # Nav Bar
        self.nav_bar = MyNavigationLayout()
        self.nav_bar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        self.nav_bar_anchor.add_widget(self.nav_bar)
        self.add_widget(self.nav_bar_anchor)
コード例 #9
0
 def on_start(self):
     for crop in sorted(Feedforward.labels):
         card = MDCard(orientation='vertical',
                       size_hint=(None, None),
                       size=(self.root.width, 300))
         imgr = Image(source="images/" + str(crop) + str(".jpg"),
                      size_hint_y=0.8,
                      allow_stretch="True",
                      keep_ratio="False")
         lbl = MDLabel(text=str(crop),
                       size_hint_y=0.2,
                       halign='center',
                       valign='center')
         card.add_widget(imgr)
         card.add_widget(lbl)
         self.root.ids.md_list.add_widget(card)
コード例 #10
0
    def start_downloading(self):
        user_input = self.root.get_screen('main').ids.url_input.text

        # video = YouTube(user_input)
        # print(type(video))
         
        if user_input != '' and re.search(r'^(https?\:\/\/)?(www\.)?(youtube\.com|youtu\.?be)\/.+$', user_input):
            self.root.current = 'progress'
            
            screen_id = self.root.get_screen('progress').ids.video_list

            for num in range(1):
                main_layout = MDFloatLayout()
                flip_card = MDCard(size_hint=(.9, .9), pos_hint={'center_x':.5, 'center_y': .5})
                box_1 = MDBoxLayout(orientation='vertical',)
                box_2 = MDBoxLayout(orientation='vertical', )
                box_3 = MDBoxLayout(orientation='vertical', padding=20)

                img = AsyncImage(source=video.thumbnail_url, size_hint=(.9, .9), pos_hint={'center_x': .5, 'center_y': .5})
                
                box_3.add_widget(img)
                box_3.add_widget(
                    MDLabel(
                        text=video.title, halign='center', font_style='Body2'
                        )
                            )
                box_2.add_widget(box_3)
                box_2.add_widget(MDRaisedButton(text='Download', pos_hint={'center_x': .5, 'center_y': .5}, size_hint=(.6, .1), on_release = self.quality_check,))

                box_1.add_widget(box_2)
                advertisement_box = MDBoxLayout(orientation='vertical', size_hint=(1, .2))
                advertisement_box.add_widget(MDLabel(text='Advertisement', halign='center'))
                advertisement_box.add_widget(MDProgressBar(pos_hint={"center_x": .5, }))
                box_1.add_widget(advertisement_box)


                flip_card.add_widget(box_1)
                
                main_layout.add_widget(flip_card)
                screen_id.add_widget(main_layout)

            
        else:
            self.show_message('Invalid URL!')
コード例 #11
0
class LoginScreen(MDScreen):
    def request(self, *args):
        email = self.input_email.text
        senha = self.input_senha.text

        def on_success(req, res):
            print(str(res))

        def on_error(*args):
            print(str(args))

        def on_redirect(*args):
            print(f'redirect: {str(args)}')

        self.req = UrlRequest("http://127.0.0.1:5000/",
                              on_success=on_success,
                              on_error=on_error,
                              verify=False,
                              on_redirect=on_redirect,
                              req_body=dumps({
                                  'email': email,
                                  'senha': senha
                              }),
                              req_headers={'Content-Type': 'application/json'})

    def __init__(self, **kwargs):
        super(LoginScreen, self).__init__(**kwargs)
        self.card = MDCard()
        self.card.text = "Valida"
        self.box = BoxLayout()
        self.box.orientation = 'vertical'
        self.card.add_widget(self.box)

        self.button_login = MDRaisedButton(text="Login")
        self.input_senha = MDTextField(password=True)
        self.button_login.bind(on_press=self.request)
        self.card.padding = "20dp"
        self.input_email = MDTextField()
        self.input_email.hint_text = "E-mail"
        self.input_senha.hint_text = "Senha"
        self.box.add_widget(self.input_email)
        self.box.add_widget(self.input_senha)
        self.box.add_widget(self.button_login)
        self.add_widget(self.card)
コード例 #12
0
ファイル: main.py プロジェクト: stevenjoro098/MENU---KIvymd
    def create_widgets(self, title, image_source, price):
        item_card = MDCard(size=(300, 240),
                           border_radius=20,
                           radius=[
                               20,
                           ],
                           elevation=10)
        #item_card.md_bg_color = [1, 0.54, 0, .3]
        card_layout = RelativeLayout()
        image = AsyncImage(source=image_source,
                           size_hint=(.5, .5),
                           pos_hint={
                               "center_x": .3,
                               "center_y": .5
                           })
        item_title = MDLabel(text=title,
                             halign="center",
                             theme_text_color="ContrastParentBackground",
                             font_style="H5",
                             pos_hint={
                                 "center_x": .7,
                                 "center_y": .7
                             })

        item_price = MDLabel(text=price,
                             halign="center",
                             theme_text_color="Secondary",
                             pos_hint={
                                 "center_x": .7,
                                 "center_y": .6
                             })
        order = MDRaisedButton(text="Order",
                               size_hint=(.5, None),
                               pos_hint={
                                   "center_x": .68,
                                   "center_y": .15
                               })
        card_layout.add_widget(image)
        card_layout.add_widget(item_title)
        card_layout.add_widget(item_price)
        card_layout.add_widget(order)
        item_card.add_widget(card_layout)
        self.list_menu.add_widget(item_card)
コード例 #13
0
    def ui_layout(self):

        start_game_button_anchor = AnchorLayout(anchor_x='center', anchor_y='bottom',
                                            padding=[dp(25), dp(25), dp(25), dp(25)])


        self.start_game_button = MDFloatingActionButton(icon='play', size=[dp(56), dp(56)])
        self.start_game_button.md_bg_color = App.get_running_app().theme_cls.primary_color
        self.start_game_button.text_color = [1, 1, 1, 1]

        if platform not in ['ios', 'android']:
            self.start_game_button.bind(on_press=lambda x: self.start_game())


        start_game_button_anchor.add_widget(self.start_game_button)


        game_card = MDCard(padding=dp(24), spacing=dp(24), orientation='vertical',
                             size_hint_x=0.85, size_hint_y=0.7,
                             pos_hint={'top': 0.85, 'center_x': 0.5})
        rules = """The objective of Battleship is to try and sink all of the other player's before they sink all of your ships. All of the other player's ships are somewhere on his/her board.  


Player's take turns guessing out the coordinates of the enemy ships. If it's a hit the cell turns RED. If its a miss the cell turns BLUE.
The first played to guess and hit all the ships completely wins!"""
        game_label = MDLabel(text=rules, font_style='Body1', halign='center',
                               size_hint=(1, 0.5))
        game_label.theme_text_color = 'Custom'
        game_label.text_color = [1, 1, 1, 1]
        game_card.add_widget(game_label)
        game_card.md_bg_color = App.get_running_app().theme_cls.accent_color
        game_card.elevation = 15

        self.add_widget(game_card)
        self.add_widget(start_game_button_anchor)

        # Nav Bar
        self.nav_bar = MyNavigationLayout()
        self.nav_bar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        self.nav_bar_anchor.add_widget(self.nav_bar)
        self.add_widget(self.nav_bar_anchor)
コード例 #14
0
ファイル: helper.py プロジェクト: Adarshb2000/Home-Automation
    def build(self):

        # AC Card
        self.ac_card = AcCard((0.5, 0.5))
        self.add_widget(self.ac_card)

        # all the features for ac
        features_layout = MDGridLayout()
        features_layout.cols = 2

        # Temp incease, decrease
        new_box_layout = MDFloatLayout()
        dec_button = Buttonn('temp-', colors['cold_color'])
        new_box_layout.add_widget(dec_button)
        dec_button.on_press = partial(self.ac_features_send, dec_button)
        features_layout.add_widget(new_box_layout)

        new_box_layout = MDFloatLayout()
        inc_button = MDCard(
            orientation='vertical',
            padding='10dp',
            pos_hint={
                'center_x': 0.5,
                'center_y': 0.5
            },
            size_hint=(0.75, 0.75),
        )
        inc_button.md_bg_color = ['warm_color']
        inc_button.add_widget(MDLabel(text='Temp+'))
        inc_button.id = 'temp+'
        inc_button.on_press = partial(self.ac_features_send, inc_button)
        new_box_layout.add_widget(inc_button)
        features_layout.add_widget(new_box_layout)

        features_layout.add_widget(btn(text='TODO'))
        features_layout.add_widget(btn(text='TODO'))
        features_layout.add_widget(btn(text='TODO'))
        features_layout.add_widget(btn(text='TODO'))

        self.add_widget(features_layout)
コード例 #15
0
    def ui_layout(self):
        add_contact_card = MDCard(padding=dp(24),
                                  spacing=dp(24),
                                  orientation='vertical',
                                  size_hint=(0.75, 0.45),
                                  pos_hint={
                                      'top': 0.75,
                                      'center_x': 0.5
                                  })

        add_contact_label = MDLabel(text='Enter In a User Name',
                                    font_style='H4',
                                    halign='center')
        add_contact_label.theme_text_color = 'Custom'
        add_contact_label.text_color = [1, 1, 1, 1]

        self.info_text = MDLabel(text='', halign='center')
        self.info_text.theme_text_color = 'Error'

        self.contact_input = MDTextFieldRound(size_hint=(0.75, None),
                                              pos_hint={'center_x': 0.5})
        # Hides left icon
        self.contact_input.icon_left_dasabled = True
        # Moves widget out of the field of view
        self.contact_input.children[2].children[2].pos_hint = {
            'center_x': 500,
            'center_y': 500
        }
        self.contact_input.icon_right = 'send'
        self.contact_input.children[2].children[0].bind(
            on_press=lambda x: self.check_name(self.contact_input.text))

        add_contact_card.add_widget(add_contact_label)
        add_contact_card.add_widget(self.info_text)
        add_contact_card.add_widget(Widget())
        add_contact_card.add_widget(Widget())
        add_contact_card.add_widget(self.contact_input)

        toolbar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        toolbar = MDToolbar(title='Add Contact', anchor_title='center')
        toolbar.md_bg_color = App.get_running_app().theme_cls.primary_color
        toolbar.left_action_items = [[
            'arrow-left', lambda x: self.change_screen('contact')
        ]]
        toolbar_anchor.add_widget(toolbar)

        self.add_widget(add_contact_card)
        self.add_widget(toolbar_anchor)
コード例 #16
0
ファイル: main.py プロジェクト: Sangwan5688/Kivy-Music-Player
 def get_playlist(self, title, listId):
     image = AsyncImage(source=playlist_images[listId],
                        size_hint=(1, 1),
                        pos_hint={'top': 0.9},
                        allow_stretch=True)
     card = MDCard(orientation='vertical',
                   border_radius=15,
                   radius=[0, 0, 15, 15],
                   pos_hint={
                       "center_x": 0.5,
                       "center_y": 0.5
                   },
                   size_hint=(None, None),
                   size=(self.win_size * 0.3, self.win_size * 0.3))
     card.add_widget(image)
     self.root.ids.trend_grid.add_widget(
         MDTextButton(text=title,
                      pos_hint={'center_x': 0.5},
                      on_press=lambda x: self.show_top(title, listId)))
     self.root.ids.trend_grid.add_widget(card)
     self.root.ids.trend_grid.add_widget(MDLabel(text=''))
     self.root.ids.trend_grid.add_widget(MDLabel(text=''))
     self.root.ids.trend_grid.add_widget(MDLabel(text=''))
     self.root.ids.trend_grid.add_widget(MDLabel(text=''))
コード例 #17
0
ファイル: gfs.py プロジェクト: FoyerSociety/GFS-KivyMD
    def close_cotis_Dialog(self, btn):
        if btn.text == "OK":
            new_card = MDCard(orientation="vertical",
                              padding="15dp",
                              size_hint=(None, None),
                              size=("180dp", "220dp"),
                              pos_hint={
                                  "center_x": 0.80,
                                  "center_y": 0.31
                              })

            new_card.add_widget(
                MDFloatingActionButton(
                    icon="alert",
                    user_font_size="14sp",
                    theme_text_color="Custom",
                    text_color=get_color_from_hex("#ffffff"),
                    md_bg_color=get_color_from_hex("#faaf00"),
                    elevation_normal=0))
            new_card.add_widget(
                MDLabel(text=self.motifs_cotis.text,
                        pos_hint={
                            "x": 0.30,
                            "y": 0.75
                        },
                        font_size='18sp'))
            new_card.add_widget(
                MDRoundFlatIconButton(icon="currency-eur",
                                      text=self.argent_cotis.text,
                                      pos_hint={
                                          "center_x": 0.5,
                                          "center_y": 0.5
                                      },
                                      font_size='17sp',
                                      margin="30dp"))
            new_card.add_widget(
                MDIconButton(icon="trash-can",
                             theme_text_color="Custom",
                             font_size="18sp",
                             text_color=get_color_from_hex("#071f38"),
                             pos_hint={
                                 "center_x": 0.5,
                                 "center_y": 0.3
                             }))
            self.INTERFACE.ids.Cotisation.add_widget(new_card)
        self.dialog.dismiss()
コード例 #18
0
    def ui_layout(self):
        record_button_anchor = AnchorLayout(
            anchor_x='center',
            anchor_y='bottom',
            padding=[dp(25), dp(25), dp(25), dp(25)])

        self.record_button = MDFloatingActionButton(icon='record',
                                                    size=[dp(56),
                                                          dp(56)])
        self.record_button.md_bg_color = App.get_running_app(
        ).theme_cls.primary_color
        self.record_button.text_color = [1, 1, 1, 1]
        if platform not in ['ios', 'android']:
            self.record_button.bind(on_press=lambda x: self.decode_audio())
        record_button_anchor.add_widget(self.record_button)

        self.decode_input = MDTextFieldRound(pos_hint={
            'center_x': 0.5,
            'center_y': 0.5
        },
                                             size_hint=(0.85, 0.5))
        self.decode_input.icon_left_dasabled = True
        # Moves widget out of the field of view
        self.decode_input.children[2].children[2].pos_hint = {
            'center_x': 500,
            'center_y': 500
        }
        # This binds the right icon to record the input
        self.decode_input.icon_right = 'database-export'
        self.decode_input.children[2].children[0].bind(
            on_press=lambda x: self.clear_text())

        decode_card = MDCard(padding=dp(24),
                             spacing=dp(24),
                             orientation='vertical',
                             size_hint_x=0.85,
                             size_hint_y=0.7,
                             pos_hint={
                                 'top': 0.85,
                                 'center_x': 0.5
                             })
        decode_label = MDLabel(text='Decode Morse Code Audio',
                               font_style='Body1',
                               halign='center',
                               size_hint=(1, 0.5))
        decode_label.theme_text_color = 'Custom'
        decode_label.text_color = [1, 1, 1, 1]
        decode_card.add_widget(decode_label)

        decode_text = 'Hit record or enter Morse Code below to start decoding'
        self.decode_output_label = MDLabel(text=decode_text,
                                           font_style='Body1',
                                           halign='center',
                                           size_hint=(1, 0.5))
        self.decode_output_label.theme_text_color = 'Custom'
        self.decode_output_label.text_color = [1, 1, 1, 1]
        if platform not in ['ios', 'android']:
            self.audio_indicator = AudioIndicator(
                stack_width=self.amr.bits_per_frame)
        else:
            self.audio_indicator = AudioIndicator(stack_width=40)
        self.audio_indicator.size_hint = (1, 2)

        decode_card.add_widget(self.audio_indicator)
        decode_card.add_widget(self.decode_output_label)
        decode_card.add_widget(self.decode_input)
        decode_card.md_bg_color = App.get_running_app().theme_cls.accent_color
        decode_card.elevation = 15

        self.add_widget(decode_card)
        self.add_widget(record_button_anchor)

        # Nav Bar
        self.nav_bar = MyNavigationLayout()
        self.nav_bar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        self.nav_bar_anchor.add_widget(self.nav_bar)
        self.add_widget(self.nav_bar_anchor)
コード例 #19
0
    def create_card(self, session, num_of_session, total_session_num,
                    session_workout_name, session_date):
        new_card_layout = MDFloatLayout()  # for centering

        excCard = MDCard(
            spacing=5,
            radius=[80],
            orientation="vertical",
            size_hint=(0.87, 0.97),
            padding=[
                25, 16, 15, 25
            ],  # [padding_left, padding_top,padding_right, padding_bottom].
            pos_hint={
                "center_y": 0.5,
                "center_x": 0.5
            },
            background="resources/card_back.png",
            elevation=1)

        # help_layout = self.create_top_card_layout(num_of_exc, num_of_exc_total, exc)
        # excCard.add_widget(help_layout)

        excnum = str(num_of_session + 1) + " of " + str(total_session_num)

        exc_num = MDLabel(text="    " + excnum,
                          font_style="Caption",
                          theme_text_color="Secondary",
                          pos_hint={
                              "center_y": 0.85,
                              "center_x": 0.17
                          })
        # help_layout.add_widget(exc_num)
        # excCard.add_widget(help_layout)
        name_layout_y_size = 1.5
        if len(session_workout_name) > 9:
            name_layout_y_size = 3
        name_layout = MDGridLayout(rows=1,
                                   cols=3,
                                   size_hint_y=name_layout_y_size)
        workout = session_workout_name
        workout_name = MDLabel(text=workout,
                               font_style="H5",
                               theme_text_color="Custom",
                               text_color=self.app.text_color,
                               size_hint_x=1.5)
        workout_date = MDLabel(text=str(session_date),
                               font_style="Caption",
                               theme_text_color="Custom",
                               text_color=self.app.text_color)
        name_layout.add_widget(workout_name)
        name_layout.add_widget(workout_date)
        name_layout.add_widget(exc_num)

        excCard.add_widget(name_layout)
        seperate = MDSeparator(height="1dp", color=self.app.text_color)
        excCard.add_widget(seperate)

        # session = ["3   X   8", "3   X   8", "3   X   8", "3   X   8"]

        for num_of_set, set in enumerate(session):
            set_label, set_number, reps_label = self.create_set_label(
                set, num_of_set)

            exc_layout = MDGridLayout(rows=1, cols=2)
            units_layout = MDGridLayout(rows=1, cols=2, size_hint_y=1.5)
            exc_layout.add_widget(set_label)
            exc_layout.add_widget(set_number)
            units_layout.add_widget(MDLabel(text="", size_hint_x=0.9))
            units_layout.add_widget(reps_label)

            excCard.add_widget(exc_layout)
            excCard.add_widget(units_layout)

        new_card_layout.add_widget(excCard)
        return new_card_layout
コード例 #20
0
ファイル: main.py プロジェクト: Sangwan5688/Kivy-Music-Player
    def play_song(self, i):
        try:
            self.stop()
        except:
            pass
        link = self.down_path_list[i][0]
        if self.root.ids.screen_manager.current != 'PlayScreen':
            self.change_screen("PlayScreen")
        self.prepare(link)
        if link.endswith('.m4a'):
            self.audio = MP4(link)
            self.play_song_name = self.audio.get('\xa9nam', ['Unknown'])[0]
            #print(audio['\xa9alb'])
            self.play_art_name = self.audio.get('\xa9ART', ['Unknown'])[0]
            #print(audio['\xa9day'])
            #print(audio['\xa9gen'])
            try:
                self.img_data = self.audio["covr"][0]
            except:
                with open('cover.jpg', 'rb') as f:
                    self.img_data = f.read()
        elif link.endswith('.mp3'):
            self.audio = MP3(link, ID3=EasyID3)
            self.audio_tags = ID3(link)
            self.play_song_name = self.audio.get('title', ['Unknown'])[0]
            self.play_art_name = self.audio.get('artist', ['Unknown'])[0]
            try:
                self.img_data = self.audio_tags.get("APIC:").data
            except:
                with open('cover.jpg', 'rb') as f:
                    self.img_data = f.read()
        else:
            with open('cover.jpg', 'rb') as f:
                self.img_data = f.read()
                self.play_song_name = 'Unknown'
                self.play_art_name = 'Unknown'

        play_image_data = io.BytesIO(self.img_data)
        img = CoreImage(play_image_data, ext="jpg").texture
        song_image = Image(allow_stretch=True)
        song_image.texture = img
        self.root.ids.PlayScreen.clear_widgets()
        self.root.ids.PlayScreen.add_widget(
            MDIconButton(icon='chevron-left',
                         pos_hint={
                             "center_x": 0.05,
                             "center_y": 0.95
                         },
                         on_press=lambda x: self.back_screen()))
        card = MDCard(orientation='vertical',
                      pos_hint={
                          "center_x": 0.5,
                          "center_y": 0.65
                      },
                      size_hint=(None, None),
                      size=(self.win_size * 0.9, self.win_size * 0.9))
        card.add_widget(song_image)
        self.root.ids.PlayScreen.add_widget(card)
        self.root.ids.PlayScreen.add_widget(
            MDLabel(text=self.play_song_name,
                    halign='center',
                    theme_text_color='Custom',
                    text_color=self.theme_cls.primary_color,
                    font_style='H4',
                    bold=True,
                    pos_hint={"top": 0.84}))
        self.root.ids.PlayScreen.add_widget(
            MDLabel(text=self.play_art_name,
                    halign='center',
                    theme_text_color='Secondary',
                    font_style='H6',
                    pos_hint={"top": 0.8}))
        self.play_progress = MDProgressBar(pos_hint={
            'center_x': 0.5,
            'center_y': 0.25
        },
                                           size_hint_x=0.9,
                                           value=0,
                                           color=self.theme_cls.primary_color)
        self.root.ids.PlayScreen.add_widget(self.play_progress)
        self.root.ids.PlayScreen.add_widget(
            MDIconButton(icon="chevron-double-left",
                         pos_hint={
                             "center_x": .15,
                             "center_y": .15
                         },
                         user_font_size="40sp",
                         on_release=lambda x: self.rewind()))
        self.root.ids.PlayScreen.add_widget(
            MDIconButton(icon="chevron-double-right",
                         pos_hint={
                             "center_x": .85,
                             "center_y": .15
                         },
                         user_font_size="40sp",
                         on_release=lambda x: self.forward()))
        self.next_button = MDIconButton(
            icon="skip-next",
            pos_hint={
                "center_x": .65,
                "center_y": .15
            },
            user_font_size="55sp",
            on_release=lambda x: self.play_song(i + 1))
        self.root.ids.PlayScreen.add_widget(self.next_button)
        self.previous_button = (MDIconButton(
            icon="skip-previous",
            pos_hint={
                "center_x": .35,
                "center_y": .15
            },
            user_font_size="55sp",
            on_release=lambda x: self.play_song(i - 1)))
        self.root.ids.PlayScreen.add_widget(self.previous_button)
        self.play_btn = MDFloatingActionButton(
            icon='play',
            pos_hint={
                'center_x': 0.5,
                "center_y": 0.15
            },
            user_font_size="50sp",
            md_bg_color=(1, 1, 1, 1),
            elevation_normal=10,
            on_press=lambda x: self.play_song_offline(i))
        self.root.ids.PlayScreen.add_widget(self.play_btn)
        self.length_stamp = MDLabel(text=self.convert_sec(
            self.sound.getDuration()),
                                    halign='right',
                                    theme_text_color='Secondary',
                                    padding_x='20dp',
                                    pos_hint={"top": 0.725})
        self.root.ids.PlayScreen.add_widget(self.length_stamp)
        self.play_stamp = (MDLabel(text=self.convert_sec(
            self.sound.getCurrentPosition()),
                                   halign='left',
                                   theme_text_color='Secondary',
                                   padding_x='20dp',
                                   pos_hint={"top": 0.725}))
        self.root.ids.PlayScreen.add_widget(self.play_stamp)
        self.play_song_offline(i)
コード例 #21
0
ファイル: main.py プロジェクト: Sangwan5688/Kivy-Music-Player
 def song_details(self, i):
     self.s_manager = self.root.ids.screen_manager
     self.change_screen('SongDetailsScreen')
     self.details_screen = self.root.ids.SongDetailsScreen
     self.details_screen.clear_widgets()
     self.song_name = self.search_data[i]['title'].replace(
         """, "'").replace("&", "&").replace("'", "'")
     self.song_id = self.search_data[i]['id']
     try:
         self.artist_name = self.search_data[i]['more_info'][
             'primary_artists'].replace(""", "'").replace(
                 "&", "&").replace("'", "'")
         self.album = self.search_data[i]['album'].replace(
             """, "'").replace("&", "&").replace("'", "'")
     except:
         self.artist_name = self.search_data[i]['subtitle']
     self.image_url = self.search_data[i]['image'].replace(
         '50x50', '500x500').replace('150x150', '500x500')
     self.image_path = os.path.join(self.data_path, self.song_id + '.jpg')
     self.fetch_thread = threading.Thread(target=self.fetch_details)
     self.fetch_thread.start()
     self.details_screen.add_widget(
         MDIconButton(icon='chevron-left',
                      pos_hint={
                          "center_x": 0.05,
                          "center_y": 0.95
                      },
                      on_press=lambda x: self.back_screen()))
     song_image = AsyncImage(source=self.image_url,
                             pos_hint={
                                 "center_x": 0.5,
                                 "center_y": 0.5
                             },
                             allow_stretch=True)
     card = MDCard(orientation='vertical',
                   pos_hint={
                       "center_x": 0.5,
                       "center_y": 0.65
                   },
                   size_hint=(None, None),
                   size=(self.win_size * 0.9, self.win_size * 0.9))
     card.add_widget(song_image)
     self.details_screen.add_widget(card)
     self.details_screen.add_widget(
         MDLabel(text=self.song_name,
                 halign='center',
                 theme_text_color='Custom',
                 text_color=self.theme_cls.primary_color,
                 font_style='H4',
                 bold=True,
                 pos_hint={"top": 0.84}))
     self.details_screen.add_widget(
         MDLabel(text=self.artist_name,
                 halign='center',
                 theme_text_color='Secondary',
                 font_style='H6',
                 pos_hint={"top": 0.8}))
     self.spinner = MDSpinner(size_hint=(None, None),
                              size=("50", "50"),
                              pos_hint={
                                  'center_x': 0.5,
                                  "center_y": 0.15
                              },
                              active=True)
     #self.details_screen.add_widget(MDLabel(text=self.album, halign='center', theme_text_color='Hint', font_style='H6', pos_hint={"top":0.9}))
     self.heart_icon = MDIconButton(icon='heart-outline',
                                    user_font_size="30sp",
                                    theme_text_color='Secondary',
                                    pos_hint={
                                        "center_x": 0.1,
                                        "center_y": 0.15
                                    },
                                    on_press=lambda x: self.add_fav())
     self.details_screen.add_widget(self.heart_icon)
     self.play_progress = MDProgressBar(pos_hint={
         'center_x': 0.5,
         'center_y': 0.25
     },
                                        size_hint_x=0.9,
                                        value=0,
                                        color=self.theme_cls.primary_color)
     self.details_screen.add_widget(self.play_progress)
     self.tap_target_view = MDTapTargetView(
         widget=self.heart_icon,
         title_text="Add to Favorites",
         description_text="Feature currently under development",
         widget_position="left_bottom",
     )
     self.details_screen.add_widget(
         MDIconButton(icon="chevron-double-left",
                      pos_hint={
                          "center_x": .3,
                          "center_y": .15
                      },
                      user_font_size="50sp",
                      on_release=lambda x: self.rewind()))
     self.details_screen.add_widget(
         MDIconButton(icon="chevron-double-right",
                      pos_hint={
                          "center_x": .7,
                          "center_y": .15
                      },
                      user_font_size="50sp",
                      on_release=lambda x: self.forward()))
     self.play_btn = MDFloatingActionButton(
         icon='play',
         pos_hint={
             'center_x': 0.5,
             "center_y": 0.15
         },
         user_font_size="50sp",
         md_bg_color=(1, 1, 1, 1),
         elevation_normal=10,
         on_press=lambda x: self.play_song_online())
     self.details_screen.add_widget(self.play_btn)
     self.details_screen.add_widget(
         MDIconButton(icon='arrow-collapse-down',
                      user_font_size="30sp",
                      theme_text_color='Secondary',
                      pos_hint={
                          'center_x': 0.9,
                          "center_y": 0.15
                      },
                      on_press=lambda x: self.download_bar()))
     try:
         self.dia.dismiss()
     except:
         pass
コード例 #22
0
    def on_pre_enter(self):
        txt = requests.get(URL + "api/parcel/", headers=auth_header()).json()

        title = MDLabel(text="Wszystkie przesyłki:",
                        font_style="H4",
                        pos_hint={
                            "center_x": .5,
                            "center_y": .5
                        },
                        size_hint=(None, None),
                        size=("400dp", "90dp"))
        self.box_layout.add_widget(title)
        for parcel in txt['_embedded']['parcelList']:
            card = MDCard(orientation="vertical",
                          padding="8dp",
                          size_hint=(None, None),
                          size=("400dp", "180dp"),
                          pos_hint={
                              "center_x": .5,
                              "center_y": .5
                          })
            label_id = MDLabel(text="Id: " + str(parcel['id']))
            label_reciever = MDLabel(text="Odbiorca: " +
                                     str(parcel['receiver']),
                                     font_style='Caption')
            label_postoffice = MDLabel(text="Skrytka pocztowa: " +
                                       str(parcel['postOffice']),
                                       font_style='Caption')
            label_size = MDLabel(text="Rozmiar: " + str(parcel['size']),
                                 font_style='Caption')
            label_status = MDLabel(text="Status: " +
                                   self.status_for_name(str(parcel['status'])),
                                   font_style='Caption')
            card.add_widget(label_id)
            card.add_widget(MDSeparator())
            card.add_widget(label_reciever)
            card.add_widget(label_postoffice)
            card.add_widget(label_size)
            card.add_widget(label_status)
            card.add_widget(MDSeparator())
            box_layout = MDBoxLayout(adaptive_height=True,
                                     padding=5,
                                     spacing=5)
            wd_button = MDRectangleFlatButton(
                text='W drodze',
                size_hint=(.333, None),
                on_release=partial(self.button_clicked,
                                   uri=str(parcel["_links"]["self"]["href"]),
                                   status="IN_TRANSPORT",
                                   label=label_status))
            d_button = MDRectangleFlatButton(
                text='Dostarczono',
                size_hint=(.333, None),
                on_release=partial(self.button_clicked,
                                   uri=str(parcel["_links"]["self"]["href"]),
                                   status="DELIVERED",
                                   label=label_status))
            o_button = MDRectangleFlatButton(
                text='Odebrano',
                size_hint=(.333, None),
                on_release=partial(self.button_clicked,
                                   uri=str(parcel["_links"]["self"]["href"]),
                                   status="PICKED_UP",
                                   label=label_status))
            box_layout.add_widget(wd_button)
            box_layout.add_widget(d_button)
            box_layout.add_widget(o_button)
            card.add_widget(box_layout)
            self.box_layout.add_widget(card)
コード例 #23
0
    def ui_layout(self):
        play_button_anchor = AnchorLayout(
            anchor_x='center',
            anchor_y='bottom',
            padding=[dp(25), dp(25), dp(25), dp(25)])

        # disable play button for now
        play_button = MDFloatingActionButton(icon='play',
                                             size=[dp(56), dp(56)])
        play_button.disabled = True
        play_button.opacity = 0
        # [76/255, 175/255, 80/255, 1]
        # play_button.md_bg_color = App.get_running_app().theme_cls.primary_color
        # play_button.text_color = [1, 1, 1, 1]
        # play_button.bind(on_press=lambda x: self.play_audio())
        # play_button_anchor.add_widget(play_button)

        self.encode_input = MDTextFieldRound(pos_hint={
            'center_x': 0.5,
            'center_y': 0.5
        },
                                             size_hint=(0.85, 0.5))
        self.encode_input.icon_right = 'send'

        self.encode_input.children[2].children[0].bind(
            on_press=lambda x: self.play_prompt())
        self.encode_input.icon_left = 'close-circle'
        self.encode_input.children[2].children[2].disabled = False
        self.encode_input.children[2].children[2].bind(
            on_press=lambda x: self.clear_input())

        encode_card = MDCard(padding=dp(24),
                             spacing=dp(24),
                             orientation='vertical',
                             size_hint_x=0.85,
                             size_hint_y=0.7,
                             pos_hint={
                                 'top': 0.85,
                                 'center_x': 0.5
                             })
        encode_label = MDLabel(text='Encode Morse Code Audio',
                               font_style='Body1',
                               halign='center',
                               size_hint=(1, 0.5))
        encode_label.theme_text_color = 'Custom'
        encode_label.text_color = [1, 1, 1, 1]

        self.encode_output_label = MDLabel(
            text='Enter text to convert to morse code',
            halign='center',
            size_hint=(1, 0.5))
        self.encode_output_label.theme_text_color = 'Custom'
        self.encode_output_label.text_color = [1, 1, 1, 1]

        self.audio_indicator = AudioIndicator()
        self.audio_indicator.size_hint = (1, 2)
        Clock.schedule_interval(self.update_audio_indicator, 0.1)

        encode_card.add_widget(encode_label)
        encode_card.add_widget(self.audio_indicator)
        encode_card.add_widget(self.encode_output_label)
        encode_card.add_widget(self.encode_input)
        encode_card.md_bg_color = App.get_running_app().theme_cls.accent_color
        encode_card.elevation = 15

        self.add_widget(encode_card)
        self.add_widget(play_button_anchor)

        # Nav Bar
        self.nav_bar = MyNavigationLayout()
        self.nav_bar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        self.nav_bar_anchor.add_widget(self.nav_bar)
        self.add_widget(self.nav_bar_anchor)

        self.cur_sound_index = 0
        self.sound_list = []
        self.cur_sound = None
コード例 #24
0
    def create_exc_card(self, exc, num_of_exc, num_of_exc_total):

        card_layout = MDFloatLayout()  # for centering
        excCard = MDCard(
            spacing=2,
            radius=[80],
            orientation="vertical",
            size_hint=(0.95, 0.8),
            padding=[
                20, 0, 0, 20
            ],  # [padding_left, padding_top,padding_right, padding_bottom].
            pos_hint={
                "center_y": 0.5,
                "center_x": 0.5
            },
            background="resources/card_back.png")

        help_layout = MDGridLayout(rows=1, cols=2, size_hint_y=0.4)
        excnum = str(num_of_exc + 1) + " of " + str(num_of_exc_total)
        exc_num = MDLabel(
            text=excnum,
            font_style="Caption",
            theme_text_color="Secondary",
        )
        del_Button = MDIconButton(
            icon="trash-can-outline",
            theme_text_color="Custom",
            text_color=self.app.text_color,
            on_release=self.show_del_exercise_dialog,
        )

        self.del_button_id_by_exc[exc] = del_Button
        self.exc_by_del_button[del_Button] = exc

        help_layout.add_widget(exc_num)
        help_layout.add_widget(del_Button)
        excCard.add_widget(help_layout)

        name_layout = MDGridLayout(rows=1, cols=2, padding=[
            0, 10, 0, 25
        ])  # [padding_left, padding_top,padding_right, padding_bottom])
        exc_name = MDLabel(text=exc,
                           font_style="H5",
                           theme_text_color="Custom",
                           text_color=self.app.text_color)

        # consider hiding option
        sButton = MDIconButton(
            icon="history",
            theme_text_color="Custom",
            text_color=self.app.theme_cls.primary_color,
            on_release=self.show_exc_history,
        )

        self.stats_button_id_by_exc[exc] = sButton
        self.exc_by_stats_button[sButton] = exc

        name_layout.add_widget(exc_name)
        name_layout.add_widget(sButton)

        excCard.add_widget(name_layout)
        card_layout.add_widget(excCard)
        return card_layout
コード例 #25
0
class Room(MDBoxLayout):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.orientation = 'vertical'

        # Main screen layout
        screen_layout = MDGridLayout()
        screen_layout.cols = 2
        screen_layout.md_bg_color = [0, 1, 1, 1]

        # AC region
        self.timer = 0

        # AC Card
        new_layout = MDFloatLayout()
        self.ac_card1 = AcCard((0.75, 0.75))
        self.ac_card1.on_press = self.ac_touch_down
        self.ac_card1.on_release = self.ac_touch_up
        new_layout.add_widget(self.ac_card1)
        screen_layout.add_widget(new_layout)

        self.content = AcPopup()
        self.content.ac_card.on_release = partial(self.ac_touch_up, popup=True)

        self.ac_popup = Popup(title='AC settings', size_hint=(.75, .75))
        self.ac_popup.content = self.content
        self.ac_popup.background_color = [i / 255
                                          for i in [137, 205, 211]] + [1]

        #--------------------------------------------------------------#

        # Light setup
        new_layout = MDFloatLayout()
        self.light_card = MDCard(
            orientation='horizontal',
            padding='10dp',
            pos_hint={
                'center_x': 0.5,
                'center_y': 0.5
            },
            size_hint=(0.75, 0.75),
        )
        self.light_card.md_bg_color = app.dark_color
        light_image = Image(
            source='static/light1.png',
            size_hint=(1, 1),
        )
        self.light_card.on_press = self.light_change
        self.light_card.add_widget(light_image)
        new_layout.add_widget(self.light_card)
        screen_layout.add_widget(new_layout)

        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        screen_layout.add_widget(Button(text='TODO'))
        self.add_widget(screen_layout)

    def ac_touch_down(self, *args):
        self.timer = time()

    def ac_touch_up(self, popup=False, *args):
        if (time() - self.timer > 0.5) and not popup:
            self.ac_popup.open()
        else:
            color = self.ac_card1.md_bg_color
            if color == app.off_red:
                app.switch(0, 'ac', 1)
                self.ac_card1.md_bg_color = self.content.ac_card.md_bg_color = app.on_green
            else:
                app.switch(0, 'ac', 0)
                self.ac_card1.md_bg_color = self.content.ac_card.md_bg_color = app.off_red
        self.timer = 0

    def button_change(self, btn, *args):
        if btn.background_color == [0, 0, 0, 1]:
            btn.background_color = [1, 1, 1, 1]
            btn.color = [0, 0, 0, 1]
        else:
            btn.background_color = [0, 0, 0, 1]
            btn.color = [1, 1, 1, 1]

    def light_change(self, *args):
        if self.light_card.md_bg_color == app.dark_color:
            self.light_card.md_bg_color = app.light_color
        else:
            self.light_card.md_bg_color = app.dark_color
        app.switch(0, 'light')
コード例 #26
0
class user_menu_operations():

    #This function loads the basic ui for creating,editing and deleting user data
    def users_loader(self):
        #Create three buttons and bind their respective functions to them
        self.change = MDRaisedButton(text='Change account details')
        self.change.bind(
            on_press=partial(user_menu_operations.account_changer, self))
        self.add = MDRaisedButton(text='Add New Account')
        self.add.bind(on_press=partial(user_menu_operations.new_user, self))
        self.remove = MDRaisedButton(text='Remove current user')
        self.remove.bind(on_press=partial(user_menu_operations.remover, self))
        Mainscreenvar = sm.get_screen("MainScreen")
        #add all the three buttons to the main user interface
        Mainscreenvar.ids.container.add_widget(self.change)
        Mainscreenvar.ids.container.add_widget(self.add)
        Mainscreenvar.ids.container.add_widget(self.remove)

    #This function displays the popup for changing details of an user
    def account_changer(self, caller):
        self.popup_card = MDCard(
            size=(400, 400),
            size_hint=(None, None),
            md_bg_color=(0.1, 0.1, 0.1, 1),
            radius=(20, 20, 20, 20),
        )

        self.layout = ModalView(
            size=(500, 500),
            size_hint=(None, None),
            background_color=(0, 0, 0, .9),
            background='atlas://data/images/defaulttheme/action_item')
        self.layout.add_widget(self.popup_card)
        #Create an object that holds the main ui using the template User_details
        self.user_details = User_Details()
        #set the current logged in user's username and password
        self.user_details.ids.user_name.text = current_user
        self.user_details.ids.password.text = current_password
        #bind the save function to the save button from the ui
        self.user_details.ids.save.bind(
            on_press=partial(user_menu_operations.saver, self, 1))
        self.popup_card.add_widget(self.user_details)
        #dispay the popup
        self.layout.open()

    #This function displays a popup that allows the user to create a new user account
    def new_user(self, caller):
        self.popup_card = MDCard(
            size=(400, 400),
            size_hint=(None, None),
            md_bg_color=(0.1, 0.1, 0.1, 1),
            radius=(20, 20, 20, 20),
        )

        self.layout = ModalView(
            size=(500, 500),
            size_hint=(None, None),
            background_color=(0, 0, 0, .9),
            background='atlas://data/images/defaulttheme/action_item')
        self.layout.add_widget(self.popup_card)
        self.user_details = User_Details()
        self.user_details.ids.save.bind(
            on_press=partial(user_menu_operations.saver, self, 2))
        self.popup_card.add_widget(self.user_details)
        self.layout.open()

    #This function saves any changes and any new user account details
    def saver(self, op_id, caller):
        data = (caller.parent.ids.user_name.text,
                caller.parent.ids.password.text)
        #if we are updating data we delete data that is already inside the table
        if op_id == 1:
            mycursor.execute("DELETE FROM users WHERE user_id = %s",
                             (current_user, ))
            mydb.commit()
        #we insert new values into the table
        mycursor.execute("INSERT INTO users VALUES(%s,%s)", data)
        mydb.commit()
        if op_id == 1:
            #if we are updating existing details we rename the table of notes with new user name
            mycursor.execute("ALTER TABLE " + current_user + " RENAME TO " +
                             caller.parent.ids.user_name.text)
            #clear the widgets on screen
            sm.get_screen("MainScreen").ids.container.clear_widgets()
            #reset the screen to the login screen
            sm.current = ('LoginScreen')

        else:
            #if new user is being added we create a new table in their name
            mycursor.execute(
                "CREATE TABLE " + caller.parent.ids.user_name.text +
                "(id double, content text, date date, color int(2))")
        #close the popup window
        self.layout.dismiss()

    #This function is called when the current user account has to be deleted
    def remover(self, caller):
        #First we delete the user name from the user table
        mycursor.execute("DELETE FROM users WHERE user_id = %s",
                         (current_user, ))
        mydb.commit()
        #Then we drop the table that stores all the users sticky notes
        mycursor.execute("DROP TABLE " + current_user)
        #clear screen
        sm.get_screen("MainScreen").ids.container.clear_widgets()
        #reset to login screen
        sm.current = 'LoginScreen'
コード例 #27
0
    def ui_layout(self):
        self.clear_widgets()
        signin_card = MDCard(padding=dp(24),
                             spacing=dp(24),
                             orientation='vertical',
                             size_hint=(0.75, 0.65),
                             pos_hint={'top': 0.8, 'center_x': 0.5}
                             )

        sign_in_label = MDLabel(text='Sign in or Create an Account',
                                font_style='H4', halign='center')
        sign_in_label.theme_text_color = 'Custom'
        sign_in_label.text_color = [1, 1, 1, 1]

        self.helper_label = MDLabel(text='', font_style='Caption', halign='center')
        self.helper_label.theme_text_color = 'Custom'
        self.helper_label.text_color = [1, 1, 1, 1]

        self.username_field = MDTextField()
        self.username_field.hint_text = "User Name"

        # Password
        self.password_field = MDTextField(password=True)
        self.password_field.hint_text = "Password"
        self.password_field.helper_text = "Password must be at least 8 characters"
        self.password_field.helper_text_mode = "on_focus"
        self.proceedButton = WelcomeButton(icon='account-alert', text='  Enter',
                                           size_hint=(None, None), size=(4 * dp(48), dp(48)))

        signin_card.add_widget(sign_in_label)
        if self.status == 'signed_in':
            sign_in_label.text = '%s already signed in!' % self.util.username
            signin_card.add_widget(self.helper_label)
            signin_card.add_widget(Widget())
            signin_card.add_widget(Widget())
            self.proceedButton.text = 'Logout'
            self.proceedButton.icon = 'logout'
            self.proceedButton.bind(on_press=lambda x: self.remove_user_data())
            signin_card.add_widget(self.proceedButton)
        elif self.status == 'sign_in':
            sign_in_label.text = 'Sign In'
            self.proceedButton.bind(on_press=lambda x: self.auth_token())
            signin_card.add_widget(self.helper_label)
            signin_card.add_widget(self.username_field)
            signin_card.add_widget(self.password_field)
            signin_card.add_widget(self.proceedButton)
            signin_card.add_widget(Widget())
        elif self.status == 'create':
            sign_in_label.text = 'Create Account'
            signin_card.add_widget(self.helper_label)
            signin_card.add_widget(self.username_field)
            signin_card.add_widget(self.password_field)
            signin_card.add_widget(self.proceedButton)
            signin_card.add_widget(Widget())
            self.proceedButton.bind(on_press=lambda x: self.create_account())
        else:
            sign_in_button = WelcomeButton(icon='login', text='Sign-in')
            sign_in_button.bind(on_press=lambda x: self.up_date_layout('sign_in'))
            create_account_button = WelcomeButton(icon='creation', text='Sign-up')
            create_account_button.bind(on_press=lambda x: self.up_date_layout('create'))

            choice_box = BoxLayout(orientation='horizontal')
            choice_box.add_widget(Widget())
            choice_box.add_widget(sign_in_button)
            choice_box.add_widget(Widget())
            choice_box.add_widget(Widget())
            choice_box.add_widget(create_account_button)
            choice_box.add_widget(Widget())

            signin_card.add_widget(Widget())
            signin_card.add_widget(Widget())
            signin_card.add_widget(choice_box)
            signin_card.add_widget(Widget())

        toolbar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        toolbar = MDToolbar(title='Add Contact', anchor_title='center')
        toolbar.md_bg_color = App.get_running_app().theme_cls.primary_color
        toolbar.left_action_items = [['arrow-left', lambda x: self.change_screen('welcome')]]
        toolbar_anchor.add_widget(toolbar)

        self.add_widget(signin_card)
        self.add_widget(toolbar_anchor)
        self.do_layout()
コード例 #28
0
class ui_builders():

    #This is a recursion function and runs for the amount of times there is sticky notes for an user
    #This was done so that each note card would have its own animation. all the sticky note info is passed
    #as a list sorted based on creation date
    def sticky_note_builder(self, data):
        #run only if there is any elements within the list data
        if len(data) > 0:
            Mainscreenvar = sm.get_screen("MainScreen")
            #set color
            if data[0][3] == 1:
                self.color = (100 / 256, 0, 0, 1)
            elif data[0][3] == 2:
                self.color = (244 / 256, 81 / 256, 30 / 256, 1)
            elif data[0][3] == 3:
                self.color = (246 / 256, 191 / 256, 38 / 256, 1)
            elif data[0][3] == 4:
                self.color = (11 / 256, 128 / 256, 67 / 256, 1)
            elif data[0][3] == 5:
                self.color = (251 / 256, 182 / 256, 121 / 256, 1)
            elif data[0][3] == 6:
                self.color = (3 / 256, 155 / 256, 129 / 256, 1)
            elif data[0][3] == 7:
                self.color = (63 / 256, 81 / 256, 181 / 256, 1)
            elif data[0][3] == 8:
                self.color = (121 / 256, 134 / 256, 203 / 256, 1)
            elif data[0][3] == 9:
                self.color = (172 / 256, 36 / 256, 127 / 256, 1)
            #make card
            self.card = MDCard(size_hint=(None, None),
                               size=(200, 200),
                               name=str(data[0][0]),
                               md_bg_color=self.color,
                               opacity=0,
                               elevation=14,
                               radius=(20, 20, 20, 20))
            self.card.bind(on_press=partial(Operations.open_edit_mode, self))
            self.layout = RelativeLayout(size=self.card.size)
            self.content = MDLabel(
                text=data[0][1],
                color=(0, 0, 0, 1),
                padding=("20dp", "20dp"),
                font_size="25sp",
                font_style='Body1',
                valign='top',
            )
            self.edit = MDIconButton(icon='pencil', pos_hint={'top': 1})
            self.delete = MDIconButton(icon='delete',
                                       pos_hint={
                                           'top': 1,
                                           'right': 1
                                       })
            self.layout.add_widget(self.edit)
            self.layout.add_widget(self.delete)
            self.layout.add_widget(self.content)
            self.card.add_widget(self.layout)

            Mainscreenvar.ids.container.add_widget(self.card)

            anim1 = Animation(opacity=1, duration=.3)
            #when the animation is complete we call the function recursor that repeats the entire process
            anim1.bind(on_complete=partial(ui_builders.recursor, self, data))
            anim1.start(self.card)
            #remove the first element of the list of data
            del data[0]

        else:
            pass

    #This function repeats the creation of stick note cards until recquired
    def recursor(self, data, *args):
        ui_builders.sticky_note_builder(self, data)
コード例 #29
0
class Operations():

    #This function opens the popup window for editing a stickynotes details
    def open_edit_mode(self, instance, *args):
        self.current_open = instance
        self.popup_card = MDCard(
            size=(200, 200),
            size_hint=(None, None),
            md_bg_color=(0.1, 0.1, 0.1, 1),
            radius=(20, 20, 20, 20),
        )

        self.layout = ModalView(
            size=(500, 500),
            size_hint=(None, None),
            background_color=(0, 0, 0, .9),
            background='atlas://data/images/defaulttheme/action_item')
        self.layout.add_widget(self.popup_card)
        #Get the full info of a sticky note from database using id
        mycursor.execute("SELECT * FROM " + current_user + ' WHERE id=' +
                         instance.name)
        note_content = mycursor.fetchone()

        #create an object self.details that holds the ui of the popup window
        self.details = Details()
        #Set the content of the sticky note
        self.details.ids.content.text = note_content[1]
        #set the color of the sticky note in the drop down menu based on value
        if note_content[3] == 1:
            self.details.ids.color.text = 'Dark Red'
        elif note_content[3] == 2:
            self.details.ids.color.text = 'Orange'
        elif note_content[3] == 3:
            self.details.ids.color.text = 'Yellow'
        elif note_content[3] == 4:
            self.details.ids.color.text = 'Green'
        elif note_content[3] == 5:
            self.details.ids.color.text = 'Peach'
        elif note_content[3] == 6:
            self.details.ids.color.text = 'Blue-Green'
        elif note_content[3] == 7:
            self.details.ids.color.text = 'Purple'
        elif note_content[3] == 8:
            self.details.ids.color.text = 'Light-Purple'
        elif note_content[3] == 9:
            self.details.ids.color.text = 'Pink'
        #bind save and delete functions to their respective buttons
        self.details.ids.save.bind(
            on_press=partial(Operations.save_changes, self, 1))
        self.details.ids.delete.bind(
            on_press=partial(Operations.deletion, self))
        #define the elements for the menu of colors
        items = [{
            'text': 'Dark Red'
        }, {
            'text': 'Orange'
        }, {
            'text': 'Yellow'
        }, {
            'text': 'Green'
        }, {
            'text': 'peach'
        }, {
            'text': 'Blue-Green'
        }, {
            'text': 'Purple'
        }, {
            'text': 'Light-Purple'
        }, {
            'text': 'Pink'
        }]
        #define the menue
        self.details.menu = MDDropdownMenu(caller=self.details.ids.color,
                                           position="auto",
                                           width_mult=4,
                                           items=items)
        self.details.menu.bind(on_release=partial(Operations.set_color, self))
        #Add the ui to the popup card
        self.popup_card.add_widget(self.details)
        #open the popup card
        self.layout.open()
        #some animation for the opening of the popup card
        anim1 = Animation(
            opacity=1,
            duration=.2,
        )
        anim2 = Animation(size=(500, 500), duration=.2)
        anim1.start(self.popup_card)
        anim2.start(self.popup_card)

    #This function is called when a new sticky note is to be created,uses same
    #structure for ui for the edit view popup card
    def open_create_mode(self, instance):
        self.popup_card = MDCard(
            size=(200, 200),
            size_hint=(None, None),
            md_bg_color=(0.1, 0.1, 0.1, 1),
            radius=(20, 20, 20, 20),
        )

        self.layout = ModalView(
            size=(500, 500),
            size_hint=(None, None),
            background_color=(0, 0, 0, .9),
            background='atlas://data/images/defaulttheme/action_item')
        self.layout.add_widget(self.popup_card)
        self.details = Details()
        self.details.remove_widget(self.details.ids.delete)
        items = [{
            'text': 'Dark Red'
        }, {
            'text': 'Orange'
        }, {
            'text': 'Yellow'
        }, {
            'text': 'Green'
        }, {
            'text': 'peach'
        }, {
            'text': 'Blue-Green'
        }, {
            'text': 'Purple'
        }, {
            'text': 'Light-Purple'
        }, {
            'text': 'Pink'
        }]
        self.details.menu = MDDropdownMenu(caller=self.details.ids.color,
                                           position="auto",
                                           width_mult=4,
                                           items=items)
        #bind a function that changes the text of the texfield when the user selects a color
        self.details.menu.bind(on_release=partial(Operations.set_color, self))
        self.popup_card.add_widget(self.details)
        self.layout.open()
        anim1 = Animation(
            opacity=1,
            duration=.2,
        )
        anim2 = Animation(size=(500, 500), duration=.2)
        anim1.start(self.popup_card)
        anim2.start(self.popup_card)
        #Bind the save sticky note function to the save button of the ui
        self.details.ids.save.bind(
            on_press=partial(Operations.save_changes, self, 2))

    #function that sets the text of the textfield after user selects color
    def set_color(self, menu, menu_item):
        self.details.ids.color.text = menu_item.text
        menu.dismiss()

    def save_changes(self, id, caller):
        #if we are just upadting info then delete original entry in db and insert new data
        if id == 1:
            name = self.current_open.name
            mycursor.execute("DELETE FROM " + current_user + ' WHERE id=' +
                             name)
            mydb.commit()
        #inserting new data as new row in db using a random id
        new_id = random.random()
        new_content = self.details.ids.content.text
        new_date = date.today().strftime('%Y-%m-%d')
        if self.details.ids.color.text == 'Dark Red':
            new_color = 1
        elif self.details.ids.color.text == 'Orange':
            new_color = 2
        elif self.details.ids.color.text == 'Yellow':
            new_color = 3
        elif self.details.ids.color.text == 'Green':
            new_color = 4
        elif self.details.ids.color.text == 'peach':
            new_color = 5
        elif self.details.ids.color.text == 'Blue-Green':
            new_color = 6
        elif self.details.ids.color.text == 'Purple':
            new_color = 7
        elif self.details.ids.color.text == 'Light-Purple':
            new_color = 8
        elif self.details.ids.color.text == 'Pink':
            new_color = 9

        #inserting data into table of db
        new_data = (new_id, new_content, new_date, new_color)
        mycursor.execute(
            'INSERT INTO ' + current_user + ' VALUES(%s,%s,%s,%s)', new_data)
        mydb.commit()
        #close popup window
        self.layout.dismiss()
        Mainscreenvar = sm.get_screen("MainScreen")
        #clear mainview to rflect new changes to any stickynote
        Mainscreenvar.ids.container.clear_widgets()
        NotesLoader.notes_loader(self)

    #Function called when a sticky note needs to be deleted
    def deletion(self, caller):
        name = self.current_open.name
        mycursor.execute("DELETE FROM " + current_user + " WHERE id= " + name)
        mydb.commit()
        Mainscreenvar = sm.get_screen("MainScreen")
        Mainscreenvar.ids.container.clear_widgets()
        self.layout.dismiss()
        NotesLoader.notes_loader(self)
コード例 #30
0
ファイル: main.py プロジェクト: yudha-pixel/VeryMon
    def on_enter(self, *args):
        dbs = db.child(self.temp_email).child("data").get()
        grid = self.ids['grid_banner']
        grid.clear_widgets()
        loading = self.ids['loading']
        try:
            for self.i in dbs.each():
                # ~~~~~~~ Banner ~~~~~~~~
                card = MDCard(size_hint=(.9, .5))
                layout = FloatLayout(pos_hint={'center_x': .5, 'center_y': .5})
                card.add_widget(layout)

                # ~~~~~~~ ID Data ~~~~~~~~
                ids = self.i.val()['ids']
                dataid = MDRaisedButton(text=f'{ids}',
                                        pos_hint={
                                            'center_x': .28,
                                            'top': 1
                                        })
                layout.add_widget(dataid)

                # ~~~~~~~ Nama Data ~~~~~~~~
                nama = self.i.val()['nama']
                datanama = MDLabel(text=nama,
                                   font_style='H6',
                                   halign='left',
                                   pos_hint={
                                       'center_x': .55,
                                       'center_y': .8
                                   })
                layout.add_widget(datanama)

                # ~~~~~~~ Keterangan Data ~~~~~~~~
                keterangan = self.i.val()['keterangan']
                dataket = MDLabel(text=keterangan,
                                  font_style='Body1',
                                  halign='left',
                                  size_hint=(.8, .3),
                                  pos_hint={
                                      'center_x': .47,
                                      'center_y': .5
                                  })
                bgket = MDRectangleFlatButton(size_hint=(.9, .45),
                                              pos_hint={
                                                  'center_x': .5,
                                                  'top': .7
                                              },
                                              disabled=True)
                layout.add_widget(bgket)
                layout.add_widget(dataket)

                # ~~~~~~~ Keluar atau Masuk ~~~~~~~~
                io = self.i.val()['io']
                dataio = MDLabel(text=io,
                                 font_style='Button',
                                 halign='right',
                                 pos_hint={
                                     'center_x': .45,
                                     'top': .65
                                 })
                layout.add_widget(dataio)

                # ~~~~~~~ Jenis Data ~~~~~~~~
                jenis = self.i.val()['jenis']
                datajenis = MDLabel(text=jenis,
                                    font_style='Button',
                                    halign='left',
                                    pos_hint={
                                        'center_x': .55,
                                        'top': .65
                                    })
                layout.add_widget(datajenis)

                # ~~~~~~~ tgl Data ~~~~~~~~
                tgl = self.i.val()['tgl']
                datatgl = MDLabel(text=tgl,
                                  font_style='Button',
                                  halign='right',
                                  pos_hint={
                                      'center_x': .45,
                                      'center_y': .8
                                  })
                layout.add_widget(datatgl)

                # ~~~~~~~ Jumlah Uang ~~~~~~~~
                jumlah = self.i.val()['jumlah']
                matauang = self.i.val()['mata_uang']
                datajumlah = MDLabel(text=matauang + ' ' + jumlah + '',
                                     font_style='Button',
                                     halign='right',
                                     pos_hint={
                                         'center_x': .45,
                                         'top': .55
                                     })
                layout.add_widget(datajumlah)

                # ~~~~~~~ Button Delete ~~~~~~~~
                hapus = Hapus(id=f'{ids}',
                              text='Hapus',
                              on_release=self.delete)

                clear = MDRaisedButton(text='Tutup')

                delete_dialog = MDDialog(title='Apakah Anda Yakin ?',
                                         size_hint=(0.95, 1),
                                         buttons=[hapus, clear])

                hapus.bind(on_release=delete_dialog.dismiss)

                delete = MDIconButton(icon='trash-can',
                                      pos_hint={
                                          'center_x': .9,
                                          'top': 1
                                      },
                                      on_release=delete_dialog.open)

                clear.bind(on_release=delete_dialog.dismiss)

                layout.add_widget(delete)

                # ~~~~~~~ Button Delete ~~~~~~~~
                # edit_menu = print('Teredit')
                edit = Edit(id=f'{ids}',
                            icon='pencil',
                            pos_hint={
                                'center_x': .8,
                                'top': 1
                            },
                            on_release=self.edited)

                layout.add_widget(edit)

                grid.add_widget(card)

            loading.active = False
        except:
            Snackbar(text="Data Kosong").show()
            loading.active = False