示例#1
0
    def load_content(self):
        self.layout.clear_widgets()

        toolbar = MDToolbar(type="top")
        toolbar.left_action_items = [["arrow-left", self.go_back]]
        toolbar.right_action_items = [["plus", self.add_book]]

        title_label = MDLabel(
            text="Title: ",
            halign="left",
            valign="top",
        )
        subtitle_label = MDLabel(
            text="Subtitle: ",
            halign="left",
            valign="top",
        )
        price_label = MDLabel(
            text="Price: ",
            halign="left",
            valign="top",
        )

        self.title_input = MDTextField()
        self.subtitle_input = MDTextField()
        self.price_input = MDTextField()

        self.layout.add_widget(toolbar)
        self.layout.add_widget(title_label)
        self.layout.add_widget(self.title_input)
        self.layout.add_widget(subtitle_label)
        self.layout.add_widget(self.subtitle_input)
        self.layout.add_widget(price_label)
        self.layout.add_widget(self.price_input)
示例#2
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)
示例#3
0
 def bottom_bar_name_def(self):
     self.bottom_bar = MDToolbar()
     self.pass_button = MDIconButton(icon="check-bold",
                                     pos_hint={
                                         'center_x': 0.5,
                                         'center_y': 0.5
                                     },
                                     on_release=self.next_card_pass)
     self.fail_button = MDIconButton(icon="close-box-outline",
                                     pos_hint={
                                         'center_x': 0.5,
                                         'center_y': 0.5
                                     },
                                     on_release=self.next_card_fail)
     self.tag_button = MDIconButton(icon="star-circle",
                                    pos_hint={
                                        'center_x': 0.5,
                                        'center_y': 0.5
                                    })
     #self.back_button.bind(on_press=self.back_display_cards)
     self.bottom_bar.add_widget(MDLabel())
     self.bottom_bar.add_widget(MDLabel())
     self.bottom_bar.add_widget(self.fail_button)
     self.bottom_bar.add_widget(MDLabel())
     self.bottom_bar.add_widget(MDLabel())
     self.bottom_bar.add_widget(self.tag_button)
     self.bottom_bar.add_widget(MDLabel())
     self.bottom_bar.add_widget(MDLabel())
     self.bottom_bar.add_widget(self.pass_button)
     self.bottom_bar.add_widget(MDLabel())
     self.bottom_bar.add_widget(MDLabel())
     self.add_widget(self.bottom_bar)
示例#4
0
 def on_enter(self, *args):
     root = BoxLayout(orientation='vertical')
     toolbar = MDToolbar(title='Меню')
     toolbar.right_action_items = [[
         "dots-vertical", lambda x: self.nav_drawer.set_state('toggle')
     ]]
     root.add_widget(toolbar)
     root.add_widget(Widget())
     self.add_widget(root)
示例#5
0
 def bottom_bar_complete(self):
     self.bottom_bar = MDToolbar()
     self.return_review = MDFlatButton(text="Return to Decks",
                                       pos_hint={
                                           'center_x': .5,
                                           'center_y': .5
                                       },
                                       on_release=self.skeleton_frame2)
     self.bottom_bar.add_widget(self.return_review)
     self.add_widget(self.bottom_bar)
示例#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
 def bottom_bar_name_def(self):
     self.bottom_bar = MDToolbar()
     #self.box = MDBoxLayout(orientation="horizontal")
     self.back_button = MDFlatButton(text="Return to Decks",
                                     pos_hint={
                                         'center_x': 0.5,
                                         'center_y': 0.5
                                     })
     self.back_button.bind(on_press=self.back_display_cards)
     #self.box.add_widget(self.back_button)
     #self.box.add_widget(MDLabel())
     self.bottom_bar.add_widget(self.back_button)
     self.add_widget(self.bottom_bar)
示例#8
0
 def __init__(self, **kwargs):
     super(RootWidget, self).__init__(**kwargs)
     self.anchor_x = 'right'
     self.anchor_y = 'top'
     mapview = MapView(zoom=11, lat=self.lat, lon=self.lon)
     self.add_widget(mapview)
     toolbar = MDToolbar(
         title="Map",
         background_palette="Primary",
         background_hue="500",
         elevation=10,
     )
     toolbar.left_action_items = [["arrow-left", lambda x: x]]
     toolbar.right_action_items = [["magnify", lambda x: self.show_confirmation_dialog()]]
     self.add_widget(toolbar)
