Exemplo n.º 1
0
    def post_init(self, dt):

        scroll = ScrollView(always_overscroll=False)
        self.list_of_devices = MDList()
        scroll.add_widget(self.list_of_devices)
        box = BoxLayout()
        box.add_widget(scroll)

        self.refresh_btn = MDFloatingActionButton(
            icon='refresh',
            pos_hint={
                'center_x': .5,
                'center_y': .5
            },
            md_bg_color=self.app.theme_cls.primary_color,
            opacity=0)
        self.refresh_btn.bind(on_release=self.get_bluetooth_devices)
        btn_layout = FloatLayout(size_hint_y=None, height=dp(100))
        btn_layout.add_widget(self.refresh_btn)

        self.container = BoxLayout(orientation='vertical')
        self.toolbar = MDToolbar(pos_hint={'top': 1})
        self.toolbar.left_action_items = [
            'chevron-left', lambda x: self.switch_screen()
        ],
        self.toolbar.right_action_items = [
            'bluetooth-off', lambda x: self.clear_device()
        ],
        self.container.add_widget(self.toolbar)
        self.container.add_widget(box)
        self.container.add_widget(btn_layout)

        self.add_widget(self.container)
Exemplo n.º 2
0
    def build(self):
        screen = Screen()
        self.theme_cls.primary_palette = "Orange"
        self.theme_cls.primary_hue = "100"

        btn1 = MDFlatButton(text='Show Chord',
                            pos_hint={
                                'center_x': 0.5,
                                'center_y': 0.05
                            })
        btn = MDFloatingActionButton(
            icon="android",
            pos_hint={
                'center_x': 0.5,
                'center_y': 0.05
            },
        )
        btn2 = MDFlatButton(text='SelectChord',
                            pos_hint={
                                'center_x': 0.05,
                                'center_y': 0.95
                            })
        btn = MDFloatingActionButton(
            icon="android",
            pos_hint={
                'center_x': 0.05,
                'center_y': 0.95
            },
        )
        screen.add_widget(btn1)
        screen.add_widget(btn2)
        return screen
Exemplo n.º 3
0
class BattleshipScreen(Screen):
    def __init__(self, **kwargs):
        super(BattleshipScreen, self).__init__(name=kwargs.get('name'))

        self.ui_layout()

    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)


    def start_game(self):

        # add this line - os.system('java -jar ./jar/<filename>.jar')
        os.system('java -jar ./jar/BATTLESHIP.jar')

    def return_home(self):
        self.manager.current = 'welcome'
Exemplo n.º 4
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 = """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)
Exemplo n.º 5
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)
Exemplo n.º 6
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 = """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)
Exemplo n.º 7
0
class AlarmScreen(Screen):
    def __init__(self, **kw):
        self.app = MDApp.get_running_app()
        Clock.schedule_once(self.post_init, 0)
        super().__init__(**kw)

    def post_init(self, dt):
        self.btn = MDFloatingActionButton(icon='alarm-off',
                                          pos_hint={
                                              'center_x': .5,
                                              'center_y': .1
                                          })
        self.btn.md_bg_color = self.app.theme_cls.primary_color
        self.btn.bind(on_release=self.close)
        self.image = Image(source=self.app.car_image,
                           pos_hint={
                               'center_x': .5,
                               'center_y': .5
                           },
                           size_hint=[None, None],
                           size=[200, 200])
        self.add_widget(self.image)
        self.add_widget(self.btn)

    def on_enter(self, *args):
        self.start_animation()
        return super().on_enter(*args)

    def on_pre_leave(self, *args):
        Animation.cancel_all(self.image)
        return super().on_pre_leave(*args)

    def start_animation(self, *_):
        a = Animation(size=[300, 300], d=1., t='in_out_elastic')
        a.bind(on_complete=self.back_aniamte)
        a.start(self.image)

    def back_aniamte(self, *_):
        a = Animation(size=[150, 150], d=1., t='in_out_elastic')
        a.bind(on_complete=self.start_animation)
        a.start(self.image)

    def close(self, *_):
        self.app.root.ids.sm.current = 'scr 1'
        if self.app.vibrator:
            self.app.vibrator.stop()
            self.app.vibrator = None
        Clock.schedule_once(self.move_close, .3)

    def move_close(self, _):
        cancel_notification(192837)
        mActivity.moveTaskToBack(True)
