Exemple #1
0
 def build(self):  #funcion para correr la app
     return Button(text='Hello World')
Exemple #2
0
 def build(self):
     return Button(text = "This is Button! Press the Mouse")
Exemple #3
0
 def build(self):
     return Button(text='Hello World')
Exemple #4
0
    def show_contract(self):

        #start fresh
        self.clear_widgets()
        self.cols = 1
        self.rows = 1

        #scroll
        s = ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
        self.add_widget(s)

        #main grid
        g = GridLayout(cols=1,
                       rows=3,
                       size_hint=(1, None),
                       height=Window.height)
        g.bind(minimum_height=g.setter('height'))
        s.add_widget(g)

        #contract
        c = Label(
            size_hint=(1, None),
            halign='center',
        )
        with open('per/contract.txt', 'r') as f:
            c.text = f.read().split('Print Name Owner')[0]
        c.bind(width=lambda *x: c.setter('text_size')(c, (c.width, None)))
        c.bind(
            texture_size=lambda *x: c.setter('height')(c, c.texture_size[1]))
        g.add_widget(c)

        #standing divisor
        r = GridLayout(cols=2,
                       rows=2,
                       size_hint=(1, None),
                       height=Window.height)
        r.bind(minimum_height=r.setter('height'))
        g.add_widget(r)

        #keys
        k = GridLayout(cols=1,
                       rows=7,
                       size_hint=(1, None),
                       height=Window.height)
        k.bind(minimum_height=k.setter('height'))
        r.add_widget(k)

        #values
        v = GridLayout(cols=1,
                       rows=7,
                       size_hint=(1, None),
                       height=Window.height)
        v.bind(minimum_height=v.setter('height'))
        r.add_widget(v)

        #name
        n = self.n = Label(text='Customer Name:', color=(.5, .5, .5, 1))

        n.g = GridLayout(cols=1, rows=3)

        n.i = TextInput(text='', foreground_color=(0, 0, 0, 1))

        n.g.add_widget(Label())
        n.g.add_widget(n.i)
        n.g.add_widget(Label())

        k.add_widget(n)
        v.add_widget(n.g)

        #addy
        a = self.a = Label(text='Customer Address:', color=(.5, .5, .5, 1))

        a.g = GridLayout(cols=1, rows=3)

        a.i = TextInput(text='', foreground_color=(0, 0, 0, 1))

        a.g.add_widget(Label())
        a.g.add_widget(a.i)
        a.g.add_widget(Label())

        k.add_widget(a)
        v.add_widget(a.g)

        #phone
        p = self.p = Label(text='Customer Phone #:', color=(.5, .5, .5, 1))

        p.g = GridLayout(cols=1, rows=3)

        p.i = TextInput(text='', foreground_color=(0, 0, 0, 1))

        p.g.add_widget(Label())
        p.g.add_widget(p.i)
        p.g.add_widget(Label())

        k.add_widget(p)
        v.add_widget(p.g)

        #claim
        l = self.l = Label(text='Insurance Claim #:', color=(.5, .5, .5, 1))

        l.g = GridLayout(cols=1, rows=3)

        l.i = TextInput(text='', foreground_color=(0, 0, 0, 1))

        l.g.add_widget(Label())
        l.g.add_widget(l.i)
        l.g.add_widget(Label())

        k.add_widget(l)
        v.add_widget(l.g)

        #insurance name
        ni = self.ni = Label(text='Insurance Name:', color=(.5, .5, .5, 1))

        ni.g = GridLayout(cols=1, rows=3)

        ni.i = TextInput(text='', foreground_color=(0, 0, 0, 1))

        ni.g.add_widget(Label())
        ni.g.add_widget(ni.i)
        ni.g.add_widget(Label())

        k.add_widget(ni)
        v.add_widget(ni.g)

        #insurance phone
        np = self.np = Label(text='Insurance Phone #:', color=(.5, .5, .5, 1))

        np.g = GridLayout(cols=1, rows=3)

        np.i = TextInput(text='', foreground_color=(0, 0, 0, 1))

        np.g.add_widget(Label())
        np.g.add_widget(np.i)
        np.g.add_widget(Label())

        k.add_widget(np)
        v.add_widget(np.g)

        #date
        d = self.d = Label(text='Date:', color=(.5, .5, .5, 1))

        d.g = GridLayout(cols=1, rows=3)

        d.i = TextInput(foreground_color=(0, 0, 0, 1))
        x = str(datetime.datetime.now()).split(' ')[0].split('-')
        self.rightdate = '/'.join(['/'.join(x[1:]), str(x[0])])
        d.i.text = self.rightdate

        d.g.add_widget(Label())
        d.g.add_widget(d.i)
        d.g.add_widget(Label())

        k.add_widget(d)
        v.add_widget(d.g)

        #button
        b = Button(size_hint=(1, None), text='Sign Contract')
        b.bind(on_press=lambda *x: self.sign_contract())
        g.add_widget(b)
Exemple #5
0
    def build(self):

        # Defining the layout of the page
        f = FloatLayout()

        # Creating a box to input the name of the recipe

        self.name1 = TextInput(hint_text="Name of Recipe",
                               font_size=10,
                               multiline=False,
                               size_hint=(.7, .05),
                               pos_hint={
                                   'x': .15,
                                   'y': .8
                               })

        # Creating a box to input the serving size

        self.servings = TextInput(hint_text="Servings",
                                  font_size=10,
                                  multiline=False,
                                  size_hint=(.33, .05),
                                  pos_hint={
                                      'x': .52,
                                      'y': .7
                                  })

        # Creating a box to input time required to cook

        self.time1 = TextInput(hint_text="Time required",
                               font_size=10,
                               multiline=False,
                               size_hint=(.33, .05),
                               pos_hint={
                                   'x': .15,
                                   'y': .7
                               })

        # Creating a box to input the ingredients of the recipe

        self.ingredients = TextInput(hint_text="Ingredients",
                                     font_size=10,
                                     size_hint=(.33, .49),
                                     pos_hint={
                                         'x': .15,
                                         'y': .18
                                     })

        # Creating a box to input the cooking directions

        self.directions = TextInput(hint_text="Directions",
                                    font_size=10,
                                    size_hint=(.33, .49),
                                    pos_hint={
                                        'x': .52,
                                        'y': .18
                                    })

        # Save Button

        saveB = Button(text="Save",
                       size_hint=(.5, .1),
                       pos_hint={
                           'x': .25,
                           'y': .05
                       })

        saveB.bind(on_press=self.clk)  # Binding of the save button

        # Back Button

        cancelB = Button(text="Back",
                         size_hint=(.05, .05),
                         pos_hint={
                             'x': .008,
                             'y': .94
                         })

        cancelB.bind(on_press=self.clk1)  # Binding of the back button

        # Adding the widgets on to the screen

        f.add_widget(
            Label(text="Add a Recipe", font_size=45, size_hint=(1, 1.9)))
        f.add_widget(saveB)
        f.add_widget(cancelB)
        f.add_widget(self.name1)
        f.add_widget(self.servings)
        f.add_widget(self.time1)
        f.add_widget(self.ingredients)
        f.add_widget(self.directions)

        return f
Exemple #6
0
 def run(self):
     o = []
     for x in self.labels:
         o.append(Button(text=x))
     # tick for texture creation
     Clock.tick()
