Python kivy.uix.popup 模块,Popup() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用kivy.uix.popup.Popup()

项目:POS-System    作者:obernardovieira    | 项目源码 | 文件源码
def userLogin(self):
        content = LoginScreen(root_self = self)

        ##
        self.popup = Popup(
                        title           = 'User Login',
                        content         = content,
                        auto_dismiss    = False,
                        size_hint       = (None, None),
                        size            = (400, 170)
                    )

        # open the popup
        self.popup.open()

    ###
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(FileChooser, self).__init__(**kvargs)

        box = BoxLayout(orientation="vertical", spacing=10)
        filechooser = FileChooserListView()
        filechooser.bind(selection=self.select_callback)
        box.add_widget(filechooser)

        if self.filter == "folder":
            box.add_widget(SettingSpacer())
            box.add_widget(Button(text=self.text_button_select,
                                  size_hint=(1, .1),
                                  on_press=self.select_callback))
            filechooser.filters = [self.is_dir]
        elif self.filter == "files":
            filechooser.filters = [self.is_file]

        self.body = Popup(title=self.title, content=box, size_hint=self.size,
                          auto_dismiss=self.auto_dismiss,
                          background=self.background_image)
        self.body.bind(on_dismiss=self.dismiss_callback)
        self.body.open()
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(KDialog, self).__init__(**kvargs)

        self.orientation = "vertical"
        self.param = None

        # ???? ??? ?????? ?????? "??-???-??????".
        self.box_buttons_select = BoxLayout(orientation="horizontal",
                                            size_hint_y=None, height=40)
        self.scroll = ScrollView()
        self.box_content = GridLayout(cols=2, size_hint_y=None)
        self.box_content.bind(minimum_height=self.box_content.setter("height"))
        self.body = Popup(title_align=self.title_align,
                          background=self.background_image,
                          on_dismiss=self.dismiss_callback)
        # ??? ???? ?????????.
        with self.box_content.canvas:
            Color(0.16, 0.16, 0.16)
            self.canvas_for_box_content = \
                Rectangle(pos=(5, 5), size=(self.box_content.width,
                                            self.box_content.height))
            self.box_content.bind(size=self._update_canvas_size,
                                  pos=self._update_canvas_size)

        self.scroll.add_widget(self.box_content)
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def _update_canvas_size(self, instance, value):
        """?????????? ??? ????????? ??????? ?????? ??????????.

        type instance: instance <kivy.uix.gridlayout.GridLayout object'>;

        type value: list;
        param value: ??????? ?????? instance;

        """

        self.canvas_for_box_content.pos = instance.pos
        self.canvas_for_box_content.size = instance.size

        # ????????? ?????? ???? Popup - ???? ?????????.
        self.body_message.height = self.canvas_for_box_content.size[1] + 150
        if self.body_message.height > Window.size[1]:
            self.body_message.height = Window.size[1] - 10
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(SelectColor, self).__init__(**kvargs)

        box = BoxLayout(orientation="vertical")
        select_color = ColorPicker(hex_color=self.default_color)
        button_select = Button(text=self.text_button_ok, size_hint=(1, .1))

        box.add_widget(select_color)
        box.add_widget(Widget(size_hint=(None, .02)))
        box.add_widget(SettingSpacer())
        box.add_widget(Widget(size_hint=(None, .02)))
        box.add_widget(button_select)

        self.body = Popup(title=self.title, content=box, size_hint=self.size,
                          background=self.background_image)
        self.body.bind(on_dismiss=self.dismiss_callback)

        button_select.bind(on_press=lambda color: self.select_callback(
            select_color.hex_color), on_release=lambda *args: self.body.dismiss())
        self.body.open()
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def _update_canvas_size(self, instance, value):
        """?????????? ??? ????????? ??????? ?????? ??????????.

        type instance: instance <kivy.uix.gridlayout.GridLayout object'>;

        type value: list;
        param value: ??????? ?????? instance;

        """

        self.canvas_for_box_content.pos = instance.pos
        self.canvas_for_box_content.size = instance.size

        # ????????? ?????? ???? Popup.
        self.body.height = self.canvas_for_box_content.size[1] + 70
        self.body.width = int(Window.size[0] / self.size_hint_x)

        if self.body.height > Window.size[1]:
            self.body.height = Window.size[1] - 10