Exemplo n.º 8
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.cols = 2
        self.padding = 10

        if os.path.isfile("prev_details.txt"):
            with open("prev_details.txt", "r") as f:
                d = f.read().split(",")
                prev_ip = d[0]
                prev_port = d[1]
                prev_username = d[2]
        else:
            prev_ip = "192.168.1.9"
            prev_port = "1234"
            prev_username = ""
        self.add_widget(MDLabel())
        self.add_widget(MDLabel())
        self.add_widget(MDLabel(text="IP : ", halign="center",
                                theme_text_color="Primary"))
        self.float = FloatLayout()
        self.ip = MDTextField(text=prev_ip, multiline=False,
                              pos_hint={'x': 0, 'y': 0.2})
        self.float.add_widget(self.ip)
        self.add_widget(self.float)

        self.add_widget(MDLabel(text="Port : ", halign="center",
                                theme_text_color="Primary"))
        self.float = FloatLayout()
        self.port = MDTextField(
            text=prev_port, multiline=False, pos_hint={'x': 0, 'y': 0.2})
        self.float.add_widget(self.port)
        self.add_widget(self.float)

        self.add_widget(MDLabel(text="Username : "******"center", theme_text_color="Primary"))
        self.float = FloatLayout()
        self.username = MDTextField(
            text=prev_username, multiline=False, pos_hint={'x': 0, 'y': 0.2})
        self.float.add_widget(self.username)
        self.add_widget(self.float)

        self.float_layout = FloatLayout()
        self.connect_fab = MDFloatingActionButton(
            icon="arrow-right", pos_hint={'x': 0.68, 'y': 0})
        self.connect_fab.bind(on_release=self.connect_button)
        self.float_layout.add_widget(self.connect_fab)
        self.add_widget(MDLabel())
        self.add_widget(MDLabel())
        self.add_widget(MDLabel())
        self.add_widget(MDLabel())
        self.add_widget(MDLabel())
        self.add_widget(self.float_layout)
Exemplo n.º 9
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)
Exemplo n.º 10
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        app = MDApp.get_running_app()
        scroll = ScrollView()
        Mlist = MDList()
        self.products = app.customconfig.load_products()

        for i in app.customconfig.load_orders():
            item = OrderListItem(i)
            item.text = f"Order: {i.order_number}"
            item.secondary_text = f"Customer: {i.customer}"
            item.tertiary_text = f"Status: {i.status}"
            icon = IconRightWidget(icon="account-details")
            icon.bind(on_release=item.show_popup)
            item.add_widget(icon)
            item.bind(on_release=item.show_popup)
            Mlist.add_widget(item)

        layout = BoxLayout()
        layout.orientation = "vertical"
        toolbar = MDToolbar(title="Orders")
        toolbar.left_action_items = [["menu", lambda x: self.openNav()]]
        layout.add_widget(toolbar)
        scroll.add_widget(Mlist)
        layout.add_widget(scroll)
        self.action = MDFloatingActionButton(icon="plus",
                                             pos_hint={"center_x": 0.5},
                                             on_release=self.openAction)
        layout.add_widget(self.action)

        self.add_widget(layout)