示例#9
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

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

        layout = BoxLayout()
        layout.orientation = "vertical"
        toolbar = MDToolbar(title="Settings")
        toolbar.left_action_items = [["menu", lambda x: self.openNav()]]
        layout.add_widget(toolbar)
        scroll.add_widget(Mlist)
        layout.add_widget(scroll)
        self.add_widget(layout)
    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)
示例#11
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()
示例#12
0
    def __init__(self, **kwargs):
        super(Drop, self).__init__(**kwargs)
        self.auto_dismiss = False

        self.layout = MyBoxLayout(orientation="vertical")
        self.options_scroll = ScrollView()
        self.options_layout = MDList()
        if not self.default:
            self.default = self.values[0]
        self.refresh()

        self.toolbar = MDToolbar(title=self.title,
                                 anchor_title="center",
                                 elevation=10)
        self.toolbar.md_bg_color = color(
            f"images/{theme_image[config_data['theme']][2]}.png")
        self.toolbar.specific_text_color = color(
            f"images/{theme_image[config_data['theme']][0]}.png")
        self.search_box = MyBoxLayout(padding=[20, 0], size_hint_y=0.2)
        self.search = TextField(padding_x=10)
        self.search_box.add_widget(self.search)
        self.toolbar.left_action_items = [["magnify", self.slide_search]]
        self.toolbar.right_action_items = [["check", self.dismiss]]
        self.layout.add_widget(self.toolbar)
        self.options_scroll.add_widget(self.options_layout)
        self.layout.add_widget(self.options_scroll)

        self.add_widget(self.layout)
示例#13
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)
示例#14
0
    def __init__(self, scroll_view=None):
        super(MyNavigationLayout, self).__init__()
        self.content_nav_drawer = ContentNavigationDrawer(self)
        self.drawer_open = False
        self.scroll_view = scroll_view

        self.add_widget(self.content_nav_drawer)
        toolbar_anchor = AnchorLayout(anchor_x='center', anchor_y='top')
        self.toolbar = MDToolbar()
        self.toolbar.anchor_title = 'center'
        self.toolbar.elevation = 0
        self.toolbar.theme_text_color = 'Custom'
        self.toolbar.text_color = [1, 1, 1, 1]
        self.toolbar.md_bg_color = App.get_running_app(
        ).theme_cls.primary_color
        self.toolbar.left_action_items = [[
            'menu', lambda x: self.toggle_nav_drawer()
        ]]
        toolbar_anchor.add_widget(self.toolbar)
        self.add_widget(toolbar_anchor)

        # This is here because on scroll views the buttons behind the nav bar
        # will count as being pressed instead of the nav drawer buttons
        if self.scroll_view:
            Clock.schedule_interval(self.disable_scroll_buttons, 0.1)
    def build(self):
        # box around evertying
        box_global = MDBoxLayout()
        box_global.orientation = 'vertical'
        # add the toolbar
        box_global.add_widget(MDToolbar(title='buba'))

        # add the tabs
        tabs = MDTabs()
        box_global.add_widget(tabs)

        # The search tab
        # tab = MDTabsBase()
        tab = Tab()
        # tab.size_hint = (None,None)
        tab.size = box_global.size
        tab.spacing = 10
        tab.text = 'search'
        tabs.add_widget(tab)

        tab.add_widget(StandardLabel(text='Check-in'))
        tab.add_widget(SelectDateButton())
        tab.add_widget(StandardDateField())

        tab.add_widget(StandardLabel(text='Check-out'))
        tab.add_widget(SelectDateButton())
        tab.add_widget(StandardDateField())

        tab.add_widget(SaveButton())
        tab.add_widget(SearchButton())

        # tab.padding_top = 3
        # tab.add_widget(Widget())

        return box_global