项目:FunUtils    作者:HoussemCharf    | 项目源码 | 文件源码
def game(self,instance):
        letters=self.letttersinput.text
        letters = ",".join(list(letters))
        #post data
        mydata=[('letters', letters),('order','length'),('pos','beg'),('dic','1'),('table','dict')]
        #Encoding
        mydata=urllib.urlencode(mydata)
        codedPath ='''aHR0cDovL3d3dy50aGV3b3JkZmluZGVyLmNvbS9zY3JhYmJsZS5waHA='''
        path=base64.b64decode(codedPath)
        req=urllib2.Request(path, mydata)
        req.add_header("Content-type", "application/x-www-form-urlencoded")
        page=urllib2.urlopen(req).read()
        # applying beautifulsoup for parsing
        soup = BS(page,"html.parser")
        # parsing the div with id
        res = soup.find("div", { "id" : "displayresults" })
        Con= res.contents[1].contents[1]
        line=""
        for child in Con.children:
            line+= child.string
        popup = Popup(title="Result",content=Label(text=line))
        popup.open()
项目:POS-System    作者:obernardovieira    | 项目源码 | 文件源码
def addToBuyList(self, obj):
        if(self.pos_system.getBuyList() == None):
            content = Label(text = 'You need to start a new list!')
            popup = Popup(
                        title           = 'No Buy List',
                        content         = content,
                        size_hint       = (None, None),
                        size            = (400, 100)
                    )

            # open the popup
            popup.open()
            return

        button = Button(text=obj.text, size_hint_y = None, height = 40)
        button.bind(on_press = self.removeFromBuyList)
        self.a_buylist.add_widget(button)
        self.pos_system.getBuyList().addItem(obj.item)
        self.updateTotalPrice()

    ###
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def set_info(self, data_to_write, x_hint_list, num_rows_to_add = 3):
        #Takes in the file data, and updates the Grid to represent
        #and indicate the files that are loaded with their metadata.

        if len(data_to_write) != self.cols:
            print('--Set info:  Data mismatch error.')
            popup = Popup(title='Grid Error 02',
                    content=Label(text = 'There was a problem in updating the grid.'),
                    size_hint = (0.3, 0.3))
            popup.open()
        else:
            threshold = 3
            #If < threshold available rows left, add more
            if self._avail < threshold:
                self.create_grid(x_hint_list, num_rows_to_add)

            length = len(self.children)
            next_row = self.find_next_row()
            end = length - (next_row * self.cols)
            start = end - self.cols
            for i, widget in enumerate(reversed(self.children[start:end])):
                #strip text primarily for title and artist, so shorten
                #doesn't take into account the trailing whitespace
                widget.text = data_to_write[i].strip()
            self._avail -= 1
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def load_audio_file(self, path):
        from kivy.core.audio import SoundLoader

        sound = SoundLoader.load(path)
        self._sound = sound

        if sound:
            update_bar_schedule = Clock.schedule_interval(self.update_bar, 1)
            self._update_bar_schedule = update_bar_schedule

            self.ids.p_bar.max = sound.length
            sound.volume = self.ids.volume_slider.value
            sound.play()
        else:
            print('Cannot play the file %s.' % path)
            error_msg = 'Cannot play the file %s.' % (path) if path else 'No file selected.'
            popup = Popup(title='Audio Error.',
                    content=Label(text= error_msg),
                    size_hint = (0.3, 0.3))
            popup.open()
