Esempio n. 1
2
class ImagesMenu(BaseScreen):
    def __init__(self, name, *navigate_screens):
        super(ImagesMenu, self).__init__(name, *navigate_screens)
        self.lower_grid = BoxLayout(orientation='vertical',
                                    spacing=5,
                                    padding=5)
        self.lower_panel.add_widget(self.lower_grid)

        self.filechooser = FileChooserListView()
        if platform == 'android':
            self.filechooser.path = '/sdcard/DCIM'
        else:
            self.filechooser.path = os.getcwd()
        self.filechooser.bind(
            on_selection=lambda x: self.selected(self.filechooser.selection))

        self.open_file_button = MDRaisedButton(text='Upload Image',
                                               size_hint=(1, .1))
        self.open_file_button.bind(on_release=lambda x: self.open_f(
            self.filechooser.path, self.filechooser.selection))

        self.lower_grid.add_widget(
            TextInput(size_hint=(1, .12), text='Image name'))
        self.lower_grid.add_widget(self.open_file_button)
        self.lower_grid.add_widget(self.filechooser)

    def open_f(self, path, filename):
        if not filename:
            img_file = None
            image_pop = Popup()
            image_pop.add_widget(
                MDLabel(text='No image file selected', halign='center'))
            image_pop.open()
        else:
            img_file = os.path.join(path, filename[0])
        image_pop = Popup()
        image_pop.add_widget(Image(source=img_file))
        image_pop.open() if img_file else ''

    def open_image_screen_callback(self):
        self.upper_panel.navigate_next()
Esempio n. 2
1
    def layout(self):
        self.user = ''

        def on_text_email(instance, value):
            self.user = str(value)
            setButtonColor()

        layout = BoxLayout(
                        orientation= 'vertical',
                        padding= (dp(48),2*dp(48)),
                        spacing= dp(48),
                        )

        userField = MDTextField()
        userField.hint_text = "Enter user ID"
        userField.bind(text=on_text_email)
        layout.add_widget(userField)

        proceedButton = MDRaisedButton(text='Enter Information', size_hint=(None, None),size= (4*dp(48),dp(48)))
        proceedButton.md_bg_color = [0.9, 0, 0, 0.9]
        app = App.get_running_app()

        def setButtonColor():
            if self.user != '':
                proceedButton.text = 'Proceed'
                proceedButton.md_bg_color = app.theme_cls.primary_color
                proceedButton.bind(on_press=lambda x: self.processInformation())

        proceedAnchor = AnchorLayout(anchor_x='center',anchor_y='center')
        proceedAnchor.add_widget(proceedButton)
        layout.add_widget(proceedAnchor)

        return layout
 def __init__(self):
     super(kar, self).__init__()
     self.name = 'all'
     self.kw = BoxLayout(orientation='vertical')
     self.k = BoxLayout()
     self.k1 = BoxLayout(padding=10, orientation='vertical', spacing=10)
     l = Label(text='[b]Hello, Welcome to Cezar 2020\b',
               color=[0, 0, 0, 1],
               markup=True)
     d = MDRaisedButton(text='login',
                        size_hint=[1, 0.5],
                        on_press=lambda x: self.reg(1))
     d1 = MDRaisedButton(text='register',
                         size_hint=[1, 0.5],
                         on_press=lambda x: self.reg(2))
     self.k1.add_widget(l)
     self.k1.add_widget(d)
     self.k1.add_widget(d1)
     self.k.bind(size=self._update1, pos=self._update1)
     with self.k.canvas.before:
         Color(rgb=(1, 1, 1))
         self.rect = Rectangle(
             source='cezar.png',
             pos=[0, 0],
             size=[self.k.size[0] / 2, self.k.size[1] / 2])
     self.kw.add_widget(self.k)
     self.kw.add_widget(self.k1)
     self.add_widget(self.kw)
