コード例 #1
0
 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()
コード例 #2
0
 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()
コード例 #3
0
 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()
コード例 #4
0
 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()
コード例 #5
0
ファイル: main.py プロジェクト: katsob/InspectorBudget
 def on_long_press(self):
     files = os.listdir(
         os.path.join(os.getcwd(),
                      load_config()["device_path"]))
     if any([x.endswith('tmp') for x in files]):
         print('COFAM')
         day = self.parent.parent.ids.date.dp.text.split(',')[1][1:]
         data = Data(filename=datename(day))
         with open(data.tmp_path, 'r') as f:
             lines = json.load(f)
         if len(lines) > 1:
             with open(data.tmp_path, 'w') as f:
                 json.dump(lines[:-1], f)
         else:
             os.remove(data.tmp_path)
         pop = Popup()
         pop.title = 'Komunikat'
         pop.separator_height = 0
         pop.size_hint = (.5, .4)
         pop.content = Button(text='Operacja cofnięta')
         pop.content.bind(on_press=pop.dismiss)
         pop.open()
     else:
         pop = Popup()
         pop.title = 'Komunikat'
         pop.separator_height = 0
         pop.size_hint = (.6, .2)
         pop.content = Button(text='Brak nowych wpisów')
         pop.content.bind(on_press=pop.dismiss)
         pop.open()
コード例 #6
0
 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
コード例 #7
0
 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)
コード例 #8
0
    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)
コード例 #9
0
ファイル: main.py プロジェクト: raymag/PyTask
        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()
コード例 #10
0
ファイル: processingZ.py プロジェクト: PatrickRogger/PampaMT
    def not_yet_implemented(self):
        popup = Popup(size_hint=[None, None])
        popup.height = 70
        popup.width = 200

        popup.title = self.lang['Not_yet_implemented']
        popup.open()
コード例 #11
0
ファイル: processingZ.py プロジェクト: PatrickRogger/PampaMT
    def not_yet_implemented(self):
        popup = Popup(size_hint=[None, None])
        popup.height = 70
        popup.width = 200

        popup.title = self.lang['Not_yet_implemented']
        popup.open()
コード例 #12
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
コード例 #13
0
 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()
コード例 #14
0
    def game_over_popUp(self):

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'Your score: ' + str(
            self.score) + '\nHighest score: ' + str(self.highest_score)
        if self.critical:
            myLabel.text = myLabel.text + '\nYou must score at least ' + str(
                self.goal) + '\nto unlock next level'

        button = Button()
        button.text = 'Ok'
        button.size_hint_y = 0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Result: Level ' + str(self.puzzle_index + 1)
        popUp.content = myBox
        popUp.size_hint = (0.8, 0.5)
        popUp.auto_dismiss = False

        button.bind(on_release=self.reset_timer)

        self.game_over_message_popUp = popUp
        self.game_over_message_popUp.open()
コード例 #15
0
    def artist_unavailable_popUp(self):

        #MOVE THESE TO SOMEWHERE BETTER

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'Artist fanpage is\nunavailable at this time'

        button = Button()
        button.text = 'Dismiss'
        button.size_hint_y = 0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Level locked'
        popUp.content = myBox
        popUp.size_hint = (0.5, 0.5)
        popUp.auto_dismiss = False

        button.bind(on_release=popUp.dismiss)

        popUp.open()
コード例 #16
0
    def state_goal_popUp(self):

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()

        if ArtInfo.max_score[self.puzzle_index] != None:
            myLabel.text = 'Reach score of ' + str(
                self.goal) + '\nto unlock next stage.\n\
Maximum score: ' + str(ArtInfo.max_score[self.puzzle_index])
        else:
            myLabel.text = 'Reach score of ' + str(
                self.goal) + '\nto unlock next stage.\n\
Maximum score: unlimtied'

        button = Button()
        button.text = 'Ok!'
        button.size_hint_y = 0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Mission'
        popUp.content = myBox
        popUp.size_hint = (0.8, 0.5)
        popUp.auto_dismiss = False

        button.bind(on_release=self.start_timing_press)

        return popUp
