Beispiel #1
1
    def layout(self):
        self.user = ''

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

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

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

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

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

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

        return layout
Beispiel #2
0
    def __init__(self, **kwargs):
        super(LeftPane, self).__init__(**kwargs)
        self.cols = 1
        self.rows = 4
        self.row_force_default = True
        self.row_default_height = 40

        self.size_hint = (500, 0.3)

        self.spacing = (0, 10)

        Title = MDLabel()
        Title.text = "Quick Inch <--> MM Converter"

        self.InchInput = MDTextField()
        self.InchInput.hint_text = "Inches"
        self.InchInput.multiline = False
        self.InchInput.on_text_validate = self.convert

        self.MMInput = MDTextField()
        self.MMInput.hint_text = "Millimeters"
        self.MMInput.multiline = False
        self.MMInput.on_text_validate = self.convert

        ConvButton = MDRaisedButton()
        ConvButton.text = "   <--- CONVERT -->   "
        ConvButton.on_press = self.convert

        self.add_widget(Title)
        self.add_widget(self.InchInput)
        self.add_widget(self.MMInput)
        self.add_widget(ConvButton)
Beispiel #3
0
    def set_address_dialog(self):
        def save_apply_address(*args):

            m = re.match(r'([0-9a-zA-Z\.]+):([0-9]+)', addr_field.text)

            if m is not None:
                self.set_scoreboard_address(addr_field.text)
                dialog.dismiss()
            else:
                # don't know what to do
                pass

        addr_field = MDTextField(hint_text='adress:port')
        if self._unformatted_address is not None:
            addr_field.text = self._unformatted_address
        contents = addr_field

        dialog = MDDialog(title='Set Scoreboard Address',
                          content=contents,
                          size_hint=(0.5, 0.5),
                          auto_dismiss=True)

        dialog.add_action_button("Save & Apply", action=save_apply_address)

        dialog.open()
Beispiel #4
0
    def all_student(self):
        self.conn = sqlite3.connect('SCHOOL.db')
        self.c = self.conn.cursor()
        self.all_students = self.c.execute('SELECT * FROM STUDENTS')

        gris = GridLayout(
            rows=2,
            # row_default_height=(self.width - self.cols * self.spacing[0]) / self.cols,
            # row_force_default=True,
            # size_hint_y=None,
            # height=self.minimum_height,
            padding=(dp(1), dp(1)),
            spacing=dp(1))
        sv = ScrollView()
        ml = MDList()
        for row in self.all_students:
            ml.add_widget(
                ThreeLineListItem(text=str(row[1]),
                                  secondary_text=row[2] + '\n' + row[3]))
        sv.do_scroll_y = True
        sv.do_scroll_x = False
        sv.add_widget(ml)
        gris.add_widget(
            MDTextField(hint_text="Helper text on focus",
                        helper_text="This will disappear when you click off",
                        helper_text_mode="on_focus"))
        gris.add_widget(sv)
        self.root.ids.students.add_widget(gris)
        self.root.ids.screen_manager.current = str(self.root.ids.students.name)
Beispiel #5
0
    def __init__(self, **kwargs):

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

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

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

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

        self.body.add_widget(self.cardholder)
        self.spacer = MDLabel(size_hint_y=0.2)
        self.cardlist.add_widget(self.spacer)
Beispiel #6
0
    def bind_email_dialog(self):
        self.content = MDTextField()
        self.content.hint_text = "邮箱"
        # content.password = True
        self.dialog = MDDialog(title="修改邮箱",
                               content=self.content,
                               size_hint=(.8, None),
                               height=dp(200),
                               auto_dismiss=True)

        self.dialog.add_action_button("确定", action=lambda *x: self.bind_email())
        self.dialog.add_action_button("取消", action=lambda *x: self.dialog.dismiss())
        self.dialog.open()
Beispiel #7
0
    def bind_dialog(self, bind_type):           # bind_type: 0-->信息门户, 1-->教务系统
        self.content = MDTextField()
        self.content.hint_text = "密码"
        # content.password = True
        self.dialog = MDDialog(title="绑定信息门户" if bind_type == 0 else "绑定教务系统",
                               content=self.content,
                               size_hint=(.8, None),
                               height=dp(200),
                               auto_dismiss=True)

        self.dialog.add_action_button("绑定", action=lambda *x: self.bind_infoport() if bind_type == 0 else self.bind_edusys())
        self.dialog.add_action_button("取消", action=lambda *x: self.dialog.dismiss())
        self.dialog.open()
Beispiel #8
0
def start():
    global game, sws

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

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

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

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

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

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

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

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

    root.ids.frame.add_widget(messagebox)

    sws = sWs()
    game = game = Entity.Engine([sws])
    Clock.schedule_interval(lambda _dt: game.tick(_dt * 1000), 0.1)
Beispiel #9
0
    def assign_game_id_dialog(self):
        def apply_game_id(*args):
            # do apply
            gid = id_field.text

            # do some processing
            if len(id_field.text) == 0:
                return

            self.assign_game_user_id(gid)
            dialog.dismiss()

        id_field = MDTextField(hint_text='Identifier')

        if self._user_id is not None:
            id_field.text = self._user_id

        dialog = MDDialog(title='Set Game Identifier',
                          content=id_field,
                          size_hint=(0.5, 0.5),
                          auto_dismiss=True)
        dialog.add_action_button('Apply', action=apply_game_id)

        dialog.open()