项目:farmgame    作者:fivedigits    | 项目源码 | 文件源码
def on_release(self):

        label = Label(size_hint_y=None,size_hint_x=None)

        label.bind(texture_size=label.setter('size'))

        fob = open("help.txt")

        label.text = fob.read()

        fob.close()

        content = ScrollView(size_hint=(1,1))

        content.add_widget(label)

        popup = Popup(title="Help",content=content,size_hint=(0.6,0.6)).open()
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def onGoTo(self):
        if self.loaded == 'Yes':
            popup = BoxLayout(
                orientation='vertical',
                size=self.size,
                pos=self.pos)
            self.goto_popup = Popup(title='Go To' +
                                    '          (1~' +
                                    str(len(self.data_view)) +
                                    ')', content=popup, size_hint=(0.9, 0.25), auto_dismiss=False)
            self.goto_textinput = TextInput()
            cancel = Button(text='Cancel', on_release=self.dismiss_goto_popup)
            ok = Button(text='Ok', on_release=self.goto_ok)
            buttons = BoxLayout(size_hint_y=None, height=self.height / 20)
            buttons.add_widget(cancel)
            buttons.add_widget(ok)
            popup.add_widget(self.goto_textinput)
            popup.add_widget(buttons)
            self.goto_popup.open()
项目:webupdate    作者:Bakterija    | 项目源码 | 文件源码
def update_dialog(self, cur_build, upd_build):
        popup = Popup(title='Update', content=ScrollView(), size_hint=(0.8,None), height=cm(5))
        grid = GridLayout(cols=1, spacing=0, size_hint_y=None)
        grid.bind(minimum_height= grid.setter('height'))
        con = StackLayout()
        grid.add_widget(con)
        popup.content.add_widget(grid)
        lbl1 = Label(text='Current build is %s' % (cur_build), size_hint_y=None, height=cm(1))
        lbl2 = Label(text='Build %s available' % (upd_build), size_hint_y=None, height=cm(1))
        btn1 = Button(text='Cancel', size_hint=(0.5, None), height=cm(1))
        btn2 = Button(text='Update', size_hint=(0.5, None), height=cm(1))
        btn1.bind(on_release=popup.dismiss)
        btn2.bind(on_release=lambda x: {self.update(), popup.dismiss()})
        for x in (lbl1, lbl2, btn1, btn2):
            con.add_widget(x)
        popup.open()
项目:webupdate    作者:Bakterija    | 项目源码 | 文件源码
def update_dialog(self, cur_build, upd_build):
        popup = Popup(title='Update', content=ScrollView(), size_hint=(0.8,None), height=cm(5))
        grid = GridLayout(cols=1, spacing=0, size_hint_y=None)
        grid.bind(minimum_height= grid.setter('height'))
        con = StackLayout()
        grid.add_widget(con)
        popup.content.add_widget(grid)
        lbl1 = Label(text='Current build is %s' % (cur_build), size_hint_y=None, height=cm(1))
        lbl2 = Label(text='Build %s available' % (upd_build), size_hint_y=None, height=cm(1))
        btn1 = Button(text='Cancel', size_hint=(0.5, None), height=cm(1))
        btn2 = Button(text='Update', size_hint=(0.5, None), height=cm(1))
        btn1.bind(on_release=popup.dismiss)
        btn2.bind(on_release=lambda x: {self.update(), popup.dismiss()})
        for x in (lbl1, lbl2, btn1, btn2):
            con.add_widget(x)
        popup.open()
项目:kivy_gosh    作者:mcroni    | 项目源码 | 文件源码
def read(self,*largs):
        content = FloatLayout()
        scroll = ScrollView()
        mdlist = MDList()
        content.add_widget(scroll)
        scroll.add_widget(mdlist)
        title = "Testimonies"
        pop = Popup(title= title,content= content,)
        pop.open()
        try:
            for message in Testify.select():
                time.sleep(0.50)
                mdlist.add_widget(PopList(text=str(message.name),secondary_text=str(message.message)))
            print('reading testimonies')
        except peewee.OperationalError:
            self.login_failure('Check Network Connection')
            # mdlist.add_widget(PopList(text=str('Error'), secondary_text=str('Please Check Internet Connection')))