Esempio n. 4
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)
Esempio n. 5
0
    def __init__(self, **kwargs):

        GridLayout.__init__(self, **kwargs)
        Thread.__init__(self)

        self.cols = 1
        self.tool = ntoolbar(title='KivDL')
        self.add_widget(self.tool)
        self.body = GridLayout(cols=1, padding=(0, 20))
        self.add_widget(self.body)
        self.tex = MDTextField(pos_hint={'center_y': 0.9}, size_hint_x=0.8)
        self.tex.hint_text = " Enter URL to download"

        self.fetch_button = MDRaisedButton(text='Fetch',
                                           pos_hint={
                                               'center_y': 0,
                                               'right': 0.95
                                           },
                                           size_hint_x=0.1)
        self.fetch_button.bind(on_press=self.addcard)
        self.urlget = GridLayout(cols=2, size_hint_y=0.2)
        self.urlget.add_widget(self.tex)
        self.urlget.add_widget(self.fetch_button)
        self.body.add_widget(self.urlget)

        self.cardholder = ScrollView(do_scroll_x=False, size_hint_x=0.8)
        self.cardlist = MDList(padding=(10, 20))
        self.cardlist.spacing = (10, 20)
        self.cardholder.add_widget(self.cardlist)

        self.body.add_widget(self.cardholder)
        self.spacer = MDLabel(size_hint_y=0.2)
        self.cardlist.add_widget(self.spacer)
Esempio n. 6
0
    def layout(self):
        self.charge = False
        self.amount = ''
        self.ready = False

        def on_text_charge(instance, value):
            self.amount = value
            if len(value) >= 1:
                self.ready = True
            else:
                self.ready = False
            setButtonColor()

        layout = BoxLayout(orientation='vertical',
                           padding=(2 * dp(48), 2 * dp(48)))

        #Charge Box
        chargeField = MDTextField()
        chargeField.hint_text = "Enter Amount to Charge"
        chargeField.input_filter = "int"
        chargeField.bind(text=on_text_charge)
        layout.add_widget(chargeField)

        proceedButton = MDRaisedButton(text='Proceed',
                                       size_hint=(None, None),
                                       size=(4 * dp(48), dp(48)))
        proceedButton.md_bg_color = [0.9, 0, 0, 0.9]

        app = App.get_running_app()

        def setButtonColor():
            if self.ready:
                proceedButton.md_bg_color = app.theme_cls.primary_color
                proceedButton.bind(on_press=lambda x: self.createCharge())

        proceedAnchor = AnchorLayout(anchor_x='center',
                                     anchor_y='bottom',
                                     padding=[60])
        proceedAnchor.add_widget(proceedButton)
        layout.add_widget(proceedAnchor)

        content = Builder.load_string(spinner)
        self.stripepopup = Popup(title='Charging Card',
                                 title_align='center',
                                 size_hint=(None, None),
                                 size=(dp(200), dp(200)))
        self.stripepopup.add_widget(content)
        self.stripepopup.title_font = 'data/fonts/Roboto-Bold.ttf'
        self.stripepopup.title_color = App.get_running_app(
        ).theme_cls.primary_color
        self.stripepopup.separator_color = App.get_running_app(
        ).theme_cls.primary_color
        self.stripepopup.background = str(
            Atlas('{}round_shadow.atlas'.format(images_path)))

        return layout
Esempio n. 7
0
    def _init_content(self):
        """Initializes the user profile."""
        user_me = UserMeGetter.user

        self.name_field = MenuField("Name", self.user_viewing.name,
                                    self.user_viewing == user_me)
        self.ids.scroll_view_container.add_widget(self.name_field)

        self.phone_field = MenuField("Phone", self.user_viewing.phonenumber,
                                     self.user_viewing == user_me)
        self.ids.scroll_view_container.add_widget(self.phone_field)

        self.mail_field = MenuField("Mail", self.user_viewing.mail,
                                    self.user_viewing == user_me)
        self.ids.scroll_view_container.add_widget(self.mail_field)

        if self.user_viewing == user_me:
            self.balance_field = MenuField(
                "Account Balance", "$ " + str(self.user_viewing.balance),
                False)
            self.ids.scroll_view_container.add_widget(self.balance_field)
            self.balance_field.add_widget(AccountButtons())

        self.widget_input = AnswerInput()

        self.sign_out_button = MDRaisedButton(
            text="Sign out",
            on_release=lambda *_: self.logout(),
            md_bg_color=[255 / 255, 0 / 255, 0 / 255, 1],
            pos_hint={
                'center_x': 0.5,
                'center_y': .05
            })

        self.ids.scroll_view_container.add_widget(self.sign_out_button)
