Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    def __init__(self, form_attrs, **kwargs):
        super(Form, self).__init__(**kwargs)
        self.cols = 1
        self.form = MDGridLayout()
        self.form.cols = 2
        self.form_attrs = form_attrs
        self.text_inputs = {}
        self.search_btn = {}
        for key, value in form_attrs.items():
            if key == 'form_name':
                self.form_name = form_attrs[key]
            elif key in ['product_id', 'provider_id']:
                self.form.add_widget(MDLabel(text=value[0] + ':'))
                self.text_inputs[key] = MDTextField(
                    multiline=False,
                    text='' if 'date' not in key else
                    datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
                self.search_btn[key] = MDRectangleFlatButton(text='Buscar ' +
                                                             value[0],
                                                             size_hint_x=None,
                                                             font_size=10)
                self.search_btn[key].bind(on_release=self.search)
                search_lo = MDGridLayout()
                search_lo.cols = 2
                search_lo.add_widget(self.text_inputs[key])
                search_lo.add_widget(self.search_btn[key])
                self.form.add_widget(search_lo)
            else:
                self.form.add_widget(MDLabel(text=value[0] + ':'))
                self.text_inputs[key] = MDTextField(
                    multiline=False,
                    text='' if 'date' not in key else
                    datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
                self.form.add_widget(self.text_inputs[key])
        self.add_widget(self.form)

        self.submit = MDRectangleFlatButton(text='Crear',
                                            font_size=40,
                                            pos_hint={
                                                'center_x': 0.5,
                                                'center_y': 0.1
                                            },
                                            size_hint_x=None)
        self.submit.bind(on_release=self.submit_form)
        self.add_widget(self.submit)
Exemplo n.º 3
0
    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)
Exemplo n.º 4
0
    def build(self):
        # box around evertying
        box_global = MDBoxLayout()
        box_global.name = 'bababallsd'
        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.spacing = 10
        tab.text = 'search'
        tabs.add_widget(tab)

        #### # the search grid
        grid = MDGridLayout()
        grid.name = 'grid'
        tab.add_widget(grid)
        grid.cols = 3
        grid.rows = 4
        grid.spacing = 5

        grid.add_widget(InputCampgroundField())
        grid.add_widget(InputCampgroundFieldplus())
        grid.add_widget(InputCampgroundFieldplus())

        grid.add_widget(StandardLabel(text='Check-in'))
        grid.add_widget(SelectDateButton())
        grid.add_widget(InputCheckIn())

        grid.add_widget(StandardLabel(text='Check-out'))
        # grid.add_widget(SelectDateButton())
        grid.add_widget(InputNoOfNights())
        grid.add_widget(InputDateField())

        grid.add_widget(SearchButton())
        grid.add_widget(SaveButton())

        #### # search result
        tab.add_widget(SearchResult())
        # tab.padding_top = 3
        # tab.add_widget(Widget())

        #### collections tab
        tab = Tab()
        tab.spacing = 10
        tab.text = 'collections'
        tabs.add_widget(tab)

        #### workplan
        tab = Tab()
        tab.spacing = 10
        tab.text = 'collections'
        tabs.add_widget(tab)

        return box_global
Exemplo n.º 5
0
    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
        new_layout = MDFloatLayout()
        self.new_card = MDCard(
            orientation='vertical',
            padding='10dp',
            pos_hint={
                'center_x': 0.5,
                'center_y': 0.5
            },
            size_hint=(0.75, 0.75),
        )
        self.new_card.md_bg_color = app.off_red
        ac_image = Image(source='static/ac1.png', )
        ac_image.size_hint_y = 0.9

        ac_image.pos_hint = {'top': 1.0, 'center_x': 0.5}
        self.new_card.radius = [4] * 4

        # ac_button.bind(active=callback)
        self.new_card.add_widget(ac_image)
        self.new_card.on_press = self.ac_touch_down
        self.new_card.on_release = self.ac_touch_up
        temp = MDLabel(text='18ºC')
        temp.font_size = 10
        temp.size = (0.25, 1)
        temp.color = [1, 1, 1, 1]
        new_layout.add_widget(self.new_card)
        screen_layout.add_widget(new_layout)

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

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

        # 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)
Exemplo n.º 6
0
    def build(self):
        screen_manager = ScreenManager()
        self.loaded_values = [
            1, 0, 0, 0, 0, 0
        ]  # round num, cp, primary obj, 1st secondary, 2nd secondary, 3rd secondary
        self.update_values()
        self.theme_cls.primary_palette = "Gray"
        self.theme_cls.primary_hue = "800"

        # Game counters screen and backgrgound color

        self.counters = Screen(name="Counters")
        self.change_bg_color()

        screen_manager.add_widget(self.counters)

        # SCROLLVIEW

        self.scroll = ScrollView()
        self.counters.add_widget(self.scroll)

        # MENU
        self.menu_button = MDIconButton(icon='format-color-fill',
                                        on_release=self.menu_open)
        self.menu_button.pos_hint = {'center_x': .9, 'center_y': .1}
        self.menu_button.md_bg_color = (1, 1, 1, 1)
        items = [{
            "text": "Ceramic White"
        }, {
            "text": "Loyal Angels Green"
        }, {
            "text": "Space Doggos Gray"
        }, {
            "text": "Codex Blue"
        }, {
            "text": "Vampire Angels Red"
        }, {
            "text": "Gray Nights"
        }, {
            "text": "Stubborn Fists Yellow"
        }]
        self.menu = MDDropdownMenu(caller=self.menu_button,
                                   items=items,
                                   callback=self.menu_callback,
                                   width_mult=5)
        self.counters.add_widget(self.menu_button)

        # MAIN GRID
        app_grid = GridLayout(cols=1, spacing=100, size_hint_y=None)
        app_grid.padding = [
            Window.width / 40, Window.height / 20, Window.width / 40,
            Window.height / 4
        ]  # [left,top,right,bottom]
        app_grid.bind(minimum_height=app_grid.setter('height'))
        self.scroll.add_widget(app_grid)

        # ROUND COUNTER

        round_parent_grid = MDGridLayout()
        round_parent_grid.cols = 1
        round_parent_grid.rows = 2
        round_parent_grid.adaptive_height = True

        round_label = MDLabel(text='Round number:')
        round_label.halign = 'center'
        round_parent_grid.add_widget(round_label)
        app_grid.add_widget(round_parent_grid)

        grid_round = GridLayout()
        grid_round.cols = 3

        increase_round = MDIconButton(icon="arrow-right-bold",
                                      on_press=self.increase_round)
        self.round_counter = MDLabel(text=str(self.loaded_values[0]))
        self.round_counter.halign = 'center'
        self.round_counter.valign = 'middle'
        decrease_round = MDIconButton(icon="arrow-left-bold",
                                      on_press=self.decrease_round)

        grid_round.add_widget(decrease_round)
        grid_round.add_widget(self.round_counter)
        grid_round.add_widget(increase_round)
        round_parent_grid.add_widget(grid_round)

        # COMMAND POINTS

        cp_parent_grid = MDGridLayout()
        cp_parent_grid.cols = 1
        cp_parent_grid.rows = 2
        cp_parent_grid.adaptive_height = True

        cp_label = MDLabel(text='Command Points Left:')
        cp_label.halign = 'center'
        cp_parent_grid.add_widget(cp_label)
        app_grid.add_widget(cp_parent_grid)

        grid_cp = MDGridLayout()
        grid_cp.cols = 3

        increase_cp = MDIconButton(icon="arrow-right-bold",
                                   on_press=self.increase_cp)
        self.cp_counter = MDLabel(text=str(self.loaded_values[1]))
        self.cp_counter.halign = 'center'
        self.cp_counter.valign = 'middle'
        decrease_cp = MDIconButton(icon="arrow-left-bold",
                                   on_press=self.decrease_cp)

        grid_cp.add_widget(decrease_cp)
        grid_cp.add_widget(self.cp_counter)
        grid_cp.add_widget(increase_cp)
        cp_parent_grid.add_widget(grid_cp)

        # VP PRIMARY

        prim_parent_grid = MDGridLayout()
        prim_parent_grid.cols = 1
        prim_parent_grid.rows = 2
        prim_parent_grid.adaptive_height = True

        prim_label = MDLabel(text='Primary Objective Points:')
        prim_label.halign = 'center'
        prim_parent_grid.add_widget(prim_label)
        app_grid.add_widget(prim_parent_grid)

        grid_prim = MDGridLayout()
        grid_prim.cols = 3

        increase_prim = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_prim)
        self.prim_counter = MDLabel(text=str(self.loaded_values[2]))
        self.prim_counter.halign = 'center'
        self.prim_counter.valign = 'middle'
        decrease_prim = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_prim)

        grid_prim.add_widget(decrease_prim)
        grid_prim.add_widget(self.prim_counter)
        grid_prim.add_widget(increase_prim)
        prim_parent_grid.add_widget(grid_prim)

        # VP SECONDARY 1

        sec1_parent_grid = MDGridLayout()
        sec1_parent_grid.cols = 1
        sec1_parent_grid.rows = 2
        sec1_parent_grid.adaptive_height = True

        sec1_label = MDTextField()
        sec1_label.hint_text = '1st Secondary Objective Points:'
        sec1_label.multiline = False
        #sec1_label = MDLabel(text='1st Secondary Objective Points:')
        sec1_label.halign = 'center'
        sec1_parent_grid.add_widget(sec1_label)
        app_grid.add_widget(sec1_parent_grid)

        grid_sec1 = MDGridLayout()
        grid_sec1.cols = 3

        increase_sec1 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec1)
        self.sec1_counter = MDLabel(text=str(self.loaded_values[3]))
        self.sec1_counter.halign = 'center'
        self.sec1_counter.valign = 'middle'
        decrease_sec1 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec1)

        grid_sec1.add_widget(decrease_sec1)
        grid_sec1.add_widget(self.sec1_counter)
        grid_sec1.add_widget(increase_sec1)
        sec1_parent_grid.add_widget(grid_sec1)

        # VP SECONDARY 2

        sec2_parent_grid = MDGridLayout()
        sec2_parent_grid.cols = 1
        sec2_parent_grid.rows = 2
        sec2_parent_grid.adaptive_height = True

        sec2_label = MDTextField()
        sec2_label.hint_text = '2nd Secondary Objective Points:'
        sec2_label.multiline = False
        #sec2_label = MDLabel(text='2nd Secondary Objective Points:')
        sec2_label.halign = 'center'
        sec2_parent_grid.add_widget(sec2_label)
        app_grid.add_widget(sec2_parent_grid)

        grid_sec2 = MDGridLayout()
        grid_sec2.cols = 3

        increase_sec2 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec2)
        self.sec2_counter = MDLabel(text=str(self.loaded_values[4]))
        self.sec2_counter.halign = 'center'
        self.sec2_counter.valign = 'middle'
        decrease_sec2 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec2)

        grid_sec2.add_widget(decrease_sec2)
        grid_sec2.add_widget(self.sec2_counter)
        grid_sec2.add_widget(increase_sec2)
        sec2_parent_grid.add_widget(grid_sec2)

        # VP SECONDARY 3

        sec3_parent_grid = MDGridLayout()
        sec3_parent_grid.cols = 1
        sec3_parent_grid.rows = 2
        sec3_parent_grid.adaptive_height = True

        sec3_label = MDTextField()
        sec3_label.hint_text = '3rd Secondary Objective Points:'
        sec3_label.multiline = False
        #sec3_label = MDLabel(text='3rd Secondary Objective Points:')
        sec3_label.halign = 'center'
        sec3_parent_grid.add_widget(sec3_label)
        app_grid.add_widget(sec3_parent_grid)

        grid_sec3 = MDGridLayout()
        grid_sec3.cols = 3

        increase_sec3 = MDIconButton(icon="arrow-right-bold",
                                     on_press=self.increase_sec3)
        self.sec3_counter = MDLabel(text=str(self.loaded_values[5]))
        self.sec3_counter.halign = 'center'
        self.sec3_counter.valign = 'middle'
        decrease_sec3 = MDIconButton(icon="arrow-left-bold",
                                     on_press=self.decrease_sec3)

        grid_sec3.add_widget(decrease_sec3)
        grid_sec3.add_widget(self.sec3_counter)
        grid_sec3.add_widget(increase_sec3)
        sec3_parent_grid.add_widget(grid_sec3)

        # Empty grid to create space

        empty_grid = MDGridLayout()
        app_grid.add_widget(empty_grid)

        # Bottom grid for Score and Reset buttons

        bottom_grid = MDGridLayout()
        bottom_grid.cols = 2
        app_grid.add_widget(bottom_grid)

        # SCORE TOAST

        score_button = MDFillRoundFlatIconButton(icon='flag-plus-outline',
                                                 text="Show score",
                                                 on_press=self.sum_up)
        button_anchor = AnchorLayout()
        button_anchor.anchor_y = 'bottom'
        button_anchor.add_widget(score_button)
        bottom_grid.add_widget(button_anchor)

        # RESET

        reset_button = MDFillRoundFlatIconButton(icon='backup-restore',
                                                 text="Reset",
                                                 on_press=self.reset_values)
        reset_button_anchor = AnchorLayout()
        reset_button_anchor.anchor_y = 'bottom'
        reset_button_anchor.add_widget(reset_button)
        bottom_grid.add_widget(reset_button_anchor)

        return screen_manager