项目:AppLogin    作者:KugiHaito    | 项目源码 | 文件源码
def reg(args, n, p):
        if n == "Nickname.." or n == "":
            p = Popup(title='Login Error', content=Label(text="Digite seu apelido!", color=(1,0,0,1)),size_hint=(.6, .2))
            p.open()
        elif p == "Password.." or p == "":
            p = Popup(title='Login Error', content=Label(text="Digite sua senha!", color=(1,0,0,1)),size_hint=(.6, .2))
            p.open()
        else:
            # Tratando dados..
            name = addslashes(n)
            pswd = addslashes(p)
            sql = "select * from users where nickname = '"+name+"'"
            rows = cur.execute(sql)
            if rows > 0:
                p = Popup(title='Login Error', content=Label(text="Este apelido esta em uso!", color=(1,0,0,1)),size_hint=(.6, .2))
                p.open()
            else:
                sql = "insert into users (nickname, passwd, level, photo, online) values ('"+name+"', '"+pswd+"', 'Usuario', default, '0')"
                cur.execute(sql)
                con.commit()
                p = Popup(title='Cadastramento Concluído', content=Label(text=name+", Cadastrado com sucesso!", color=(0,1,0,1)),size_hint=(.6, .2))
                p.open()
项目:SnapchatClone    作者:FOC96    | 项目源码 | 文件源码
def do_login(self, loginText, passwordText):
        a = SnapDB()
        val = a.checkLogin(nickname=loginText, password=passwordText)
        userID = val[1]

        if val[1] != None:
            a = SnapDB()
            a.getUserData(userID)
            popup = Popup(title='Hola', content=Label(text='Hi '+localFiles.getLocalUserInfo()[2].split(" ")[0]+', happy snapchatting!'), size_hint=(None, None), size=(350, 200))
            popup.open()
            self.manager.transition = SlideTransition(direction="left")
            self.manager.current = 'connected'
        else:
            popup = Popup(title='Error', content=Label(text='The password or username are incorrect. Try again.'), size_hint=(None, None), size=(350, 200))
            popup.open()

        app = App.get_running_app()

        app.config.read(app.get_application_config())
        app.config.write()
项目:SnapchatClone    作者:FOC96    | 项目源码 | 文件源码
def checkSnapInbox(self):
        try:
            print("Looking for snaps...")
            a = Snap()
            namesFound = a.getImageName(localFiles.getLocalUserInfo()[0])[0]
            idsFound = a.getImageName(localFiles.getLocalUserInfo()[0])[1]

            if len(namesFound) == 0:
                popup = Popup(title='Oops!', content=Label(text='There are no new snaps for you, '+localFiles.getLocalUserInfo()[2].split(" ")[0]), size_hint=(None, None), size=(350, 200))
                popup.open()
            else:
                for x in range(len(namesFound)):
                    img = str(namesFound[x]).strip()
                    ImageFunctions.showImg(img)
                a.updateSnapStatus(localFiles.getLocalUserInfo()[0])
        except:
            print("ERROR")
项目:KivMob    作者:MichaelStott    | 项目源码 | 文件源码
def desktop_warning(self):
        layout = BoxLayout(orientation='vertical')
        layout.add_widget(Label(text='KivMob will not display ads on ' +\
                          'nonmobile platforms. You must build an ' +\
                          'Android project to demo ads. (iOS not yet ' +\
                          'supported)',
                          size_hint_y=1,
                          text_size=(250,  None),
                          halign='left',
                          valign='middle'))
        button_layout = BoxLayout()
        button1=Button(text="Open Build Steps", size_hint=(0.8, 0.2))
        button1.bind(on_release = lambda x :
                     webbrowser.open("https://www.google.com"))
        button_layout.add_widget(button1)
        button2=Button(text="Close", size_hint=(0.8, 0.2))
        button2.bind(on_release = lambda x : popup.dismiss())
        button_layout.add_widget(button2)
        layout.add_widget(button_layout)
        popup = Popup(title='KivMob Demo Alert',
                      content=layout,
                      size_hint=(0.9, 0.9))
        popup.open()