Esempio n. 8
0
    def on_release(self):
        if not self.info.get('speaker'):
            return
        print(" i am here on release")
        box = BoxLayout(height=dp(500), orientation='vertical',
                        spacing=dp(10), size_hint_y=None)

        # adding avatar widget
        if self.info['speaker'].get('avatar'):
            image = AsyncImage(source=self.info['speaker']['avatar'],
                               allow_stretch=True)
            box.add_widget(image)

        # adding place widget
        if self.info.get('place'):
            place = MDRaisedButton(text=self.info['place'], elevation_normal=2,
                                   opposite_colors=True,
                                   pos_hint={'center_x': .5, 'center_y': .4})
            box.add_widget(place)

        # adding description widget
        label = MDLabel(font_style='Body1', theme_text_color='Primary',
                        text=self._parse_text(), size_hint_y=None)
        label.bind(texture_size=label.setter('size'))

        box.add_widget(label)
        self.dialog = MDDialog(title=self.info['speaker']['name'],
                               content=box,
                               size_hint=(1, None),
                               height=dp(500),
                               auto_dismiss=False)

        self.dialog.add_action_button('Close',
                                      action=lambda *x: self.dialog.dismiss())
        self.dialog.open()
Esempio n. 9
0
    def on_pre_enter(self, *args):

        sApp = App.get_running_app()
        sApp.root.ids.toolbar.title = 'Who pulled, and how well?'

        self.puller = 'puller_not_set'
        # print("starting pulling, off: "+str(sApp.current_point.current_sequence().offence))
        for player in sApp.current_point.current_sequence().lines[
                1 - sApp.current_point.current_sequence().offence]:
            pb = ToggleButton(text=player.display_name, group=u'players')
            pickcallback = partial(self.set_puller, pb, player)
            pb.bind(on_release=pickcallback)
            self.ids.LeftBox.add_widget(pb)

        for action in hierarch.Pull.all_pulls:
            outcome = MDRaisedButton(text=action, size_hint=(1, 0.25))
            outcomecallback = partial(self.set_pull_outcome, outcome)
            outcome.bind(on_release=outcomecallback)
            self.ids.RightBox.add_widget(outcome)
Esempio n. 10
0
    def __init__(self, **kwargs):
        NavigationLayout.__init__(self, **kwargs)
        self.box = newwid()
        self.bottomnav = MDBottomNavigation(size_hint_y=0.1)
        self.bottomnavmainbutton = MDBottomNavigationItem(text="Home",
                                                          icon='home')
        self.bottomnavbrowserbutton = MDBottomNavigationItem(
            text="Browser", icon='google-earth')
        self.scrrenmngr = ScreenManager(pos_hint={
            'center_x': 0.5,
            'center_y': 0.5
        })
        self.mainscreen = Screen(name="MainScreen")
        self.browserscreen = Screen(name="BrowserScreen")
        self.nd = MDNavigationDrawer()
        self.nd.add_widget(
            MDRaisedButton(text='sdsdsdsd',
                           pos_hint={
                               'center_x': 0.5,
                               'center_y': 0.5
                           }))
        self.mainui = BoxLayout(orientation='vertical')
        self.mainui.add_widget(self.scrrenmngr)
        self.add_widget(self.nd)
        kvv = '''
        
Screen:
    name: 'bottom_navigation'
    MDBottomNavigation:
        id: bottom_navigation_demo
        MDBottomNavigationItem:
            name: 'home'
            text: "Home"
            icon: "home"
            BoxLayout:
                id: main
        MDBottomNavigationItem:
            name: 'Browser'
            text: "Browser"
            icon: 'google-earth'
            BoxLayout:
                id: browser
        '''
        self.nv = Builder.load_string(kvv)
        self.nv.ids.main.add_widget(self.box)
        self.add_widget(self.nv)
        self.nv.ids.browser.add_widget(self.browserscreen)
        self.browbox = BoxLayout(orientation='vertical')
        self.browbox.add_widget(ntoolbar(title='KivDL'))
        self.brow = searcherbox()
        self.browbox.add_widget(self.brow)

        self.browserscreen.add_widget(self.browbox)