Exemplo n.º 11
0
    def build(self):
        screen = Screen()

        btn_flat = MDFlatButton(text='Hello World',
                                pos_hint={
                                    'center_x': .5,
                                    'center_y': .9
                                })

        btn_rectangle_flat = MDRectangleFlatButton(text='Hello World',
                                                   pos_hint={
                                                       'center_x': .5,
                                                       'center_y': .8
                                                   })

        icon_btn = MDIconButton(icon='android',
                                pos_hint={
                                    'center_x': .5,
                                    'center_y': .7
                                })

        icon_floating_btn = MDFloatingActionButton(icon='language-python',
                                                   pos_hint={
                                                       'center_x': .5,
                                                       'center_y': .6
                                                   })

        screen.add_widget(btn_flat)
        screen.add_widget(btn_rectangle_flat)
        screen.add_widget(icon_btn)
        screen.add_widget(icon_floating_btn)

        return screen
Exemplo n.º 12
0
    def __init__(self, **kwargs):
        super().__init__(**kwargs)

        # In this small block, books are generated from the json file.
        # (from the task)
        self.books = []
        json_books = BooksProvider.load_books_from_json()
        for json_book in json_books:
            self.books.append(Book(**json_book))

        add_book_button = MDFloatingActionButton(
            icon="plus", on_release=self.open_book_adder_screen)

        # Creating layout where all inner parts will be placed
        # (such as the foundation of the house)
        self.layout = MDBoxLayout(orientation="vertical")

        self.search_field = SearchField()
        # ScrollView allows to scroll list that was put inside of whis view.
        # If there is no ScrollView, the user will not be able to see list
        # items that are outside of the screen.
        self.scroll_view = ScrollView()

        # Books are put in the books_list
        # (the book_list is put in the scroll_view, this is realized in the
        # `load_books_list` method)
        self.load_books_list(self.books)

        # Search field and scroll view are put into the layout
        self.layout.add_widget(self.search_field)
        self.layout.add_widget(self.scroll_view)

        # And the layout is put into this screen
        self.add_widget(self.layout)
        self.add_widget(add_book_button)
Exemplo n.º 13
0
    def build(self):
        #Build root widget, that is the core application or interface
        self.theme_cls.primary_palette = 'Green'
        screen = Screen()
        #Create a screen variable and add elements to the Screen to display them
        btn_num = MDRectangleFlatButton(text='Enter', pos_hint={'center_x': 0.5, 'center_y': 0.65},
                                        on_release=self.get_data_num)
        screen.add_widget(btn_num)
        btn_sms = MDRectangleFlatButton(text='Enter', pos_hint={'center_x': 0.5, 'center_y': 0.45},
                                        on_release=self.get_data_sms)
        screen.add_widget(btn_sms)
        icon_record = MDFloatingActionButton(icon='microphone',
                                             pos_hint={'center_x': 0.5, 'center_y': 0.25},
                                             size_hint_x=None,
                                             on_press=self.get_voice)

        screen.add_widget(icon_record)

        self.num = Builder.load_string(num_helper)
        screen.add_widget(self.num)

        self.sms = Builder.load_string(sms_helper)
        screen.add_widget(self.sms)

        return screen
Exemplo n.º 14
0
 def build(self):
     screen = Screen()
     btn_rect = MDRectangleFlatButton(text='Click Me',
                                      pos_hint={
                                          'center_x': 0.5,
                                          'center_y': 0.5
                                      })
     btn_flat = MDFlatButton(text='Click Me',
                             pos_hint={
                                 'center_x': 0.5,
                                 'center_y': 0.6
                             })
     btn_icon = MDIconButton(icon='android',
                             pos_hint={
                                 'center_x': 0.5,
                                 'center_y': 0.7
                             })
     btn_flt = MDFloatingActionButton(icon='android',
                                      pos_hint={
                                          'center_x': 0.5,
                                          'center_y': 0.5
                                      })
     screen.add_widget(btn_flat)
     screen.add_widget(btn_rect)
     screen.add_widget(btn_icon)
     screen.add_widget(btn_flt)
     return screen
Exemplo n.º 15
0
 def build(self):
     screen = Screen()
     btn1 = MDFlatButton(text='Hello World', pos_hint={'center_x': 0.5, 'center_y': 0.5})
     btn = MDFloatingActionButton(icon="android",
                                  pos_hint={'center_x': 0.5, 'center_y': 0.5},
                                  )
     screen.add_widget(btn1)
     return screen