Exemple #7
0
    def show_full_img(self, instance):

        clicked_img = instance.source
        img = Image(source=clicked_img)
        img_size_x = img.texture_size[0]
        img_size_y = img.texture_size[1]

        #Normalise the image width
        while img_size_x >= Window.width or img_size_y >= Window.height:
            if img_size_x > img_size_y:
                img_size_x -= 16
                img_size_y -= 9
            else:
                img_size_y -= 9

        img_size_x - 100
        img_size_y - 100
        #Normalise the image height
        # while img_size_y > Window.height - 90:
        #     img_size_y -= 9

        #Get the next and previous images
        all_imgs = sorted(self.images)
        print('Image Size: (%sx%s)' % (img_size_x, img_size_y))
        print('Image Center: ', img.center)
        print('Img Position: ', img.pos)
        nxt_img = 'img/'
        prev_img = 'img/'
        for x in range(len(all_imgs)):
            if all_imgs[x] == clicked_img[4:]:
                if x != len(all_imgs) - 1:
                    nxt_img += all_imgs[x + 1]
                else:
                    nxt_img = all_imgs[0]
                if x != 0:
                    prev_img += all_imgs[x - 1]
                else:
                    prev_img += all_imgs[len(all_imgs) - 1]
                break

        view_image = ViewImage(size_hint=(None, None),
                               size=(img_size_x, img_size_y),
                               padding=(0, 0),
                               background_color=(0, 0, 0, .8))
        print('Modal Size: ', view_image.size)
        print('Modal Center: ', view_image.center)
        print('Window Size: (%sx%s)' % (Window.width, Window.height))
        print('Window Center: (%sx%s)' % (Window.width / 2, Window.height / 2))
        with view_image.canvas.before:
            Color(1, 1, 1, .8)
            Rectangle(source=instance.source, pos=self.pos, size=self.size)
        image_container = BoxLayout(spacing=10, padding=(0, 10))
        image_ops = AnchorLayout(anchor_x='center', anchor_y='bottom')
        image_ops_cont = BoxLayout(size_hint=(None, None), size=(200, 50))

        prev_img_btn = Button(text='%s' % (icon('zmdi-caret-left', 32)),
                              color=(0, 0, 0, 1),
                              markup=True,
                              size_hint=(None, None),
                              size=(95, 30),
                              background_normal='',
                              background_color=(1, 1, 1, .5))

        nxt_img_btn = Button(text='%s' % (icon('zmdi-caret-right', 26)),
                             color=(0, 0, 0, 1),
                             markup=True,
                             size_hint=(None, None),
                             size=(95, 30),
                             background_normal='',
                             background_color=(1, 1, 1, .5))

        crop = Button(text='%s' % (icon('zmdi-crop', 26)),
                      color=(0, 0, 0, 1),
                      markup=True,
                      size_hint=(None, None),
                      size=(45, 30),
                      background_normal='',
                      background_color=(1, 1, 1, .5),
                      on_release=self.crop_image)

        set_as = Button(text='%s' % (icon('zmdi-wallpaper', 26)),
                        color=(0, 0, 0, 1),
                        markup=True,
                        size_hint=(None, None),
                        size=(45, 30),
                        background_normal='',
                        background_color=(1, 1, 1, .5))

        effects = DropDown()
        effect_sharpen = Button(text='%s' % (icon('zmdi-grain', 32)),
                                color=(0, 0, 0, 1),
                                markup=True,
                                size_hint=(None, None),
                                size=(45, 30),
                                background_normal='',
                                background_color=(1, 1, 1, .5),
                                on_release=self.sharpen_image)
        effect_blur = Button(text='%s' % (icon('zmdi-blur', 32)),
                             color=(0, 0, 0, 1),
                             markup=True,
                             size_hint=(None, None),
                             size=(45, 30),
                             background_normal='',
                             background_color=(1, 1, 1, .5),
                             on_release=self.blur_image)
        effect_emboss = Button(text='%s' % (icon('zmdi-gradient', 32)),
                               color=(0, 0, 0, 1),
                               markup=True,
                               size_hint=(None, None),
                               size=(45, 30),
                               background_normal='',
                               background_color=(1, 1, 1, .5),
                               on_release=self.emboss_image)
        effect_cartoon = Button(text='%s' % (icon('zmdi-exposure', 32)),
                                color=(0, 0, 0, 1),
                                markup=True,
                                size_hint=(None, None),
                                size=(45, 30),
                                background_normal='',
                                background_color=(1, 1, 1, .5),
                                on_release=self.cartoon_image)

        #Add Effects Buttons To The Dropdown
        effects.add_widget(effect_sharpen)
        effects.add_widget(effect_blur)
        effects.add_widget(effect_emboss)
        effects.add_widget(effect_cartoon)

        effects_list_trigger = Button(text='%s' %
                                      (icon('zmdi-graphic-eq', 32)),
                                      color=(0, 0, 0, 1),
                                      markup=True,
                                      size_hint=(None, None),
                                      size=(45, 30),
                                      background_normal='',
                                      background_color=(1, 1, 1, .5),
                                      on_release=effects.open)

        image_ops_cont = BoxLayout(size_hint=(None, None), size=(200, 50))

        #Add image operations buttons to their container
        image_ops_cont.add_widget(prev_img_btn)
        image_ops_cont.add_widget(crop)
        image_ops_cont.add_widget(set_as)
        image_ops_cont.add_widget(effects_list_trigger)
        image_ops.add_widget(image_ops_cont)
        image_container.add_widget(img)
        image_ops_cont.add_widget(nxt_img_btn)

        #Display all widgets to the screen
        view_image.add_widget(image_container)
        view_image.add_widget(image_ops)
        view_image.open()
Exemple #8
0
    def build(self):
        # self.formula='0'
        # scat=Scatter()
        gl=GridLayout(cols=5, spacing=5, size_hint=(1,.6))
        bl=BoxLayout(orientation='vertical', padding=5)
        # scat.add_widget(fl)
        self.lbl=Label(text='0', font_size=40, size_hint=(1,.2), halign='right', 
        valign='center', text_size=(400-50, 500*.4-50))
       
        bl.add_widget(self.lbl)

        gl.add_widget(Button(text='7', on_press=self.add_number))
        gl.add_widget(Button(text='8', on_press=self.add_number))
        gl.add_widget(Button(text='9', on_press=self.add_number))
        gl.add_widget(Button(text='+', on_press=self.add_operator))
        # gl.add_widget(Button(text='<--', on_press=self.clear))
        gl.add_widget(Button(text='<--', on_press=self.backspace))

        

        gl.add_widget(Button(text='4', on_press=self.add_number))
        gl.add_widget(Button(text='5', on_press=self.add_number))
        gl.add_widget(Button(text='6', on_press=self.add_number))
        gl.add_widget(Button(text='-', on_press=self.add_operator))
        gl.add_widget(Button(text='(', on_press=self.add_number))

        gl.add_widget(Button(text='1', on_press=self.add_number))
        gl.add_widget(Button(text='2', on_press=self.add_number))
        gl.add_widget(Button(text='3', on_press=self.add_number))
        gl.add_widget(Button(text='x', on_press=self.add_operator))
        gl.add_widget(Button(text=')', on_press=self.add_number))



        # gl.add_widget(Button(text='C', on_press=self.sett_zerro))
        # gl.add_widget(Widget())
        gl.add_widget(Button(text='0', on_press=self.add_number))
        gl.add_widget(Button(text='.', on_press=self.add_number))
        gl.add_widget(Button(text='=', on_press=self.get_result))
        gl.add_widget(Button(text='/', on_press=self.add_operator))
        gl.add_widget(Button(text='C', on_press=self.clear))

        

        bl.add_widget(gl)

        return bl
Exemple #9
0
 def __init__(self, **kwargs):
     super(MySettingsPanel, self).__init__(**kwargs)
     
     # Get the current launch directory
     curdir = dirname(__file__)
     
     '''
     # 
     # I think this isn't working under unix
     # because of the '\\'. Actually, it isn't
     # even working under windows ;-)
     # 
     
     # find all fill-resolution background images
     all_background_images = glob(join(curdir, 'backgrounds/*', 'background_*'))
     all_background_filenames = []
     for image in all_background_images:
         # extract the filname, cut the 'background_' and the file extension
         all_background_filenames.append(image.rpartition('\\')[2])
         all_background_filenames.append(image.replace('background_', '', 1))
         all_background_filenames.append(image.rpartition('.')[0])
     
     all_background_thumbnails = glob(join(curdir, 'backgrounds/*', 'thumbnail_*'))
     all_background_thumbnail_filenames = []
     for background_thumbnail in all_background_thumbnails:
         # extract the filname, cut the 'thumbnail_' and the file extension
         all_background_thumbnail_filenames.append(background_thumbnail.rpartition('\\')[2])
         all_background_thumbnail_filenames.append(background_thumbnail.replace('thumbnail_', '', 1))
         all_background_thumbnail_filenames.append(background_thumbnail.rpartition('.')[0])
     
     print all_background_filenames
     print all_background_thumbnail_filenames
     
     
     all_background_images_and_thumbnails = []
     for background_image_filename in all_background_filenames:   
         # try to find a thumbnail for the image.
         try:
             thumbnail_index = all_background_thumbnail_filenames.index(background_image_filename)
             all_background_images_and_thumbnails.append(all_background_thumbnails[thumbnail_index])
         except Exception, e:
             # means, there isn't a thumbnail for this image.
             all_background_images_and_thumbnails.append(all_background_images[all_background_filenames.index(background_image_filename)])
     '''
     
     # fill the background selector with images
     for filename in glob(join(curdir, 'backgrounds/*', 'background_*')):
         try:
             # load the image
             picture = Button(
                              background_down=filename,
                              background_normal=filename,
                              size_hint_y=None,
                              height=180
                              #size=(200, 170)
                              )
             # add to the grid
             self.background_scroll_view_grid.add_widget(picture)
             
         except Exception, e:
             print 'Background images: Unable to load <%s>. Reason: %s' % (filename, e)
Exemple #10
0
 def __init__(self, **kwargs):
     super(BubbleShowcase, self).__init__(**kwargs)
     self.but_bubble = Button(text='Press to show bubble')
     self.but_bubble.bind(on_release=self.show_bubble)
     self.add_widget(self.but_bubble)
