mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-23 17:47:31 +00:00
merge dashboard back into ui
This commit is contained in:
parent
1179a4cf9e
commit
9938316400
7 changed files with 324 additions and 1034 deletions
|
@ -7,14 +7,14 @@ theming:
|
||||||
$(PYTHON) -m kivy.atlas theming/light 1024 theming/light/*.png
|
$(PYTHON) -m kivy.atlas theming/light 1024 theming/light/*.png
|
||||||
apk:
|
apk:
|
||||||
# running pre build setup
|
# running pre build setup
|
||||||
@cp build/buildozer.spec ../../buildozer.spec
|
@cp tools/buildozer.spec ../../buildozer.spec
|
||||||
# get aes.py
|
# get aes.py
|
||||||
@cd ../..; wget -4 https://raw.github.com/devrandom/slowaes/master/python/aes.py
|
@cd ../..; wget -4 https://raw.github.com/devrandom/slowaes/master/python/aes.py
|
||||||
# rename electrum to main.py
|
# rename electrum to main.py
|
||||||
@mv ../../electrum ../../main.py
|
@mv ../../electrum ../../main.py
|
||||||
@-if [ ! -d "../../.buildozer" ];then \
|
@-if [ ! -d "../../.buildozer" ];then \
|
||||||
cd ../..; buildozer android debug;\
|
cd ../..; buildozer android debug;\
|
||||||
cp -f gui/kivy/build/blacklist.txt .buildozer/android/platform/python-for-android/src/blacklist.txt;\
|
cp -f gui/kivy/tools/blacklist.txt .buildozer/android/platform/python-for-android/src/blacklist.txt;\
|
||||||
rm -rf ./.buildozer/android/platform/python-for-android/dist;\
|
rm -rf ./.buildozer/android/platform/python-for-android/dist;\
|
||||||
fi
|
fi
|
||||||
@-cd ../..; buildozer android debug deploy run
|
@-cd ../..; buildozer android debug deploy run
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from kivy.uix.carousel import Carousel
|
from kivy.uix.carousel import Carousel
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
|
||||||
class CCarousel(Carousel):
|
class Carousel(Carousel):
|
||||||
|
|
||||||
def on_touch_move(self, touch):
|
def on_touch_move(self, touch):
|
||||||
if self._get_uid('cavoid') in touch.ud:
|
if self._get_uid('cavoid') in touch.ud:
|
||||||
|
@ -30,11 +30,3 @@ class CCarousel(Carousel):
|
||||||
|
|
||||||
self._offset += diff * 1.27
|
self._offset += diff * 1.27
|
||||||
return True
|
return True
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
from kivy.app import runTouchApp
|
|
||||||
from kivy.uix.button import Button
|
|
||||||
cc = CCarousel()
|
|
||||||
for i in range(10):
|
|
||||||
cc.add_widget(Button(text=str(i)))
|
|
||||||
runTouchApp(cc)
|
|
|
@ -111,7 +111,7 @@ class Drawer(StencilView):
|
||||||
ov = self._overlay_widget
|
ov = self._overlay_widget
|
||||||
ov.x=min(self._hidden_widget.width,
|
ov.x=min(self._hidden_widget.width,
|
||||||
max(ov.x + touch.dx*2, 0))
|
max(ov.x + touch.dx*2, 0))
|
||||||
#_anim = Animation(x=x, duration=1/60)
|
#_anim = Animation(x=x, duration=1/2, t='in_out_quart')
|
||||||
#_anim.cancel_all(ov)
|
#_anim.cancel_all(ov)
|
||||||
#_anim.start(ov)
|
#_anim.start(ov)
|
||||||
|
|
||||||
|
|
|
@ -440,27 +440,23 @@ StencilView
|
||||||
Rectangle:
|
Rectangle:
|
||||||
size: self.size
|
size: self.size
|
||||||
pos: self.pos
|
pos: self.pos
|
||||||
canvas.after:
|
|
||||||
Color
|
|
||||||
rgba: 1, 1, 1, 1
|
|
||||||
BorderImage
|
|
||||||
border: 0, 32, 0, 0
|
|
||||||
source: 'atlas://gui/kivy/theming/light/shadow_right'
|
|
||||||
pos: self.pos
|
|
||||||
size: self.size
|
|
||||||
width:
|
width:
|
||||||
(root.width * .877) if app.ui_mode[0] == 'p'\
|
(root.width * .877) if app.ui_mode[0] == 'p'\
|
||||||
else root.width * .35 if app.orientation[0] == 'l'\
|
else root.width * .35 if app.orientation[0] == 'l'\
|
||||||
else root.width * .10
|
else root.width * .10
|
||||||
height: root.height
|
height: root.height
|
||||||
ScreenManager:
|
BoxLayout:
|
||||||
id: manager
|
|
||||||
x: wallet_management.width if app.ui_mode[0] == 't' else 0
|
x: wallet_management.width if app.ui_mode[0] == 't' else 0
|
||||||
size: root.size
|
width: (root.width - self.x) if app.ui_mode[0] == 't' else root.width
|
||||||
|
size_hint: None, None
|
||||||
|
height: root.height
|
||||||
canvas.before:
|
canvas.before:
|
||||||
Color
|
Color
|
||||||
rgba: 1, 1, 1, 1
|
rgba: 1, 1, 1, 1
|
||||||
BorderImage:
|
BorderImage
|
||||||
border: 2, 2, 2, 23
|
border: 0, 32, 0, 0
|
||||||
size: self.size
|
source: 'atlas://gui/kivy/theming/light/shadow_right'
|
||||||
pos: self.x, self.y
|
pos: root.pos
|
||||||
|
size: self.x, self.height
|
||||||
|
ScreenManager:
|
||||||
|
id: manager
|
|
@ -7,16 +7,17 @@ from electrum.wallet import format_satoshis
|
||||||
|
|
||||||
from kivy.app import App
|
from kivy.app import App
|
||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
from kivy.metrics import inch
|
from kivy.lang import Builder
|
||||||
from kivy.logger import Logger
|
from kivy.logger import Logger
|
||||||
|
from kivy.metrics import inch
|
||||||
from kivy.utils import platform
|
from kivy.utils import platform
|
||||||
from kivy.properties import (OptionProperty, AliasProperty, ObjectProperty,
|
from kivy.properties import (OptionProperty, AliasProperty, ObjectProperty,
|
||||||
StringProperty, ListProperty)
|
StringProperty, ListProperty)
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
|
||||||
#inclusions for factory so that widgets can be used in kv
|
#inclusions for factory so that widgets can be used in kv
|
||||||
from gui.kivy.drawer import Drawer
|
from electrum_gui.kivy.drawer import Drawer
|
||||||
from gui.kivy.dialog import InfoBubble
|
from electrum_gui.kivy.dialog import InfoBubble
|
||||||
|
|
||||||
# delayed imports
|
# delayed imports
|
||||||
notification = None
|
notification = None
|
||||||
|
@ -307,7 +308,8 @@ class ElectrumWindow(App):
|
||||||
self.completions = []
|
self.completions = []
|
||||||
|
|
||||||
# setup UX
|
# setup UX
|
||||||
#self.load_dashboard
|
self.screens = ['mainscreen']
|
||||||
|
self.load_screen(index=0)
|
||||||
|
|
||||||
self.icon = "icons/electrum.png"
|
self.icon = "icons/electrum.png"
|
||||||
|
|
||||||
|
@ -352,8 +354,8 @@ class ElectrumWindow(App):
|
||||||
return quote_text
|
return quote_text
|
||||||
|
|
||||||
def set_currencies(self, quote_currencies):
|
def set_currencies(self, quote_currencies):
|
||||||
#TODO remove this and just directly update a observable property
|
|
||||||
self._trigger_update_status()
|
self._trigger_update_status()
|
||||||
|
print quote_currencies
|
||||||
self.currencies = sorted(quote_currencies.keys())
|
self.currencies = sorted(quote_currencies.keys())
|
||||||
|
|
||||||
def update_console(self, *dt):
|
def update_console(self, *dt):
|
||||||
|
@ -683,19 +685,22 @@ class ElectrumWindow(App):
|
||||||
Logger.debug('orientation: {} ui_mode: {}'.format(self._orientation,
|
Logger.debug('orientation: {} ui_mode: {}'.format(self._orientation,
|
||||||
self._ui_mode))
|
self._ui_mode))
|
||||||
|
|
||||||
def load_screen(self, index=0, direction='left'):
|
def load_screen(self, index=0, direction='left', manager=None):
|
||||||
|
''' Load the appropriate screen as mentioned in the parameters.
|
||||||
'''
|
'''
|
||||||
'''
|
manager = manager or self.root.manager
|
||||||
screen = Builder.load_file('data/screens/' + self.screens[index])
|
screen = Builder.load_file('gui/kivy/ui_screens/'\
|
||||||
|
+ self.screens[index] + '.kv')
|
||||||
screen.name = self.screens[index]
|
screen.name = self.screens[index]
|
||||||
root.manager.switch_to(screen, direction=direction)
|
manager.switch_to(screen, direction=direction)
|
||||||
|
|
||||||
def load_next_screen(self):
|
def load_next_screen(self):
|
||||||
'''
|
'''
|
||||||
'''
|
'''
|
||||||
manager = root.manager
|
manager = root.manager
|
||||||
try:
|
try:
|
||||||
self.load_screen(self.screens.index(manager.current_screen.name)+1)
|
self.load_screen(self.screens.index(manager.current_screen.name)+1,
|
||||||
|
manager=manager)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
self.load_screen()
|
self.load_screen()
|
||||||
|
|
||||||
|
@ -705,9 +710,10 @@ class ElectrumWindow(App):
|
||||||
manager = root.manager
|
manager = root.manager
|
||||||
try:
|
try:
|
||||||
self.load_screen(self.screens.index(manager.current_screen.name)-1,
|
self.load_screen(self.screens.index(manager.current_screen.name)-1,
|
||||||
direction='right')
|
direction='right',
|
||||||
|
manager=manager)
|
||||||
except IndexError:
|
except IndexError:
|
||||||
self.load_screen(-1, direction='right')
|
pass
|
||||||
|
|
||||||
def show_error(self, error,
|
def show_error(self, error,
|
||||||
width='200dp',
|
width='200dp',
|
||||||
|
|
File diff suppressed because it is too large
Load diff
286
gui/kivy/ui_screens/mainscreen.kv
Normal file
286
gui/kivy/ui_screens/mainscreen.kv
Normal file
|
@ -0,0 +1,286 @@
|
||||||
|
#:import TabbedCarousel electrum_gui.kivy.tabbed_carousel.TabbedCarousel
|
||||||
|
#:import ScreenDashboard electrum_gui.kivy.screens.ScreenDashboard
|
||||||
|
#:import Factory kivy.factory.Factory
|
||||||
|
#:import Carousel electrum_gui.kivy.carousel.Carousel
|
||||||
|
|
||||||
|
Screen:
|
||||||
|
canvas.before:
|
||||||
|
Color:
|
||||||
|
rgba: 0.917, 0.917, 0.917, 1
|
||||||
|
Rectangle:
|
||||||
|
size: self.size
|
||||||
|
pos: self.pos
|
||||||
|
BoxLayout:
|
||||||
|
orientation: 'vertical'
|
||||||
|
ActionBar:
|
||||||
|
id: action_bar
|
||||||
|
size_hint: 1, None
|
||||||
|
height: '40dp'
|
||||||
|
border: 4, 4, 4, 4
|
||||||
|
background_image: 'atlas://gui/kivy/theming/light/action_bar'
|
||||||
|
ScreenManager:
|
||||||
|
id: manager
|
||||||
|
ScreenTabs:
|
||||||
|
id: tabs
|
||||||
|
name: "tabs"
|
||||||
|
#ScreenPassword:
|
||||||
|
# id: password
|
||||||
|
# name: 'password'
|
||||||
|
|
||||||
|
<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
|
||||||
|
|
||||||
|
################################
|
||||||
|
## Cards (under Dashboard)
|
||||||
|
################################
|
||||||
|
|
||||||
|
<Card@GridLayout>
|
||||||
|
cols: 1
|
||||||
|
padding: '12dp' , '22dp', '12dp' , '12dp'
|
||||||
|
spacing: '12dp'
|
||||||
|
size_hint: 1, None
|
||||||
|
height: max(100, self.minimum_height)
|
||||||
|
canvas.before:
|
||||||
|
Color:
|
||||||
|
rgba: 1, 1, 1, 1
|
||||||
|
BorderImage:
|
||||||
|
border: 9, 9, 9, 9
|
||||||
|
source: 'atlas://gui/kivy/theming/light/card'
|
||||||
|
size: self.size
|
||||||
|
pos: self.pos
|
||||||
|
|
||||||
|
<CardLabel@Label>
|
||||||
|
color: 0.45, 0.45, 0.45, 1
|
||||||
|
size_hint: 1, None
|
||||||
|
text: ''
|
||||||
|
text_size: self.width, None
|
||||||
|
height: self.texture_size[1]
|
||||||
|
halign: 'left'
|
||||||
|
valign: 'top'
|
||||||
|
|
||||||
|
<CardButton@Button>
|
||||||
|
background_normal: 'atlas://gui/kivy/theming/light/card_btn'
|
||||||
|
bold: True
|
||||||
|
font_size: '10sp'
|
||||||
|
color: 0.699, 0.699, 0.699, 1
|
||||||
|
size_hint: None, None
|
||||||
|
size: self.texture_size[0] + dp(32), self.texture_size[1] + dp(7)
|
||||||
|
|
||||||
|
<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
|
||||||
|
|
||||||
|
<CardRecentActivity@Card>
|
||||||
|
BoxLayout:
|
||||||
|
size_hint: 1, None
|
||||||
|
height: lbl.height
|
||||||
|
CardLabel:
|
||||||
|
id: lbl
|
||||||
|
text: _('RECENT ACTIVITY')
|
||||||
|
CardButton:
|
||||||
|
id: btn_see_all
|
||||||
|
text: _('SEE ALL')
|
||||||
|
font_size: '12sp'
|
||||||
|
on_release: app.gui.main_gui.update_history(see_all=True)
|
||||||
|
GridLayout:
|
||||||
|
id: content
|
||||||
|
spacing: '7dp'
|
||||||
|
cols: 1
|
||||||
|
size_hint: 1, None
|
||||||
|
height: self.minimum_height
|
||||||
|
CardSeparator
|
||||||
|
|
||||||
|
<CardPaymentRequest@Card>
|
||||||
|
CardLabel:
|
||||||
|
text: _('PAYMENT REQUEST')
|
||||||
|
CardSeparator:
|
||||||
|
|
||||||
|
<CardStatusInfo@Card>
|
||||||
|
status: app.status
|
||||||
|
base_unit: 'BTC'
|
||||||
|
quote_text: '.'
|
||||||
|
unconfirmed: '.'
|
||||||
|
BoxLayout:
|
||||||
|
size_hint: 1, None
|
||||||
|
height: '72dp'
|
||||||
|
IconButton:
|
||||||
|
mipmap: True
|
||||||
|
color: .90, .90, .90, 1
|
||||||
|
source: 'atlas://gui/kivy/theming/light/qrcode'
|
||||||
|
size_hint: None, 1
|
||||||
|
width: self.height
|
||||||
|
on_release:
|
||||||
|
Factory.WalletAddressesDialog().open()
|
||||||
|
GridLayout:
|
||||||
|
id: grid
|
||||||
|
cols: 1
|
||||||
|
orientation: 'vertical'
|
||||||
|
CardLabel:
|
||||||
|
halign: 'right'
|
||||||
|
valign: 'top'
|
||||||
|
bold: True
|
||||||
|
size_hint: 1, None
|
||||||
|
font_size: '38sp'
|
||||||
|
text:
|
||||||
|
'[color=#4E4F4F]{}[/color]'\
|
||||||
|
'[sup][color=9b948d]{}[/color][/sup]'\
|
||||||
|
.format(unicode(root.status), root.base_unit)
|
||||||
|
CardLabel
|
||||||
|
halign: 'right'
|
||||||
|
markup: True
|
||||||
|
font_size: '15dp'
|
||||||
|
text: '[color=#c3c3c3]{}[/color]'.format(root.quote_text)
|
||||||
|
CardLabel
|
||||||
|
halign: 'right'
|
||||||
|
markup: True
|
||||||
|
text: '[color=#c3c3c3]{}[/color]'.format(root.unconfirmed)
|
||||||
|
|
||||||
|
<DashboardActionView@ActionView>
|
||||||
|
ActionPrevious:
|
||||||
|
id: action_previous
|
||||||
|
app_icon: 'atlas://gui/kivy/theming/light/wallets'
|
||||||
|
with_previous: False
|
||||||
|
size_hint: None, 1
|
||||||
|
mipmap: True
|
||||||
|
width: '77dp'
|
||||||
|
ActionButton:
|
||||||
|
id: action_logo
|
||||||
|
important: True
|
||||||
|
size_hint: 1, 1
|
||||||
|
markup: True
|
||||||
|
mipmap: True
|
||||||
|
bold: True
|
||||||
|
font_size: '22dp'
|
||||||
|
icon: 'atlas://gui/kivy/theming/light/logo'
|
||||||
|
minimum_width: '1dp'
|
||||||
|
ActionButton:
|
||||||
|
id: action_contact
|
||||||
|
important: True
|
||||||
|
width: '25dp'
|
||||||
|
icon: 'atlas://gui/kivy/theming/light/add_contact'
|
||||||
|
text: 'Add Contact'
|
||||||
|
on_release: NewContactDialog().open()
|
||||||
|
ActionOverflow:
|
||||||
|
id: action_preferences
|
||||||
|
canvas.after:
|
||||||
|
Color:
|
||||||
|
rgba: 1, 1, 1, 1
|
||||||
|
border: 0, 0, 0, 0
|
||||||
|
overflow_image: 'atlas://gui/kivy/theming/light/settings'
|
||||||
|
width: '32dp'
|
||||||
|
ActionButton:
|
||||||
|
text: _('Seed')
|
||||||
|
on_release:
|
||||||
|
action_preferences._dropdown.dismiss()
|
||||||
|
if app.wallet.seed: app.gui.main_gui.protected_seed_dialog(self)
|
||||||
|
ActionButton:
|
||||||
|
text: _('Password')
|
||||||
|
ActionButton:
|
||||||
|
text: _('Network')
|
||||||
|
on_release:
|
||||||
|
app.root.current = 'screen_network'
|
||||||
|
action_preferences._dropdown.dismiss()
|
||||||
|
ActionButton:
|
||||||
|
text: _('Preferences')
|
||||||
|
on_release:
|
||||||
|
action_preferences._dropdown.dismiss()
|
||||||
|
app.gui.main_gui.show_settings_dialog(self)
|
||||||
|
|
||||||
|
<ScreenDashboard>
|
||||||
|
action_view: Factory.DashboardActionView()
|
||||||
|
ScrollView:
|
||||||
|
do_scroll_x: False
|
||||||
|
RelativeLayout:
|
||||||
|
size_hint: 1, None
|
||||||
|
height: grid.height
|
||||||
|
GridLayout
|
||||||
|
id: grid
|
||||||
|
cols: 1 #if root.width < root.height else 2
|
||||||
|
size_hint: 1, None
|
||||||
|
height: self.minimum_height
|
||||||
|
padding: '12dp'
|
||||||
|
spacing: '12dp'
|
||||||
|
GridLayout:
|
||||||
|
cols: 1
|
||||||
|
size_hint: 1, None
|
||||||
|
height: self.minimum_height
|
||||||
|
spacing: '12dp'
|
||||||
|
orientation: 'vertical'
|
||||||
|
CardStatusInfo:
|
||||||
|
id: status_card
|
||||||
|
CardPaymentRequest:
|
||||||
|
id: payment_card
|
||||||
|
CardRecentActivity:
|
||||||
|
id: recent_activity_card
|
||||||
|
|
||||||
|
<CleanHeader@TabbedPanelHeader>
|
||||||
|
border: 0, 0, 4, 0
|
||||||
|
markup: False
|
||||||
|
color: (0.191, 0.558, 0.742, 1) if self.state == 'down' else (0.636, 0.636, 0.636, 1)
|
||||||
|
text_size: self.size
|
||||||
|
halign: 'center'
|
||||||
|
valign: 'middle'
|
||||||
|
bold: True
|
||||||
|
font_size: '12sp'
|
||||||
|
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: 1, 1, 1, .7
|
||||||
|
Rectangle:
|
||||||
|
size: self.size
|
||||||
|
pos: self.x + 1, self.y - 1
|
||||||
|
texture: self.texture
|
||||||
|
|
||||||
|
<ScreenTabs@Screen>
|
||||||
|
TabbedCarousel:
|
||||||
|
id: panel
|
||||||
|
background_image: 'atlas://gui/kivy/theming/light/tab'
|
||||||
|
strip_image: 'atlas://gui/kivy/theming/light/tab_strip'
|
||||||
|
strip_border: 4, 0, 2, 0
|
||||||
|
ScreenDashboard:
|
||||||
|
id: screen_dashboard
|
||||||
|
tab: tab_dashboard
|
||||||
|
#ScreenSend:
|
||||||
|
# id: screen_send
|
||||||
|
# tab: tab_send
|
||||||
|
#ScreenReceive:
|
||||||
|
# id: screen_receive
|
||||||
|
# tab: tab_receive
|
||||||
|
#ScreenContacts:
|
||||||
|
# id: screen_contacts
|
||||||
|
# tab: tab_contacts
|
||||||
|
CleanHeader:
|
||||||
|
id: tab_dashboard
|
||||||
|
text: _('DASHBOARD')
|
||||||
|
slide: 0
|
||||||
|
#CleanHeader:
|
||||||
|
# id: tab_send
|
||||||
|
# text: _('SEND')
|
||||||
|
# slide: 1
|
||||||
|
#CleanHeader:
|
||||||
|
# id: tab_receive
|
||||||
|
# text: _('RECEIVE')
|
||||||
|
# slide: 2
|
||||||
|
#CleanHeader:
|
||||||
|
# id: tab_contacts
|
||||||
|
# text: _('CONTACTS')
|
||||||
|
# slide: 3
|
Loading…
Add table
Reference in a new issue