Beispiel #10
0
 def __init__(self,**kwargs):
     MDTextField.__init__(self,**kwargs)
     self.previoustext=self.text
     Clock.schedule_interval(self.textcheck,0.5)
Beispiel #11
0
 def generate_screens(self):
     for group in group_cells:
         for c in items[group]:
             if type(c) == dict:
                 temp_screen = Screen(name=c.keys()[0])
                 temp_items = c[c.keys()[0]]
             else:
                 temp_screen = Screen(name=c)
                 temp_items = c
             main_container = BoxLayout(id='main_container',
                                        orientation='vertical',
                                        padding=[dp(10), 0, 0, 0],
                                        spacing=dp(20))
             if not type(temp_items) == str:
                 for i, value in enumerate(temp_items):
                     #print value
                     temp_box = BoxLayout(orientation='horizontal',
                                          size_hint_y=0.1)
                     temp_label = MDLabel(id='label' + str(i),
                                          font_style="Caption",
                                          halign="left",
                                          text=value,
                                          theme_text_color='Secondary'
                                          if self._app.theme_cls.theme_style
                                          == 'Light' else 'Primary')
                     temp_checkbox = MDResetCheckbox(pass_text=value,
                                                     size_hint=(None, None),
                                                     size=(dp(48), dp(48)),
                                                     pos_hint={
                                                         'center_x': 0.25,
                                                         'center_y': 0.5
                                                     })
                     temp_checkbox.bind(state=self.aux_populate)
                     self.bind(reset=temp_checkbox.set_active_false)
                     temp_box.add_widget(temp_label)
                     temp_box.add_widget(temp_checkbox)
                     main_container.add_widget(temp_box)
             else:
                 temp_box = BoxLayout(orientation='horizontal',
                                      size_hint_y=0.1)
                 if temp_items == 'Create other type':
                     temp_checkbox = MDResetCheckbox(size_hint=(None, None),
                                                     size=(dp(48), dp(48)),
                                                     pos_hint={
                                                         'center_x': 0.25,
                                                         'center_y': 0.5
                                                     })
                     temp_text_field = MDTextField(color_mode='accent')
                     temp_text_field.bind(
                         text=temp_checkbox.setter('pass_text'))
                     temp_box.add_widget(temp_text_field)
                 else:
                     temp_label = MDLabel(id='label1',
                                          font_style="Caption",
                                          halign="left",
                                          text=temp_items,
                                          theme_text_color='Secondary'
                                          if self._app.theme_cls.theme_style
                                          == 'Light' else 'Primary')
                     temp_box.add_widget(temp_label)
                     temp_checkbox = MDResetCheckbox(pass_text=temp_items,
                                                     size_hint=(None, None),
                                                     size=(dp(48), dp(48)),
                                                     pos_hint={
                                                         'center_x': 0.25,
                                                         'center_y': 0.5
                                                     })
                 temp_checkbox.bind(state=self.aux_populate)
                 self.bind(reset=temp_checkbox.set_active_false)
                 temp_box.add_widget(temp_checkbox)
                 main_container.add_widget(temp_box)
             main_container.add_widget(BoxLayout())
             temp_screen.add_widget(main_container)
             self.add_widget(temp_screen)
Beispiel #12
0
    def layout(self):

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

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

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

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

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

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

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

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

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

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

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

        return layout
Beispiel #13
0
class StripeMD(BoxLayout):
    def __init__(self, **kwargs):
        super(StripeMD, self).__init__(**kwargs)
        self.util = kwargs.get('util')
        key = kwargs.get('key')
        layout = self.layout()
        self.add_widget(layout)
        if platform in ["ios", "android"]:
            self.stripe = Stripe.StripeToken()
            self.stripeUtil = Stripe.StripeUtil()
            self.stripeUtil.stripekey = key

    def layout(self):

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

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

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

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

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

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

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

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

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

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

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

        return layout

    def processInformation(self):
        self.card = False
        self.year = False
        self.month = False
        self.cvc = False

        self.creditCardField.text = ''
        self.expYear.text = ''
        self.expMonth.text = ''
        self.cvcTextField.text = ''

        #Create pop up for process delay
        self.authenPopup.open()

        if platform in ["ios", "android"]:
            #THIS IS WHERE STRIP STARTS
            #send all the card info to stripe
            #to generate a token
            self.stripe.genToken(self.stripeUtil, self.paymentDict['card'],
                                 int(self.paymentDict['month']),
                                 int(self.paymentDict['year']),
                                 self.paymentDict['cvc'])
            self.paymentDict = {}
            #Now we wait for stripe to generate our token
            self.event = Clock.schedule_interval(self.set_popup, 0.1)
        else:
            self.event = Clock.schedule_interval(self.os_error_popup, 0.1)

    def os_error_popup(self, dt):
        self.authenPopup.titel = "Stripe only \nWorks in ios\n and Android"
        time.sleep(2)
        self.authenPopup.dismiss()
        self.event.cancel()

    def set_popup(self, dt):
        #This section acts as a callback for our stripe token
        #Once it is no longer empty, proceed to check the token
        #for authenticity
        if self.stripeUtil.token != "":
            #Error token "Your card's number is invalid"
            if 'invalid' in self.stripeUtil.token:
                self.authenPopup.title = "Invalid Card"
                time.sleep(1)
                self.authenPopup.dismiss()
                self.event.cancel()
            else:
                #Send the stripe token to your server and wait for your rsp
                status = self.util.sendTokenToServer(self.stripeUtil.token,
                                                     self.util.user)
                if status == True:
                    self.authenPopup.content = "Created user succesfully"
                    time.sleep(1)
                    self.authenPopup.dismiss()
                    self.event.cancel()
                    self.changeScreen()
                else:
                    self.authenPopup.content = "Authenticating Failed"
                    time.sleep(1)
                    self.authenPopup.dismiss()
                    self.event.cancel()

    def clearTextFields(self):
        self.securityCode.text = ''
        self.zipcode.text = ''
        self.experationMonth.text = ''
        self.experationYear.text = ''
        self.cardNumber.text = ''
        self.Name.text = ''

    def changeScreen(self):
        if self.util.screenchange:
            self.manager.current = self.util.screenchange