Exemple #11
0
    def __init__(self, **kwargs):
        super(ScreenTwo, self).__init__(**kwargs)

        generalBox = BoxLayout(orientation='vertical')

        my_box = BoxLayout()
        userimage = MyImage(source=TestApp.image_path,
                            size_hint=(1, 2.9),
                            pos_hint={'top': 1})
        my_box.add_widget(userimage)
        generalBox.add_widget(my_box)

        for i in range(0, 3):
            TestApp.breed_names[i] = decode_breed(TestApp.breed_list[i])

        my_box1 = BoxLayout()
        image1 = MyImage(source=("resources/" + TestApp.breed_names[0] +
                                 ".jpg"),
                         size_hint=(1, 1.2),
                         pos_hint={'top': -1})
        image2 = MyImage(source=("resources/" + TestApp.breed_names[1] +
                                 ".jpg"),
                         size_hint=(1, 1.2),
                         pos_hint={'top': -1})
        image3 = MyImage(source=("resources/" + TestApp.breed_names[2] +
                                 ".jpg"),
                         size_hint=(1, 1.2),
                         pos_hint={'top': -1})
        my_box1.add_widget(image1)
        my_box1.add_widget(image2)
        my_box1.add_widget(image3)
        generalBox.add_widget(my_box1)

        my_box4 = BoxLayout()
        my_label4 = MyLabel(text='', size_hint=(1, 0.1))
        my_box4.add_widget(my_label4)
        generalBox.add_widget(my_box4)

        my_box3 = BoxLayout()
        breed1 = MyLabel(text=("Your dog is: " + str(TestApp.breed_names[0])),
                         size_hint=(1, .4),
                         pos_hint={'top': -0.20})
        breed2 = MyLabel(text=("Similar breed is: " +
                               str(TestApp.breed_names[1])),
                         size_hint=(1, .4),
                         pos_hint={'top': -0.20})
        breed3 = MyLabel(text=("Similar breed is: " +
                               str(TestApp.breed_names[2])),
                         size_hint=(1, .4),
                         pos_hint={'top': -0.20})
        my_box3.add_widget(breed1)
        my_box3.add_widget(breed2)
        my_box3.add_widget(breed3)
        generalBox.add_widget(my_box3)

        my_box2 = BoxLayout()
        my_button1 = Button(text="Try with another picture!",
                            font_size='30sp',
                            size_hint=(1, 0.4))
        my_button1.bind(on_press=self.changer)
        my_box2.add_widget(my_button1)
        generalBox.add_widget(my_box2)

        self.add_widget(generalBox)
Exemple #12
0
    def concluirInit(self, dt):

        for marca in self.linha_cont_marca:
            self.add_widget(Button(text=marca.Nome_Marca))
            self.add_widget(Button(text="Edit", size_hint_x=0.3))
            self.add_widget(Button(text='Delete', size_hint_x=0.3))
Exemple #13
0
 def make_buttons(self, name):
     newbutton = Button(text=name, id=name)
     newbutton.bind(on_press=partial(lambda a: self.auth(name)))
     self.added_buttons.append(newbutton)