示例#16
0
 def ban_show(self):
     if self.bmi < 16:
         self.advice = "[color=b71c1c]You are [b]severely thin[/b].[/color]"
     elif self.bmi >= 16 and self.bmi < 17:
         self.advice = "[color=f44336]You are [b]moderately thin[/b].[/color]"
     elif self.bmi >= 17 and self.bmi < 18.5:
         self.advice = "[color=F57F17]You are [b]mildly thin[/b].[/color]"
     elif self.bmi >= 18.5 and self.bmi < 25:
         self.advice = "[color=4CAF50]You are [b]normal[/b].[/color]"
     elif self.bmi >= 25 and self.bmi < 30:
         self.advice = "[color=F57F17]You are [b]overweight[/b].[/color]"
     elif self.bmi >= 30 and self.bmi < 35:
         self.advice = "[color=f44336]You are [b]mildly obese[/b].[/color]"
     elif self.bmi >= 35 and self.bmi < 40:
         self.advice = "[color=d32f2f]You are [b]moderately obese[/b].[/color]"
     elif self.bmi >= 40:
         self.advice = "[color=b71c1c]You are [b]severely obese[/b].[/color]"
     self.bmi_text = f"[color=311B92]Your BMI is [b]{self.bmi}[/b][/color]" if main_app.theme == "purple" else f"[color=263238]Your BMI is [b]{self.bmi}[/b][/color]"
     self.ban = MDBanner(
         opening_transition="in_elastic",
         type="two-line",
         id="banner",
         text=[self.bmi_text, self.advice],
         vertical_pad=Window.size[0] / 8,
         over_widget=self.parent.parent.parent.parent,
     )
     self.tool = MDToolbar(id="toolbar", pos_hint={"top": 1}, elevation=0)
     self.parent.parent.parent.parent.parent.add_widget(self.ban)
     self.ban.show()
示例#17
0
    def __init__(self, scrn_mngr, **kwargs):
        super(MainScreen, self).__init__(**kwargs)
        self.grid = MDGridLayout()
        self.grid.cols = 1
        self.practice_type = None
        self.vs = None
        self.rep_num = 0
        # self.manager.transition.direction = 'right'
        self.scrn_mngr = scrn_mngr
        self.scrn_mngr.transition.direction = 'right'

        self.toolbar = MDToolbar()
        self.set_tool_bar_params()
        self.grid.add_widget(self.toolbar)

        # ''' Create the camera view'''
        self.cam = None
        # self.grid.add_widget(self.cam)

        # self.create_camera()

        # ''' Set the back button'''
        # self.set_back_btn()

        self.add_widget(self.grid)
 def build(self):
     # box around evertying
     box_global = MDBoxLayout()
     box_global.orientation = 'vertical'
     # add the toolbar
     box_global.add_widget(MDToolbar(title = 'buba'))
     
     # add the tabs
     tabs = MDTabs()
     box_global.add_widget(tabs)
     
     # The search tab
     # tab = MDTabsBase()
     tab = Tab(size = box_global.size)
     tab.text = 'search'
     tabs.add_widget(tab)
     
     # box = MDBoxLayout()
     # tab.add_widget(box)
     # box.orientation = 'vertical'
     
     # # button = MDFlatButton()
     # tab.add_widget(StartDateContainer())
     tab.add_widget(SelectDateButton())
     self.start_date_text = StandardTextField()
     self.start_date_text.hint_text = 'mm/dd/yyyy'
     # tab.add_widget(self.start_date_text)
     tab.add_widget(SaveButton(padding = 3))
     tab.add_widget(SaveButton())
     tab.add_widget(SaveButton())
     
     tab.padding_top = 3
     # tab.add_widget(Widget())
     
     return box_global
    def build(self):
        self.theme_cls.primary_palette = "Blue"
        screen = Screen()

        text = MDToolbar(title='Health Monitor App',
                         specific_text_color=(1, 1, 1, 1),
                         pos_hint={
                             'center_x': 0.5,
                             'center_y': 0.95
                         })

        img = Image(source="Healt.jpg",
                    pos_hint={
                        'center_x': 0.5,
                        'center_y': 0.5
                    })

        button = MDRectangleFlatButton(text='Continue',
                                       pos_hint={
                                           'center_x': 0.5,
                                           'center_y': 0.2
                                       },
                                       on_release=self.login)
        screen.add_widget(text)
        screen.add_widget(img)
        screen.add_widget(button)
        return screen
 def build(self):
     # box around evertying
     box_global = MDBoxLayout()
     box_global.orientation = 'vertical'
     # add the toolbar
     box_global.add_widget(MDToolbar(title = 'buba'))
     
     # add the tabs
     tabs = MDTabs()
     box_global.add_widget(tabs)
     
     # The search tab
     # tab = MDTabsBase()
     tab = Tab(size = box_global.size)
     tab.text = 'search'
     tabs.add_widget(tab)
     
     # box = MDBoxLayout()
     # tab.add_widget(box)
     # box.orientation = 'vertical'
     
     # # button = MDFlatButton()
     tab.add_widget(StartDateContainer())
     tab.add_widget(SaveButton())
     tab.add_widget(Widget())
     
     return box_global