Exemplo n.º 16
0
 def post_init(self, dt):
     self.btn = MDFloatingActionButton(icon='alarm-off',
                                       pos_hint={
                                           'center_x': .5,
                                           'center_y': .1
                                       })
     self.btn.md_bg_color = self.app.theme_cls.primary_color
     self.btn.bind(on_release=self.close)
     self.image = Image(source=self.app.car_image,
                        pos_hint={
                            'center_x': .5,
                            'center_y': .5
                        },
                        size_hint=[None, None],
                        size=[200, 200])
     self.add_widget(self.image)
     self.add_widget(self.btn)
Exemplo n.º 17
0
 def show_drill(self, chosen_drills):
     """Shows all the chosen drills on the screen"""
     i = 0
     for page in [self.ids.drill1, self.ids.drill2, self.ids.drill3]:
         page.ids.title.text = chosen_drills[i]['title']
         page.ids.body.text = chosen_drills[i]['description']
         if chosen_drills[i]['link'] is not None:
             floating_button = MDFloatingActionButton(pos_hint={
                 'center_x': 0.8,
                 'center_y': 0.1
             },
                                                      icon='youtube')
             floating_button.md_bg_color = self.app.theme_cls.primary_color
             floating_button.bind(on_release=lambda x, link=chosen_drills[i]
                                  ['link']: open_url(link))
             page.add_widget(floating_button)
             self.youtube_button[i] = floating_button
         i += 1
Exemplo n.º 18
0
    def build(self):
        self.theme_cls.primary_palette = "Blue"
        screen = Screen()

        # username = MDTextField(
        #     pos_hint={'center_x': 0.5, 'center_y': 0.5},
        #     size_hint_x=None, width=200)

        username = Builder.load_string(helpers.username_input)
        screen.add_widget(username)

        password = Builder.load_string(helpers.password_input)
        screen.add_widget(password)

        btn1 = MDRectangleFlatButton(text='Submit',
                                     pos_hint={
                                         'center_x': 0.5,
                                         'center_y': 0.3
                                     })
        btn = MDFloatingActionButton(
            icon="android",
            pos_hint={
                'center_x': 0.5,
                'center_y': 0.3
            },
        )
        btn2 = MDRectangleFlatButton(text='Cancel',
                                     pos_hint={
                                         'center_x': 0.620,
                                         'center_y': 0.3
                                     })
        btn = MDFloatingActionButton(
            icon="android",
            pos_hint={
                'center_x': 0.4,
                'center_y': 0.3
            },
        )

        screen.add_widget(btn1)
        screen.add_widget(btn2)

        return screen
Exemplo n.º 19
0
 def build(self):
     screen = Screen()
     btn1 = MDFlatButton(text='Hello World', pos_hint={'x': 0, 'y': 0})
     btn = MDFloatingActionButton(icon="android",
                                  pos_hint={'center_x': 0.5, 'center_y': 0.5},
                                  )
     btn2 = MDIconButton(icon='language-python',pos_hint={'x': 0.5, 'y': 0.5})
     screen.add_widget(btn1)
     screen.add_widget(btn)
     screen.add_widget(btn2)
     return screen
Exemplo n.º 20
0
 def create_numeric_control(self, app, text=''):
     grid = MDGridLayout(spacing=3, padding=3, cols=3)
     decrease_number_btn = MDFloatingActionButton(
         icon="minus",
         md_bg_color=app.theme_cls.primary_color,
         on_release=self.numeric_decrement)
     self.parameter_label = LabelButton(
         text=text,
         font_size=40,
         halign='center',
         theme_text_color="Custom",
         text_color=(1, .2, 1, 1),
         on_release=self.commit_parameter_value)
     increase_number_btn = MDFloatingActionButton(
         icon="plus",
         md_bg_color=app.theme_cls.primary_color,
         on_release=self.numeric_increment)
     self.popup_container.clear_widgets()
     grid.add_widget(decrease_number_btn)
     grid.add_widget(self.parameter_label)
     grid.add_widget(increase_number_btn)
     self.popup_container.add_widget(grid)