项目:KivMob    作者:MichaelStott    | 项目源码 | 文件源码
def interstitial_warning(self):
        layout = BoxLayout(orientation='vertical')
        layout.add_widget(Label(text="Ad has not loaded. " +\
                                    "Wait a few seconds and then " +\
                                    "try again.",
                                    size_hint_y=1,
                                    text_size=(250,  None),
                                    halign='left',
                                    valign='middle'))
        button_layout = BoxLayout()
        close=Button(text="Close", size_hint=(0.8, 0.2))
        close.bind(on_release = lambda x : popup.dismiss())
        button_layout.add_widget(close)
        layout.add_widget(button_layout)
        popup = Popup(title='KivMob Demo Alert',
                      content=layout,
                      size_hint=(0.9, 0.9))
        popup.open()
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kvargs):
        super(AboutDialog, self).__init__(**kvargs)
        if self.flag:
            self.background_box_content = [0.0, 0.0, 0.0, 1.0]

        box_content = self.ids.box_content
        height, avatar_size_hint = (60, (.05, .9)) if not self.flag \
            else (120, (.1, 1))

        self.ids.logo.size_hint = avatar_size_hint
        self.ids.box_logo_and_title.height = height

        # ????????? ??????????.
        for info_string in self.info_program:
            if info_string == "":
                box_content.add_widget(SettingSpacer())
                continue

            info_string = \
                Label(text=info_string, size_hint_y=None,
                      font_size=self.base_font_size, markup=True,
                      on_ref_press=self.events_callback)
            info_string.bind(size=lambda *args: self._update_label_size(args))
            box_content.add_widget(info_string)

        if not self.flag:
            self.body_message = Popup(
                underline_color=self.underline_color, content=self,
                title=self.title_message,
                size_hint=(self.user_size_hint[0], self.user_size_hint[1]),
                pos_hint={"center_x": .5, "center_y": .5},
                background=self.background_image,
                on_dismiss=self.dismiss_callback)
            self.body_message.open()
        else:
            refs = Label(text=self.refs, markup=True, size_hint=(1, .1))
            refs.bind(on_ref_press=self.events_callback)
            self.add_widget(refs)
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def show(self):
            self.body = Popup(title="Test progress:", content=self,
                              auto_dismiss=False, size_hint=(.7, .5),
                              on_dismiss=self.dismiss_callback)
            self.body.open()

            self.thread = threading.Thread(target=self.retrieve_callback,
                                           args=(self._tick,))
            self.thread.start()
项目:HeaTDV4A    作者:HeaTTheatR    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(ImageViewer, self).__init__(**kwargs)
        self.orientation = "vertical"

        # ???? ??? ?????? ?????? "??-???-??????".
        self.box_buttons_select = \
            BoxLayout(orientation="horizontal", size_hint_y=None, height=40)
        self.body = Popup(title=self.title, title_align=self.title_align,
                          background=self.background_image,
                          on_dismiss=self.dismiss_callback,
                          auto_dismiss=self.auto_dismiss,
                          size_hint=self.size_hint)
        self.flag = False
项目:POS-System    作者:obernardovieira    | 项目源码 | 文件源码
def bt_login(self):

        row = self.root_self.database.isValidLogin(self.username.text, self.password.text)

        if(row == None):
            content = Label(text = 'Username or Password incorrect!')
            popup = Popup(
                        title           = 'User Login',
                        content         = content,
                        size_hint       = (None, None),
                        size            = (400, 100)
                    )

            # open the popup
            popup.open()
            return
        #
        self.root_self.pos_system.setUserName(self.username.text)
        self.root_self.pos_system.setUserID(row[0])
        self.root_self.database.registerLogs(self.root_self.pos_system.getUserID(), 0)
        #
        self.root_self.loadBarOptions()
        self.root_self.loadMainWindow()
        #
        self.root_self.a_price.label_price = Label(text = '0€')
        self.root_self.a_price.add_widget(self.root_self.a_price.label_price)
        #
        self.root_self.popup.dismiss()

    ###
项目:POS-System    作者:obernardovieira    | 项目源码 | 文件源码
def userLogout(self, obj):
        content = LogoutScreen(root_self = self)

        self.popup = Popup(
                        title           = 'User Logout',
                        content         = content,
                        auto_dismiss    = False,
                        size_hint       = (None, None),
                        size            = (400, 170)
                    )

        # open the popup
        self.popup.open()

    ###
项目:pgp2img    作者:icefalcn    | 项目源码 | 文件源码
def show_load(self, inout):
        self.inorout = inout
        content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
        self._popup = Popup(title="Load file", content=content,
                            size_hint=(0.9, 0.9))
        self._popup.open()