コード例 #17
0
    def locked_pop_up(self):
        #A LOT OF LITERAL

        from kivy.uix.label import Label

        myBox=BoxLayout()
        myBox.orientation='vertical'
        
        myLabel=Label()
        myLabel.text='Clear previous stage\nto unlock this level'
        myLabel.valign='middle'
        myLabel.halign='center'

        button=Button()
        button.text='Dismiss'
        button.size_hint_y=0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)
        
        popUp=Popup()
        popUp.title='Level locked'
        popUp.content=myBox
        popUp.size_hint=(0.7,0.5)

        button.bind(on_release=popUp.dismiss)
        
        return popUp
コード例 #18
0
    def expand_query_search(self):

        # Get expanded query
        query_str = self.ids['search_query_input'].text
        query_expanded = expand_query(query_str, self.model_selected)
        query = self.vsm_models[self.corpus_selected].to_vector(
            query_str) if self.model_selected == 'vsm' else query_str

        # Buttons for options
        yes_btn = Button(text='Expanded',
                         on_press=partial(self.search, query_expanded,
                                          query_str))
        no_btn = Button(text='Original',
                        on_press=partial(self.search, query, query_str))

        # Popup
        box_layout = BoxLayout(orientation='horizontal')
        box_layout.add_widget(yes_btn)
        box_layout.add_widget(no_btn)
        query_expansion_popup = Popup()
        query_expansion_popup.add_widget(box_layout)
        query_expansion_popup.title = str(query_expanded)
        query_expansion_popup.title_align = "center"
        query_expansion_popup.size_hint = None, None
        query_expansion_popup.size = 800, 400
        query_expansion_popup.open()

        return
コード例 #19
0
ファイル: client.py プロジェクト: SilvanKohler/kiosk
    def on_press(self, instance):
        renew_timeout()
        global times, user, registration_fields
        if focused is not None:
            Clock.schedule_once(focused.refocus, 0.1)

        # logger.debug('Application: '+time.time() - times.get(instance.text, time.time() - 100))
        if time.time() - times.get(instance.text, time.time() - 100) > .05:
            times.update({instance.text: time.time()})
            # logger.debug('Application: '+instance.text)
            if focused is not None:
                if instance.text not in ('DEL', 'SPEICHERN'):
                    focused.insert_text(instance.text)
                elif instance.text == 'DEL':
                    focused.do_backspace()
                elif instance.text == 'SPEICHERN':
                    if '' in (RS.ids['firstname'].text,
                              RS.ids['lastname'].text, RS.ids['email'].text):
                        b = BoxLayout()
                        b.orientation = 'vertical'
                        b.add_widget(
                            Label(text='Bitte alle Felder ausfüllen!'))
                        btn = Button(text='Ok')
                        b.add_widget(btn)
                        p = Popup()
                        p.title = 'Fehler'
                        p.content = b
                        btn.bind(on_press=p.dismiss)
                        p.open()
                        return
                    # Create user
                    user = data.register_user(RS.ids['firstname'].text,
                                              RS.ids['lastname'].text,
                                              RS.ids['email'].text, badge_)
                    logout()
コード例 #20
0
    def are_you_sure_exit(self):

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'Are you sure\nyou wanna exit the game?'

        button = Button()
        button.text = 'No'
        button.size_hint_y = 0.2

        button1 = Button()
        button1.text = 'Yes'
        button1.size_hint_y = 0.2

        bar = Widget()
        bar.size_hint_y = 0.02

        myBox.add_widget(myLabel)
        myBox.add_widget(button1)
        myBox.add_widget(bar)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Exiting the game'
        popUp.content = myBox
        popUp.size_hint = (0.8, 0.8)

        button.bind(on_release=popUp.dismiss)
        button1.bind(on_release=self.exit_application)

        return popUp
コード例 #21
0
    def achievement_popUp(self):
        #MUST BE CALLED AFTER CALLING self.achievement_update() above

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = self.achievement_update()
        myLabel.size_hint_y = len(ArtInfo.fanpage_url) * 0.07

        myScroll = ScrollView()
        myScroll.add_widget(myLabel)

        button = Button()
        button.text = 'Dismiss'
        button.size_hint_y = 0.15

        myBox.add_widget(myScroll)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Highest scores'
        popUp.content = myBox
        popUp.size_hint = (0.9, 0.8)

        button.bind(on_release=popUp.dismiss)

        popUp.open()