Exemplo n.º 21
0
 def build(self):
     screen = Screen()
     btn_flat = MDRectangleFlatButton(text='Hello World',
                                      pos_hint={
                                          'center_x': 0.5,
                                          'center_y': 0.5
                                      })
     icon_btn = MDFloatingActionButton(icon='language-python',
                                       pos_hint={
                                           'center_x': 0.5,
                                           'center_y': 0.5
                                       })
     screen.add_widget(icon_btn)
     return screen
Exemplo n.º 22
0
    def __init__(self, **kwargs):
        super().__init__(cols=1, **kwargs)

        self.__next_image_index = 0

        self.add_image_button = MDFloatingActionButton(
            icon="plus", on_release=self.open_image_chooser)

        self.scroll_view = ScrollView(size_hint=(1, 1))

        self.builder = ImageGridBuilder()

        self.scroll_view.add_widget(self.builder)
        self.add_widget(self.scroll_view)
        self.add_widget(self.add_image_button)
Exemplo n.º 23
0
    def build(self):
        screen = Screen()
        flat_btn = MDRectangleFlatButton(text="Click",
                                         pos_hint={
                                             'center_x': 0.3,
                                             'center_y': 0.5
                                         })  # button is on center

        icon_btn = MDFloatingActionButton(icon='language-java',
                                          pos_hint={
                                              'center_x': 0.6,
                                              'center_y': 0.5
                                          })
        screen.add_widget(icon_btn)
        screen.add_widget(flat_btn)
        return screen
 def build(self):
     screen = MDScreen()
     # btn_flat = MDFlatButton(text='Hello World', pos_hint={'center_x': 0.5, 'center_y': 0.5})
     btn_flat = MDRectangleFlatButton(text='Hello World',
                                      pos_hint={
                                          'center_x': 0.3,
                                          'center_y': 0.5
                                      })
     # btn_icon=MDIconButton(icon='lightbulb',pos_hint={'center_x':0.5,'center_y':0.5})
     btn_icon = MDFloatingActionButton(icon='lightbulb',
                                       pos_hint={
                                           'center_x': 0.5,
                                           'center_y': 0.5
                                       })
     screen.add_widget(btn_icon)
     screen.add_widget(btn_flat)
     return screen
Exemplo n.º 25
0
    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()
Exemplo n.º 26
0
    def ui_layout(self):
        self.clear_widgets()

        layout = BoxLayout(orientation='vertical')
        scroll = ScrollView(do_scroll_x=False,
                            size_hint=(1, None),
                            size=(Window.width, Window.height))
        scroll_box = BoxLayout(orientation='vertical',
                               size_hint_y=None,
                               padding=(dp(12), dp(60)),
                               spacing=dp(5))
        scroll_box.bind(minimum_height=scroll_box.setter('height'))
        # Add more self.scrollbox.add_widget(MDLabel(text='')) to increase padding
        scroll_box.add_widget(MDLabel(text=' '))
        scroll_box.add_widget(MDLabel(text=' '))
        scroll_box.add_widget(MDLabel(text=' '))
        scroll_box.add_widget(MDLabel(text=' ', size_hint=(1, 5)))

        for contact in self.util.contact_list:
            contact_card = ContactCard(util=self.util,
                                       contact=contact
                                       )
            scroll_box.add_widget(contact_card)

        scroll.add_widget(scroll_box)
        layout.add_widget(scroll)

        # Add floating action button to write messages
        add_contact_anchor = AnchorLayout(anchor_x='right', anchor_y='bottom',
                                          padding=[dp(25), dp(25), dp(25), dp(25)])
        add_contact_btn = MDFloatingActionButton(icon='account-plus', size=[dp(56), dp(56)])
        add_contact_btn.md_bg_color = App.get_running_app().theme_cls.primary_color
        add_contact_btn.theme_text_color = "Custom"
        add_contact_btn.text_color = [1, 1, 1, 1]
        add_contact_btn.bind(on_press=lambda x: self.change_screen('add_contact'))
        add_contact_anchor.add_widget(add_contact_btn)

        toolbar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        toolbar = MDToolbar(title='Contacts', 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('message')]]
        toolbar_anchor.add_widget(toolbar)

        self.add_widget(layout)
        self.add_widget(add_contact_anchor)
        self.add_widget(toolbar_anchor)

        self.do_layout()
 def build(self):
     screen = Screen()
     self.theme_cls.primary_palette = "Yellow"
     self.theme_cls.primary_hue = "900"
     self.theme_cls.theme_style = "Dark"
     btn_flat = MDRectangleFlatButton(text="this is hacker",
                                      pos_hint={
                                          'center_x': 0.5,
                                          'center_y': 0.5
                                      })
     icon_btn = MDFloatingActionButton(icon='android',
                                       pos_hint={
                                           'center_x': 0.4,
                                           'center_y': 0.5
                                       })
     screen.add_widget(btn_flat)
     screen.add_widget(icon_btn)
     return screen