Esempio n. 11
0
    def show_products(self):

        for product in product_list:
            one_product = BoxLayout(orientation='vertical', size_hint_y=1)

            image_section = BoxLayout(orientation='vertical', size_hint_y=.65)
            image = ProductImage(
                id=str(product['id']),
                source=product['img'],
            )
            image.price = product['price']

            # on_touch_down=lambda x,y: print(x,y))
            image.title = product['title']

            image_section.add_widget(image)

            label_section = BoxLayout(orientation='vertical', size_hint_y=.10)
            label_section.add_widget(
                MDLabel(font_style='Caption',
                        font_size='20dp',
                        theme_text_color='Primary',
                        text=product['title'].upper(),
                        halign='center'))

            button_section = BoxLayout(orientation='vertical', size_hint_y=.20)
            button_cart = MDRaisedButton(
                id=str(product['id']),
                text='ADD TO CART',
                pos_hint={'center_x': .5},
                elevation=9,
                #on_release = lambda x:self.open_popup(product_list[self.search_index_by_id(int(x.id))]['title'], product_list[int(x.id)]['img'], product_list[int(x.id)]['id'])
                #on_press = lambda x: print(product_list[int(x.id)]['title'], product_list[int(x.id)]['img'])
                #on_release = lambda x: self.search_index_by_id(int(x.id))
                #on_release = lambda x: print(product_list[self.search_index_by_id(int(x.id))]['title'], product_list[self.search_index_by_id(int(x.id))]['img'], product_list[self.search_index_by_id(int(x.id))]['id'])
                # on_release = lambda x: ProductListing.open_popup(product_list[self.search_index_by_id(int(x.id))]['title'],
                # 	product_list[self.search_index_by_id(int(x.id))]['img'],
                # 	product_list[self.search_index_by_id(int(x.id))]['id'],
                # 	product_list[self.search_index_by_id(int(x.id))]['price'])
                on_release=lambda x: ProductListing.add_to_cart(
                    product_list[self.search_index_by_id(int(x.id))]['id'],
                    product_list[self.search_index_by_id(int(x.id))]['img'],
                    product_list[self.search_index_by_id(int(x.id))]['title'],
                    product_list[self.search_index_by_id(int(x.id))]['price']))
            button_section.add_widget(button_cart)

            one_product.add_widget(image_section)
            one_product.add_widget(label_section)
            one_product.add_widget(button_section)

            self.add_widget(one_product)
Esempio n. 12
0
def start():
    global game, sws

    uname = MDTextField(text='Kivy')
    uname._hint_lbl.text = 'Username'

    sname = MDTextField(text='ws://localhost:8080/chat')
    sname._hint_lbl.text = 'Server'

    root.ids.drawer.add_widget(uname)
    root.ids.drawer.add_widget(sname)

    root.ids.drawer.add_widget(
        MDRaisedButton(text='Connect',
                       on_press=lambda _ev: sws.start(sname.text, uname.text)))

    root.ids.drawer.add_widget(BoxLayout())

    root.ids.frame.add_widget(
        MDRaisedButton(
            text='Send',
            on_press=lambda _ev: sws.send({'message': messagebox.text})))

    root.ids.frame.add_widget(
        MDRaisedButton(text='none',
                       on_press=lambda _ev: sws.send({
                           'action': 'join',
                           'room': 'pop'
                       })))

    messagebox = MDTextField()
    messagebox._hint_lbl.text = 'Message'

    root.ids.frame.add_widget(messagebox)

    sws = sWs()
    game = game = Entity.Engine([sws])
    Clock.schedule_interval(lambda _dt: game.tick(_dt * 1000), 0.1)
Esempio n. 13
0
    def __init__(self, name, *navigate_screens):
        super(ImagesMenu, self).__init__(name, *navigate_screens)
        self.lower_grid = BoxLayout(orientation='vertical',
                                    spacing=5,
                                    padding=5)
        self.lower_panel.add_widget(self.lower_grid)

        self.filechooser = FileChooserListView()
        if platform == 'android':
            self.filechooser.path = '/sdcard/DCIM'
        else:
            self.filechooser.path = os.getcwd()
        self.filechooser.bind(
            on_selection=lambda x: self.selected(self.filechooser.selection))

        self.open_file_button = MDRaisedButton(text='Upload Image',
                                               size_hint=(1, .1))
        self.open_file_button.bind(on_release=lambda x: self.open_f(
            self.filechooser.path, self.filechooser.selection))

        self.lower_grid.add_widget(
            TextInput(size_hint=(1, .12), text='Image name'))
        self.lower_grid.add_widget(self.open_file_button)
        self.lower_grid.add_widget(self.filechooser)