コード例 #22
0
def get_stock_data(row_text, dt):

    sym = row_text[9:-7]
    if not sym.isalpha():
        print('%s not a symbol' % sym)
        return

    nse = Nse()
    print('getting nse price for stock ', sym)
    q = nse.get_quote(sym)
    popup = Popup()
    popup.title = 'Live data for ' + sym
    popup.size_hint = (.7, .6)
    popup.pos_hint = {'center_x': .5, 'center_y': .5}

    if q is not None:
        ltp = q['lastPrice']
        low = q['dayLow']
        high = q['dayHigh']
        high52 = q['high52']
        low52 = q['low52']
        prevClose = q['previousClose']
        pChange = q['pChange']
        val = get_ltp_string(sym, ltp, prevClose, pChange)
        c1 = Label(text='Symbol')
        c2 = Label(text=sym)
        c3 = Label(text='PrevClose')
        c4 = Label(text=str(prevClose))
        c5 = Label(text='Last Price')
        c6 = Label(text=val, markup=True)
        c7 = Label(text='Day Low')
        c8 = Label(text=str(low))
        c9 = Label(text='Day High')
        c10 = Label(text=str(high))
        c11 = Label(text='52 week Low')
        c12 = Label(text=str(low52))
        c13 = Label(text='52 week High')
        c14 = Label(text=str(high52))
        # add the data
        gridlayout = GridLayout(cols=2)
        gridlayout.add_widget(c1)
        gridlayout.add_widget(c2)
        gridlayout.add_widget(c3)
        gridlayout.add_widget(c4)
        gridlayout.add_widget(c5)
        gridlayout.add_widget(c6)
        gridlayout.add_widget(c7)
        gridlayout.add_widget(c8)
        gridlayout.add_widget(c9)
        gridlayout.add_widget(c10)
        gridlayout.add_widget(c11)
        gridlayout.add_widget(c12)
        gridlayout.add_widget(c13)
        gridlayout.add_widget(c14)
        content = gridlayout
    else:
        content = Label(text='No data available for symbol ' + sym)
    popup.content = content
    popup.open()
    MDApp.get_running_app().stock_fetch = False
コード例 #23
0
    def unvailable_feature_popUp_creator(self):

        #I WILL MAKE THE FEATURES SIMPLE UNAVAILABLE FOR NOW

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'This feature will be\navailable in future version'

        button = Button()
        button.text = 'Dismiss'
        button.size_hint_y = 0.3

        myBox.add_widget(myLabel)
        myBox.add_widget(button)

        popUp = Popup()
        popUp.title = 'Feature not yet available'
        popUp.content = myBox
        popUp.size_hint = (0.8, 0.5)

        button.bind(on_release=popUp.dismiss)

        return popUp
コード例 #24
0
    def disrupt_game_popUp(self):

        myBox = BoxLayout()
        myBox.orientation = 'vertical'

        myLabel = Label()
        myLabel.text = 'This will quit the current game.\nAre you sure?'

        button1 = Button()
        button1.text = 'Yes'
        button1.size_hint_y = 0.2

        button2 = Button()
        button2.text = 'No'
        button2.size_hint_y = 0.2

        bar = Widget()
        bar.size_hint_y = 0.02

        myBox.add_widget(myLabel)
        myBox.add_widget(button1)
        myBox.add_widget(bar)
        myBox.add_widget(button2)

        popUp = Popup()
        popUp.title = 'Stop the game?'
        popUp.content = myBox
        popUp.size_hint = (0.9, 0.8)
        popUp.auto_dismiss = False

        #button.bind(on_release=popUp.dismiss)
        button1.bind(on_release=self.disrupt_yes)
        button2.bind(on_release=self.disrupt_no)

        return popUp
コード例 #25
0
    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)
コード例 #26
0
 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)
コード例 #27
0
    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)
コード例 #28
0
 def show_file_explorer(self):
     popup = Popup(size_hint=(0.8, 0.8))
     file_explorer = FileChooserListView(
         filters=['*.jpg', '*.png', '*.jpeg'])
     file_explorer.bind(on_submit=self.show_add_slide)
     file_explorer.popup = popup
     popup.content = file_explorer
     popup.title = _('File explorer')
     popup.open()
