Пример #1
0
 def copy_to_clipboard(self):
     Clipboard.copy(self.text_for_clipboard)
     msg = _('Text copied to clipboard.')
     Clock.schedule_once(lambda dt: self.app.show_info(msg))
Пример #2
0
 def close(self):
     Question(_('Close channel?'), self._close).open()
Пример #3
0
 def __do_sign(self, password):
     try:
         self.app.wallet.sign_transaction(self.tx, password)
     except InvalidPassword:
         self.app.show_error(_("Invalid PIN"))
     self.update()
Пример #4
0
 def do_copy(self):
     uri = self.get_URI()
     self.app._clipboard.copy(uri)
     self.app.show_info(_('Request copied to clipboard'))
Пример #5
0
 def _do_sign(self, password):
     self.status_str = _('Signing') + '...'
     Clock.schedule_once(lambda dt: self.__do_sign(password), 0.1)
Пример #6
0
 def do_sign(self):
     self.app.protected(_("Sign this transaction?"), self._do_sign, ())
Пример #7
0
 def proxy_status(self):
     net_params = self.app.network.get_parameters()
     proxy = net_params.proxy
     return proxy.get('host') + ':' + proxy.get('port') if proxy else _(
         'None')
Пример #8
0
 def show_qr(self):
     original_raw_tx = str(self.tx)
     qr_data = self.tx.to_qr_data()
     self.app.qr_dialog(_("Raw Transaction"),
                        qr_data,
                        text_for_clipboard=original_raw_tx)
Пример #9
0
class InfoBubble(Factory.Bubble):
    '''Bubble to be used to display short Help Information'''

    message = StringProperty(_('Nothing set !'))
    '''Message to be displayed; defaults to "nothing set"'''

    icon = StringProperty('')
    ''' Icon to be displayed along with the message defaults to ''

    :attr:`icon` is a  `StringProperty` defaults to `''`
    '''

    fs = BooleanProperty(False)
    ''' Show Bubble in half screen mode

    :attr:`fs` is a `BooleanProperty` defaults to `False`
    '''

    modal = BooleanProperty(False)
    ''' Allow bubble to be hidden on touch.

    :attr:`modal` is a `BooleanProperty` defauult to `False`.
    '''

    exit = BooleanProperty(False)
    '''Indicates whether to exit app after bubble is closed.

    :attr:`exit` is a `BooleanProperty` defaults to False.
    '''

    dim_background = BooleanProperty(False)
    ''' Indicates Whether to draw a background on the windows behind the bubble.

    :attr:`dim` is a `BooleanProperty` defaults to `False`.
    '''
    def on_touch_down(self, touch):
        if self.modal:
            return True
        self.hide()
        if self.collide_point(*touch.pos):
            return True

    def show(self, pos, duration, width=None, modal=False, exit=False):
        '''Animate the bubble into position'''
        self.modal, self.exit = modal, exit
        if width:
            self.width = width
        if self.modal:
            from kivy.uix.modalview import ModalView
            self._modal_view = m = ModalView(background_color=[.5, .5, .5, .2])
            Window.add_widget(m)
            m.add_widget(self)
        else:
            Window.add_widget(self)

        # wait for the bubble to adjust its size according to text then animate
        Clock.schedule_once(lambda dt: self._show(pos, duration))

    def _show(self, pos, duration):
        def on_stop(*l):
            if duration:
                Clock.schedule_once(self.hide, duration + .5)

        self.opacity = 0
        arrow_pos = self.arrow_pos
        if arrow_pos[0] in ('l', 'r'):
            pos = pos[0], pos[1] - (self.height / 2)
        else:
            pos = pos[0] - (self.width / 2), pos[1]

        self.limit_to = Window

        anim = Factory.Animation(opacity=1, pos=pos, d=.32)
        anim.bind(on_complete=on_stop)
        anim.cancel_all(self)
        anim.start(self)

    def hide(self, now=False):
        ''' Auto fade out the Bubble
        '''
        def on_stop(*l):
            if self.modal:
                m = self._modal_view
                m.remove_widget(self)
                Window.remove_widget(m)
            Window.remove_widget(self)
            if self.exit:
                App.get_running_app().stop()
                import sys
                sys.exit()
            else:
                App.get_running_app().is_exit = False

        if now:
            return on_stop()

        anim = Factory.Animation(opacity=0, d=.25)
        anim.bind(on_complete=on_stop)
        anim.cancel_all(self)
        anim.start(self)