Exemplo n.º 1
0
    def raise_numpad(self,
                     numpad_title,
                     callback,
                     units=None,
                     minimum=None,
                     maximum=None,
                     do_decimal=False,
                     auto_dismiss=True):
        if do_decimal:
            numpad = self.numpads['decimal']
        else:
            numpad = self.numpads['regular']
        numpad.units = units
        numpad.minimum_value = minimum
        numpad.maximum_value = maximum
        if numpad.parent is not None:
            numpad.parent.remove_widget(numpad)
        numpad_popup = FlatPopup(title=numpad_title,
                                 content=numpad,
                                 size_hint=(.8, .8),
                                 auto_dismiss=auto_dismiss)

        def return_callback(value, is_return):
            if callback is not None:
                callback(value, is_return)
            if is_return:
                numpad_popup.dismiss(force=True)
                numpad_popup.ids.container.remove_widget(numpad)
                numpad.return_callback = None
                numpad.display_text = '0'

        numpad.return_callback = return_callback
        numpad_popup.open()
Exemplo n.º 2
0
 def raise_option_dialogue(self, option_title, option_text, options,
         callback, auto_dismiss=True):
     option_content = OptionContent(options, option_text=option_text,
         callback=callback)
     option_popup = FlatPopup(content=option_content, size_hint=(.6,.4),
         auto_dismiss=auto_dismiss)
     option_popup.title = option_title
     option_content.dismiss_func = option_popup.dismiss
     option_popup.open()
Exemplo n.º 3
0
 def raise_error(self, error_title, error_text, auto_dismiss=True, timeout=None):
     error_content = ErrorContent()
     error_popup = FlatPopup(
         content=error_content, size_hint=(.6, .4),
         auto_dismiss=auto_dismiss)
     error_content.error_text = error_text
     error_popup.title = error_title
     dismiss_button = error_content.dismiss_button
     dismiss_button.bind(on_release=error_popup.dismiss)
     error_popup.open()
     if timeout is not None:
         def close_popup(dt):
             error_popup.dismiss()
         Clock.schedule_once(close_popup, timeout)
Exemplo n.º 4
0
 def raise_option_dialogue(self,
                           option_title,
                           option_text,
                           options,
                           callback,
                           auto_dismiss=True):
     option_content = OptionContent(options,
                                    option_text=option_text,
                                    callback=callback)
     option_popup = FlatPopup(content=option_content,
                              size_hint=(.6, .4),
                              auto_dismiss=auto_dismiss)
     option_popup.title = option_title
     option_content.dismiss_func = option_popup.dismiss
     option_popup.open()
Exemplo n.º 5
0
    def raise_error(self,
                    error_title,
                    error_text,
                    auto_dismiss=True,
                    timeout=None):
        error_content = ErrorContent()
        error_popup = FlatPopup(content=error_content,
                                size_hint=(.6, .4),
                                auto_dismiss=auto_dismiss)
        error_content.error_text = error_text
        error_popup.title = error_title
        dismiss_button = error_content.dismiss_button
        dismiss_button.bind(on_release=error_popup.dismiss)
        error_popup.open()
        if timeout is not None:

            def close_popup(dt):
                error_popup.dismiss()

            Clock.schedule_once(close_popup, timeout)
Exemplo n.º 6
0
 def raise_numpad(self, numpad_title, callback, units=None,
     minimum=None, maximum=None, do_decimal=False, auto_dismiss=True):
     if do_decimal:
         numpad = self.numpads['decimal']
     else:
         numpad = self.numpads['regular']
     numpad.units = units
     numpad.minimum_value = minimum
     numpad.maximum_value = maximum
     if numpad.parent is not None:
         numpad.parent.remove_widget(numpad)
     numpad_popup = FlatPopup(
         title=numpad_title, content=numpad, size_hint=(.8, .8),
         auto_dismiss=auto_dismiss)
     def return_callback(value, is_return):
         if callback is not None:
             callback(value, is_return)
         if is_return:
             numpad_popup.dismiss(force=True)
             numpad_popup.ids.container.remove_widget(numpad)
             numpad.return_callback = None
             numpad.display_text = '0'
     numpad.return_callback = return_callback
     numpad_popup.open()