Esempio n. 14
0
    def get_nav_bar(self):
        main_bar = MDCard(size_hint=(1.0, 0.08),
                          pos_hint={'center_x': 0.5, 'center_y': 0.05})
        bar_box = BoxLayout(orientation='horizontal', padding=dp(8))
        back_button = MDRaisedButton(text='Back', theme_text_color='Secondary',
                                     font_style='Title', size_hint_x=None,
                                     width=dp(36), height=self.parent.height,
                                     pos_hint={'center_x': 0.2, 'center_y': 0.5},
                                     on_release=partial(self.prev_page))
        title_label = MDLabel(disabled=True, theme_text_color='Primary', halign='center',
                              height=self.parent.height,
                              pos_hint={'center_x': 0.2, 'center_y': 0.5})
        title_label.text = self.current_story.title
        next_button = MDRaisedButton(text='Next', theme_text_color='Secondary',
                                     font_style='Title', size_hint_x=None,
                                     width=dp(36), height=self.parent.height,
                                     pos_hint={'center_x': 0.2, 'center_y': 0.5},
                                     on_release=partial(self.next_page))

        bar_box.add_widget(back_button)
        bar_box.add_widget(title_label)
        bar_box.add_widget(next_button)
        main_bar.add_widget(bar_box)
        return main_bar
Esempio n. 15
0
	def __init__(self):
		super(lis,self).__init__()
		tot=network.get_firebase('Schedule')
		day1=tot['Day1']
		day2=tot['Day2']
		k1={}
		k2={}
		for no,i in enumerate(day1):
			if (no==0):
				continue
			k1[no]=i.replace('\\t','\t')
		for no,i in enumerate(day2):
			if (no==0):
				continue
			k2[no]=i.replace('\\t','\t')
		self.name='shed'
		t=Toolbar(title='shedule',md_bg_color= self.theme_cls.primary_color,background_palette='Primary')
		t.add_widget(MDRaisedButton(text='back',on_press=lambda x:self.cng_scr('vute')))
		#b1=BoxLayout(orientation='vertical')
		b1=GridLayout(rows=12)
		n=MDList()
		l1=OneLineListItem(text='Day 1')
		n.add_widget(l1)
		k1_key=k1.keys()
		for i in k1_key:
			ln=OneLineListItem(text=k1[i])
			n.add_widget(ln)
		l3=OneLineListItem(text='')
		n.add_widget(l3)
		l2=OneLineListItem(text='Day 2')
		n.add_widget(l2)
		k2_key=k2.keys()
		for i in k2_key:
			ln=OneLineListItem(text=k2[i])
			n.add_widget(ln)

		b1.add_widget(t)
		b1.add_widget(n)
		self.add_widget(b1)
Esempio n. 16
0
    def __init__(self):
        super(lis, self).__init__()
        self.k1 = db.get_db('all')
        self.k2 = self.k1[3:]
        k1 = self.k1
        k2 = self.k2
        self.name = 'info'
        t = Toolbar(title='personal info',
                    md_bg_color=self.theme_cls.primary_color,
                    background_palette='Primary')
        t.add_widget(
            MDRaisedButton(text='back',
                           on_press=lambda a: self.cng_scr('vute')))
        #b1=BoxLayout(orientation='vertical')
        b1 = GridLayout(rows=12)
        n = MDList()
        l1 = OneLineListItem(text='Details')
        n.add_widget(l1)
        name = k1[0].split(' ')[0]
        n.add_widget(OneLineListItem(text='Name :\t' + name))
        n.add_widget(OneLineListItem(text='phone :\t' + k1[1]))
        n.add_widget(OneLineListItem(text='email :\t' + k1[2]))
        l3 = OneLineListItem(text='')
        n.add_widget(l3)
        l2 = OneLineListItem(text='Registered courses')
        n.add_widget(l2)
        cou = 1
        for i in range(len(k2)):
            if k2[i] == '1':
                ln = OneLineListItem(text=str(cou) + ')  ' + proj[i])
                cou += 1
                n.add_widget(ln)
        if cou == 1:
            ln = OneLineListItem(text='no regestered courses')
            n.add_widget(ln)

        b1.add_widget(t)
        b1.add_widget(n)
        self.add_widget(b1)
Esempio n. 17
0
def start():
    global game

    def do_something(_ev):
        call(
            "am start -f 0x00001000 --user 0 -n com.android.mms/.ui.ConversationList",
            feedbacks.toast)

    root.ids.drawer.add_widget(
        MDRaisedButton(text='command', on_press=do_something))

    root.ids.drawer.add_widget(BoxLayout())
    '''  
  root.ids.frame.add_widget(
    MDRaisedButton(
      text='Send',
      on_press=lambda _ev: sws.send({'message':messagebox.text})
    )
  )'''

    game = Entity.Engine([])
    Clock.schedule_interval(lambda _dt: game.tick(_dt * 1000), 0.1)
