Ejemplo n.º 1
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()
Ejemplo n.º 2
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()