コード例 #29
0
 def connect(self, idx):
     netw = Networker()
     try:
         netw.connect_to(Active.cl.c_list[idx])
         netw.send_val(Active.cl.c_list[idx].token)
         if netw.get_ack() != netw.SOCK_ACK:
             raise BadCredentials("Connection rejected by " + Active.cl.c_list[idx].name)
         netw.send_val(Active.cl.c_list[idx].password)
         if netw.get_ack() != netw.SOCK_ACK:
             raise BadCredentials("Connection rejected by " + Active.cl.c_list[idx].name)
         netw.send_val(str(NET_CONNEC) + ":0")
         netw.s.close()
         Active.client = Active.cl.c_list[idx]
         Active.conf_task.get_config(Active.client)
     except BadCredentials as bc:
         popup = Popup(size_hint=(None, None), size=(300, 150))
         popup.add_widget(Label(text=bc.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Wrong Credentials"
         popup.open()
         return
     except ConnectionError:
         popup = Popup(size_hint=(None, None), size=(300, 150))
         popup.add_widget(Label(text="Unable to connect to host " + Active.cl.c_list[idx].name))
         popup.bind(on_press=popup.dismiss)
         popup.title = "Connection Error"
         popup.open()
         return
     except NoConnectivity:
         popup = Popup(size_hint=(None, None), size=(300, 150))
         popup.add_widget(Label(text="Unable to connect to host " + Active.cl.c_list[idx].name))
         popup.bind(on_press=popup.dismiss)
         popup.title = "No connectivity"
         popup.open()
         return
     except ConfigException as ce:
         popup = Popup(size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text=ce.value))
         popup.bind(on_press=popup.dismiss)
         popup.title = ce.title
         popup.open()
         return
     self.get_index('Scanner')
     self.load_screen(self.index)
コード例 #30
0
ファイル: main.py プロジェクト: PrestaMath/reverse_tile
    def popup_pass_turn(self):
        btn_ok = Button(text='Ok')
        popup = Popup(title='You have to pass your turn' ,content=btn_ok, auto_dismiss=False,
                      size_hint=(None, None), size=(Window.width/2,Window.height/2))

        if self.player == 'X':
            popup.title = 'Computer has to pass turn'
            Clock.schedule_once(popup.dismiss, 3)
            
        btn_ok.bind(on_press=popup.dismiss)
        popup.open()
コード例 #31
0
    def popup_pass_turn(self):
        btn_ok = Button(text='Ok')
        popup = Popup(title='You have to pass your turn' ,content=btn_ok, auto_dismiss=False,
                      size_hint=(None, None), size=(Window.width/2,Window.height/2))

        if self.player == 'X':
            popup.title = 'Computer has to pass turn'
            Clock.schedule_once(popup.dismiss, 3)
            
        btn_ok.bind(on_press=popup.dismiss)
        popup.open()
コード例 #32
0
    def create_protocol(self):
        """ go to creating protocol popup """

        popup = Popup(background="utilities/blackgreen.jpg",
                      auto_dismiss=False,
                      size_hint=(None, None),
                      size=(1500, 1000))
        popup.title = self.team_one + "     vs.     " + self.team_two
        popup.title_align = 'center'
        popup.title_size = '28sp'
        popup.content = MatchPopup(popup, self)
        popup.open()
コード例 #33
0
ファイル: main.py プロジェクト: PatrickRogger/PampaMT
 def open_popup_new_dir(self, path):
     poupup = Popup(content=PopupNewDir(make_new_dir=self.make_new_dir))
     poupup.title = lang['New_Folder']
     poupup.title_size = 16
     poupup.size_hint = None, None
     poupup.height = 120
     poupup.width = 250
     poupup.id = 'pop_new_dir'
     self.ids['pop_new_dir'] = poupup
     global path_new_dir
     self.path_new_dir = path
     poupup.open()
コード例 #34
0
ファイル: main.py プロジェクト: PatrickRogger/PampaMT
 def open_popup_new_dir(self,path):
     poupup = Popup(content=PopupNewDir(make_new_dir=self.make_new_dir))
     poupup.title = lang['New_Folder']
     poupup.title_size = 16
     poupup.size_hint = None, None
     poupup.height = 120
     poupup.width = 250
     poupup.id = 'pop_new_dir'
     self.ids['pop_new_dir'] = poupup
     global path_new_dir
     self.path_new_dir = path
     poupup.open()
コード例 #35
0
 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
コード例 #36
0
 def setConf(self, *kwargs):
     modified = False
     for arg in kwargs:
         if arg.__class__ is CfgCheckBox:
             if arg.active is not bool(Active.confList.get_value(arg.value1, arg.value2)):
                 tmp = Active.confList
                 Active.confList.set_config(arg.value1, arg.value2, int(arg.active))
                 try:
                     Active.conf_task.send_conf_mod(Active.client, arg.value1, arg.value2, str(int(arg.active)))
                 except ConfigException as ce:
                     Active.confList = tmp
                     popup = Popup(size_hint=(None, None), size=(400, 150))
                     popup.add_widget(Label(text=ce.value))
                     popup.bind(on_press=popup.dismiss)
                     popup.title = ce.title
                     popup.open()
                     return
                 modified = True
         else:
             if str(arg.text) != Active.confList.get_value(arg.value1, arg.value2):
                 tmp = Active.confList
                 Active.confList.set_config(arg.value1, arg.value2, arg.text)
                 try:
                     Active.conf_task.send_conf_mod(Active.client, arg.value1, arg.value2,
                                                    Active.confList.get_value_res(arg.value1, arg.value2))
                 except ConfigException as ce:
                     Active.confList = tmp
                     popup = Popup(size_hint=(None, None), size=(400, 150))
                     popup.add_widget(Label(text=ce.value))
                     popup.bind(on_press=popup.dismiss)
                     popup.title = ce.title
                     popup.open()
                     return
                 modified = True
     if modified:
         popup = Popup(title='Configuration Saved', size_hint=(None, None), size=(400, 150))
         popup.add_widget(Label(text="Configuration settings have been saved"))
         popup.bind(on_press=popup.dismiss)
         popup.open()
コード例 #37
0
 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
コード例 #38
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
コード例 #39
0
 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)