Esempio n. 18
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
Esempio n. 19
0
    def set_content(self, instance_content_dialog):
        def _events_callback(result_press):
            self.dismiss()
            if result_press:
                self.events_callback(result_press, self)

        if self.device_ios:  # create buttons for iOS
            self.background = self._background

            if instance_content_dialog.__class__ is ContentInputDialog:
                self.text_field = MDTextFieldRect(
                    pos_hint={'center_x': .5},
                    size_hint=(1, None),
                    multiline=False,
                    height=dp(33),
                    cursor_color=self.theme_cls.primary_color,
                    hint_text=instance_content_dialog.hint_text)
                instance_content_dialog.ids.box_input.height = dp(33)
                instance_content_dialog.ids.box_input.add_widget(
                    self.text_field)

            if self.text_button_cancel != '':
                anchor = 'left'
            else:
                anchor = 'center'
            box_button_ok = AnchorLayout(anchor_x=anchor)
            box_button_ok.add_widget(
                MDTextButton(text=self.text_button_ok,
                             font_size='18sp',
                             on_release=lambda x: _events_callback(
                                 self.text_button_ok)))
            instance_content_dialog.ids.box_buttons.add_widget(box_button_ok)

            if self.text_button_cancel != '':
                box_button_ok.anchor_x = 'left'
                box_button_cancel = AnchorLayout(anchor_x='right')
                box_button_cancel.add_widget(
                    MDTextButton(text=self.text_button_cancel,
                                 font_size='18sp',
                                 on_release=lambda x: _events_callback(
                                     self.text_button_cancel)))
                instance_content_dialog.ids.box_buttons.add_widget(
                    box_button_cancel)

        else:  # create buttons for Android
            if instance_content_dialog.__class__ is ContentInputDialog:
                self.text_field = MDTextField(
                    size_hint=(1, None),
                    height=dp(48),
                    hint_text=instance_content_dialog.hint_text)
                instance_content_dialog.ids.box_input.height = dp(48)
                instance_content_dialog.ids.box_input.add_widget(
                    self.text_field)
                instance_content_dialog.ids.box_buttons.remove_widget(
                    instance_content_dialog.ids.sep)

            box_buttons = AnchorLayout(anchor_x='right',
                                       size_hint_y=None,
                                       height=dp(30))
            box = BoxLayout(size_hint_x=None, spacing=dp(5))
            box.bind(minimum_width=box.setter('width'))
            button_ok = MDRaisedButton(
                text=self.text_button_ok,
                on_release=lambda x: _events_callback(self.text_button_ok))
            box.add_widget(button_ok)

            if self.text_button_cancel != '':
                button_cancel = MDFlatButton(
                    text=self.text_button_cancel,
                    theme_text_color='Custom',
                    text_color=self.theme_cls.primary_color,
                    on_release=lambda x: _events_callback(self.
                                                          text_button_cancel))
                box.add_widget(button_cancel)

            box_buttons.add_widget(box)
            instance_content_dialog.ids.box_buttons.add_widget(box_buttons)
            instance_content_dialog.ids.box_buttons.height = button_ok.height
            instance_content_dialog.remove_widget(
                instance_content_dialog.ids.sep)