示例#21
0
    def load_screen(self, book):
        """Loads all elements for the detailed info.

        Created as separate method because on every book we need to reload the
        information.
        """
        self.book = book

        toolbar = MDToolbar(type="top")
        toolbar.left_action_items = [["arrow-left", self.go_back]]
        toolbar.right_action_items = [["delete", self.delete_item]]

        content = BookInfoContent(book)

        self.layout.add_widget(toolbar)
        self.layout.add_widget(content)
示例#22
0
    def __init__(self):
        super().__init__()
        self.row = 2
        self.music_list = get_all_music(MUSIC_DIR[PLATFORM])
        self.orientation = "vertical"
        self.toolbar = MDToolbar(title="Music Player")
        self.toolbar.right_action_items = [[
            "database-settings", lambda x: self.goto_setting()
        ]]
        self.add_widget(self.toolbar)
        scroll_list = ScrollView()
        dml = MDList()
        self.counter = 0
        try:
            for music in self.music_list:
                meta = music['meta']
                path = music['path']
                self.dl = TwoLineListItem(text=(meta['title'] or path),
                                          secondary_text=(meta['artist']
                                                          or 'Unkown'))
                self.dl.id = str(self.counter)
                self.dl.bind(on_press=self.to_playing)
                dml.add_widget(self.dl)
                self.counter += 1
        except Exception as e:
            print(e)
            # raise e

        scroll_list.add_widget(dml)
        self.add_widget(scroll_list)
示例#23
0
                def scope(info):
                    btn = Button(text="Open in Browser")

                    def f(*a):
                        self.openInBrowser("http://" + info['hash'] +
                                           ".localhost:7009")

                    btn.bind(on_press=f)

                    l.add_widget(btn)

                    btn = Button(text="Copy URL")

                    def f(*a):
                        try:
                            from kivy.core.clipboard import Clipboard
                            Clipboard.copy("http://" + info['hash'] +
                                           ".localhost:7009")
                        except:
                            logging.exception("Could not copy to clipboard")

                    btn.bind(on_press=f)

                    self.localServicesListBox.add_widget(
                        MDToolbar(title=str(info.get('title', 'no title'))))

                    l.add_widget(btn)
示例#24
0
    def goToDiscovery(self, *a):
        "Go to the local network discovery page"
        self.discoveryListbox.clear_widgets()

        try:
            hardline.discoveryPeer.search('', n=1)
            time.sleep(2)
            for i in hardline.getAllDiscoveries():
                info = i

                self.discoveryListbox.add_widget(
                    MDToolbar(title=str(info.get('title', 'no title'))))
                l = StackLayout(adaptive_size=True,
                                spacing=8,
                                size_hint=(1, None))

                #Need to capture that info in the closures
                def scope(info):
                    btn = Button(text="Open in Browser")

                    def f(*a):
                        self.openInBrowser("http://" + info['hash'] +
                                           ".localhost:7009")

                    btn.bind(on_press=f)

                    l.add_widget(btn)

                    btn = Button(text="Copy URL")

                    def f(*a):
                        try:
                            from kivy.core.clipboard import Clipboard
                            Clipboard.copy("http://" + info['hash'] +
                                           ".localhost:7009")
                        except:
                            logging.exception("Could not copy to clipboard")

                    btn.bind(on_press=f)

                    self.localServicesListBox.add_widget(
                        MDToolbar(title=str(info.get('title', 'no title'))))

                    l.add_widget(btn)

                scope(info)

                self.discoveryListbox.add_widget(l)
                lb = self.saneLabel("Hosted By: " + info.get("from_ip", ""),
                                    self.discoveryListbox)
                self.discoveryListbox.add_widget(lb)
                lb = self.saneLabel("ID: " + info['hash'],
                                    self.discoveryListbox)
                self.discoveryListbox.add_widget(lb)

        except Exception:
            logging.info(traceback.format_exc())

        self.screenManager.current = "Discovery"