项目:pgp2img    作者:icefalcn    | 项目源码 | 文件源码
def show_save(self):
        content = SaveDialog(save=self.save, cancel=self.dismiss_popup)
        self._popup = Popup(title="Save file", content=content,
                            size_hint=(0.9, 0.9))
        self._popup.open()
项目:Python_For_Android_Hacking    作者:priyankgada    | 项目源码 | 文件源码
def progbar(self):
        pb = ProgressBar()
        popup = Popup(title='Brute Forcing... Do NOT Close This Window!', content=pb, size_hint=(0.7, 0.3))
        popup.open()
        time.sleep(2)
        pb.value = 25
        time.sleep(4)
        pb.value = 50
        time.sleep(6)
        pb.value = 75
        time.sleep(8)
        pb.value = 100

        popup = Popup(title="Password Not Found!",content=Label(text="Password Not Found in our dictionary, give it a try later"),size_hint=(0.7,0.3))
        popup.open()
项目:Python_For_Android_Hacking    作者:priyankgada    | 项目源码 | 文件源码
def do_action2(self, *args):
        if self.user_input2=='': # user enter no value
            popup = Popup(title="Profile Name Can't Be empty!",content=Label(text="Profile Name Format ie Hussam Khrais"),size_hint=(0.7,0.3))
            popup.open()
            return

        threading.Thread(target=self.progbar).start()
        return
项目:Python_For_Android_Hacking    作者:priyankgada    | 项目源码 | 文件源码
def progbar(self):
        pb = ProgressBar()
        popup = Popup(title='Searching in DB... Do NOT Close This Window!', content=pb, size_hint=(0.7, 0.3))
        popup.open()
        time.sleep(2)
        pb.value = 25
        time.sleep(4)
        pb.value = 50
        time.sleep(6)
        pb.value = 75
        time.sleep(8)
        pb.value = 100
        popup = Popup(title="Password Not Found!",content=Label(text="Double check profile name OR try brute force option!"),size_hint=(0.7,0.3))
        popup.open()
项目:Python_For_Android_Hacking    作者:priyankgada    | 项目源码 | 文件源码
def do_action(self, *args):

        if self.user_input=='': # user enter no value
            popup = Popup(title="Profile Name Can't Be empty!",content=Label(text="Profile Name Format ie Hussam Khrais"),size_hint=(0.7,0.3))
            popup.open()
            return
        threading.Thread(target=self.progbar).start()
        return
项目:glucometer    作者:johnyburd    | 项目源码 | 文件源码
def display_BG(self, value):
        popup = Popup(title='BG',
        content=Label(text=value,font_size=25),
        size_hint=(None, None), size=(125, 125))
        popup.bind(on_dismiss=self.dismiss_both)
        popup.open()
项目:android-notification-buttons    作者:Bakterija    | 项目源码 | 文件源码
def on_release(self):
        if not self.popup:
            self.popup = Popup(size_hint=(0.8, 0.6), title_color=(0, 0, 0, 1),
            background='', background_color=(0.2, 0.2, 0.2, 0.9))
            self.popup.title = 'Set Notification id'
            self.popup.content = Numpad()
            self.popup.content.callback = self.numpad_select_callback
        self.popup.open()
项目:android-notification-buttons    作者:Bakterija    | 项目源码 | 文件源码
def on_release(self):
        if not self.popup:
            self.popup = Popup(size_hint=(0.8, 0.3), title_color=(0, 0, 0, 1),
            background='', background_color=(0.2, 0.2, 0.2, 0.9))
            self.popup.title = 'Set Notification activity'
            self.popup.content = ActivityNumpad()
            self.popup.content.callback = self.numpad_select_callback
        self.popup.open()
项目:caltrac    作者:shiburizu    | 项目源码 | 文件源码
def newFoodIns(self,delta):
        t = date.today() - timedelta(delta)
        try:
            realKcal = float(self.kcalInp.text)*float(self.portionInp.text)
            c.execute("INSERT INTO foods(name,date,kcal,portion) VALUES(?,?,?,?);",
                (self.foodInp.text,t,realKcal,int(self.portionInp.text)))
            db.commit()
            CalApp.updateJournal(delta)
            CalApp.sm.current = 'Root'
        except ValueError:
            invalid = Popup(title='Invalid entries',
                content=Label(text='Check your data and try again.'),
                size_hint=(None, None),size=('250dp','150dp'))
            invalid.open()