Esempio n. 20
0
    def layout(self):

        self.paymentDict = {}
        self.card = False
        self.year = False
        self.month = False
        self.cvc = False

        def on_text_card(instance, value):
            if len(value) == 16:
                self.card = True
                self.paymentDict['card'] = str(value)
            else:
                self.card = False
            setButtonColor()

        def on_text_month(instance, value):
            if len(value) == 2:
                self.month = True
                self.paymentDict['month'] = str(value)
            else:
                self.month = False
            setButtonColor()

        def on_text_year(instance, value):
            if len(value) == 4:
                self.year = True
                self.paymentDict['year'] = str(value)
            else:
                self.year = False
            setButtonColor()

        def on_text_cvc(instance, value):
            if len(value) == 3:
                self.cvc = True
                self.paymentDict['cvc'] = str(value)
            else:
                self.cvc = False
            setButtonColor()

        layout = BoxLayout(orientation='vertical',
                           padding=(2 * dp(48), 2 * dp(48)))
        # Credit Card Input
        self.creditCardField = MDTextField()
        self.creditCardField.hint_text = "Credit Card Number"
        self.creditCardField.input_filter = 'int'
        self.creditCardField.max_text_length = 16
        self.creditCardField.bind(text=on_text_card)
        layout.add_widget(self.creditCardField)

        # Exp date input
        dateBox = BoxLayout()
        self.expMonth = MDTextField(
        )  # This is the color used by the textfield
        self.expMonth.hint_text = "Exp Month"
        self.expMonth.input_filter = 'int'
        self.expMonth.max_text_length = 2
        self.expMonth.bind(text=on_text_month)
        self.expYear = MDTextField()
        self.expYear.hint_text = "Exp Year"
        self.expYear.input_filter = 'int'
        self.expYear.max_text_length = 4
        self.expYear.bind(text=on_text_year)
        dateBox.add_widget(self.expMonth)
        dateBox.add_widget(self.expYear)
        layout.add_widget(dateBox)
        # CVC
        cvcBox = BoxLayout()
        self.cvcTextField = MDTextField()
        self.cvcTextField.hint_text = "CVC"
        self.cvcTextField.helper_text = "3 digit number on back of card"
        self.cvcTextField.helper_text_mode = "on_focus"
        self.cvcTextField.input_filter = "int"
        self.cvcTextField.bind(text=on_text_cvc)
        blankWidget8 = MDLabel(text='')
        cvcBox.add_widget(self.cvcTextField)
        cvcBox.add_widget(blankWidget8)
        layout.add_widget(cvcBox)

        # Combined Boxes into
        proceedButton = MDRaisedButton(text='Enter Credit Card',
                                       size_hint=(None, None),
                                       size=(4 * dp(48), dp(48)))
        proceedButton.md_bg_color = [0.9, 0, 0, 0.9]
        # proceedButton.bind(on_press=lambda x: self.processInformation(paymentDict))
        self.app = App.get_running_app()

        def setButtonColor():
            if all([self.card, self.year, self.month, self.cvc]):
                proceedButton.md_bg_color = self.app.theme_cls.primary_color
                proceedButton.text = 'Proceed'
                proceedButton.bind(
                    on_press=lambda x: self.processInformation())
            else:
                proceedButton.unbind

        proceedAnchor = AnchorLayout(anchor_x='center', anchor_y='bottom')
        proceedAnchor.add_widget(proceedButton)
        # #Combine all together
        layout.add_widget(proceedAnchor)

        content = Builder.load_string(spinner)
        self.authenPopup = Popup(title='Authorizing...',
                                 title_align='center',
                                 size_hint=(None, None),
                                 size=(dp(200), dp(200)))
        self.authenPopup.add_widget(content)
        self.authenPopup.title_font = 'data/fonts/Roboto-Bold.ttf'
        self.authenPopup.title_color = App.get_running_app(
        ).theme_cls.primary_color
        self.authenPopup.separator_color = App.get_running_app(
        ).theme_cls.primary_color
        self.authenPopup.background = str(
            Atlas('{}round_shadow.atlas'.format(images_path)))

        return layout