Exemple #14
0
        def build(self):                
                """ This function is used to make application """
                layout = FloatLayout()
                Window.size = (800, 1000)
                with layout.canvas:
                        Rectangle(size=(800, 1000), pos=(0, 0), source='/home/msd/Desktop/l.jpg')

                self.l1 = Label(text='[b][color=#600968][size=40]Registeration![/size][/color][/b]',
                                pos=(200, 900),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)		
                self.l2 = Label(text='[b][color=#600968][size=40]Name:[/size][/color][/b]',
                                pos=(80, 800),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)	
                self.name1 = TextInput(multiline=False,
                                      pos=(400, 800),
                                      size_hint=(None,None),
			              size=(300, 50),
                                      hint_text='Enter your name',
                                      hint_text_color=(213/250, 175/250, 214/250, 1))
                self.l3 = Label(text='[b][color=#600968][size=40]Family Name:[/size][/color][/b]',
                                pos=(80, 700),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.familyname = TextInput(multiline=False,
                                            pos=(400, 700),
                                            size_hint=(None, None),
                                            size=(300, 50),
                                            hint_text='Enter your family name',
                                            hint_text_color=(213/250, 175/250, 214/250, 1))
                self.l4 = Label(text='[b][color=#600968][size=40]User Name:[/size][/color][/b]',
                                pos=(80, 600),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.username = TextInput(multiline=False,
                                          pos=(400, 600),
                                          size_hint=(None, None),
                                          size=(300, 50),
                                          hint_text='Enter a username',
                                          hint_text_color=(213/250, 175/250, 214/250, 1))
                self.l5 = Label(text='[b][color=#600968][size=40]PassWord:[/size][/color][/b]',
                                pos=(80, 500),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.password = TextInput(multiline=False,
                                          pos=(400, 500),
                                          size_hint=(None, None),
			                  size=(300, 50),
                                          password=True)
                self.l6 = Label(text='[b][color=#600968][size=40]Confirm PassWord:[/size][/color][/b]',
                                pos=(80, 400),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.confirmpassword = TextInput(multiline=False,
                                                pos=(400, 400),
                                                size_hint=(None, None),
			                        size=(300, 50),
                                                password=True)
                self.l7 = Label(text='[b][color=#600968][size=40]E-mail:[/size][/color][/b]',
                                pos=(80, 300),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.email = TextInput(multiline=False,
                                       pos=(400, 300),
                                       size_hint=(None, None),
		                       size=(300, 50),
                                       hint_text='Enter your E-mail adress',
                                       hint_text_color=(213/250, 175/250, 214/250, 1))
                self.l8 = Label(text='[b][color=#600968][size=40]Gender:[/size][/color][/b]',
                                pos=(80, 200),
                                size_hint=(None, None),
                                size=(300, 70),
                                markup=True)
                self.gender = TextInput(multiline=False,
                                        pos=(400, 200),
                                        size_hint=(None, None),
			                size=(300, 50),
                                        hint_text='Male or Female',
                                        hint_text_color=(213/250, 175/250, 214/250, 1))
                layout.add_widget(self.l1)
                layout.add_widget(self.l2)
                layout.add_widget(self.name1)
                layout.add_widget(self.l3)
                layout.add_widget(self.familyname)
                layout.add_widget(self.l4)
                layout.add_widget(self.username)
                layout.add_widget(self.l5)
                layout.add_widget(self.password)
                layout.add_widget(self.l6)
                layout.add_widget(self.confirmpassword)
                layout.add_widget(self.l7)
                layout.add_widget(self.email)
                layout.add_widget(self.l8)
                layout.add_widget(self.gender)
                self.b1 = Button(text='[color=#0c0c0c][size=40]Submit[/size][/color]',
			        pos=(300, 100),
		       	        size_hint=(None, None),
		                size=(200, 50),
		                background_color=(100/250, 50/250, 125/250, 1),
                                markup=True)
                self.b2 = Button(text='[color=#0c0c0c][size=40]Back[/size][/color]',
			        pos=(300, 50),
		       	        size_hint=(None, None),
		                size=(200, 50),
		                background_color=(100/250, 50/250, 125/250, 1),
                                markup=True)
                layout.add_widget(self.b1)
                layout.add_widget(self.b2)
                self.b1.bind(on_press=self.callback1)
                self.b2.bind(on_press=self.callback2)
                return layout
Exemple #15
0
    def build(self):

        polygon_table = ScrollView(size_hint=(1, 1),
                                   scroll_type=['bars'],
                                   bar_margin=10,
                                   bar_width=10)
        dataset_polygons_table = ScrollView(size_hint=(1, 1),
                                            scroll_type=['bars'],
                                            bar_margin=10,
                                            bar_width=10)

        current_labels_panel = GridLayout(size_hint=(None, 1),
                                          width=300,
                                          rows=2)
        current_labels_panel.add_widget(polygon_table)

        dataset_labels_panel = GridLayout(size_hint=(None, 1),
                                          width=300,
                                          rows=2)
        dataset_labels_panel.add_widget(dataset_polygons_table)

        train_button = Button(size_hint=(1, None), text="Train", height=100)
        train_button.bind(on_press=lambda _: self.train_func(
            polygon_dataset_layout.children))

        add_polygons = Button(size_hint=(1, None), text="Add Data", height=100)
        add_polygons.bind(on_press=lambda _: self.transfer_polygons(
            polygon_table_layout.children, polygon_dataset_layout))
        add_polygons.bind(on_press=lambda _: self.add_polygons_func(
            polygon_table_layout.children))

        polygon_dataset_layout = StackLayout(orientation='lr-tb',
                                             size_hint=(1, None),
                                             spacing=5,
                                             height=4000)
        dataset_polygons_table.add_widget(polygon_dataset_layout)

        dataset_labels_panel.add_widget(train_button)
        current_labels_panel.add_widget(add_polygons)

        polygon_table_layout = StackLayout(orientation='lr-tb',
                                           size_hint=(1, None),
                                           spacing=5,
                                           height=4000)

        polygon_table.add_widget(polygon_table_layout)

        self.sv = ZoomWindow(item_list=polygon_table_layout,
                             remove_poly_func=self.remove_polygon_func,
                             size_hint=(1, 1),
                             scroll_type=['bars'],
                             bar_margin=10,
                             bar_width=10)
        self.populate_polygons(self.dataset_file, self.sv,
                               polygon_dataset_layout)

        window = GridLayout(size=Window.size, cols=1)
        main_page = GridLayout(size=Window.size, cols=3)
        top_bar = StackLayout(orientation='lr-tb',
                              size_hint=(1, None),
                              spacing=5,
                              height=50)
        file_open_btn = Button(size_hint=(None, 1), width=100, text="Open")
        top_bar.add_widget(file_open_btn)

        use_model_btn = Button(size_hint=(None, 1), width=100, text="Run")
        top_bar.add_widget(use_model_btn)
        use_model_btn.bind(on_press=lambda _: self.run_model(
            self.sv.i.source, self.sv.layout.add_polygon))

        test = GridLayout(cols=1)
        filechooser = FileChooserIconView(size_hint=(1.0, 0.8),
                                          path=str(Path.home()))
        test.add_widget(filechooser)
        open_file = Button(size_hint=(1.0, 0.2), text="Open")
        test.add_widget(open_file)
        test.add_widget(Label(size_hint=(0, 0)))

        file_menu_window = Popup(title="File Selector",
                                 content=test,
                                 size_hint=(None, None),
                                 size=(800, 800))
        file_open_btn.bind(on_press=file_menu_window.open)
        open_file.bind(
            on_press=lambda _: self.open_file(filechooser.selection))

        main_page.add_widget(self.sv)
        main_page.add_widget(current_labels_panel)
        main_page.add_widget(dataset_labels_panel)
        # layout = ScalableFloatLayout(size=(3000, 3000),size_hint=(None, None))
        # layout.add_widget(l)
        window.add_widget(top_bar)
        window.add_widget(main_page)
        return window
Exemple #16
0
 def build(self):
     b = Button(on_press=self.show_popup, text="Show Popup")
     return b
Exemple #17
0
 def run(self):
     o = []
     for x in self.labels:
         o.append(Button(text=x))
Exemple #18
0
    def __init__(self, **kwargs):
        super(SignUpScreen, self).__init__(**kwargs)

        title_label = Label(text="Create Account", markup=True)
        title_label.pos = (492, 700)
        title_label.size_hint = (None, None)
        title_label.font_size = (40)
        title_label.color = (0, 0, 0, 1)

        email_input = TextInput(hint_text='Email Address')
        email_input.focus = True
        email_input.write_tab = False
        email_input.multiline = False
        email_input.pos = (410, 650)
        email_input.size_hint = (None, None)
        email_input.size = (280, 30)
        self.email_input = email_input

        password_input = TextInput(hint_text='Password')
        password_input.password = True
        password_input.write_tab = False
        password_input.multiline = False
        password_input.pos = (410, 590)
        password_input.size_hint = (None, None)
        password_input.size = (280, 30)
        self.password_input = password_input

        re_password_input = TextInput(hint_text='Re-Enter Password')
        re_password_input.password = True
        re_password_input.write_tab = False
        re_password_input.multiline = False
        re_password_input.pos = (410, 530)
        re_password_input.size_hint = (None, None)
        re_password_input.size = (280, 30)
        self.re_password_input = re_password_input

        name_input = TextInput(hint_text='Name')
        name_input.write_tab = False
        name_input.multiline = False
        name_input.pos = (410, 470)
        name_input.size_hint = (None, None)
        name_input.size = (280, 30)
        self.name_input = name_input

        surname_input = TextInput(hint_text='Surname')
        surname_input.write_tab = False
        surname_input.multiline = False
        surname_input.pos = (410, 410)
        surname_input.size_hint = (None, None)
        surname_input.size = (280, 30)
        self.surname_input = surname_input

        phone_input = TextInput(hint_text='Phone number')
        phone_input.write_tab = False
        phone_input.multiline = False
        phone_input.pos = (410, 350)
        phone_input.size_hint = (None, None)
        phone_input.size = (280, 30)
        self.phone_input = phone_input

        birthdate_input = TextInput(hint_text='Birthday, DD/MM/YYYY')
        birthdate_input.write_tab = False
        birthdate_input.multiline = False
        birthdate_input.pos = (410, 290)
        birthdate_input.size_hint = (None, None)
        birthdate_input.size = (280, 30)
        self.birthdate_input = birthdate_input

        create_account_button = Button(text="Create Account")
        create_account_button.background_color = (0.4, 0.5, 0.6, 1)
        create_account_button.pos = (450, 200)
        create_account_button.size_hint = (None, None)
        create_account_button.size = (200, 50)
        create_account_button.bind(on_release=self.create_account)

        return_to_login_button = Button(text="Return to Login page")
        return_to_login_button.background_color = (0.4, 0.5, 0.6, 1)
        return_to_login_button.pos = (450, 120)
        return_to_login_button.size_hint = (None, None)
        return_to_login_button.size = (200, 50)
        return_to_login_button.bind(on_release=self.return_to_login)

        self.alert_label = Label()

        self.add_widget(title_label)
        self.add_widget(self.email_input)
        self.add_widget(self.password_input)
        self.add_widget(self.re_password_input)
        self.add_widget(self.name_input)
        self.add_widget(self.surname_input)
        self.add_widget(self.phone_input)
        self.add_widget(self.birthdate_input)
        self.add_widget(create_account_button)
        self.add_widget(return_to_login_button)
Exemple #19
0
 def create_location_buttons(self, loc_list):
     for l in location_manager.get_locations():
         btn = Button(text=l, size_hint=(None, None), size=(200, 30))
         btn.bind(on_release=lambda btn_: self.loc_drop.select(btn_.text))
         loc_list.add_widget(btn)
     loc_list.bind(on_select=self.on_loc_select)
Exemple #20
0
    def btn(self):
        close_button = Button(text="close")
        layout = GridLayout(cols=1)

        url = ""
        if self.search_by_url.text != "":
            url = self.search_by_url.text
            self.search_by_url.text = ""

        elif self.search_by_name_first.text != "" and self.search_by_name_last != "":
            url = "https://en.wikipedia.org/wiki/" + self.search_by_name_first.text + "_" + self.search_by_name_last.text
            self.search_by_name_first.text = ""
            self.search_by_name_last.text = ""
        if url != "":
            page = Backend.WikiPage(url)
            #import the page of the player
            if page.check_url():
                try:
                    #init deatils of the player, parsing his all championship Trophies and etc
                    page.init_detail()
                    self.manager.page = page
                    #update_details  of the player as date of birth, place of birth,high school, college
                    self.manager.get_screen("player").update_details()
                    self.manager.get_screen(
                        'time_line').player_dict = page.dict_by_year
                    self.manager.get_screen(
                        'time_line').keys = self.manager.get_screen(
                            'time_line').player_dict.keys()
                    self.manager.get_screen(
                        'time_line').prev_year = "Back To Player Page"
                    self.manager.get_screen(
                        'time_line').curr_year = self.manager.get_screen(
                            'time_line').keys[0]
                    self.manager.get_screen(
                        'time_line').next_year = self.manager.get_screen(
                            'time_line').keys[1]
                    self.manager.get_screen(
                        'time_line').player_name = page.name + " Timeline"
                    self.manager.get_screen('time_line').index = 0
                    self.manager.get_screen('time_line').insert_current_year()
                    self.manager.current = "player"
                except:
                    #exception if the player is not exist
                    layout.add_widget(Label(text='Player Not Found'))
                    layout.add_widget(close_button)
                    popup = Popup(title='Search Error',
                                  content=layout,
                                  size_hint=(None, None),
                                  size=(500, 500))
                    popup.open()
                    close_button.bind(on_press=popup.dismiss)
            else:
                #pop up to the user  if the player is not exist
                layout.add_widget(Label(text='Player Not Found'))
                layout.add_widget(close_button)
                popup = Popup(title='Search Error',
                              content=layout,
                              size_hint=(None, None),
                              size=(500, 500))
                popup.open()
                close_button.bind(on_press=popup.dismiss)
        else:
            # pop up to the user  if the player is not exist

            layout.add_widget(Label(text='Please Enter Valid Input'))
            layout.add_widget(close_button)
            popup = Popup(title='Search Error',
                          content=layout,
                          size_hint=(None, None),
                          size=(500, 500))
            popup.open()
            close_button.bind(on_press=popup.dismiss)
Exemple #21
0
    def show_form(self):

        #clear old screen
        self.clear_widgets()

        #init persistent aesthetics
        self.cols = 1
        self.rows = 1
        Window.clearcolor = (1, 1, 1, 1)
        self.background_color = (1, 1, 1, 1)

        #scroll
        self.scroll = ScrollView(size_hint=(1, None),
                                 size=(Window.width, Window.height))
        self.add_widget(self.scroll)

        #to hold key/value columns and submit button
        self.archgrid = GridLayout(rows=3,
                                   cols=1,
                                   size_hint_y=None,
                                   spacing=0,
                                   height=Window.height)
        self.archgrid.bind(minimum_height=self.archgrid.setter('height'))
        self.scroll.add_widget(self.archgrid)

        #separate key from value
        elf = self.grid = GridLayout(cols=2,
                                     rows=1,
                                     size_hint_y=None,
                                     height=Window.width * 16 / 9)
        self.archgrid.add_widget(elf)

        #key column
        elf.labels = cola = GridLayout(cols=1,
                                       size_hint=(1, None),
                                       spacing=10,
                                       height=Window.width * 16 / 9)
        elf.add_widget(elf.labels)

        #value column
        elf.inputs = colb = GridLayout(cols=1,
                                       size_hint=(2, None),
                                       spacing=10,
                                       height=Window.width * 16 / 9)
        elf.add_widget(elf.inputs)

        #tech name
        self.tech = Label(text='Tech Name:', color=(.5, .5, .5, 1))
        cola.add_widget(self.tech)
        self.techg = GridLayout(cols=1, rows=3)
        self.techg.add_widget(Label())
        self.techi = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.techg.add_widget(self.techi)
        self.techg.add_widget(Label())
        colb.add_widget(self.techg)

        #customer name
        self.cust = Label(text='Customer Name:', color=(.5, .5, .5, 1))
        cola.add_widget(self.cust)
        self.custg = GridLayout(cols=1, rows=3)
        self.custg.add_widget(Label())
        self.custi = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.custg.add_widget(self.custi)
        self.custg.add_widget(Label())
        colb.add_widget(self.custg)

        #address
        self.addy = Label(text='Address:', color=(.5, .5, .5, 1))
        cola.add_widget(self.addy)
        self.addyg = GridLayout(cols=1, rows=3)
        self.addyg.add_widget(Label())
        self.addyi = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.addyg.add_widget(self.addyi)
        self.addyg.add_widget(Label())
        colb.add_widget(self.addyg)

        #phone
        self.phone = Label(text='Cust Phone #:', color=(.5, .5, .5, 1))
        cola.add_widget(self.phone)
        self.phoneg = GridLayout(cols=1, rows=3)
        self.phoneg.add_widget(Label())
        self.phonei = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.phoneg.add_widget(self.phonei)
        self.phoneg.add_widget(Label())
        colb.add_widget(self.phoneg)

        #area
        self.area = Label(text='Contaminated Area:', color=(.5, .5, .5, 1))
        cola.add_widget(self.area)
        cola.add_widget(Label())
        colb.area = GridLayout(cols=2, rows=3)
        self.areag = colb.area
        self.area1 = Label(text='Level 1', color=(0, 0, 0, 1))
        self.areag.add_widget(self.area1)
        self.area1i = CheckBox(group='area', color=(0, 0, 0, 3))
        self.areag.add_widget(self.area1i)
        self.area2 = Label(text='Level 2', color=(0, 0, 0, 1))
        self.areag.add_widget(self.area2)
        self.area2i = CheckBox(group='area', color=(0, 0, 0, 3))
        self.areag.add_widget(self.area2i)
        self.area3 = Label(text='Level 3', color=(0, 0, 0, 1))
        self.areag.add_widget(self.area3)
        self.area3i = CheckBox(group='area', color=(0, 0, 0, 3))
        self.areag.add_widget(self.area3i)
        colb.add_widget(self.areag)
        colb.add_widget(Label())

        #respirable particulates
        self.resp = Label(text='Respirable Particulates:',
                          color=(.5, .5, .5, 1))
        cola.add_widget(self.resp)
        self.respg = GridLayout(cols=1, rows=3)
        self.respg.add_widget(Label())
        self.respi = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.respg.add_widget(self.respi)
        self.respg.add_widget(Label())
        colb.add_widget(self.respg)

        #aqi
        self.aqi = Label(text='A.Q.I.:', color=(.5, .5, .5, 1))
        cola.add_widget(self.aqi)
        self.aqig = GridLayout(cols=1, rows=3)
        self.aqig.add_widget(Label())
        self.aqii = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.aqig.add_widget(self.aqii)
        self.aqig.add_widget(Label())
        colb.add_widget(self.aqig)

        #temp
        self.temp = Label(text='Temperature:', color=(.5, .5, .5, 1))
        cola.add_widget(self.temp)
        self.tempg = GridLayout(cols=1, rows=3)
        self.tempg.add_widget(Label())
        self.tempi = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.tempg.add_widget(self.tempi)
        self.tempg.add_widget(Label())
        colb.add_widget(self.tempg)

        #relative humidity
        self.relh = Label(text='Relative Humidity:', color=(.5, .5, .5, 1))
        cola.add_widget(self.relh)
        self.relhg = GridLayout(cols=1, rows=3)
        self.relhg.add_widget(Label())
        self.relhi = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.relhg.add_widget(self.relhi)
        self.relhg.add_widget(Label())
        colb.add_widget(self.relhg)

        #hcho
        self.hcho = Label(text='HCHO:', color=(.5, .5, .5, 1))
        cola.add_widget(self.hcho)
        #some spacer labels have been removed for aesthetic testing
        #cola.add_widget(Label())
        self.hchog = GridLayout(cols=2, rows=2)
        self.hchos = Label(text='Safe', color=(0, 0, 0, 1))
        self.hchosi = CheckBox(group='hcho', color=(0, 0, 0, 3))
        self.hchou = Label(text='Unsafe', color=(0, 0, 0, 1))
        self.hchoui = CheckBox(group='hcho', color=(0, 0, 0, 3))
        self.hchog.add_widget(self.hchos)
        self.hchog.add_widget(self.hchosi)
        self.hchog.add_widget(self.hchou)
        self.hchog.add_widget(self.hchoui)
        colb.add_widget(self.hchog)
        #colb.add_widget(Label())

        #hcho count
        self.hchoc = Label(text='HCHO Count:', color=(.5, .5, .5, 1))
        cola.add_widget(self.hchoc)
        self.hchocg = GridLayout(cols=1, rows=3)
        self.hchocg.add_widget(Label())
        self.hchoci = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.hchocg.add_widget(self.hchoci)
        self.hchocg.add_widget(Label())
        colb.add_widget(self.hchocg)

        #tvco
        self.tvco = Label(text='TVCO:', color=(.5, .5, .5, 1))
        cola.add_widget(self.tvco)
        #cola.add_widget(Label())
        self.tvcog = GridLayout(cols=2, rows=2)
        self.tvcos = Label(text='Safe', color=(0, 0, 0, 1))
        self.tvcosi = CheckBox(group='tvco', color=(0, 0, 0, 3))
        self.tvcou = Label(text='Unsafe', color=(0, 0, 0, 1))
        self.tvcoui = CheckBox(group='tvco', color=(0, 0, 0, 3))
        self.tvcog.add_widget(self.tvcos)
        self.tvcog.add_widget(self.tvcosi)
        self.tvcog.add_widget(self.tvcou)
        self.tvcog.add_widget(self.tvcoui)
        colb.add_widget(self.tvcog)
        #colb.add_widget(Label())

        #tvco count
        self.tvcoc = Label(text='TVCO Count:', color=(.5, .5, .5, 1))
        cola.add_widget(self.tvcoc)
        self.tvcocg = GridLayout(cols=1, rows=3)
        self.tvcocg.add_widget(Label())
        self.tvcoci = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.tvcocg.add_widget(self.tvcoci)
        self.tvcocg.add_widget(Label())
        colb.add_widget(self.tvcocg)

        #control cell
        self.cell0 = Label(text='Control Cell:', color=(.5, .5, .5, 1))
        cola.add_widget(self.cell0)
        self.cell0g = GridLayout(cols=1, rows=3)
        self.cell0g.add_widget(Label())
        self.cell0i = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.cell0g.add_widget(self.cell0i)
        self.cell0g.add_widget(Label())
        colb.add_widget(self.cell0g)

        #number of cells
        self.cells = Label(text='Number of Cells:', color=(.5, .5, .5, 1))
        cola.add_widget(self.cells)
        self.cellsg = GridLayout(cols=1, rows=3)
        self.cellsg.add_widget(Label())
        self.cellsi = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.cellsg.add_widget(self.cellsi)
        self.cellsg.add_widget(Label())
        colb.add_widget(self.cellsg)

        #number of swabs
        self.swabs = Label(text='Number of swabs:', color=(.5, .5, .5, 1))
        cola.add_widget(self.swabs)
        self.swabsg = GridLayout(cols=1, rows=3)
        self.swabsg.add_widget(Label())
        self.swabsi = TextInput(text='', foreground_color=(0, 0, 0, 1))
        self.swabsg.add_widget(self.swabsi)
        self.swabsg.add_widget(Label())
        colb.add_widget(self.swabsg)

        #camera button
        submit = self.scroll.submit = Button(
            text='Take Pictures',
            size_hint=(1, None),
            height=Window.width / 6,
            background_color=(2, 2, 2, 1),
            color=(.2, .2, .2, 1),
        )
        submit.bind(on_press=lambda *x: self.show_camera())
        self.archgrid.add_widget(submit)

        #done button
        done = self.scroll.done = Button(
            text='Done',
            size_hint=(1, None),
            height=Window.width / 6,
            background_color=(2, 2, 2, 1),
            color=(.2, .2, .2, 1),
        )
        done.bind(on_press=lambda *x: self.submit_form())
        self.archgrid.add_widget(done)
Exemple #22
0
    def para(self,var,select):
        global font_size
        self.filetodic(var,select)#write file values in dici
        self.clear_widgets()
        self.AddButtons(select)
        self.cols = 3
        self.add_widget(Label(text="Lower Rate Limit"))# these blocks show the specific parameters for the mode...
        self.name1 = TextInput(multiline=False) # ...and gives the user the chance to change them
        self.add_widget(self.name1)
        self.submit1 = Button(text = "Change",font_size = font_size)

        self.submit1.bind(on_press = partial(self.pressed,self.name1,var,select,'Lower Rate Limit'))
        self.add_widget(self.submit1)

        self.add_widget(Label(text="Upper Rate Limit"))
        self.name2 = TextInput(multiline=False)
        self.add_widget(self.name2)
        self.submit2 = Button(text = "Change",font_size = font_size)
        self.submit2.bind(on_press = partial(self.pressed,self.name2,var,select,'Upper Rate Limit'))
        self.add_widget(self.submit2)

        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Maximum Sensor Rate"))
            self.name16 = TextInput(multiline=False)
            self.add_widget(self.name16)
            self.submit16 = Button(text = "Change",font_size = font_size)
            self.submit16.bind(on_press = partial(self.pressed,self.name16,var,select,'Maximum Sensor Rate'))
            self.add_widget(self.submit16)

        if(select == 5 or select == 10):
            self.add_widget(Label(text="Fixed AV Delay"))
            self.name14 = TextInput(multiline=False)
            self.add_widget(self.name14)
            self.submit14 = Button(text = "Change",font_size = font_size)
            self.submit14.bind(on_press = partial(self.pressed,self.name14,var,select,'Fixed AV Delay'))
            self.add_widget(self.submit14)

        if(select == None):
            self.add_widget(Label(text="Dynamic AV Delay"))
            self.name15 = TextInput(multiline=False)
            self.add_widget(self.name15)
            self.submit15 = Button(text = "Change",font_size = font_size)
            self.submit15.bind(on_press = partial(self.pressed,self.name15,var,select,'Dynamic AV Delay'))
            self.add_widget(self.submit15)


        if(select == 1 or select == 3 or select == 6 or select ==5 or select == 8 or select == 10):
            self.add_widget(Label(text="Atrial Amplitude"))
            self.name3 = TextInput(multiline=False)
            self.add_widget(self.name3)
            self.submit3 = Button(text = "Change",font_size = font_size)
            self.submit3.bind(on_press = partial(self.pressed,self.name3,var,select,'Atrial Amplitude'))
            self.add_widget(self.submit3)
        if(select == 1 or select == 3  or select == 5 or select == 6  or select == 8 or select == 10):
            self.add_widget(Label(text="Atrial Pulse Width"))
            self.name4 = TextInput(multiline=False)
            self.add_widget(self.name4)
            self.submit4 = Button(text = "Change",font_size = font_size)
            self.submit4.bind(on_press = partial(self.pressed,self.name4,var,select,'Atrial Pulse Width'))
            self.add_widget(self.submit4)

        if(select == 2 or select == 4  or select == 5 or select == 7  or select == 9 or select == 10):
            self.add_widget(Label(text="Ventricular Amplitude"))
            self.name5 = TextInput(multiline=False)
            self.add_widget(self.name5)
            self.submit5 = Button(text = "Change",font_size = font_size)
            self.submit5.bind(on_press = partial(self.pressed,self.name5,var,select,'Ventricular Amplitude'))
            self.add_widget(self.submit5)

        if(select == 2 or select == 4  or select == 5 or select == 7 or select == 9 or select == 10):
            self.add_widget(Label(text="Ventricular Pulse Width"))
            self.name6 = TextInput(multiline=False)
            self.add_widget(self.name6)
            self.submit6 = Button(text = "Change",font_size = font_size)
            self.submit6.bind(on_press = partial(self.pressed,self.name6,var,select,'Ventricular Pulse Width'))
            self.add_widget(self.submit6)


        if(select == 3  or select == 8):
            self.add_widget(Label(text="Atrial Sensitivity"))
            self.name8 = TextInput(multiline=False)
            self.add_widget(self.name8)
            self.submit8 = Button(text = "Change",font_size = font_size)
            self.submit8.bind(on_press = partial(self.pressed,self.name8,var,select,'Atrial Sensitivity'))
            self.add_widget(self.submit8)

        if(select == 9):
            self.add_widget(Label(text="VRP"))
            self.name21 = TextInput(multiline=False)
            self.add_widget(self.name21)
            self.submit21 = Button(text = "Change",font_size = font_size)
            self.submit21.bind(on_press = partial(self.pressed,self.name21,var,select,'VRP'))
            self.add_widget(self.submit21)

        if(select == 3  or select == 8 or select == 9):
            self.add_widget(Label(text="ARP"))
            self.name9 = TextInput(multiline=False)
            self.add_widget(self.name9)
            self.submit9 = Button(text = "Change",font_size = font_size)
            self.submit9.bind(on_press = partial(self.pressed,self.name9,var,select,'ARP'))
            self.add_widget(self.submit9)

        if(select == 3  or select == 8):
            self.add_widget(Label(text="PVARP"))
            self.name10 = TextInput(multiline=False)
            self.add_widget(self.name10)
            self.submit10 = Button(text = "Change",font_size = font_size)
            self.submit10.bind(on_press = partial(self.pressed,self.name10,var,select,'PVARP'))
            self.add_widget(self.submit10)

        # if(select == 3 or select == 4 or select == 8  or select == 9):
        #     self.add_widget(Label(text="Hysteresis"))
        #     self.name11 = TextInput(multiline=False)
        #     self.add_widget(self.name11)
        #     self.submit11 = Button(text = "Change",font_size = font_size)
        #     self.submit11.bind(on_press = partial(self.pressed,self.name11,var,select,'Hysteresis'))
        #     self.add_widget(self.submit11)

        if(select == 3 or select == 4  or select == 8  or select == 9):
            self.add_widget(Label(text="Rate Smoothing"))
            self.name12 = TextInput(multiline=False)
            self.add_widget(self.name12)
            self.submit12 = Button(text = "Change",font_size = font_size)
            self.submit12.bind(on_press = partial(self.pressed,self.name12,var,select,'Rate Smoothing'))
            self.add_widget(self.submit12)

        if(select == 4 or select == 9):
            self.add_widget(Label(text="Ventricular Sensitivity"))
            self.name13 = TextInput(multiline=False)
            self.add_widget(self.name13)
            self.submit13 = Button(text = "Change",font_size = font_size)
            self.submit13.bind(on_press = partial(self.pressed,self.name13,var,select,'Ventricular Sensitivity'))
            self.add_widget(self.submit13)


        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Activity Threshold"))
            self.name17 = TextInput(multiline=False)
            self.add_widget(self.name17)
            self.submit17 = Button(text = "Change",font_size = font_size)
            self.submit17.bind(on_press = partial(self.pressed,self.name17,var,select,'Activity Threshold'))
            self.add_widget(self.submit17)

        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Reaction Time"))
            self.name18 = TextInput(multiline=False)
            self.add_widget(self.name18)
            self.submit18 = Button(text = "Change",font_size = font_size)
            self.submit18.bind(on_press = partial(self.pressed,self.name18,var,select,'Reaction Time'))
            self.add_widget(self.submit18)

        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Response Factor"))
            self.name19 = TextInput(multiline=False)
            self.add_widget(self.name19)
            self.submit19 = Button(text = "Change",font_size = font_size)
            self.submit19.bind(on_press = partial(self.pressed,self.name19,var,select,'Response Factor'))
            self.add_widget(self.submit19)


        if(select == 6 or select == 7 or select == 8 or select == 9 or select == 10):
            self.add_widget(Label(text="Recovery Time"))
            self.name20 = TextInput(multiline=False)
            self.add_widget(self.name20)
            self.submit20 = Button(text = "Change",font_size = font_size)
            self.submit20.bind(on_press = partial(self.pressed,self.name20,var,select,'Recovery Time'))
            self.add_widget(self.submit20)



        Connect()

        self.add_widget(Label(text="Show "+var+" Parameters Values"))
        self.submitend = Button(text = "Values",font_size = font_size)
        self.submitend.bind(on_press = partial(self.Popup,var))
        self.add_widget(self.submitend)

        self.graphv = Button(text = "Ventricle E-GRAM",font_size = font_size)
        self.graphv.bind(on_press = startthreadV)
        self.add_widget(self.graphv)
        self.add_widget(Label(text=""+connection))
        self.add_widget(Label(text="NAME: "+name))
        self.grapha = Button(text = "Atrium E-GRAM",font_size = font_size)
        self.grapha.bind(on_press = startthreadA)
        self.add_widget(self.grapha)
Exemple #23
0
    def clk2(self, obj):

        # Defining the parameters for the Yummly API

        my_key = '8b6f178c57d40dee7d88629b32e01c23'
        my_id = 'fabbe897'
        userAnswer = self.search.text
        userAnswer = userAnswer.rstrip()
        userAnswer = userAnswer.lstrip()
        counter = 1

        # Determining how many search variables were entered and changing
        # search parameters based on it.

        for i in range(0, len(userAnswer)):
            if (userAnswer[i] == " " and (userAnswer[i + 1]).isalpha()):
                counter += 1

        if (counter == 1):
            recipe = userAnswer.split(' ')
            my_search = {
                'requirePictures': 'True',
                'allowedIngredient[]': [recipe]
            }
        elif (counter == 2):
            recipe, recipe1 = userAnswer.split(' ')
            my_search = {
                'requirePictures': 'True',
                'allowedIngredient[]': [recipe, recipe1]
            }
        elif (counter == 3):
            recipe, recipe1, recipe2 = userAnswer.split(' ')
            my_search = {
                'requirePictures': 'True',
                'allowedIngredient[]': [recipe, recipe1, recipe2]
            }
        elif (counter == 4):
            recipe, recipe1, recipe2, recipe3 = userAnswer.split(' ')
            my_search = {
                'requirePictures': 'True',
                'allowedIngredient[]': [recipe, recipe1, recipe2, recipe3]
            }
        elif (counter == 5):
            recipe, recipe1, recipe2, recipe3, recipe4 = userAnswer.split(' ')
            my_search = {
                'requirePictures': 'True',
                'allowedIngredient[]':
                [recipe, recipe1, recipe2, recipe3, recipe4]
            }

        # Saving API response into a workable variable

        r = requests.get(
            'http://api.yummly.com/v1/api/recipes?_app_id=fabbe897&_app_key=8b6f178c57d40dee7d88629b32e01c23&',
            params=my_search)

        # Using json to decode the API response
        data = r.json()

        # Filtering JSON response into image, and recipe name and displaying
        # the image of the reicipe on the screen and the name on a button

        for i in range(0, 10):

            if (i == 0):
                thing = str(data["matches"][i]["smallImageUrls"])
                ids5 = str(data["matches"][i]["id"])
                thing = thing[2:-2]
                img = AsyncImage(source=thing,
                                 pos_hint={
                                     'center_x': .34,
                                     'center_y': .7
                                 },
                                 size_hint=(5, 5))
                self.butt = Button(text=data["matches"][i]["recipeName"],
                                   font_size=10.5,
                                   size_hint=(.29, .1),
                                   pos_hint={
                                       'x': .19,
                                       'y': .53
                                   })
                self.add_widget(self.butt)
                self.add_widget(img)
                #self.butt.bind(on_press = justC(ids5))
            elif (i == 1):
                thing1 = str(data["matches"][i]["smallImageUrls"])
                ids4 = str(data["matches"][i]["id"])
                thing1 = thing1[2:-2]
                img1 = AsyncImage(source=thing1,
                                  pos_hint={
                                      'center_x': .63,
                                      'center_y': .7
                                  },
                                  size_hint=(5, 5))
                self.butt1 = Button(text=data["matches"][i]["recipeName"],
                                    font_size=10.5,
                                    size_hint=(.29, .1),
                                    pos_hint={
                                        'x': .5,
                                        'y': .53
                                    })
                self.add_widget(self.butt1)
                self.add_widget(img1)
                #self.butt1.bind(on_press = justC(ids4))
            elif (i == 2):
                thing2 = str(data["matches"][i]["smallImageUrls"])
                ids3 = str(data["matches"][i]["id"])
                thing2 = thing2[2:-2]
                img2 = AsyncImage(source=thing2,
                                  pos_hint={
                                      'center_x': .34,
                                      'center_y': .43
                                  },
                                  size_hint=(5, 5))
                self.butt2 = Button(text=data["matches"][i]["recipeName"],
                                    font_size=10.5,
                                    size_hint=(.29, .1),
                                    pos_hint={
                                        'x': .19,
                                        'y': .27
                                    })
                self.add_widget(self.butt2)
                self.add_widget(img2)
                #self.butt2.bind(on_press = justC(ids3))
            elif (i == 3):
                thing3 = str(data["matches"][i]["smallImageUrls"])
                ids2 = str(data["matches"][i]["id"])
                thing3 = thing3[2:-2]
                img3 = AsyncImage(source=thing3,
                                  pos_hint={
                                      'center_x': .63,
                                      'center_y': .43
                                  },
                                  size_hint=(5, 5))
                self.butt3 = Button(text=data["matches"][i]["recipeName"],
                                    font_size=10.5,
                                    size_hint=(.29, .1),
                                    pos_hint={
                                        'x': .5,
                                        'y': .27
                                    })
                self.add_widget(self.butt3)
                self.add_widget(img3)
                #self.butt3.bind(on_press = justC(ids2))
            elif (i == 4):
                thing4 = str(data["matches"][i]["smallImageUrls"])
                ids1 = str(data["matches"][i]["id"])
                thing4 = thing4[2:-2]
                img4 = AsyncImage(source=thing4,
                                  pos_hint={
                                      'center_x': .34,
                                      'center_y': .19
                                  },
                                  size_hint=(5, 5))
                self.butt4 = Button(text=data["matches"][i]["recipeName"],
                                    font_size=10,
                                    size_hint=(.29, .1),
                                    pos_hint={
                                        'x': .19,
                                        'y': .01
                                    })
                self.add_widget(self.butt4)
                self.add_widget(img4)
                #self.butt4.bind(on_press = justC(ids1))
            elif (i == 5):
                thing5 = str(data["matches"][i]["smallImageUrls"])
                ids = str(data["matches"][i]["id"])
                thing5 = thing5[2:-2]
                img5 = AsyncImage(source=thing5,
                                  pos_hint={
                                      'center_x': .63,
                                      'center_y': .19
                                  },
                                  size_hint=(5, 5))
                self.butt5 = Button(text=data["matches"][i]["recipeName"],
                                    font_size=10,
                                    size_hint=(.29, .1),
                                    pos_hint={
                                        'x': .5,
                                        'y': .01
                                    })
                self.add_widget(self.butt5)
                self.add_widget(img5)
                #self.butt5.bind(on_press = justC(ids))

    # Function to get reicpe that user chooses from selection on the page

            def justC(passId):
                finalUrl = "http://api.yummly.com/v1/api/recipe/" + passId + "?_app_id=fabbe897&_app_key=8b6f178c57d40dee7d88629b32e01c23&"
                rec = requests.get(finalUrl)
                b = rec.json()
                url = b["attribution"]["html"]
                m = str(re.findall('<a href="?\'?([^"\'>]*)', url))
                m = m[2:-2]
                webbrowser.open(m)
Exemple #24
0
 def build(self):
     # return a Button() as a root widget
     return Button(text='hello world')
Exemple #25
0
 def build(self):
     self.btn = Button(text='0',
                       font_size=30,
                       background_color=[1, 1, 1, 1],
                       on_press=self.click)
     return self.btn
Exemple #26
0
    def info_ancestors(self, instance):
        """
            Вывод подробной инфы о предке
        """
        self.manager.get_screen('info').clear_widgets()
        sl = BoxLayout(orientation=horizontal, padding=padding_in_find)
        first_page_bl = BoxLayout(orientation=vertical)
        self.search_on_first_page(first_page_bl)
        sl.add_widget(first_page_bl)

        # print(instance.id)
        data, image = self.family_tree.find_full(instance.id)

        # if not self.page:
        #     self.cursor += 1

        if instance.text == 'Вперед':
            if self.cursor != len(self.page) - 1:
                self.cursor += 1
        elif instance.text == 'Назад':
            if self.cursor != 0:
                self.cursor -= 1
        else:
            if len(self.page) >= 1:
                self.cursor += 1
                del self.page[self.cursor:]

            self.page.append(instance.id)

        st = StackLayout(size_hint_y=1)
        sl.add_widget(st)
        st.add_widget(
            Label(
                text='Личная карточка',
                **unpress_label(50),
                size_hint_y=.1,
            ))
        st.add_widget(
            Label(
                text='Родители' if len(data.get('parents')) > 0 else '',
                **unpress_label(font_in_pr_page),
                size_hint=(1, .05),
            ))

        # print(data)

        for parent in data.get('parents'):
            st.add_widget(
                Button(**button_for_parents(
                    parent.get('fullname').replace(' ', '\n'),
                    parent.get('id'),
                    self.info_ancestors,
                    (.5, .1),
                    font_in_pr_page,
                )))

        if data.get('second_half') and len(data.get('second_half')) > 0:
            if len(data.get('second_half')) > 1:
                st.add_widget(
                    Button(text='Супруги',
                           on_press=lambda x: self.output_on_first_page(
                               first_page_bl, data.get('second_half')),
                           **for_more_objects,
                           **unpress_label(font_in_pr_page)))
            else:
                second_half = data.get('second_half')[0]
                mini_bl = BoxLayout(
                    orientation=vertical,
                    size_hint=(.33, .35),
                )
                mini_bl.add_widget(
                    Label(text=second_half.get('rel'),
                          **unpress_label(font_in_pr_page)))
                mini_bl.add_widget(
                    Button(
                        **button_for_parents(
                            second_half.get('fullname').replace(' ', '\n'),
                            second_half.get('id'), self.info_ancestors, (1, 1),
                            font_in_pr_page), ))
                mini_bl.add_widget(Widget())
                st.add_widget(mini_bl)
        else:
            st.add_widget(
                Label(
                    text='',
                    **unpress_label(font_in_pr_page),
                    size_hint=(.33, .35),
                ))

        if image:
            st.add_widget(
                Image(source='static\\' + image[0], size_hint=(.33, .35)))
        else:
            st.add_widget(
                Label(text='', **unpress_label(30), size_hint=(.33, .35)))

        if data.get('bro_and_sis'):
            if len(data.get('bro_and_sis')) > 1:
                st.add_widget(
                    Button(text='Братья и сестры',
                           on_press=lambda x: self.output_on_first_page(
                               first_page_bl, data.get('bro_and_sis')),
                           **for_more_objects,
                           **unpress_label(font_in_pr_page)))
            else:
                mini_bl = BoxLayout(orientation=vertical, size_hint=(.33, .35))

                mini_bl.add_widget(
                    Label(
                        text='Братья и сестры',
                        **unpress_label(25),
                        size_hint=(1, .3),
                    ))
                mini_bl.add_widget(
                    Button(**button_for_parents(
                        data.get('bro_and_sis')[0].get('fullname').replace(
                            ' ', '\n'),
                        data.get('bro_and_sis')[0].get('fullname').get('id'),
                        self.info_ancestors, (1, .3), 25)))
                st.add_widget(mini_bl)
        else:
            st.add_widget(
                Label(text='',
                      **unpress_label(font_in_pr_page),
                      size_hint=(.33, .35)))

        st.add_widget(
            Label(text=data.get('fullname') +
                  ('\n' + data.get('bdate') if data.get('bdate') else ''),
                  **unpress_label(font_in_pr_page),
                  size_hint_y=.05,
                  halign='center'))
        # print(data)

        temp_data = ''
        if data.get('comment'):
            news_str = data.get('comment').split()
            for part in range(6, len(news_str), 6):
                news_str[part] += '\n'
            data['comment'] = ' '.join(news_str)
            if len(data.get('comment')) > 400:
                temp_data = data.get('comment')[:400]
                temp_data = temp_data[:temp_data.rfind(' ')] + '...'
            else:
                temp_data = data.get('comment')

        st.add_widget(
            Button(
                text=temp_data if data.get('comment') else '',
                **unpress_label(font_in_pr_page),
                size_hint_y=.33,
                halign='center',
                background_color=invisible_background_color,
                on_press=lambda x: self.description_in_popup(
                    data.get('comment')),
            ))

        navigation_bl = BoxLayout(
            orientation='horizontal',
            size_hint_y=.1,
        )
        st.add_widget(navigation_bl)
        if self.cursor != 0 and len(self.page) >= 2:
            navigation_bl.add_widget(
                Button(**navigation_buttons(
                    'Назад', str(self.page[self.cursor -
                                           1]), self.info_ancestors)))
        if self.cursor < len(self.page) - 1 and len(self.page) >= 2:
            navigation_bl.add_widget(
                Button(**navigation_buttons(
                    'Вперед', str(self.page[self.cursor +
                                            1]), self.info_ancestors)))

        self.manager.get_screen('info').add_widget(sl)
        self.change_screen(info_screen)
Exemple #27
0
    def open_routine(self, instance):

        self.update_the_workout_list(instance.id + '.csv')

        update_workout_list.insert(
            0,
            datetime.datetime.today().strftime('%m-%d-%Y'))
        update_workout_list.insert(0, instance.id)

        # Changes screens to Display Routine
        self.transition.direction = 'left'  # Changes the open direction to go left
        self.current = "DisplayRoutine"  # Which screen it will change to

        self.display_name.text = str(
            instance.id)  # Changes the label to the current routine

        file_name = instance.id + '.csv'  # Creates the full file name with extension

        self.display_grid.rows += 1  # Adds a row in the grid for the exercise

        # Creates titles for the Display Routine Page
        status_label = Label(text='Status')  # Creates status label
        self.display_grid.add_widget(status_label)  # Adds label to the grid
        name_label = Label(text='Exercise Name')  # Creates exercise name label
        self.display_grid.add_widget(name_label)  # Adds label to the grid

        newest_line_check = 0  # To check to make sure your on the newest line of data

        newest_line = self.get_newest_line(
            instance.id + '.csv')  # Gets the newest line in the file

        # Loops to obtain data from the file
        with open('routines/' +
                  file_name) as csv_file:  # Opens the file to read
            csv_reader = csv.reader(csv_file,
                                    delimiter=',')  # Starts the csv reader
            for newest_row in csv_reader:  # Loops through the rows in the file
                newest_line_check += 1  # Increments once for each new row it loops through
                if newest_line_check != newest_line:  # Checks to see if you are not on the newest like
                    pass  # If your not, do nothing
                else:  # If you are, add all the data

                    # Variables to keep track of which element in the row you are on
                    element_index = 0  # To get the first exercise name (two elements in)
                    exercise_number = 0  # To get every exercise after (every four elements)

                    # Loops over each element in the row
                    for element in newest_row:

                        if element_index == 2:  # If your on the second element (first exercise name)

                            if element[0] == '[':
                                element = ast.literal_eval(
                                    element
                                )  # To convert the 'string' in csv file to a list
                                element = element[
                                    0]  # To get the first element in the list

                            self.display_grid.rows += 1  # Add a row to the grid
                            id_name = file_name + ',' + element  # Creates id_name with filename and exercise name

                            # Creates a label for the exercise name
                            my_label = Label(text=element, color=[1, 1, 1, 1])

                            # Creates a button for the status of completion for the exercise
                            my_button = Button(
                                text="Not Completed",
                                color=[0.502, 0, 0, 1],
                                background_color=[0.502, 0, 0, 1],
                                on_press=self.open_exercise,
                                id=id_name)

                            self.display_grid.add_widget(
                                my_button)  # Adds the button to the grid
                            self.display_grid.add_widget(
                                my_label)  # Adds the label to the grid

                            # Resets the exercise number (first two loops increment it to 2)
                            exercise_number = 0

                        # To stop it for increasing element index past 3 (Needs to be higher than two)
                        if element_index < 4:
                            element_index += 1  # Increments element index

                        # Every four elements, there is a exercise name
                        if exercise_number == 4:

                            if element[0] == '[':
                                element = ast.literal_eval(
                                    element
                                )  # To convert the 'string' in csv file to a list
                                element = element[
                                    0]  # To get the first element in the list

                            self.display_grid.rows += 1  # Increment the number of rows in grid
                            id_name = file_name + ',' + element  # Creates id_name with filename and exercise name

                            # Creates a label for the exercise name
                            my_label = Label(text=element, color=[1, 1, 1, 1])

                            # Creates a button for the status of completion for the exercise
                            my_button = Button(
                                text="Not Completed",
                                color=[0.502, 0, 0, 1],
                                background_color=[0.502, 0, 0, 1],
                                on_press=self.open_exercise,
                                id=id_name)

                            self.display_grid.add_widget(
                                my_button)  # Adds the button to the grid
                            self.display_grid.add_widget(
                                my_label)  # Adds the label to the grid
                            exercise_number = 1  # Sets to 1 because it only increments 3 times, and needs to reach 4
                        else:  # If exercise number is not 4
                            exercise_number += 1  # Increment the exercise number
Exemple #28
0
    def build(self):
        video = Image(source='fb1.mp4')

        return Button(text="Hello world!", background_normal=(0, 0, 0, 0))
Exemple #29
0
 def build(self):
     bt = Button(text="Welcome to LikeGeeks!",
                 pos=(300, 350),
                 size_hint=(.25, .18))
     return bt
Exemple #30
0
 def update_graph(self, *args):
     """
     This method is to update the plot points of the Graph
     Then check the current value of points in network_thread
     """
     if self.plot:  # Check if there are available graph plot to remove
         self.ids['tracert_graph'].remove_plot(
             self.plot)  # Remove the graph plot
         self.ids['tracert_graph']._clear_buffer()  # Clear the buffer
     self.plot = MeshLinePlot(color=[1, 0, 0, 1])
     self.plot.points = [(self.hop_dict[num * -1]['time'], num * -1)
                         for num in range(len(self.hop_dict))
                         ]  # Set the value of plot points
     self.ids.tracert_graph.ymin = -1 * (len(self.hop_dict) - 1
                                         )  # Set the ymin use max hop
     time_list = [self.hop_dict[num]['time'] for num in self.hop_dict]
     self.ids.tracert_graph.xmax = round(
         max(time_list) *
         1.1)  # Set the xmas use the max value in time_list
     self.ids['tracert_graph'].add_plot(self.plot)
     self.ids.output_grid.clear_widgets(
     )  # Clear current label widget in output_grid
     for num in range(1, len(
             self.hop_dict)):  # Loop for adding label widget in output_grid
         num = num * -1
         hop_label = Label(text=str(num * -1), size_hint_x=0.1)
         pl = round(
             self.hop_dict[num]['packetloss'] /
             self.hop_dict[num]['count'] * 100, 2)
         pl_label = Label(text=str(pl), size_hint_x=0.1)
         if self.hop_dict[num][
                 'desip'] == 'Request':  # Change text Request into RTO
             self.hop_dict[num]['desip'] = 'RTO'
         ip_button = Button(text=self.hop_dict[num]['desip'],
                            size_hint_x=0.3,
                            on_release=partial(
                                self.on_press,
                                self.hop_dict[num]['hostname'],
                                self.hop_dict[num]['desip'], str(num * -1)))
         if len(
                 self.hop_dict[num]['hostname']
         ) > 10:  # Cut the letter of host name if the len is morethan 10
             hop_dict = self.hop_dict[num]['hostname'][:10] + '...'
         else:
             hop_dict = self.hop_dict[num]['hostname']
         name_label = Label(text=hop_dict,
                            size_hint_x=0.3,
                            text_size=(self.ids.output_grid.width * 0.3,
                                       None),
                            halign='center')
         avg_label = Label(text=str(self.hop_dict[num]['avg']),
                           size_hint_x=0.1)
         cur_label = Label(text=str(self.hop_dict[num]['time']),
                           size_hint_x=0.1)
         self.ids.output_grid.add_widget(hop_label)
         self.ids.output_grid.add_widget(pl_label)
         self.ids.output_grid.add_widget(ip_button)
         self.ids.output_grid.add_widget(name_label)
         self.ids.output_grid.add_widget(avg_label)
         self.ids.output_grid.add_widget(cur_label)
     # self.t2 = time.time()
     # print(self.t2 - self.t1)
     self.on_start()  # Update the value of plot points from network_thread