Beispiel #14
0
    def show_example_dialog(self):
        content1 = MDTextField(hint_text="Имя",
                               required=True,
                               helper_text="Обязательное поле",
                               helper_text_mode="on_error")
        content2 = MDTextField(hint_text="Парол",
                               required=True,
                               helper_text="Обязательное поле",
                               helper_text_mode="on_error")
        content1.hint_text = "Имя пользователя"
        content1.helper_text = "Некорректный ввод"
        content1.min_text_length = 2
        content1.color_mode = 'accent'
        content2.hint_text = "Пароль"
        content2.helper_text = "Некорректный ввод"
        content2.min_text_length = 8
        content2.color_mode = 'accent'
        layout1 = BoxLayout(orientation='vertical',
                            size_hint_y=None,
                            height=dp(180),
                            padding=dp(48),
                            spacing=10)
        layout1.add_widget(content1)
        layout1.add_widget(content2)

        # content.bind(texture_size=content.setter('size'))
        self.dialog = MDDialog(title="Вход",
                               content=layout1,
                               size_hint=(.8, None),
                               height=dp(300),
                               auto_dismiss=False)
        self.dialog.add_action_button("ОК",
                                      action=lambda *x: self.dialog.dismiss())
        self.dialog.add_action_button("Отмена",
                                      action=lambda *x: self.dialog.dismiss())
        self.dialog.open()
Beispiel #15
0
 def show_dialog(self, dialog_type, userid='', filename=''):
     """
     :param dialog_type: offline, login, connection, file_request, refused, logout, add_friend
     :return: None
     """
     if dialog_type == 'offline':
         label_text = 'This friend is currently offline'
         dialog_text = 'Friend is offline'
     elif dialog_type == 'login':
         label_text = 'Please Check your username and password'
         dialog_text = 'Wrong username/password!'
     elif dialog_type == 'connection':
         label_text = 'Please Check your Internet Connection'
         dialog_text = 'Connection Failed'
     elif dialog_type == 'file_request':
         label_text = 'Your Friend {} want to send file {} to you, do you want to accept?'.format(
             userid, filename)
         dialog_text = 'Sending File Request'
     elif dialog_type == 'refused':
         label_text = 'Your request to send file are refused'
         dialog_text = 'Request Refused'
     elif dialog_type == 'logout':
         label_text = 'Cannot connect to server, logout failed'
         dialog_text = 'Logout Error'
     elif dialog_type == 'add_friend':
         label_text = ''
         dialog_text = "Please Input your friend's userid"
     else:
         raise Exception, 'No such dialog_type'
     if dialog_type == 'add_friend':
         content = MDTextField(id='friend_name',
                               hint_text='friend name',
                               required=True,
                               color_mode='accent',
                               helper_text='your friend userid',
                               helper_text_mode='on_focus')
     else:
         content = MDLabel(font_style='Body1',
                           theme_text_color='Secondary',
                           text=label_text,
                           size_hint_y=None,
                           valign='top')
         content.bind(texture_size=content.setter('size'))
     self.error_dialog = MDDialog(title=dialog_text,
                                  content=content,
                                  size_hint=(.8, None),
                                  height=dp(200),
                                  auto_dismiss=False)
     self.error_dialog.add_action_button(
         "OK",
         action=lambda *x: self.dialog_dismiss(dialog_type, userid, filename
                                               ))
     if dialog_type == 'file_request':
         self.error_dialog.add_action_button(
             "NO",
             action=lambda *x: self.dialog_dismiss('{}_no'.format(
                 dialog_type)))
     if dialog_type == 'add_friend':
         self.error_dialog.add_action_button(
             "Cancel",
             action=lambda *x: self.dialog_dismiss('{}_cancel'.format(
                 dialog_type)))
     self.error_dialog.open()