URI: 
       tkivy: split mainscreen.kv into dynamically loaded .kv files - electrum - Electrum Bitcoin wallet
  HTML git clone https://git.parazyd.org/electrum
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
       ---
   DIR commit 65ecbf990d712fd152ef6d1f8e5a3a7401839df1
   DIR parent d68042e76e3f194c9ec43524a7f79844a4703ce7
  HTML Author: ThomasV <thomasv@electrum.org>
       Date:   Tue,  6 Oct 2015 09:59:29 +0200
       
       kivy: split mainscreen.kv into dynamically loaded .kv files
       
       Diffstat:
         M gui/kivy/main.kv                    |     452 ++++++++++++++++++++++++++++---
         M gui/kivy/main_window.py             |     288 +++++++++++--------------------
         M gui/kivy/theming/light-0.png        |       0 
         M gui/kivy/theming/light.atlas        |       4 ++--
         M gui/kivy/theming/light/logo.png     |       0 
         D gui/kivy/uix/console.py             |     319 -------------------------------
         M gui/kivy/uix/dialogs/carousel_dial… |       5 +++--
         M gui/kivy/uix/screens.py             |     146 +++++++++++++++++++++++++++----
         A gui/kivy/uix/ui_screens/contacts.kv |      93 +++++++++++++++++++++++++++++++
         A gui/kivy/uix/ui_screens/history.kv  |     224 +++++++++++++++++++++++++++++++
         A gui/kivy/uix/ui_screens/network.kv  |      10 ++++++++++
         A gui/kivy/uix/ui_screens/receive.kv  |     171 +++++++++++++++++++++++++++++++
         A gui/kivy/uix/ui_screens/send.kv     |     243 +++++++++++++++++++++++++++++++
         A gui/kivy/uix/ui_screens/settings.kv |      27 +++++++++++++++++++++++++++
         A gui/kivy/uix/ui_screens/wallet.kv   |      14 ++++++++++++++
       
       15 files changed, 1430 insertions(+), 566 deletions(-)
       ---
   DIR diff --git a/gui/kivy/main.kv b/gui/kivy/main.kv
       t@@ -1,4 +1,6 @@
        #:import Window kivy.core.window.Window
       +#:import Factory kivy.factory.Factory
       +#:import _ electrum.i18n._
        
        # Custom Global Widgets
        
       t@@ -7,6 +9,79 @@
            size_hint: 1, None
            height: self.minimum_height
        
       +<LightOptions@SpinnerOption>
       +    font_size: '14sp'
       +    border: 4, 4, 4, 4
       +    color: 0.439, 0.439, 0.439, .8
       +    background_normal: 'atlas://gui/kivy/theming/light/action_button_group'
       +    background_down: 'atlas://gui/kivy/theming/light/overflow_btn_dn'
       +    size_hint_y: None
       +    height: '48dp'
       +    text_size: self.size[0] - dp(20), self.size[1]
       +    halign: 'left'
       +    valign: 'middle'
       +    shorten: True
       +    on_press:
       +        ddn = self.parent.parent
       +        Factory.Animation(opacity=0, d=.25).start(ddn)
       +
       +<OppositeDropDown@DropDown>
       +    #auto_width: False
       +    size_hint: None, None
       +    size: self.container.minimum_size if self.container else (0, 0)
       +    on_container: if args[1]: self.container.padding = '4dp', '4dp', '4dp', '4dp'
       +    canvas.before:
       +        Color:
       +            rgba: 1, 1, 1, 1
       +        BorderImage:
       +            pos:self.pos
       +            border: 20, 20, 20, 20
       +            source: 'atlas://gui/kivy/theming/light/dropdown_background'
       +            size: self.size
       +
       +<OppositeSpinner@CSpinner>
       +    dropdown_cls: Factory.OppositeDropDown
       +    option_cls: Factory.LightOptions
       +    border: 20, 20, 9, 9
       +    background_normal: 'atlas://gui/kivy/theming/light/action_group_dark'
       +    background_down: self.background_normal
       +    values: ('Copy to clipboard', 'Send Payment')
       +    size_hint: None, 1
       +    width: '12dp'
       +    on_release:
       +        ddn = self._dropdown
       +        ddn.opacity = 0
       +        Factory.Animation(opacity=1, d=.25).start(ddn)
       +
       +
       +<BlueSpinner@BoxLayout>
       +    foreground_color: 1, 1, 1, 1
       +    spacing: '9dp'
       +    text: ''
       +    values: ('', )
       +    icon: ''
       +    Image:
       +        source: root.icon
       +        size_hint: None, None
       +        size: '22dp', '22dp'
       +        pos_hint: {'center_y': .5}
       +    OppositeSpinner:
       +        color: root.foreground_color
       +        background_normal: 'atlas://gui/kivy/theming/light/action_group_light'
       +        markup: False
       +        shorten: True
       +        font_size: '16dp'
       +        size_hint: 1, .7
       +        pos_hint: {'center_y': .5}
       +        text: root.text
       +        text_size: self.size
       +        halign: 'left'
       +        valign: 'middle'
       +        on_text:
       +            root.text = args[1]
       +        values: root.values
       +
       +
        <IconButton@ButtonBehavior+Image>
            allow_stretch: True
            size_hint_x: None
       t@@ -50,39 +125,8 @@
            background_normal: 'atlas://gui/kivy/theming/light/textinput_active'
        
        
       -<CreateAccountButtonBlue@Button>
       -    canvas.after:
       -        Color
       -            rgba: 1, 1, 1, 1 if self.disabled else 0
       -        Rectangle:
       -            texture: self.texture
       -            size: self.size
       -            pos: self.pos
       -        Color
       -            rgba: .5, .5, .5, .5 if self.disabled else 0
       -        Rectangle:
       -            texture: self.texture
       -            size: self.size
       -            pos: self.x - dp(1), self.y + dp(1)
       -    border: 15, 5, 5, 5
       -    background_color: (1, 1, 1, 1) if self.disabled else (.203, .490, .741, 1 if self.state == 'normal' else .75)
       -    size_hint: 1, None
       -    height: '48sp'
       -    text_size: self.size
       -    halign: 'center'
       -    valign: 'middle'
       -    root: None
       -    background_normal: 'atlas://gui/kivy/theming/light/btn_create_account'
       -    background_down: 'atlas://gui/kivy/theming/light/btn_create_account'
       -    background_disabled_normal: 'atlas://gui/kivy/theming/light/btn_create_act_disabled'
       -    on_press: if self.root: self.root.dispatch('on_press', self)
       -    on_release: if self.root: self.root.dispatch('on_release', self)
       -
       -
       -<CreateAccountButtonGreen@CreateAccountButtonBlue>
       -    background_color: (1, 1, 1, 1) if self.disabled else (.415, .717, 0, 1 if self.state == 'normal' else .75)
        ###########################
       -##    Gloabal Defaults
       +#     Global Defaults
        ###########################
        <TextInput>
            on_focus: app._focused_widget = root
       t@@ -127,11 +171,346 @@
                    size_hint: 1, 1
                    width: 0 if root.fs else (root.width - img.width)
        
       -StencilView:
       -    manager: None
       +
       +
       +<WalletActionPrevious@ActionPrevious>
       +    app_icon: 'atlas://gui/kivy/theming/light/' + ('wallets' if app.ui_mode[0] != 't' else 'tab_btn')
       +    with_previous: False
       +    size_hint: None, 1
       +    mipmap: True
       +    on_release: app.root.children[0].toggle_drawer()
       +
       +
       +<SendReceiveToggle@BoxLayout>
       +    padding: '5dp', '5dp'
       +    size_hint: 1, None
       +    height: '45dp'
       +    canvas.before:
       +        Color:
       +            rgba: 1, 1, 1, 1
       +        BorderImage:
       +            border: 12, 12, 12, 12
       +            source: 'atlas://gui/kivy/theming/light/card'
       +            size: self.width + dp(3), self.height
       +            pos: self.x - dp(1.5), self.y
       +
       +<SendReceiveCardTop@GridLayout>
       +    canvas.before:
       +        BorderImage:
       +            border: 9, 9, 9, 9
       +            source: 'atlas://gui/kivy/theming/light/card_top'
       +            size: self.size
       +            pos:self.pos
       +    padding: '12dp', '22dp', '12dp', 0
       +    cols: 1
       +    size_hint: 1, None
       +    height: '120dp'
       +    spacing: '4dp'
       +
       +<SendReceiveBlueBottom@GridLayout>
       +    canvas.before:
       +        Color:
       +            rgba: .238, .585, .878, 1
       +        BorderImage:
       +            border: 9, 9, 9, 9
       +            source: 'atlas://gui/kivy/theming/light/card_bottom'
       +            size: self.size
       +            pos: self.pos
       +        Color:
       +            rgba: 1, 1, 1, 1
       +
       +    item_height: dp(42)
       +    foreground_color: .843, .914, .972, 1
       +    cols: 1
       +    padding: '12dp', 0
       +
       +
       +<SendToggle@ToggleButton>
       +    source: ''
       +    group: 'transfer_type'
       +    markup: False
       +    bold: True
       +    border: 4, 4, 4, 4
       +    background_normal: self.background_down
       +    color:
       +        (.140, .140, .140, 1) if self.state == 'down' else (.796, .796, .796, 1)
       +    canvas.after:
       +        Color:
       +            rgba: 1, 1, 1, 1
       +    Image:
       +        source: root.source
       +        color: root.color
       +        size: '30dp', '30dp'
       +        center_x: root.center_x - ((root.texture_size[0]/2)+(self.width/1.5))
       +        center_y: root.center_y
       +
       +
       +<CardSeparator@Widget>
       +    size_hint: 1, None
       +    height: dp(1)
       +    color: .909, .909, .909, 1
       +    canvas:
       +        Color:
       +            rgba: root.color if root.color else (0, 0, 0, 0)
       +        Rectangle:
       +            size: self.size
       +            pos: self.pos
       +
       +<AddressSelector@BlueSpinner>
       +    icon: 'atlas://gui/kivy/theming/light/globe'
       +    values: app.wallet.addresses() if app.wallet else []
       +    text: _("Select Your address")
       +
       +
       +<ElectrumScreen>
       +    ScrollView:
       +        do_scroll_x: False
       +        do_scroll_y: False if root.fullscreen else (content.height > root.height - dp(16))
       +        AnchorLayout:
       +            size_hint_y: None
       +            height: root.height if root.fullscreen else max(root.height, content.height)
       +            GridLayout:
       +                id: content
       +                cols: 1
       +                spacing: '8dp'
       +                padding: '8dp'
       +                size_hint: (1, 1) if root.fullscreen else (.8, None)
       +                height: self.height if root.fullscreen else self.minimum_height
       +
       +
       +<TabbedCarousel>
       +    carousel: carousel
       +    do_default_tab: False
       +    Carousel:
       +        scroll_timeout: 190
       +        anim_type: 'out_quart'
       +        min_move: .05
       +        anim_move_duration: .1
       +        anim_cancel_duration: .54
       +        scroll_distance: '10dp'
       +        on_index: root.on_index(*args)
       +        id: carousel
       +
       +
       +<CarouselIndicator@TabbedCarousel>
       +    tab_pos: 'bottom_mid'
       +    tab_height: '32dp'
       +    tab_width: self.tab_height
       +    #background_image: 'atlas://data/images/defaulttheme/action_item'
       +    strip_border: 0, 0, 0, 0
       +
       +<CloseButton@IconButton>
       +    source: 'atlas://gui/kivy/theming/light/closebutton'
       +    opacity: 1 if self.state == 'normal' else .75
       +    size_hint: None, None
       +    size: '27dp', '27dp'
       +
       +<-CarouselDialog>
       +    header_color: '#707070ff'
       +    text_color: 0.701, 0.701, 0.701, 1
       +    title_size: '13sp'
       +    title: ''
       +    separator_color: 0.89, 0.89, 0.89, 1
       +    background: 'atlas://gui/kivy/theming/light/tab_btn'
       +    carousel_content: carousel_content
            canvas.before:
                Color:
       +            rgba: 0, 0, 0, .9
       +        Rectangle:
       +            size: Window.size
       +            pos: 0, 0
       +        Color:
                    rgba: 1, 1, 1, 1
       -        Rectangle
       +        BorderImage:
       +            border: 12, 12, 12, 12
       +            source: 'atlas://gui/kivy/theming/light/dialog'
       +            size: root.width, root.height - self.carousel_content.tab_height if self.carousel_content else 0
       +            pos: root.x, self.y + self.carousel_content.tab_height if self.carousel_content else 10
       +    BoxLayout:
       +        orientation: 'vertical'
       +        GridLayout:
       +            cols: 1
       +            size_hint: 1, None
       +            height: self.minimum_height
       +            padding: 0, '7sp'
       +            Label:
       +                font_size: root.title_size
       +                text: u'[color={}]{}[/color]'.format(root.header_color, root.title)
       +                text_size: self.width, None
       +                halign: 'left'
       +                size_hint: 1, None
       +                height: self.texture_size[1]
       +            CardSeparator:
       +                color: root.separator_color
       +                height: root.separator_height
       +        FloatLayout:
       +            size_hint: None, None
       +            size: 0, 0
       +            CloseButton:
       +                id: but_close
       +                top: root.top - dp(10)
       +                right: root.right - dp(10)
       +                on_release: root.dismiss()
       +        CarouselIndicator:
       +            id: carousel_content
       +
       +
       +<CleanHeader@TabbedPanelHeader>
       +    border: 0, 0, 16, 0
       +    markup: False
       +    text_size: self.size
       +    halign: 'center'
       +    valign: 'middle'
       +    bold: True
       +    font_size: '12.5sp'
       +    background_normal: 'atlas://gui/kivy/theming/light/tab_btn'
       +    background_disabled_normal: 'atlas://gui/kivy/theming/light/tab_btn_disabled'
       +    background_down: 'atlas://gui/kivy/theming/light/tab_btn_pressed'
       +    #canvas.before:
       +    #    Color:
       +    #        rgba: .6, .6, .6, .7
       +    #    Rectangle:
       +    #        size: self.size
       +    #        pos: self.x + 1, self.y - 1
       +    #        texture: self.texture
       +
       +
       +<ColoredLabel@Label>:
       +    font_size: '48sp'
       +    color: (.6, .6, .6, 1)
       +    canvas.before:
       +        Color:
       +            rgb: (.9, .9, .9)
       +        Rectangle:
       +            pos: self.x + sp(2), self.y + sp(2)
       +            size: self.width - sp(4), self.height - sp(4)
       +
       +
       +
       +<ScreenTabs@Screen>
       +    TabbedCarousel:
       +        id: panel
       +        tab_height: '48dp'
       +        default_tab: send_tab
       +        strip_border: 0, 0, 0, 0
       +
       +        HistoryScreen:
       +            id: history_screen
       +            tab: history_tab
       +
       +        SendScreen:
       +            id: send_screen
       +            tab: send_tab
       +
       +        ReceiveScreen:
       +            id: receive_screen
       +            tab: receive_tab
       +
       +        ContactsScreen:
       +            id: contacts_screen
       +            tab: contacts_tab
       +
       +        CleanHeader:
       +            id: history_tab
       +            text: _('History')
       +            slide: 0
       +        CleanHeader:
       +            id: send_tab
       +            text: _('Send')
       +            slide: 1
       +        CleanHeader:
       +            id: receive_tab
       +            text: _('Receive')
       +            slide: 2
       +        CleanHeader:
       +            id: contacts_tab
       +            text: _('Contacts')
       +            slide: 3
       +
       +
       +<ActionButton>:
       +    border: 4, 0, 0, 0
       +    #background_down: 'atlas://gui/kivy/theming/light/overflow_btn_dn'
       +
       +<OverflowButton@ActionButton>
       +    text_size: dp(50), None
       +    last: False
       +    halign: 'left'
       +    valign: 'middle'
       +    overflow: None
       +    #background_normal:
       +    #    'atlas://gui/kivy/theming/light/' +\
       +    #    ('action_button_group'\
       +    #    if (self.inside_group and not self.last) else 'tab_btn')
       +
       +    #on_press:
       +    #    ddn = self.overflow._dropdown
       +    #    Factory.Animation.cancel_all(ddn)
       +    #    anim = Factory.Animation(opacity=0, d=.25)
       +    #    anim.bind(on_complete=ddn.dismiss)
       +    #    anim.start(ddn)
       +
       +BoxLayout:
       +
       +    orientation: 'vertical'
       +
       +    canvas.before:
       +        Color:
       +            rgb: .6, .6, .6
       +        Rectangle:
                    size: self.size
       -            pos: self.pos
       -\ No newline at end of file
       +            source: 'gui/kivy/data/background.png'
       +
       +    ActionBar:
       +
       +        ActionView:
       +            id: av
       +
       +            ActionPrevious: 
       +                app_icon: 'atlas://gui/kivy/theming/light/logo'
       +                with_previous: False
       +                on_release: app.on_back()
       +
       +            ActionButton:
       +                id: action_status
       +                important: True
       +                size_hint: 1, 1
       +                markup: True
       +                mipmap: True
       +                bold: True
       +                markup: True
       +                color: 1, 1, 1, 1
       +                text:
       +                    "[color=#777777]{}[/color]"\
       +                    .format(app.status)
       +                font_size: '22dp'
       +                minimum_width: '1dp'
       +
       +            ActionOverflow:
       +                id: action_overflow
       +                width: '60dp'
       +                OverflowButton:
       +                    text: _('Network')
       +                    overflow: action_overflow
       +                    on_release: app.popup_dialog('network')
       +                OverflowButton:
       +                    text: _('Wallet')
       +                    overflow: action_overflow
       +                    on_release: app.popup_dialog('wallet')
       +                OverflowButton:
       +                    text: _('Preferences')
       +                    overflow: action_overflow
       +                    on_release: app.popup_dialog('settings')
       +                
       +    ScreenManager:
       +        id: manager
       +        #tabs: Factory.ScreenTabs()
       +        ScreenTabs:
       +            id: tabs
       +            name: "tabs"
       +
       +        #on_current_screen:
       +            #spnr.text = args[1].name
       +            #idx = app.screen_names.index(args[1].name)
       +            #if idx > -1: app.hierarchy.append(idx)
       +            #args
   DIR diff --git a/gui/kivy/main_window.py b/gui/kivy/main_window.py
       t@@ -9,11 +9,6 @@ from electrum.contacts import Contacts
        from electrum import bitcoin
        from electrum.util import profiler, print_error
        
       -from kivy.config import Config
       -Config.set('modules', 'screen', 'droid2')
       -Config.set('graphics', 'width', '480')
       -Config.set('graphics', 'height', '840')
       -
        from kivy.app import App
        from kivy.core.window import Window
        from kivy.logger import Logger
       t@@ -23,8 +18,7 @@ from kivy.properties import (OptionProperty, AliasProperty, ObjectProperty,
        from kivy.cache import Cache
        from kivy.clock import Clock
        from kivy.factory import Factory
       -
       -from electrum_gui.kivy.uix.drawer import Drawer
       +from kivy.metrics import inch, metrics
        
        # lazy imports for factory so that widgets can be used in kv
        Factory.register('InstallWizard',
       t@@ -34,15 +28,31 @@ Factory.register('ELTextInput', module='electrum_gui.kivy.uix.screens')
        
        
        # delayed imports: for startup speed on android
       -notification = app = Decimal = ref = format_satoshis = Builder = None
       -inch = None
       +notification = app = ref = format_satoshis = Builder = None
        util = False
       -re = None
       +
       +from decimal import Decimal
       +import re
        
        # register widget cache for keeping memory down timeout to forever to cache
        # the data
        Cache.register('electrum_widgets', timeout=0)
        
       +from kivy.uix.screenmanager import Screen
       +from kivy.uix.tabbedpanel import TabbedPanel
       +
       +class ElectrumScreen(Screen):
       +    fullscreen = BooleanProperty(False)
       +    #def add_widget(self, *args):
       +    #    if 'content' in self.ids:
       +    #        return self.ids.content.add_widget(*args)
       +    #    return super(ElectrumScreen, self).add_widget(*args)
       +
       +
       +Factory.register('TabbedCarousel', module='electrum_gui.kivy.uix.screens')
       +
       +
       +
        class ElectrumWindow(App):
        
            def _get_bu(self):
       t@@ -102,11 +112,9 @@ class ElectrumWindow(App):
            :attr:`electrum_config` is a `ObjectProperty`, defaults to None.
            '''
        
       -    status = StringProperty(_('Uninitialised'))
       -    '''The status of the connection should show the balance when connected
       +    status = StringProperty(_('Not Connected'))
       +    balance = StringProperty('')
        
       -    :attr:`status` is a `StringProperty` defaults to 'uninitialised'
       -    '''
        
            def _get_num_zeros(self):
                try:
       t@@ -136,11 +144,8 @@ class ElectrumWindow(App):
                return int(p * x)
        
        
       -    navigation_higherarchy = ListProperty([])
       -    '''This is a list of the current navigation higherarchy of the app used to
       -    navigate using back button.
       -
       -    :attr:`navigation_higherarchy` is s `ListProperty` defaults to []
       +    hierarchy = ListProperty([])
       +    '''used to navigate with the back button.
            '''
        
            _orientation = OptionProperty('landscape',
       t@@ -239,6 +244,8 @@ class ElectrumWindow(App):
                global Builder
                if not Builder:
                    from kivy.lang import Builder
       +
       +
                return Builder.load_file('gui/kivy/main.kv')
        
            def _pause(self):
       t@@ -252,6 +259,7 @@ class ElectrumWindow(App):
            def on_start(self):
                ''' This is the start point of the kivy ui
                '''
       +        Logger.info("dpi: {} {}".format(metrics.dpi, metrics.dpi_rounded))
                win = Window
                win.bind(size=self.on_size,
                            on_keyboard=self.on_keyboard)
       t@@ -299,6 +307,14 @@ class ElectrumWindow(App):
                if self.wallet:
                    self.wallet.stop_threads()
        
       +    def on_back(self):
       +        try:
       +            self.hierarchy.pop()()
       +        except IndexError:
       +            # capture back button and pause app.
       +            self._pause()
       +
       +
            def on_keyboard_height(self, window, height):
                win = window
                active_widg = win.children[0]
       t@@ -351,6 +367,12 @@ class ElectrumWindow(App):
                self.init_ui()
                self.load_wallet(wallet)
        
       +    def popup_dialog(self, name):
       +        popup = Builder.load_file('gui/kivy/uix/ui_screens/'+name+'.kv')
       +        popup.open()
       +
       +
       +
            @profiler
            def init_ui(self):
                ''' Initialize The Ux part of electrum. This function performs the basic
       t@@ -366,13 +388,15 @@ class ElectrumWindow(App):
                self.completions = []
        
                # setup UX
       -        self.screens = ['mainscreen',]
       +        self.screens = {}
        
                #setup lazy imports for mainscreen
                Factory.register('AnimatedPopup',
                                 module='electrum_gui.kivy.uix.dialogs')
       -        Factory.register('TabbedCarousel',
       -                         module='electrum_gui.kivy.uix.screens')
       +
       +        #Factory.register('TabbedCarousel',
       +        #                 module='electrum_gui.kivy.uix.screens')
       +
                Factory.register('ScreenDashboard',
                                 module='electrum_gui.kivy.uix.screens')
                #Factory.register('EffectWidget',
       t@@ -386,17 +410,26 @@ class ElectrumWindow(App):
        
                # preload widgets. Remove this if you want to load the widgets on demand
                Cache.append('electrum_widgets', 'AnimatedPopup', Factory.AnimatedPopup())
       -        Cache.append('electrum_widgets', 'TabbedCarousel', Factory.TabbedCarousel())
       +
       +        #Cache.append('electrum_widgets', 'TabbedCarousel', Factory.TabbedCarousel())
       +
                Cache.append('electrum_widgets', 'QRCodeWidget', Factory.QRCodeWidget())
                Cache.append('electrum_widgets', 'CSpinner', Factory.CSpinner())
        
                # load and focus the ui
                #Load mainscreen
       -        dr = Builder.load_file('gui/kivy/uix/ui_screens/mainscreen.kv')
       -        self.root.add_widget(dr)
       -        self.root.manager = manager = dr.ids.manager
       -        self.root.main_screen = m = manager.screens[0]
       -        self.tabs = m.ids.tabs
       +
       +        #dr = Builder.load_file('gui/kivy/uix/ui_screens/mainscreen.kv')
       +        #self.root.add_widget(dr)
       +        #self.root.manager = manager = dr.ids.manager
       +        #self.root.main_screen = m = manager.screens[0]
       +        #self.tabs = m.ids.tabs
       +
       +        self.root.manager = self.root.ids['manager']
       +        self.recent_activity_card = None
       +        self.history_screen = None
       +        self.contacts_screen = None
       +        self.wallet_screen = None
        
                #TODO
                # load left_menu
       t@@ -411,6 +444,7 @@ class ElectrumWindow(App):
        
                self.wallet = None
        
       +
            def create_quote_text(self, btc_balance, mode='normal'):
                '''
                '''
       t@@ -473,10 +507,6 @@ class ElectrumWindow(App):
                if not self.wallet:
                    return
        
       -        global Decimal
       -        if not Decimal:
       -            from decimal import Decimal
       -
                unconfirmed = ''
                quote_text = ''
        
       t@@ -487,34 +517,38 @@ class ElectrumWindow(App):
                    server_height = self.network.get_server_height()
                    server_lag = self.network.get_local_height() - server_height
                    if not self.wallet.up_to_date or server_height == 0:
       -                text = _("Synchronizing...")
       +                self.status = _("Synchronizing...")
                    elif server_lag > 1:
       -                text = _("Server is lagging (%d blocks)"%server_lag)
       +                self.status = _("Server lagging (%d blocks)"%server_lag)
                    else:
                        c, u, x = self.wallet.get_account_balance(self.current_account)
                        text = self.format_amount(c)
       +                self.balance = text
                        if u:
                            unconfirmed =  " [%s unconfirmed]" %( self.format_amount(u, True).strip())
                        if x:
                            unmatured =  " [%s unmatured]"%(self.format_amount(x, True).strip())
       +                self.balance = text.strip()
                        quote_text = self.create_quote_text(Decimal(c+u+x)/100000000, mode='symbol') or ''
       +                self.status = self.balance
                else:
       -            text = _("Not connected")
       -        try:
       -            status_card = self.root.main_screen.ids.tabs.ids.\
       -                        screen_dashboard.ids.status_card
       -        except AttributeError:
       -            return
       -        self.status = text.strip()
       +            self.status = _("Not connected")
       +            
       +        return
       +
       +        print self.root.manager.ids
       +
       +        #try:
       +        status_card = self.root.main_screen.ids.tabs.ids.\
       +                      screen_dashboard.ids.status_card
       +        #except AttributeError:
       +        #    return
       +
                status_card.quote_text = quote_text.strip()
                status_card.uncomfirmed = unconfirmed.strip()
        
            def format_amount(self, x, is_diff=False, whitespaces=False):
       -        '''
       -        '''
       -        global format_satoshis
       -        if not format_satoshis:
       -            from electrum.util import format_satoshis
       +        from electrum.util import format_satoshis
                return format_satoshis(x, is_diff, self.num_zeros,
                                       self.decimal_point, whitespaces)
        
       t@@ -532,116 +566,16 @@ class ElectrumWindow(App):
                    self.update_history_tab()
                    self.update_contacts_tab()
        
       -    def parse_histories(self, items):
       -        for item in items:
       -            tx_hash, conf, value, timestamp, balance = item
       -            time_str = _("unknown")
       -            if conf > 0:
       -                try:
       -                    time_str = datetime.datetime.fromtimestamp(
       -                                    timestamp).isoformat(' ')[:-3]
       -                except Exception:
       -                    time_str = _("error")
       -
       -            if conf == -1:
       -                time_str = _('unverified')
       -                icon = "atlas://gui/kivy/theming/light/close"
       -            elif conf == 0:
       -                time_str = _('pending')
       -                icon = "atlas://gui/kivy/theming/light/unconfirmed"
       -            elif conf < 6:
       -                time_str = ''  # add new to fix error when conf < 0
       -                conf = max(1, conf)
       -                icon = "atlas://gui/kivy/theming/light/clock{}".format(conf)
       -            else:
       -                icon = "atlas://gui/kivy/theming/light/confirmed"
       -
       -            if value is not None:
       -                v_str = self.format_amount(value, True).replace(',','.')
       -            else:
       -                v_str = '--'
       -
       -            balance_str = self.format_amount(balance).replace(',','.')
       -
       -            if tx_hash:
       -                label, is_default_label = self.wallet.get_label(tx_hash)
       -            else:
       -                label = _('Pruned transaction outputs')
       -                is_default_label = False
       -
       -            yield (conf, icon, time_str, label, v_str, balance_str, tx_hash)
        
            @profiler
            def update_history_tab(self, see_all=False):
       -        try:
       -            history_card = self.root.main_screen.ids.tabs.ids.\
       -                        screen_dashboard.ids.recent_activity_card
       -        except AttributeError:
       -            return
       -        histories = self.parse_histories(reversed(
       -                        self.wallet.get_history(self.current_account)))
       -
       -        # repopulate History Card
       -        last_widget = history_card.ids.content.children[-1]
       -        history_card.ids.content.clear_widgets()
       -        history_add = history_card.ids.content.add_widget
       -        history_add(last_widget)
       -        RecentActivityItem = Factory.RecentActivityItem
       -        global Decimal, ref
       -        if not ref:
       -            from weakref import ref
       -        if not Decimal:
       -            from decimal import Decimal
       -
       -        get_history_rate = self.get_history_rate
       -        count = 0
       -        for items in histories:
       -            count += 1
       -            conf, icon, date_time, address, amount, balance, tx = items
       -            ri = RecentActivityItem()
       -            ri.icon = icon
       -            ri.date = date_time
       -            mintimestr = date_time.split()[0]
       -            ri.address = address
       -            ri.amount = amount
       -            ri.quote_text = get_history_rate(ref(ri),
       -                                             Decimal(amount),
       -                                             mintimestr)
       -            ri.balance = balance
       -            ri.confirmations = conf
       -            ri.tx_hash = tx
       -            history_add(ri)
       -            if count == 8 and not see_all:
       -                break
       -
       -        history_card.ids.btn_see_all.opacity = (0 if count < 8 else 1)
       -
       +        if self.history_screen:
       +            self.history_screen.update(see_all)
        
            def update_contacts_tab(self):
       -        contact_list = self.root.main_screen.ids.tabs.ids.\
       -            screen_contacts.ids.contact_container
       -        #contact_list.clear_widgets()
       +        if self.contacts_screen:
       +            self.contacts_screen.update()
        
       -        child = -1
       -        children = contact_list.children
       -
       -        for key in sorted(self.contacts.keys()):
       -            _type, address = self.contacts[key]
       -            label = self.wallet.labels.get(address, '')
       -            child += 1
       -            try:
       -                if children[child].label == label:
       -                    continue
       -            except IndexError:
       -                pass
       -            tx = self.wallet.get_num_tx(address)
       -            ci = Factory.ContactItem()
       -            ci.address = address
       -            ci.label = label
       -            ci.tx_amount = tx
       -            contact_list.add_widget(ci)
       -
       -        #self.run_hook('update_contacts_tab')
        
            def do_send(self):
                app = App.get_running_app()
       t@@ -650,9 +584,6 @@ class ElectrumWindow(App):
                label = unicode(scrn.message_e.text)
                r = unicode(scrn.payto_e.text).strip()
                # label or alias, with address in brackets
       -        global re
       -        if not re:
       -            import re
                m = re.match('(.*?)\s*\<([1-9A-HJ-NP-Za-km-z]{26,})\>', r)
                to_address = m.group(2) if m else r
        
       t@@ -774,46 +705,23 @@ class ElectrumWindow(App):
            def on_size(self, instance, value):
                width, height = value
                self._orientation = 'landscape' if width > height else 'portrait'
       -
       -        global inch
       -        if not inch:
       -            from kivy.metrics import inch
       -
                self._ui_mode = 'tablet' if min(width, height) > inch(3.51) else 'phone'
       -        Logger.debug('orientation: {} ui_mode: {}'.format(self._orientation,
       -                                                          self._ui_mode))
       -
       -    def load_screen(self, index=0, direction='left', manager=None, switch=True):
       -        ''' Load the appropriate screen as mentioned in the parameters.
       -        '''
       +        #Logger.info("size: {} {}".format(width, height))
       +        #Logger.info('orientation: {}'.format(self._orientation))
       +        #Logger.info('ui_mode: {}'.format(self._ui_mode))
       +
       +    def load_screen(self, name, direction='left', manager=None):
       +        screen = self.screens.get(name)
       +        if screen is None:
       +            screen = Builder.load_file('gui/kivy/uix/ui_screens/' + name + '.kv')
       +            screen.name = name
       +            self.screens[name] = screen
                manager = manager or self.root.manager
       -        screen = Builder.load_file('gui/kivy/uix/ui_screens/'\
       -            + self.screens[index] + '.kv')
       -        screen.name = self.screens[index]
       -        if switch:
       -            manager.switch_to(screen, direction=direction)
       -        return screen
       -
       -    def load_next_screen(self):
       -        '''
       -        '''
       -        manager = root.manager
       -        try:
       -            self.load_screen(self.screens.index(manager.current_screen.name)+1,
       -                             manager=manager)
       -        except IndexError:
       -            self.load_screen()
       +        manager.switch_to(screen, direction=direction)
        
       -    def load_previous_screen(self):
       -        ''' Load the previous screen from disk.
       -        '''
       -        manager = root.manager
       -        try:
       -            self.load_screen(self.screens.index(manager.current_screen.name)-1,
       -                             direction='right',
       -                             manager=manager)
       -        except IndexError:
       -            pass
       +    def load_history(self):
       +        #Builder.load_file('gui/kivy/uix/ui_screens/history.kv')
       +        print "load history", self.root.manager.ids.history
        
            def save_new_contact(self, address, label):
                address = unicode(address)
   DIR diff --git a/gui/kivy/theming/light-0.png b/gui/kivy/theming/light-0.png
       Binary files differ.
   DIR diff --git a/gui/kivy/theming/light.atlas b/gui/kivy/theming/light.atlas
       t@@ -1 +1 @@
parazyd.org:70 /git/electrum/commit/65ecbf990d712fd152ef6d1f8e5a3a7401839df1.gph:966: line too long