Beispiel #1
0
        def showTasks(self):
            def reloadData(self):
                with open('data/database.json', 'w') as db:
                    json.dump(database, db)

            def delTask(Button):
                if Button.text in database:
                    database.remove(Button.text)
                taskPopupGrid.remove_widget(Button)

            def closeTaskPopup(Button):
                taskPopup.dismiss()
                reloadData(self)

            taskPopup = Popup()
            taskPopup.title = 'Tarefas'
            taskPopupGrid = GridLayout(cols=1)
            taskPopup.add_widget(taskPopupGrid)
            for task in database:
                taskPopupGrid.add_widget(
                    Button(text=task,
                           on_release=delTask,
                           font_size='30sp',
                           background_color=[10, 1, 1, 1]))
            taskPopupGrid.add_widget(
                Button(text='Fechar',
                       on_release=closeTaskPopup,
                       font_size='30sp',
                       background_color=[1, 2, 2, 1]))
            taskPopup.open()
 def update_list(self):
     try:
         Active.scanList = Active.scan_task.get_scan_list(Active.client)
     except ScanException as se:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=se.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = se.title
         popup.open()
         return
     except EmptyListException as ee:
         global empty
         if empty is 0:
             empty = 1
             popup = Popup(size_hint=(None, None), size=(400, 150))
             popup.add_widget(Label(text=ee.value))
             popup.bind(on_press=popup.dismiss)
             popup.title = ee.title
             popup.open()
     self.scdata.clear()
     for x in range(0, len(Active.scanList)):
         self.scdata.append({'path': Active.scanList[x].path,
                           'options': Active.scanList[x].options})
     self.list_adapter.data = self.scdata
     if hasattr(self.list_view, '_reset_spopulate'):
         self.list_view._reset_spopulate()