コード例 #40
0
 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)
コード例 #41
0
    def make_calendar(self):
        popup = Popup()
        popup.title = 'Calendar'
        layout = BoxLayout(orientation='vertical')
        inner_layout_1 = BoxLayout(size_hint=(1, 0.9),
                                   orientation='vertical')
        calendar_selection = GridLayout(cols=4,
                                        rows=1,
                                        size_hint=(1, 0.1))
        prev_month = Button(markup=True,
                            text="<",
                            font_size="30sp",
                            on_release=self.prev_month)
        next_month = Button(markup=True,
                            text=">",
                            font_size="30sp",
                            on_release=self.next_month)
        select_month = Factory.SelectMonth()
        self.month_button = Button(text='{}'.format(vars.month_by_number(self.month)),
                                   on_release=select_month.open)
        for index in range(12):
            month_options = Button(text='{}'.format(vars.month_by_number(index)),
                                   size_hint_y=None,
                                   height=40,
                                   on_release=partial(self.select_calendar_month, index))
            month_options.on_press = select_month.select(self.month_button.text)
            select_month.add_widget(month_options)

        select_month.on_select = lambda instance, x: setattr(self.month_button, 'text', x)
        select_year = Factory.SelectMonth()

        self.year_button = Button(text="{}".format(self.year),
                                  on_release=select_year.open)
        for index in range(10):
            year_options = Button(text='{}'.format(int(self.year) + index),
                                  size_hint_y=None,
                                  height=40,
                                  on_release=partial(self.select_calendar_year, index))
            year_options.on_press = select_year.select(self.year_button.text)

        select_month.bind(on_select=lambda instance, x: setattr(self.month_button, 'text', x))
        calendar_selection.add_widget(prev_month)
        calendar_selection.add_widget(self.month_button)
        calendar_selection.add_widget(self.year_button)
        calendar_selection.add_widget(next_month)
        self.calendar_layout = GridLayout(cols=7,
                                          rows=8,
                                          size_hint=(1, 0.9))
        self.create_calendar_table()

        inner_layout_1.add_widget(calendar_selection)
        inner_layout_1.add_widget(self.calendar_layout)
        inner_layout_2 = BoxLayout(size_hint=(1, 0.1),
                                   orientation='horizontal')
        inner_layout_2.add_widget(Button(markup=True,
                                         text="cancel",
                                         on_release=popup.dismiss))

        layout.add_widget(inner_layout_1)
        layout.add_widget(inner_layout_2)
        popup.content = layout
        popup.open()