Exemplo n.º 28
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)  

        app = MDApp.get_running_app()
        scroll = ScrollView()
        self.Mlist = MDList()
        self.build_list()

        layout = BoxLayout()
        layout.orientation = "vertical"
        toolbar = MDToolbar(title="Materials")
        toolbar.left_action_items = [
            ["menu", lambda x: self.openNav()]]
        layout.add_widget(toolbar)
        scroll.add_widget(self.Mlist)
        layout.add_widget(scroll)
        self.action_popup = MaterialActionPopup(self.build_list)
        self.action = MDFloatingActionButton(icon="plus", pos_hint={"center_x":0.5}, on_release=self.action_popup.open)
        layout.add_widget(self.action)
        self.add_widget(layout)
    def build(self):
        self.theme_cls.primary_palette = "Yellow"
        self.theme_cls.primary_hue = "900"
        self.theme_cls.theme_style = "Dark"
        screen = MDScreen()

        # btn_flat = MDFlatButton(text='Hello World', pos_hint={'center_x': 0.5, 'center_y': 0.5})
        btn_flat = MDRectangleFlatButton(text='Hello World',
                                         pos_hint={
                                             'center_x': 0.3,
                                             'center_y': 0.5
                                         })
        # btn_icon=MDIconButton(icon='lightbulb',pos_hint={'center_x':0.5,'center_y':0.5})
        btn_icon = MDFloatingActionButton(icon='lightbulb',
                                          pos_hint={
                                              'center_x': 0.5,
                                              'center_y': 0.5
                                          })
        screen.add_widget(btn_icon)
        screen.add_widget(btn_flat)
        return screen
Exemplo n.º 30
0
    def build(self):
        self.screen = Screen()
        self.theme_cls.primary_palette = 'Green'
        self.theme_cls.theme_style = 'Dark'
        front_label = MDLabel(text='Welcome Champion!!!',
                              halign='center',
                              theme_text_color='Secondary',
                              font_style='H3',
                              pos_hint={
                                  'center_x': 0.5,
                                  'center_y': 0.65
                              })
        button_flat = MDFloatingActionButton(icon='soccer',
                                             pos_hint={
                                                 'center_x': 0.5,
                                                 'center_y': 0.1
                                             },
                                             on_release=self.login)
        self.username = MDTextField(text='username',
                                    pos_hint={
                                        'center_x': 0.5,
                                        'center_y': 0.4
                                    },
                                    size_hint_x=None,
                                    width=300)
        self.password = MDTextField(text='password',
                                    pos_hint={
                                        'center_x': 0.5,
                                        'center_y': 0.3
                                    },
                                    size_hint_x=None,
                                    width=300)

        self.screen.add_widget(self.password)
        self.screen.add_widget(self.username)
        self.screen.add_widget(button_flat)
        self.screen.add_widget(front_label)

        return self.screen