项目:caltrac    作者:shiburizu    | 项目源码 | 文件源码
def setup2(self):
        try:
            CalApp.inp = [self.nameInp.text.strip(' \t\n\r'),
                float(self.heightInp.text),
                float(self.weightInp.text),int(self.yearsInp.text),
                self.genderChoice]
            CalApp.sm.current='Profile2'

        except (TypeError,ValueError) as e:
            invalid = Popup(title='Invalid entries',
                content=Label(text='Check your data and try again.'),
                size_hint=(None, None),size=('250dp','150dp'))
            invalid.open()
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def edit_row(self, index, data_to_write):
        if len(data_to_write) != self.cols:
            print('--Edit Row:  Data mismatch error.')
            popup = Popup(title='Grid Error 01',
                    content=Label(text = 'There was a problem in updating the grid.'),
                    size_hint = (0.3, 0.3))
            popup.open()
        else:
            end = len(self.children) - (index * self.cols)
            start = end - self.cols
            #Update the selected file's info too.
            if self.children[start].text == self._sel_file:
                self._sel_file = data_to_write[-1]
            for i, widget in enumerate(reversed(self.children[start:end])):
                widget.text = data_to_write[i].strip()
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def show_load(self):
        content = LoadDialog(load=self.load, cancel=self.dismiss_popup)
        self._popup = Popup(title='Load file', content=content,
                            size_hint=(0.75, 0.75))
        self._popup.open()
项目:AssembleAudio    作者:The-White-Wolf    | 项目源码 | 文件源码
def display_log(self):
        popup = Popup(title='Network Log',
                content=Label(text = 'Log is not implemented yet.'),
                size_hint = (0.3, 0.3))
        popup.open()
项目:Sandra-Programming    作者:pythongiant    | 项目源码 | 文件源码
def __init__(self,stuff):
        close=Label(text=stuff)
        popup=Popup(title="Meetings",size_hint=(None, None), size=(500, 400))

        root=ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
        popup.add_widget(close)
        root.add_widget(popup)
        popup.open()
项目:Mobile-TetriNET    作者:Smug28    | 项目源码 | 文件源码
def _key_handler(self, instance, KEY, *args):   # Reakce na stisk systémové klávesy OS Android
        print "Key: {0}".format(KEY)
        if KEY == 1001:
            if self.sm.current not in ('MainMenuScreen', 'GameScreen'):
                if self.sm.current == "SettingsScreen":
                    self.sm.get_screen("SettingsScreen").dropdown.dismiss()
                self.sm.current_screen.prev()
            else:
                if self.sm.current == 'MainMenuScreen':
                    text = self.L.STR_POPUP_EXIT
                    title = self.L.STR_POPUP_EXIT_TITLE
                    yes_callback = self.popupStop
                else:
                    text = self.L.STR_POPUP_DISCONNECT
                    title = self.L.STR_POPUP_DISCONNECT_TITLE
                    yes_callback = self.popupDisconnect
                content = BoxLayout(orientation='vertical')
                content.add_widget(Label(text=text, font_name='font/Roboto-Regular.ttf', font_size='14dp'))
                buttons = GridLayout(cols=2, rows=1, spacing=10, size_hint=(1, .3))
                yes = Button(text=self.L.STR_YES)
                yes.bind(on_press=yes_callback)
                no = Button(text=self.L.STR_NO)
                buttons.add_widget(yes)
                buttons.add_widget(no)
                content.add_widget(buttons)
                self.popupExit = Popup(title=title, size_hint=(.7,.3), content=content, auto_dismiss=False)
                no.bind(on_press=self.popupExit.dismiss)
                self.popupExit.open()
        elif KEY == 1002:
            self.dispatch('on_pause')
        elif KEY == 1004:
            self.dispatch('on_pause')