示例#25
0
    def calculation(self) -> None:
        """
        Calcule l'itinéraire le plus court entre deux points, une liste
        contenant toutes les étapes est mise en place ainsi qu'un bouton
        afin de supprimer l'itinéraire calculé.
        """
        search_screen = self.parent.get_screen("search_screen")

        router = Router(search_screen.lat_a, search_screen.lon_a,
                        search_screen.lat_b, search_screen.lon_b)

        shortest_route = router.shortest_route()

        grid = GridLayout(cols=1,
                          spacing=30,
                          padding=(40, 40, 40, 160),
                          size_hint_y=None)
        grid.bind(minimum_height=grid.setter("height"))

        scroll = ScrollView()
        scroll.add_widget(grid)

        for step in shortest_route.get_steps():
            maneuver = step.get_maneuver()
            image_source = get_information_image(maneuver.get_modifier(),
                                                 maneuver.get_type())

            grid.add_widget(
                StepWidget(
                    image_source=image_source,
                    name=step.get_name(),
                    distance=
                    f"Marchez sur {format_distance(step.get_distance())}"))

        self.add_widget(scroll)

        bottom_bar = MDBottomAppBar()
        toolbar = MDToolbar(title=f"v{__version__}",
                            type="bottom",
                            icon="delete",
                            icon_color=(1, 1, 1, 1))
        toolbar.on_action_button = self.delete_screen
        bottom_bar.add_widget(toolbar)

        self.add_widget(bottom_bar)
示例#26
0
    def build(self):
        self.tmp_outer_box = MDBoxLayout(orientation='vertical')
        self.tmp_toolbar = MDToolbar(title="Example Tabs")
        self.tmp_tabs = MDTabs()

        self.tmp_outer_box.add_widget(self.tmp_toolbar)
        self.tmp_outer_box.add_widget(self.tmp_tabs)

        return self.tmp_outer_box
 def __init__(self, **kwargs):
     super(LayoutsApp, self).__init__(**kwargs)
     self.NDrawer = MDNavigationDrawer()
     self.Screen1 = MDFloatLayout()
     self.BLay = BoxLayout()
     self.MDTool = MDToolbar()
     self.Widgy = Widget()
     self.NLayout = NavigationLayout()
     self.CNDrawer = ContentNavigationDrawer()
     return
示例#28
0
 def __init__(self):
     super().__init__()
     self.orientation = "vertical"
     self.toolbar = MDToolbar(title="Setting")
     self.toolbar.left_action_items = [["arrow-left", self.back]]
     self.add_widget(self.toolbar)
     self.container = BoxLayout()
     label = MDLabel(text="", halign="center")
     self.container.add_widget(label)
     self.add_widget(self.container)
示例#29
0
    def skeleton_frame2(self, instance):
        # method must be used to make the on_press method work
        self.scrollview.remove_widget(self.list)
        self.box.remove_widget(self.bottom_bar)
        self.list = MDList()
        self.scrollview.add_widget(self.list)

        #Displays all decks on the app
        self.box = MDBoxLayout(orientation="vertical")
        self.scrollview = ScrollView()
        self.list = MDList()
        self.scrollview.add_widget(self.list)

        #calls the activate_for_loop method
        self.display_deck()

        # Buttons on the bottom of the screen
        # Buttons are places on bottom of screen
        self.box.add_widget(
            MDLabel(size_hint=(0.2, 0.15)))  # Push down the list of buttons
        self.box.add_widget(self.scrollview)

        self.bottom_bar = MDToolbar()
        self.delete_deck_button = MDIconButton(icon="trash-can-outline",
                                               pos_hint={
                                                   'center_x': .5,
                                                   'center_y': .5
                                               })
        self.delete_deck_button.bind(on_press=self.delete_deck)
        self.build_deck_button = MDIconButton(icon="plus-thick",
                                              pos_hint={
                                                  'center_x': 0.5,
                                                  'center_y': 0.5
                                              })
        self.build_deck_button.bind(on_press=self.build_new_deck)

        #add method to make a new deck
        self.bottom_bar.add_widget(self.delete_deck_button)
        self.bottom_bar.add_widget(MDLabel())
        self.bottom_bar.add_widget(self.build_deck_button)
        self.bottom_bar.add_widget(MDLabel())
        self.box.add_widget(self.bottom_bar)
        self.add_widget(self.box)
示例#30
0
    def skeleton_frame(self):
        # Displays all decks on the app
        self.box = MDBoxLayout(orientation="vertical")
        self.scrollview = ScrollView()
        self.list = MDList()
        self.scrollview.add_widget(self.list)

        # calls the activate_for_loop method
        self.display_deck()

        # Buttons on the bottom of the screen
        # Buttons are places on bottom of screen
        self.box.add_widget(
            MDLabel(size_hint=(0.2, 0.15)))  # Push down the list of buttons
        self.box.add_widget(self.scrollview)

        self.bottom_bar = MDToolbar()
        self.box.add_widget(self.bottom_bar)
        self.add_widget(self.box)