Пример #1
0
    def _setup_ui(self, _):
        self._setup_ui_img()
        button = MDRaisedButton(size_hint=(1, None))
        button_2 = MDRaisedButton(size_hint=(1, None))
        if self.is_owner:

            if self.request.status == Status.AVAILABLE \
               or self.request.status == Status.ACCEPTED:
                button_2.text = "Cancel package"
                button_2.on_release = self.cancel_delivery_by_owner
            if self.request.status == Status.ACCEPTED:
                button.text = "Confirm Pickup"
                button.on_release = self.confirm_pickup
            elif self.request.status == Status.TRAVELLING:
                button.text = "Confirm Delivery"
                button.on_release = self.confirm_delivery

        else:
            if self.request.status == Status.AVAILABLE:
                button.text = "Accept Delivery"
                button.on_release = self.accept_delivery
            elif self.request.status == Status.ACCEPTED \
                    and self.request.assistant.uid == UserMeGetter._user_id:
                button.text = "Cancel delivery"
                button.on_release = self.cancel_delivery_by_assistant

        if button.text != "":
            self.ids.stack.add_widget(button)

        if button_2.text != "":
            self.ids.stack.add_widget(button_2)

        if button.text != "" and button_2.text != "":
            button.size_hint_x = 0.5
            button_2.size_hint_x = 0.5
Пример #2
0
    def __init__(self, **kwargs):
        super(LeftPane, self).__init__(**kwargs)
        self.cols = 1
        self.rows = 4
        self.row_force_default = True
        self.row_default_height = 40

        self.size_hint = (500, 0.3)

        self.spacing = (0, 10)

        Title = MDLabel()
        Title.text = "Quick Inch <--> MM Converter"

        self.InchInput = MDTextField()
        self.InchInput.hint_text = "Inches"
        self.InchInput.multiline = False
        self.InchInput.on_text_validate = self.convert

        self.MMInput = MDTextField()
        self.MMInput.hint_text = "Millimeters"
        self.MMInput.multiline = False
        self.MMInput.on_text_validate = self.convert

        ConvButton = MDRaisedButton()
        ConvButton.text = "   <--- CONVERT -->   "
        ConvButton.on_press = self.convert

        self.add_widget(Title)
        self.add_widget(self.InchInput)
        self.add_widget(self.MMInput)
        self.add_widget(ConvButton)