Esempio n. 21
0
    def on_pre_enter(self, *args):

        self.popup = None
        self.temp_event = ['player_not_set', None, None,
                           None]  # [player, action, ts_start, ts_end]
        self.pblist = []
        sApp = App.get_running_app()

        sApp.root.ids.toolbar.title = 'Select Player, then Action'

        # sequence_display = Label(text=str(seq_content),pos_hint={'top':1})
        # not sure pos_hint works very well - possibly bc i never use it and hence am mixing
        # this is the shit to fix with the UI restructure hey
        self.update_sequence()

        for player in sApp.current_point.current_sequence().lines[
                sApp.current_point.current_sequence().offence]:
            pb = ToggleButton(
                text=player.display_name,
                group=u'players')  #, size_hint=[0.33,None]) #StackLayout stuff
            pickcallback = partial(self.set_player, player)
            pb.bind(on_release=pickcallback)
            self.pblist.append(pb)
            self.ids.LeftBox.add_widget(pb)

        #fakePlayer = hierarch.Player(player_name=sApp.game.teams[sApp.current_point.current_sequence().offence].team_name,
        #                             player_number=-1,
        #                            player_gender='G')
        #pb = ToggleButton(text=fakePlayer.display_name, group=u'players')#, size_hint=[0.33,None])
        #pickcallback = partial(self.set_player,fakePlayer)
        #pb.bind(on_release=pickcallback)
        #self.pblist.append(pb)
        #self.ids.LeftBox.add_widget(pb)

        action = 'pass'
        select = MDRaisedButton(text=action)
        selectcallback = partial(self.set_action, action)
        select.bind(on_release=selectcallback)
        self.ids.RightBox.add_widget(select)

        rightGrid = GridLayout(cols=2, spacing=10, size_hint_y=0.9)

        self.ids.RightBox.add_widget(rightGrid)

        for action in hierarch.Event.primary_actions:
            select = MDRaisedButton(text=action)
            selectcallback = partial(self.set_action, action)
            select.bind(on_release=selectcallback)
            #self.ids.RightBox.add_widget(select)
            rightGrid.add_widget(select)

        #secondaryBox = BoxLayout(orientation='horizontal',
        #                         padding=[0,10])
        for action in hierarch.Event.secondary_actions:
            select = MDRaisedButton(text=action)
            selectcallback = partial(self.set_action, action)
            select.bind(on_release=selectcallback)
            #secondaryBox.add_widget(select)
            #self.ids.RightBox.add_widget(secondaryBox)
            rightGrid.add_widget(select)

        action = 'goal'
        select = MDRaisedButton(text=action)
        selectcallback = partial(self.set_action, action)
        select.bind(on_release=selectcallback)
        rightGrid.add_widget(select)

        for action in hierarch.Event.defensive_actions:
            select = MDRaisedButton(text=action)
            selectcallback = partial(self.set_action, action)
            select.bind(on_release=selectcallback)
            #self.ids.RightBox.add_widget(select)
            rightGrid.add_widget(select)

        playBreakButton = MDRaisedButton(text='Break in play')
        playBreakButton.bind(on_release=self.playbreak_switch)
        #self.ids.RightBox.add_widget(playBreakButton)
        rightGrid.add_widget(playBreakButton)

        undoButton = MDRaisedButton(text='Undo Event')
        # undocallback = partial(self.undo_action)
        undoButton.bind(on_release=self.undo_action)
        #self.ids.RightBox.add_widget(undoButton)
        rightGrid.add_widget(undoButton)
Esempio n. 22
0
    def open_popup(product_title, image_source, id, price):
        ProductListing.the_popup = Popup(id='product_popup',
                                         size_hint=(1, .8),
                                         auto_dismiss=True,
                                         background='',
                                         background_color=(.5, .5, .5, .8),
                                         title_color=(0, 0, 0, 1),
                                         title=product_title)

        popup_box = BoxLayout(orientation='vertical', size_hint_y=1)
        popup_box.add_widget(AsyncImage(source=image_source))
        popup_box.add_widget(
            MDLabel(size_hint_y=.15,
                    text=product_title,
                    halign='center',
                    font_style='H5',
                    font_size='20dp'))
        popup_box.add_widget(
            MDLabel(size_hint_y=.25,
                    text=str(price) + 'p',
                    halign='center',
                    font_style='H6',
                    font_size='30dp',
                    color=[1, 0, 0, 1]))

        button_section = BoxLayout(
            size_hint_y=.15,
            orientation='horizontal',
            padding='10dp',
            spacing='10dp',
            # size_hint = (None, None),
            # size = self.minimum_size,
            pos_hint={'center_x': .5},
        )
        button1_section = AnchorLayout(
            # size = self.parent.size,
            anchor_x='center',
            anchor_y='center')

        button2_section = AnchorLayout(
            # size = self.parent.size,
            anchor_x='center',
            anchor_y='center')

        button1_section.add_widget(
            MDRectangleFlatButton(
                text='Close',
                pos_hint={'center_x': .5},
                # size = self.minimum_size,
                size_hint_x=.5,
                on_release=lambda a: ProductListing.the_popup.dismiss(),
            ))
        button2_section.add_widget(
            MDRaisedButton(
                text='Add to cart',
                # icon = 'cart',
                pos_hint={'center_x': .5},
                size_hint_x=.5,
                elevation=9,
                on_release=lambda x: ProductListing.add_to_cart(
                    id, image_source, product_title, price)))

        button_section.add_widget(button1_section)
        button_section.add_widget(button2_section)
        popup_box.add_widget(button_section)
        ProductListing.the_popup.add_widget(popup_box)
        ProductListing.the_popup.open()