Beispiel #3
0
 def mod_sc(self, btn, path, ids, state):
     for x in range(0, len(Active.scanList)):
         if path is Active.scanList[x].path:
             tmp = Active.scanList[x]
             break
     if ids is 'is_temp':
         Active.scanList[x].is_temp = 1 if state is 'down' else 0
         Active.scanList[x].options['CL_TEMP'] = 1 if state is 'down' else '0'
     else:
         Active.scanList[x].options[ids] = '1' if state is 'down' else '0'
         if ids is 'BACKUP' and state is 'down':
             Active.scanList[x].options['DEL_F_SIZE'] = '0'
         elif ids is 'DEL_F_SIZE' and state is 'down':
             Active.scanList[x].options['BACKUP'] = '0'
         elif ids is 'BACKUP_OLD' and state is 'down':
             Active.scanList[x].options['DEL_F_OLD'] = '0'
         elif ids is 'DEL_F_OLD' and state is 'down':
             Active.scanList[x].options['BACKUP_OLD'] = '0'
     try:
         Active.scan_task.mod_from_scan(Active.client, path, Active.scanList[x].get_options(),
                                        Active.scanList[x].is_temp)
     except ScanException as se:
         popup = Popup(size_hint=(None, None), size=(500, 150))
         popup.add_widget(Label(text=se.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = se.title
         popup.open()
         btn.state = 'normal' if state is 'down' else 'down'
         Active.scanList[x] = tmp
         return
Beispiel #4
0
 def search(self, term, provider):
     Logger.debug('Search: requesting {term} from {provider}'.format(term=term,
                                                                     provider=provider))
     self.grid.clear_widgets()
     providers = {'MetMuseum': 'www.metmuseum.org',
                  'Getty OCI': 'search.getty.edu'}
     if not term:
         popup = Popup(title=_('Error'), size_hint=(0.3, 0.2))
         popup.add_widget(Label(text=_('Please enter a search term.')))
         popup.open()
         return
     elif provider == 'Flickr':
         results = self.app.search_flickr(term)
         for photo in results['photos']['photo']:
             photo['thumb'] = self.app.get_flickr_url(photo, 't')
             photo['artist'] = photo['owner']
             photo['year'] = 'None'
             Logger.debug('Search (Flickr): Loading {url}'.format(url=photo['thumb']))
             image = ItemButton(photo=photo, source=photo['thumb'], keep_ratio=True, size_hint=(None, None))
             self.grid.add_widget(image)
     elif provider == _('Select a search engine'):
         popup = Popup(title=_('Error'), size_hint=(0.3, 0.2))
         popup.add_widget(Label(text=_('Please select a search engine.')))
         popup.open()
     elif provider == 'MetMuseum':
         self.app.search_term(term, providers[provider], self.current_page)
     elif provider == 'Getty OCI':
         self.app.search_term(term, providers[provider], self.current_page)
Beispiel #5
0
 def down(self):
     print "down", self.f
     popup = Popup(title='Action')
     btn1 = Button(text='Apply')
     btn2 = Button(text='Cancel')
     btn2.bind(on_press=popup.dismiss)
     btn1.bind(on_press=self.on_apply_press)
     ww = []
     self.w = []
     if self.f['type'] != 'action':
         pp = [self.f]        
     else:
         pp = self.f['params']
     for p in pp:
         (w1, w2) = self.down_input(self.f)
         ww.append(w1)
         self.w.append(w2)
             
     self.popupv = popup
     b = BoxLayout(orientation='vertical')
     for w in ww:
         b.add_widget(w)
     b.add_widget(btn1)
     b.add_widget(btn2)
     popup.add_widget(b)
     popup.open()
Beispiel #6
0
 def ver(self, nom):
     nlikes=0
     persona=[]
     likesitos=[]
     tipo=personasDB.find({"Nombre":nom})
     for x in tipo:
         persona.append(x["Id"])
         persona.append(x["Nombre"])
         persona.append(x["Edad"])
         persona.append(x["Genero"])
         likesitos=x["Likes"]
     for n in likesitos:
         if n=="Like":
             nlikes=nlikes+1
     labels="like", "Dislike"
     plt.pie([nlikes, len(likesitos)-nlikes], labels=labels, autopct='%1.1f%%', shadow=True, startangle=130)
     plt.savefig("mostranding.png")
     plt.close()
     img=Popup(size_hint=(.6, .6), pos_hint={'x': 0.2, 'top': 0.85}, title="", separator_height=0)
     bl=BoxLayout(orientation='vertical', space=5)
     bl.add_widget(Label(text="Id:"+persona[0], size_hint=(1, .05), halign='left'))
     bl.add_widget(Label(text="Nombre:"+persona[1], size_hint=(1, .05), halign='left'))
     bl.add_widget(Label(text="Edad:"+persona[2], size_hint=(1, .05), halign='left'))
     bl.add_widget(Label(text="Genero:"+persona[3], size_hint=(1, .05), halign='left'))
     bl2=BoxLayout(orientation='horizontal', cols=2)
     bl2.add_widget(Label(text="Resultados por imagenes:\n1: "+likesitos[0]+"\n2: "+likesitos[1]+"\n3: "+likesitos[2]+"\n4: "+likesitos[3]+"\n5: "+likesitos[4]))
     botoncito1=Button(background_normal='mostranding.jpg', size_hint=(1, .7))
     bl2.add_widget(botoncito1)
     bl.add_widget(bl2)
     img.add_widget(bl)
     img.open()
 def update_list(self):
     try:
         Active.qrList = Active.qr_task.get_qr_list(Active.client)
     except QrException as qr:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=qr.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = qr.title
         popup.open()
         return
     except EmptyListException as ee:
         global empty
         if empty is 0:
             empty = 1
             popup = Popup(size_hint=(None, None), size=(400, 150))
             popup.add_widget(Label(text=ee.value))
             popup.bind(on_press=popup.dismiss)
             popup.title = ee.title
             popup.open()
     finally:
         self.qrdata.clear()
         for x in range(0, len(Active.qrList)):
             self.qrdata.append({'filename': Active.qrList[x].f_name,
                               'old_path': Active.qrList[x].o_path})
         self.list_adapter.data = self.qrdata
         if hasattr(self.list_view, '_reset_spopulate'):
             self.list_view._reset_spopulate()
Beispiel #8
0
    def yesNoPopUp(titleLabel, text, yesCallback=None, noCallback=None):
        popup = Popup(title=titleLabel,
                      auto_dismiss=False,
                      size_hint=(0, 0),
                      size=(400, 200))

        mainLayout = BoxLayout(orientation="vertical")
        label = Label(text=text)
        mainLayout.add_widget(label)

        buttonLayout = BoxLayout()

        yesButton = Button(text="YES",
                           on_press=yesCallback,
                           on_release=popup.dismiss)

        noButton = Button(text="NO",
                          on_press=noCallback,
                          on_release=popup.dismiss)

        buttonLayout.add_widget(yesButton)
        buttonLayout.add_widget(noButton)

        mainLayout.add_widget(buttonLayout)

        popup.add_widget(mainLayout)
        return popup
Beispiel #9
0
 def build_output_path_options(self):
     lbl_file_path = Label(text='Output Directory', size_hint=(.1, .05), pos_hint={'x': 0.5, 'y': .4})
     self.text_output_directory = TextInput(text="", multiline=False, size_hint=(.5, .05),
                                            pos_hint={'x': .3, 'y': .35})
     self.text_output_directory.bind(text=self.select_output_dir)
     self.text_output_directory.disabled = True
     self.btn_browse_directory = Button(text='Browse', size_hint=(.09, .05), pos_hint={'x': .8, 'y': .35})
     self.btn_browse_directory.disabled = True
     self.btn_browse_directory.bind(on_release=lambda show_file_selection_dialog: file_chooser_dialog.open())
     self.app.add_widget(lbl_file_path)
     self.app.add_widget(self.text_output_directory)
     self.app.add_widget(self.btn_browse_directory)
     file_chooser_dialog = Popup(title="Select Output Directory", size=(500, 500))
     file_chooser = FileChooserIconView()
     file_chooser.path = os.getcwd()
     file_chooser_layout = FloatLayout(size=(500, 500))
     file_chooser_layout.add_widget(file_chooser)
     file_chooser_dialog.add_widget(file_chooser_layout)
     btn_open_file = Button(text='Select Folder', size_hint=(.15, .05), pos_hint={'x': .75, 'y': .01})
     btn_open_file.bind(
         on_release=lambda load_file: self.select_directory(self.text_output_directory, file_chooser_dialog,
                                                            file_chooser.path))
     btn_cancel_file = Button(text='Cancel', size_hint=(.1, .05), pos_hint={'x': .9, 'y': .01})
     btn_cancel_file.bind(on_release=lambda cancel_file_selection_dialog: file_chooser_dialog.dismiss())
     file_chooser_layout.add_widget(btn_open_file)
     file_chooser_layout.add_widget(btn_cancel_file)
Beispiel #10
0
    def on_triple_tap(self):

        filechoser_layout = AnchorLayout()

        #filechoser = FileChooserIconView( size_hint = (0.75,0.85), path=settings['kraken_path'] +'/picture') #, multiselect = True)
        filechoser = FileChooserIconView(size_hint=(0.75, 0.85),
                                         path='/home')  #, multiselect = True)
        filechoser_list_layout = AnchorLayout(anchor_x='left', anchor_y='top')
        filechoser_list_layout.add_widget(filechoser)

        button_layout = AnchorLayout(anchor_x='left', anchor_y='bottom')

        box = BoxLayout(orientation='vertical',
                        size_hint=(0.75, None),
                        height=96)

        bli = BoxLayout(orientation='horizontal')
        ok_button = Button(text='Ok')
        cancel_button = Button(text='Cancel')

        bli2 = BoxLayout(orientation='horizontal')
        ti = TextInput(size_hint=(1, None), height=48)
        bli2.add_widget(Label(text='Enter File Name : '))
        bli2.add_widget(ti)

        bli.add_widget(ok_button)
        bli.add_widget(cancel_button)
        box.add_widget(bli2)
        box.add_widget(bli)
        button_layout.add_widget(box)

        image_layout = AnchorLayout(anchor_x='right', anchor_y='center')
        wimg = Image(source=settings['kraken_path'] + '/picture/girl.jpg',
                     size_hint=(0.25, None),
                     size=(200, Window.size[1]))
        image_layout.add_widget(wimg)

        filechoser_layout.add_widget(filechoser_list_layout)
        filechoser_layout.add_widget(button_layout)
        filechoser_layout.add_widget(image_layout)

        popup_browser = Popup(title='Select File')
        popup_browser.add_widget(filechoser_layout)

        def save_path(instance):
            if ti.text != '':
                self.text = filechoser.path + '/' + ti.text
            else:
                self.text = filechoser.selection[0]
            popup_browser.dismiss()

        def file_select(self, file):
            if file:
                wimg.source = file[0]

        cancel_button.bind(on_press=popup_browser.dismiss)
        ok_button.bind(on_press=save_path)
        filechoser.bind(selection=file_select)

        popup_browser.open()
Beispiel #11
0
class MessageBox(App):
    def __init__(self, parent, titleheader="Message", message="", options={"OK": ""}, size_hint=(.8,.3), font_size=None,  size=None, modal=0, edit_add = False, edit_default_text=""):
    #def build(self, parent, titleheader="Message", message="", options={"OK": ""}, size_hint=(.8,.2),  size=(None, None)):
        def popup_callback(instance):
            self.retvalue = instance.text
            self.popup.dismiss()


        self.parent = parent
        self.retvalue = None
        self.titleheader = titleheader
        self.message = message
        self.options = options
        self.font_size=font_size
        self.edit_add=edit_add
        self.edit_default_text=edit_default_text
        if size: self.size = size
        else: self.size=(0,0)
        if size_hint: self.size_hint=size_hint

        #box = GridLayout(orientation='vertical', cols=1)
        box = GridLayout(cols=1)
        box.orientation='vertical'
        #self.add_widget(box)
        #box.add_widget(Label(text=self.message, font_size=self.font_size))
        box.add_widget(Label(text=self.message))

        if self.edit_add:
            self.edit=TextInput(text=self.edit_default_text)
            box.add_widget(self.edit)
        b_list =  []
        buttonbox = BoxLayout(orientation='horizontal',size_hint=(1, None),height=32)
        box.add_widget(buttonbox)
        for b in self.options:
            b_list.append(Button(text=b, on_press=popup_callback))
            #b_list[-1].bind(on_press=self.popup_callback)
            buttonbox.add_widget(b_list[-1])
        if modal:
            #Допилить
            self.popup = ModalView()
            self.popup.title=titleheader
            self.popup.size_hint=self.size_hint
            self.popup.size=self.size
            self.popup.add_widget(box)
        else:
            self.popup = Popup(title=titleheader, content=box, size_hint=self.size_hint, size=self.size)
        #self.popup = Popup(title=titleheader, content=box, size_hint=self.size_hint)
        self.popup.open()
        self.popup.bind(on_dismiss=self.OnClose)

    def OnClose(self, event):
        self.popup.unbind(on_dismiss=self.OnClose)
        self.popup.dismiss()
        if self.retvalue != None and self.retvalue in self.options and self.options[self.retvalue] != "":
            command = "self.parent."+ (self.options[self.retvalue]%self.edit.text if self.edit_add else self.options[self.retvalue])
            exec(command)
    def dismiss(self):
        self.retvalue = 'dismiss'
        self.popup.dismiss()
Beispiel #12
0
 def load_description(self):
     f = open(os.sep.join([self.demo_path, 'readme.md'])).read()
     description = Popup(title=self.title,
                         size_hint=(None, None),
                         height=500,
                         width=700)
     description.add_widget(RstDocument(text=f))
     description.open()
Beispiel #13
0
 def show_aggregation_result(self, howmany):
     popup = Popup(title='Aggregation result', size_hint=(0.7, 0.7))
     l = BoxLayout(orientation='vertical')
     l.add_widget(
         Label(text='Processed %d distinct hands' % (howmany),
               font_size='25sp'))
     popup.add_widget(l)
     popup.open()
Beispiel #14
0
 def quit_popup(self):
     popup = Popup(title='Score Summary Window', size_hint=(0.7, 0.7))
     l = BoxLayout(orientation='vertical')
     l.add_widget(Label(text='Game Over', font_size='40sp'))
     l.add_widget(Label(text='Total moves played: %d' % self.total_moves, font_size='25sp'))
     popup.add_widget(l)
     popup.bind(on_dismiss=self.summary_popup_dismiss)
     popup.open()
Beispiel #15
0
    def on_touch(self, obj, event):
        '''
        vamos a capturar eventos en estas zonas
        *************************
        *1*       *0*         *2*
        ***       ***         ***
        *                       *
        *                       *
        * *                   * *
        *3*                   *4*
        * *                   * *
        *                       *
        *                       *
        *                       *
        ***                   ***
        *5*                   *6*
        *************************
        :param widget:
        :param event:
        :return:
        '''
        #zona1 = ((0, Window.width * 0.1), (Window.height, (Window.height - Window.height * 0.1)))
        #zona2 = ((Window.width - Window.width * 0.1, Window.width), (Window.height, (Window.height - Window.height * 0.1)))
        zona0 = ((Window.width * 0.5 - Window.width * 0.1,
                  Window.width * 0.5 + Window.width * 0.1),
                 (Window.height - Window.height * 0.1, Window.height))
        zona3 = ((0, Window.width * 0.1),
                 (Window.height * 0.1 + Window.height * 0.5,
                  Window.height * -0.1 + Window.height * 0.5))
        zona4 = ((Window.width - Window.width * 0.1, Window.width),
                 (Window.height * 0.1 + Window.height * 0.5,
                  Window.height * -0.1 + Window.height * 0.5))

        if (zona0[0][0] < event.pos[0] and event.pos[0] < zona0[0][1]) and (
                zona0[1][0] < event.pos[1] and event.pos[1] < zona0[1][1]):
            box = GridLayout(cols=5)
            botonAncho = Button(text="Ancho")
            botonAncho.bind(on_press=self.ancho)
            box.add_widget(botonAncho)

            botonAjustarAlto = Button(text="Alto")
            botonAjustarAlto.bind(on_press=self.ajustarAlto)
            box.add_widget(botonAjustarAlto)

            botonCentrado = Button(text="normal")
            botonCentrado.bind(on_press=self.sinAjuste)
            box.add_widget(botonCentrado)

            botonRotar = Button(text="Rotar")
            botonRotar.bind(on_press=self.rotar)
            box.add_widget(botonRotar)

            p = Popup(title='Comic View popup',
                      size_hint=(None, None),
                      size=(400, 150))
            p.add_widget(box)

            p.open()
Beispiel #16
0
    def check_backup(self, _):
        if not (os.path.isfile(BACKUP)):
            self.info_popup(
                "Er is geen backup gevonden.\nJe bestelling is verzonden en aangekomen."
            )
            return
        #probeer de backup in te laden
        try:
            store = JsonStore(BACKUP)
            info = store.get("backup").get(
                "info")  #gebruiken voor popup met info
            data = store.get("backup").get("data")
            DATA.load_data(data)

        except Exception as e:
            print("JSON load error", str(e))
            self.info_popup("Er ging iets mis bij het inladen van de backup.")
            return

        #maak popup met info over de klant/status
        popup = Popup(title="Klantinfo")
        layout = GridLayout(cols=1)

        layout.add_widget(
            Label(text="ID:  {}".format(info["id"]), font_size=30))
        layout.add_widget(
            Label(text="Naam:  {}".format(info["naam"]), font_size=28))
        layout.add_widget(
            Label(text="Tafel: {}".format(info["tafel"]), font_size=30))
        layout.add_widget(
            Label(text="Verzonden: {}".format("Ja" if (
                info["verzonden"]) else "Nee"),
                  font_size=30))
        layout.add_widget(
            Label(text="Bevestigd: {}".format("Ja" if (
                info["bevestigd"]) else "Nee"),
                  font_size=30))

        info_label = Label(
            text=
            "[color=#ffff00]Indien je bestelling reeds verzonden is zullen veranderingen niet worden toegelaten![/color]",
            font_size=30,
            markup=True)
        info_label.bind(width=self._update_text_width)
        layout.add_widget(info_label)

        knop = Button(text="sluit", width=Window.size[0] * .75)
        knop.bind(on_press=popup.dismiss)
        layout.add_widget(knop)

        popup.add_widget(layout)
        popup.open()

        #herlaad het bestellingscherm
        m_app.prod_pagina.klik(Label(text=""), True)
        m_app.prod_pagina.reset()
        m_app.screen_manager.current = "bestelling"
Beispiel #17
0
 def create_subject(self, instance):
     subject = self.sub_text.text.upper()
 
     subject_file = open('subject.txt', 'at')
     subject_file.write('\n' + subject)
     subject_file.close()
     sub_pop = Popup(title='Subject Creation', size_hint=(.5, .5), auto_dismiss=True)
     sub_pop_text = Label(text=self.sub_text.text)
     sub_pop.add_widget(sub_pop_text)
     sub_pop.open()
 def get_h5_file(self):
     try:
         root = tk.Tk()
         root.withdraw()
         loaded_model_path=filedialog.askopenfilename(filetypes=[('HDF5 File','*.h5')])
         self.load_model(loaded_model_path)
     except OSError:
         popup = Popup(title='Error', size_hint=(0.5, 0.5),auto_dismiss=True)
         popup.add_widget((Label(text="You didn't select any file")))
         popup.open()    
Beispiel #19
0
        def view_details(_):
            details = Popup(size_hint=(.8, .8), title=self.character.class_)
            class_ = (session.query(Class).filter(
                Class.name == self.character.class_).scalar())
            if class_:
                text = class_.details
            else:
                text = "Class_ '%s' not found" % self.character.class_

            details.add_widget(RstDocument(text=text))
            details.open()
 def save_model(self):
     try:
         file_name="MyModel"+time.strftime("%Y-%m-%d-%H-%M-%S")
         self.model.save_model(file_name)
         popup = Popup(title='Current model saved successfully !!', size_hint=(0.5, 0.5),auto_dismiss=True)
         popup.open()
         popup.add_widget((Label(text=f'Model Saved in current directory with name\n {file_name}.h5\nRename the file to make sense of it.')))
     except ValueError:
         popup = Popup(title='Cannot Save Model', size_hint=(0.5, 0.5),auto_dismiss=True)
         popup.open()
         popup.add_widget((Label(text='First Train the model before saving it !!!')))
Beispiel #21
0
    def open_content_dropdown(self, text_input):
        options = {
            'euler angles (0-0xffff)': 'rx,ry,rz',
            'euler angles (0-1.0)': 'rx_d,ry_d,rz_d',
            'accelerations (0-0xffff)': 'ax,ay,az',
            'accelerations (0-1.0)': 'ax_d,ay_d,az_d',
            'accelerations + euler (0-0xffff)': 'ax,ay,az,rx,ry,rz',
            'accelerations + euler (0-1.0)': 'ax_d,ay_d,az_d,rx_d,ry_d,rz_d',
        }

        #d = DropDown(width=text_input.width)
        #for o in options:
        #    b = Button(text=o, size_hint_y=None)
        #    b.bind(texture_size=b.setter('size'))
        #    b.bind(on_press=lambda x: text_input.setter('text')(options[o]))
        #    d.add_widget(b)

        #d.open(text_input)

        p = Popup(title='message content', size_hint=(.9, .9))

        def callback(option):
            text_input.text = options.get(option, option)
            p.dismiss()

        content = GridLayout(spacing=10, cols=1)
        for o in options:
            b = Button(text=o)
            b.bind(on_press=lambda x: callback(x.text))
            content.add_widget(b)

        instructions = Label(
            text='custom content:\n two types of sensors are '
            'proposed, rotation (euler angles) and acceleration, each '
            'in 3 axis: rx, ry and rz represent rotation values, ax, '
            'ay and az represent acceleration values, any value can '
            'take a "_d" suffix, to be casted to a value between 0 '
            'and 1 instead of the default (from 0 to 0xffff', size_hint_y=None)
        instructions.bind(
            size=instructions.setter('text_size'),
            texture_size=instructions.setter('size'))
        content.add_widget(instructions)
        ti = TextInput(
            text=text_input.text,
            multiline=False,
            input_type='text',
            keyboard_suggestions=False)
        content.add_widget(ti)
        b = Button(text='set custom')
        b.bind(on_press=lambda x: callback(ti.text))
        content.add_widget(b)

        p.add_widget(content)
        p.open()
Beispiel #22
0
        def view_details(_):
            details = Popup(size_hint=(.8, .8), title=self.character.race)
            race = (session.query(Race).filter(
                Race.name == self.character.race).scalar())
            if race:
                text = race.details
            else:
                text = "Race '%s' not found" % self.character.race

            details.add_widget(RstDocument(text=text))
            details.open()
Beispiel #23
0
    def generate_error_popup(title, message, size_hint=(0.7, 0.4)):
        """This generates a pop up showing an error and an OK button to dismiss"""
        error_popup = Popup(title=title, size_hint=size_hint)
        error_box = BoxLayout(orientation='vertical')
        error_message_label = Label(text=message, font_size=25)
        error_ok_button = Button(text='OK', on_release=partial(Utils.close_popup, error_popup))

        error_box.add_widget(error_message_label)
        error_box.add_widget(error_ok_button)
        error_popup.add_widget(error_box)
        error_popup.open()
Beispiel #24
0
 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 ''
Beispiel #25
0
    def open_content_dropdown(self, text_input):
        options = {
            'euler angles (0-0xffff)': 'rx,ry,rz',
            'euler angles (0-1.0)': 'rx_d,ry_d,rz_d',
            'accelerations (0-0xffff)': 'ax,ay,az',
            'accelerations (0-1.0)': 'ax_d,ay_d,az_d',
            'accelerations + euler (0-0xffff)': 'ax,ay,az,rx,ry,rz',
            'accelerations + euler (0-1.0)': 'ax_d,ay_d,az_d,rx_d,ry_d,rz_d',
        }

        #d = DropDown(width=text_input.width)
        #for o in options:
        #    b = Button(text=o, size_hint_y=None)
        #    b.bind(texture_size=b.setter('size'))
        #    b.bind(on_press=lambda x: text_input.setter('text')(options[o]))
        #    d.add_widget(b)

        #d.open(text_input)

        p = Popup(title='message content', size_hint=(.9, .9))

        def callback(option):
            text_input.text = options.get(option, option)
            p.dismiss()

        content = GridLayout(spacing=10, cols=1)
        for o in options:
            b = Button(text=o)
            b.bind(on_press=lambda x: callback(x.text))
            content.add_widget(b)

        instructions = Label(
            text='custom content:\n two types of sensors are '
            'proposed, rotation (euler angles) and acceleration, each '
            'in 3 axis: rx, ry and rz represent rotation values, ax, '
            'ay and az represent acceleration values, any value can '
            'take a "_d" suffix, to be casted to a value between 0 '
            'and 1 instead of the default (from 0 to 0xffff',
            size_hint_y=None)
        instructions.bind(size=instructions.setter('text_size'),
                          texture_size=instructions.setter('size'))
        content.add_widget(instructions)
        ti = TextInput(text=text_input.text,
                       multiline=False,
                       input_type='text',
                       keyboard_suggestions=False)
        content.add_widget(ti)
        b = Button(text='set custom')
        b.bind(on_press=lambda x: callback(ti.text))
        content.add_widget(b)

        p.add_widget(content)
        p.open()
 def get_csv_file(self,Train=False,Test=False):
     try:
         root = tk.Tk()
         root.withdraw()        
         if Train:
             self.train_path=filedialog.askopenfilename(filetypes=[('CSV File','*.csv')])
         if Test:
             self.test_path=filedialog.askopenfilename(filetypes=[('CSV File','*.csv')])
     except OSError:
         popup = Popup(title='Error', size_hint=(0.5, 0.5),auto_dismiss=True)
         popup.add_widget((Label(text="You didn't select any file")))
         popup.open()
Beispiel #27
0
        def view_details(_):
            monster_type = self.monster.monster_type or ''
            details = Popup(size_hint=(.8, .8), title=monster_type)
            monster_type = (session.query(Monster).filter(
                Monster.name == monster_type).scalar())
            if monster_type:
                text = monster_type.get_details()
            else:
                text = "Monster_Type '%s' not found" % monster_type

            details.add_widget(RstDocument(text=text))
            details.open()
Beispiel #28
0
 def popup_readme(self):
     readme_path = os.sep.join([
         self.bundle_dir, 'plugins', 'processing', 'model_zoo', 'models',
         self.id, 'README.md'
     ])
     f = open(readme_path).read()
     description = Popup(title=self.title,
                         size_hint=(None, None),
                         height=500,
                         width=700)
     description.add_widget(RstDocument(text=f))
     description.open()
 def draw_network(self,layers=[1,1]):
     if all(item<=13 for item in layers):    
         self.drawer.draw(layers=layers,weighted=False)
     else:
         layers_copy=layers.copy()
         for i in range(len(layers)):
             layers_copy[i]=min(layers[i],13)
         popup = Popup(title='Network Preview Notice', size_hint=(0.5, 0.5),auto_dismiss=True)
         popup.add_widget((Label(text="For all layer with neurons >13 will be scaled to 13 \n for performance issues.")))
         popup.open()
         self.drawer.draw(layers=layers_copy,weighted=False)
     self.reload()
Beispiel #30
0
 def display_out(self, uid, out='out'):
     process = self.processes[uid]
     p = Popup(size_hint=(.95, .95),
               title='std%s %s' % (out, process['label'].text))
     sc = ScrollView()
     content = Label(text=process[out], size_hint=(None, None))
     sc.bind(width=content.setter('width'))
     content.bind(width=lambda c, w:
                  content.setter('text_size')(c, (w, None)))
     content.bind(texture_size=content.setter('size'))
     sc.add_widget(content)
     p.add_widget(sc)
     p.open()
 def deleteItem(self, item, index):
     try:
         Active.scan_task.rm_from_scan(Active.client, item.path)
     except ScanException as se:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=se.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = se.title
         popup.open()
         return
     Active.scanList.pop(index)
     global update
     update = 1
 def restoreItem(self, item, index):
     try:
         Active.qr_task.restore_from_qr(Active.client, item.f_name)
     except QrException as qr:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=qr.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = qr.title
         popup.open()
         return
     Active.qrList.pop(index)
     global update
     update = 1
Beispiel #33
0
    def on_start(self):
        if connected == False:
            popup_ = Popup(title='Warning', size_hint=(0.5,0.3), separator_color=(1,0,0,1))
            box_1 = BoxLayout(orientation = 'vertical')
            lab = Label(text='Serial connection not established!')
            ok_btn = Button(text='OK', size_hint_y = 0.35)
            box_1.add_widget(lab)
            box_1.add_widget(ok_btn)
            popup_.add_widget(box_1)

            # ok_btn.bind(on_release=lambda a:self.stop_app())

            popup_.open()
Beispiel #34
0
 def display_out(self, uid, out='out'):
     process = self.processes[uid]
     p = Popup(size_hint=(.95, .95),
               title='std%s %s' % (out, process['label'].text))
     sc = ScrollView()
     content = Label(text=process[out], size_hint=(None, None))
     sc.bind(width=content.setter('width'))
     content.bind(
         width=lambda c, w: content.setter('text_size')(c, (w, None)))
     content.bind(texture_size=content.setter('size'))
     sc.add_widget(content)
     p.add_widget(sc)
     p.open()
Beispiel #35
0
 def deleteItem(self, item, index):
     try:
         Active.qr_task.rm_from_qr(Active.client, item.f_name)
     except QrException as qr:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=qr.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = qr.title
         popup.open()
         return
     Active.qrList.pop(index)
     global update
     update = 1
Beispiel #36
0
    def exit(self, sender):
        boxLayout = BoxLayout(orientation='vertical')
        popup = Popup(title='Exit', size_hint=(None, None), size=(800, 400))
        popup.add_widget(boxLayout)

        boxLayout.add_widget(
            Button(text='Exit Application', on_press=self.exit_app))
        boxLayout.add_widget(Button(text='Reboot Device',
                                    on_press=self.reboot))
        boxLayout.add_widget(
            Button(text='Shutdown Device', on_press=self.shutdown))

        popup.open()
Beispiel #37
0
    def get_date(self, date):
        sql_connection = sqlite3.connect('Records/records.db')
        cursor = sql_connection.cursor()

        cursor.execute('select * from past_records where date=?',
                       [''.join(re.findall('[0-9]', str(date)))])

        def result_back_button_pressed(btn):
            result_popup.dismiss()

        def bad_back_button_pressed(btn):
            bad_popup.dismiss()

        result = cursor.fetchone()
        sql_connection.close()
        if result:
            result_popup = Popup(title='popup', size_hint=(0.5, 0.7))
            result_box = BoxLayout(orientation='vertical')
            data_tables = MDDataTable(
                size_hint=(1, 0.5),
                # pos_hint = {'y':0},
                column_data=[
                    ("", dp(25)),
                    ("", dp(30)),
                    # ("Team Lead", dp(30))
                ],
                row_data=[
                    ('steps', str(result[1])),
                    ('dist', str(result[2])),
                    ('calories', str(result[3])),
                ])
            result_box.add_widget(data_tables)
            result_box.add_widget(
                Button(pos_hint={'x': 0.4},
                       size_hint=(0.2, 0.1),
                       text='뒤로가기',
                       on_release=result_back_button_pressed,
                       font_name='Fonts/NanumBarunGothic.ttf'))
            result_popup.add_widget(result_box)
            result_popup.open()
        else:
            bad_popup = Popup(title='popup', size_hint=(0.3, 0.3))
            bad_box = BoxLayout(orientation='vertical')
            bad_box.add_widget(
                Label(text='결과가 없습니다', font_name='Fonts/NanumBarunGothic.ttf'))
            bad_box.add_widget(
                Button(text='뒤로가기',
                       on_release=bad_back_button_pressed,
                       font_name='Fonts/NanumBarunGothic.ttf'))
            bad_popup.add_widget(bad_box)
            bad_popup.open()
Beispiel #38
0
 def cal_young_dend_ratio(self):
     if po1.text != '' and po2.text != '':
         pe1 = int(po1.text)
         p3 = int(po2.text)
         r = round((pe1 / p3) * 100, 0)
         result.text = str(r)
     else:
         d = Popup(title='Wrong Input',
                   size_hint=(.5, .5),
                   auto_dismiss=True)
         b = Button(text='textinputs cannot be empty',
                    on_press=d.dismiss)
         d.add_widget(b)
         d.open()
Beispiel #39
0
 def _show_category(self):
     popup = Popup(title="%s Backgrounds" % self.category.name)
     self.scroller = ScrollView(do_scroll_x=False)
     self.grid = GridLayout(cols=3, size_hint_y=None)
     for filename, index in self.category.backgrounds:
         self.grid.add_widget(BackgroundDisplay(screen=self.screen,
                                                filename=filename,
                                                index=index,
                                                popup=popup))
     for i in range(3 - len(self.category.backgrounds)):
         self.grid.add_widget(Widget())
     self.scroller.bind(size=self._resize)
     self.scroller.add_widget(self.grid)
     popup.add_widget(self.scroller)
     popup.open()
Beispiel #40
0
    def generate_input_popup(callback, size_hint=(.5, .3), hint_text='Enter username. Only letters', button_text='Submit', title='Enter username', message='Please enter username.\n3 - 10 characters\nNo spaces, punctuations, numbers, or special characters like @\nEnter only letters'):
        """ Returns an input field, to which the text inputted can be drawn from, and the pop up just so it can be closed"""
        input_popup = Popup(size_hint=size_hint, title=title)
        popup_box = BoxLayout(orientation='vertical')
        popup_label = Label(text=message)
        input_entry = TextInput(font_size=20, hint_text=hint_text, size_hint=(1, .3))
        submit_button = Button(text=button_text, font_size=15, on_release=callback, size_hint=(.5, .3))

        popup_box.add_widget(popup_label)
        popup_box.add_widget(input_entry)
        popup_box.add_widget(submit_button)
        input_popup.add_widget(popup_box)

        input_popup.open()
        return input_entry, input_popup
    def on_start(self):
        pu = Popup(title = 'WOW!!!',
                   size_hint = [0.5, 0.5],
                   auto_dismiss = True)
        bx = BoxLayout(orientation = 'vertical')
        lb = Label(text = 'Welcome to APS/DOP calculator',
                   size_hint = [1, 3])
        bt = Button(text = 'OK',
                    size_hint = [1, 1],
                    on_release = pu.dismiss)
        pu.add_widget(bx)

        bx.add_widget(lb)
        bx.add_widget(bt)
        pu.open()
Beispiel #42
0
    def intra_hand_popup(self, goal_changed=False, dismiss=None):
        """Generate a popup to emphasize the start of a new hand.
        By clicking over the button, it disappears.
        When 
        """
        popup = Popup(title='Next Hand Window', size_hint=(0.3, 0.3))
        if dismiss == None:
            dismiss = popup.dismiss
        
        l = BoxLayout(orientation='vertical')
        if goal_changed:
            l.add_widget(Label(text='Your Goal card has changed', font_size='30sp'))

        l.add_widget(Button(text='Next hand', font_size='40sp', on_press=dismiss))
        popup.add_widget(l)
        popup.open()
 def rm_all(self):
     try:
         Active.qr_task.rm_all_from_qr(Active.client)
     except QrException as qe:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=qe.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = qe.title
         popup.open()
         return
     Active.changed['qr'] = 1
     popup = Popup(size_hint=(None, None), size=(400, 150))
     popup.add_widget(Label(text="Removal successful, please wait while\n the interface refreshes"))
     popup.bind(on_press=popup.dismiss)
     popup.title = "Remove Successful"
     popup.open()
    def __init__(self, **kwargs):
        self.scdata = list()
        self.orientation = 'vertical'
        # FOR NETWORK
        Active.scanList.clear()
        try:
            Active.scanList = Active.scan_task.get_scan_list(Active.client)
        except ScanException as se:
            popup = Popup(size_hint=(None, None), size=(400, 150))
            popup.add_widget(Label(text=se.value))
            popup.bind(on_press=popup.dismiss)
            popup.title = se.title
            popup.open()
            return
        except EmptyListException as ee:
            global empty
            if empty is 0:
                empty = 1
                popup = Popup(size_hint=(None, None), size=(400, 150))
                popup.add_widget(Label(text=ee.value))
                popup.bind(on_press=popup.dismiss)
                popup.title = ee.title
                popup.open()
        for x in range(0, len(Active.scanList)):
            self.scdata.append({'path': Active.scanList[x].path,
                                'options': Active.scanList[x].options})

        self.list_adapter = ListAdapter(data=self.scdata,
                                        args_converter=self.formatter,
                                        cls=ScCompositeListItem,
                                        selection_mode='single',
                                        allow_empty_selection=False)

        super(ScannerViewModal, self).__init__(**kwargs)
        self.list_view = ListView(adapter=self.list_adapter)
        self.add_widget(HeaderBox())
        self.add_widget(self.list_view)
        if len(self.scdata) is 0:
            detail_view = ScDetailView(sc_name="List is empty", size_hint=(.6, 1.0))
        else:
            detail_view = ScDetailView(sc_name=self.list_adapter.selection[0].text, size_hint=(.6, 1.0))

        self.list_adapter.bind(
            on_selection_change=detail_view.sc_changed)
        self.add_widget(detail_view)
        Clock.schedule_interval(self.callback, 60)
        Clock.schedule_interval(self.callback2, 5)
Beispiel #45
0
    def errorPopup(titleLabel, text, onCloseCallback=None):
        popup = Popup(title=titleLabel,
                      auto_dismiss=False,
                      size_hint=(0, 0),
                      size=(400, 200))

        mainLayout = BoxLayout(orientation="vertical")
        label = Label(text=text, color=[1.0, 0.0, 0.0, 1.0])
        mainLayout.add_widget(label)

        okButton = Button(text="CLOSE",
                          on_press=onCloseCallback,
                          on_release=popup.dismiss)

        mainLayout.add_widget(okButton)
        popup.add_widget(mainLayout)
        return popup
    def __init__(self, **kwargs):
        self.qrdata = list()
        # FOR NETWORK
        Active.qrList.clear()
        try:
            Active.qrList = Active.qr_task.get_qr_list(Active.client)
        except QrException as qr:
            popup = Popup(size_hint=(None, None), size=(400, 150))
            popup.add_widget(Label(text=qr.value))
            popup.bind(on_press=popup.dismiss)
            popup.title = qr.title
            popup.open()
        except EmptyListException as ee:
            global empty
            if empty is 0:
                empty = 1
                popup = Popup(size_hint=(None, None), size=(400, 150))
                popup.add_widget(Label(text=ee.value))
                popup.bind(on_press=popup.dismiss)
                popup.title = ee.title
                popup.open()
        for x in range(0, len(Active.qrList)):
            self.qrdata.append({'filename': Active.qrList[x].f_name,
                                'old_path': Active.qrList[x].o_path})

        self.list_adapter = ListAdapter(data=self.qrdata,
                                        args_converter=self.formatter,
                                        selection_mode='single',
                                        allow_empty_selection=False,
                                        cls=QrCompositeListItem)

        super(QuarantineViewModal, self).__init__(**kwargs)
        self.list_view = ListView(adapter=self.list_adapter)
        self.add_widget(self.list_view)
        if len(self.qrdata) is 0:
            detail_view = QrDetailView(qr_name="List is empty", size_hint=(.6, 1.0))
        else:
            detail_view = QrDetailView(qr_name=self.list_adapter.selection[0].text,
                                       size_hint=(.6, 1.0))

        self.list_adapter.bind(
            on_selection_change=detail_view.qr_changed)
        self.add_widget(detail_view)
        Clock.schedule_interval(self.callback, 60)
        Clock.schedule_interval(self.callback2, 5)
 def addscan(self, path, is_temp, size, age, *args):
     try:
         if not path or not re.search(r'^[\'"]?(?:/[^/]+)*[\'"]?$', path):
             raise EmptyFields("Text fields empty or incorrect format")
         if not age or not re.search(r'^[0-9]+$', age):
             if age != "Age in days":
                 raise EmptyFields("Text fields empty or incorrect format")
         if not size or not re.search(r'^[0-9]+$', size):
             if size != "Size in MB":
                 raise EmptyFields("Text fields empty or incorrect format")
     except EmptyFields as ef:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=ef.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Input Error"
         popup.open()
         return
     tmp = ScanElem(path)
     tmp.is_temp = 0 if is_temp is 'normal' else 1
     opt = ''
     for arg in args:
         opt += '0' if arg is 'normal' else '1'
     tmp.set_options(opt)
     if size == "Size in MB":
         tmp.back_limit_size = -1
         tmp.del_limit_size = -1
     else:
         tmp.back_limit_size = int(size)
         tmp.del_limit_size = int(size)
     if age == "Age in days":
         tmp.max_age = -1
     else:
         tmp.max_age = age
     try:
         Active.scan_task.add_to_scan(Active.client, tmp)
     except ScanException as se:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=se.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = se.title
         popup.open()
         return
     Active.changed['sc'] = 1
     self.get_index("Scanner")
     self.load_screen(self.index)
Beispiel #48
0
 def save_popup(self):
     s = BoxLayout(orientation='vertical')
     global save_popup
     save_popup = Popup(title=title+'.txt', size_hint=(None, None), size=(400, 200), auto_dismiss=False)
     saved = Label(text='To the path:')
     loc = TextInput(text=title + '.txt', multiline=False)
     sve_btn = Button(text='Save')
     sve_btn.bind(on_release=main.save_doc)
     cls_btn = Button(text='Cancel')
     cls_btn.bind(on_release=save_popup.dismiss)
     sve = BoxLayout(orientation='horizontal')
     sve.add_widget(sve_btn)
     sve.add_widget(cls_btn)
     s.add_widget(saved)
     s.add_widget(loc)
     s.add_widget(sve)
     save_popup.add_widget(s)
     save_popup.open()
Beispiel #49
0
 def close_popup(self):
     c = BoxLayout(orientation='vertical')
     d = BoxLayout(orientation='horizontal')
     global close_popup
     close_popup = Popup(title='Close', size_hint=(None, None), size=(400, 200), auto_dismiss=False)
     closed = Label(text='Are you sure?')
     loc = Label(text='')
     cl_btn = Button(text='Cancel')
     cl_btn.bind(on_release=close_popup.dismiss)
     cls_btn = Button(text='Yes')
     cls_btn.bind(on_release=main.close_doc)
     d.add_widget(cls_btn)
     d.add_widget(cl_btn)
     c.add_widget(closed)
     c.add_widget(loc)
     c.add_widget(d)
     close_popup.add_widget(c)
     close_popup.open()
Beispiel #50
0
class ConfigMenu(GridLayout):
    name = StringProperty(None)
    region = StringProperty(None)
    pop = ObjectProperty(None)
    endpoints = ListProperty(['BR', 'EUNE', 'EUW', 'JP', 'KR',
                              'LAN', 'LAS', 'NA', 'OCE', 'TR',
                              'RU', 'PBE'])
    err_pop = ObjectProperty(None)
    loading = ObjectProperty(None)

    def __init__(self, **kwargs):
        super(ConfigMenu, self).__init__(**kwargs)
        filename = open('config.json')
        conf = json.load(filename)
        filename.close()
        self.name = conf['summoner']
        self.region = conf['region'].upper()
        self.pop = Popup(size_hint=(0.7, 0.7))
        box = BoxLayout(orientation='vertical')
        for item in self.endpoints:
            btn = RegionButton(text=item)
            btn.bind(on_release=self.set_region)
            box.add_widget(btn)
        self.pop.add_widget(box)

    def set_region(self, regbut):
        self.region = regbut.text
        self.pop.dismiss()

    def set_name(self, namtext):
        self.name = namtext.text
        result = backend.change_name(self.name, self.region)
        # self.loading.dismiss()
        if result:
            self.back_to_main()
        else:
            self.err_pop = ErrorPopup()
            self.err_pop.open()

    def back_to_main(self):
        App.get_running_app().root.transition = FallOutTransition()
        App.get_running_app().root.current = 'main_screen'
    def createParentTask(self,name,description,duration, deadline):

        self.task.name = name
        self.task.description = description
        self.task.duration = int(duration)
        self.task.deadline = deadline
        Task.updateTask(self.task)

        self.clear_widgets()

        print('app is running')
        popup = Popup(title='You have created a new task!',auto_dismiss=False)
        popup.size_hint = 0.25,0.25

        content = Button(text='Close me!',size_hint_y = .10)
        popup.add_widget(content)

        # bind the on_press event of the button to the dismiss function
        content.bind(on_press=popup.dismiss)
        popup.open()
Beispiel #52
0
 def on_touch_up(self, touch):
     """Display the Achievement screen on a touch."""
     if not self.earned: return
     if not self.collide_point(*touch.pos): return
     if 'start' in dir(touch) and touch.start is self:
         popup = Popup(title=str(self.achievement))
         layout = BoxLayout(orientation="vertical")
         if self.achievement.reward is None:
             layout.add_widget(AchievementEarnedDisplay(achievement=self.achievement))
         else:
             card = App.get_running_app().loaded_deck.get_special(self.achievement.reward)
             layout.add_widget(UnlockDisplay(achievement=self.achievement,
                                             reward=card))
         buttons = BoxLayout(size_hint=(1, .125))
         buttons.add_widget(Widget())
         buttons.add_widget(Button(text="OK", size_hint=(2, 1),
                                   on_release=popup.dismiss))
         buttons.add_widget(Widget())
         layout.add_widget(buttons)
         popup.add_widget(layout)
         popup.open()
 def modify_item(self, name, ip, pw, token, index):
     if Active.cl.c_list[index].name is not name:
         Active.cl.c_list[index].name = name
     if Active.cl.c_list[index].ip is not ip:
         Active.cl.c_list[index].ip = ip
     if len(pw) < 2:
         pass
     elif len(pw) < 4:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text="Password must be at least 4 characters long"))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Password Error"
         popup.open()
         return
     else:
         Active.cl.c_list[index].set_password(pw)
     if len(token) < 4:
         pass
     elif 'KL' not in token or not re.search(r'[0-9]', token):
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text="Invalid token format"))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Token Error"
         popup.open()
         return
     else:
         Active.cl.c_list[index].token = token
     Active.cl.save_list(Active.cl)
     global update
     update = 1
     popup = Popup(size_hint=(None, None), size=(400, 150))
     popup.add_widget(Label(text="Client " + Active.cl.c_list[index].name + " successfully modified"))
     popup.bind(on_press=popup.dismiss)
     popup.title = "Modification Successful"
     popup.open()
 def addsrv(self, server, ip, pw, token):
     if len(server) < 1:
         popup = Popup(size_hint=(None, None), size=(300, 150))
         popup.add_widget(Label(text="Client name must not be empty"))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Client Name Error"
         popup.open()
     elif len(pw) < 4:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text="Password must not be empty"))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Password Error"
         popup.open()
     elif 'KL' not in token or not re.search(r'[0-9]', token):
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text="Invalid token format"))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Token Error"
         popup.open()
     else:
         Active.cl.add_client(Active.cl, Client(token, ip, server, pw))
         self.get_index('Chooser')
         self.load_screen(self.index)
         global update
         update = 1
 def register(self, user, pwd, pwd_verif):
     if pwd != pwd_verif:
         popup = Popup(size_hint=(None, None), size=(300, 150))
         popup.add_widget(Label(text="Passwords do not match"))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Registration Error"
         popup.open()
     elif not re.search(r'[a-z]', user) or (len(user) < 4):
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text="Username must not be empty\n"
                                     "and a minimum of 4 characters"))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Registration Error"
         popup.open()
     elif (len(pwd) < 6) or not re.search(r'[a-z]', pwd) or not re.search(r'[0-9]', pwd):
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text="Password must not be empty and a\n"
                                     "minimum of 6 characters and numbers"))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Registration Error"
         popup.open()
     else:
         f = open(self.user_db, mode='w')
         f.write(str(Crypter.encrypt(user)))
         f.write(':sep:')
         f.write(str(Crypter.encrypt(pwd)))
         f.close()
         self.get_index('Login')
         self.load_screen(self.index)
 def login(self, user, pwd):
     f = open(self.user_db, mode='r')
     file_c = f.read()
     f.close()
     user = Crypter.encrypt(user)
     pwd = Crypter.encrypt(pwd)
     tab_user = file_c.split(':sep:')
     user_f = tab_user[0]
     pwd_f = tab_user[1]
     if (str(user_f) != str(user)) or (str(pwd_f) != str(pwd)):
             popup = Popup(size_hint=(None, None), size=(300, 150))
             popup.add_widget(Label(text="Wrong username or password"))
             popup.bind(on_press=popup.dismiss)
             popup.title = "Bad Credentials"
             popup.open()
     else:
         Active.user = user
         Active.cl.load_list(Active.cl)
         if not Active.cl.c_list:
             self.get_index('AddServ')
         else:
             self.get_index('Chooser')
         self.load_screen(self.index)
 def addQR(self, filename):
     try:
         if not filename or not re.search(r'^[\'"]?(?:/[^/]+)*[\'"]?$', filename):
             raise EmptyFields("Incorrect format for filename")
     except EmptyFields as ef:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=ef.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Input Error"
         popup.open()
         return
     try:
         Active.qr_task.add_to_qr(Active.client, filename)
     except QrException as qr:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=qr.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = qr.title
         popup.open()
         return
     Active.changed['qr'] = 1
     self.get_index("Quarantine")
     self.load_screen(self.index)