项目:LinkArchiever    作者:Mohamad1994HD    | 项目源码 | 文件源码
def __init__(self, msg=None, *args, **kwargs):
        super(MsgDialog, self).__init__(*args, **kwargs)
        self.popup = Popup(content=self,
                           size_hint=kwargs['size_hint'],
                           title=kwargs['title'])
        self.msgtext = msg
项目:LinkArchiever    作者:Mohamad1994HD    | 项目源码 | 文件源码
def on_open_press(self):
        # initialize filepicker instance
        content = FilePicker(on_close=self.close_popup, path=self.drive_selected)

        self.file_popup = Popup(title='Select your file',
                                content=content,
                                size_hint=(.8, .8))
        self.file_popup.open()
项目:webkivy    作者:miohtama    | 项目源码 | 文件源码
def show_exception(e):
    """Show th latest exception in a pop-up dialog."""
    tb = traceback.format_exc()
    Logger.exception(str(e))
    Logger.exception(tb)
    popup = Popup(title='Python exception occured',
        content=TextInput(text=str(e) + "\n\n" + tb),
        size_hint=(.8, .8))
    popup.open()
项目:farmgame    作者:fivedigits    | 项目源码 | 文件源码
def on_release(self):

        if self.last_touch and self.last_touch.is_double_tap:

            app.game_state = GameState()

            popup = Popup(title="Info",content=Label(text="Game restarted"),size_hint=(0.25,0.15)).open()
项目:iotdm-pyclient    作者:peterchauyw    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(MainScreen, self).__init__(**kwargs)
        self.protocol = kwargs['protocol']
        self.screen_manager = kwargs['screen_manager']
        self.method_chooser = MethodPanel(controller=self)
        self.method_chooser_visible = False
        self.popup = Popup(title='Actions',
           content=Label(text=''),
           size_hint=(None, None), size=(400, 400))
项目:iotdm-pyclient    作者:peterchauyw    | 项目源码 | 文件源码
def __init__(self, **kwargs):
        super(NodesScreen, self).__init__(**kwargs)
        self.screen_manager = kwargs['screen_manager']
        self.discoveries = {}
        self.bookmarks = {}
        self.load_link_list()
        self.popup = Popup(title='Actions',
           content=Label(text=''),
           size_hint=(None, None), size=(400, 400))
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def download_apk(instance, answer):
    global popup
    if answer == "yes":
        global apk_url
        apk_path = os.path.join(
            main_utils.get_mobileinsight_path(),
            "update.apk")
        if os.path.isfile(apk_path):
            os.remove(apk_path)

        t = threading.Thread(target=download_thread, args=(apk_url, apk_path))
        t.start()

        progress_bar = ProgressBar()
        progress_bar.value = 1

        def download_progress(instance):
            def next_update(dt):
                if progress_bar.value >= 100:
                    return False
                progress_bar.value += 1
            Clock.schedule_interval(next_update, 1 / 25)

        progress_popup = Popup(
            title='Downloading MobileInsight...',
            content=progress_bar
        )

        progress_popup.bind(on_open=download_progress)
        progress_popup.open()

    popup.dismiss()
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def build(self):
        file = open("privacy_agreement.txt")
        privacy_agreement = file.read()
        privacy_agreement = privacy_agreement +'\nDo you agree to share data collected on your phone?'
        content = PrivacyPopup(text=privacy_agreement)
        content.bind(on_answer=self._on_answer)
        self.popup = Popup(title="Agreement on Data Sharing",
                           content=content,
                           size_hint=(None, None),
                           size=(1200, 2300),
                           auto_dismiss=False)
        self.popup.open()
项目:mobileinsight-mobile    作者:mobile-insight    | 项目源码 | 文件源码
def onOpen(self, *args):
        self.open_popup = Popup(
            title='Open file',
            content=Open_Popup(
                load=self.load),
            background_normal='',
            background_color=(0/255.0, 161/255.0, 247/255.0, 1),
            color=(0/255.0, 161/255.0, 247/255.0, 1),
            auto_dismiss=True)
        # self.open_popup.bind(on_dismiss=self.exit_open_popup)
        self.open_popup.open()