Implement kivy android client Ui with network status and navigation window listing

This commit is contained in:
surbhi 2019-01-18 13:49:08 +05:30
parent 054ee13874
commit c975bc6523
No known key found for this signature in database
GPG Key ID: 88928762974D3618
31 changed files with 22841 additions and 7 deletions

3
.gitignore vendored
View File

@ -18,3 +18,6 @@ dist
docs/_*/* docs/_*/*
docs/autodoc/ docs/autodoc/
pyan/ pyan/
.buildozer/
debug.log

0
src/.bash_aliases Normal file
View File

22550
src/PyBitmessage/debug.log.1 Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1 @@
30826

Binary file not shown.

View File

@ -0,0 +1,50 @@
from pythonforandroid.toolchain import Recipe, shprint, shutil, current_directory
from os.path import exists, join
import os
import sys
from multiprocessing import cpu_count
import sh
class BitmsghashRecipe(Recipe):
# This could also inherit from PythonRecipe etc. if you want to
# use their pre-written build processes
url = 'https://github.com/surbhicis/bitmsghash/archive/master.zip'
# {version} will be replaced with self.version when downloading
depends = ['openssl']
conflicts = []
def get_recipe_env(self, arch=None):
env = super(BitmsghashRecipe, self).get_recipe_env(arch)
r = Recipe.get_recipe('openssl', self.ctx)
b = r.get_build_dir(arch.arch)
env['CCFLAGS'] = env['CFLAGS'] = \
env['CFLAGS'] + ' -I{openssl_build_path}/include ' \
'-I{openssl_build_path}/include/openssl'.format(
openssl_build_path=b)
env['LDFLAGS'] = \
env['LDFLAGS'] + ' -L{openssl_build_path} ' \
'-lcrypto{openssl_version} ' \
'-lssl{openssl_version}'.format(
openssl_build_path=b,
openssl_version=r.version)
return env
def should_build(self, arch=None):
super(BitmsghashRecipe, self).should_build(arch)
return not exists(
join(self.ctx.get_libs_dir(arch.arch), 'libbitmsghash.so'))
def build_arch(self, arch=None):
super(BitmsghashRecipe, self).build_arch(arch)
env = self.get_recipe_env(arch)
with current_directory(join(self.get_build_dir(arch.arch))):
dst_dir = join(self.get_build_dir(arch.arch))
shprint(sh.make, '-j', str(cpu_count()), _env=env)
self.install_libs(arch, '{}/libbitmsghash.so'.format(dst_dir),
'libbitmsghash.so')
recipe = BitmsghashRecipe()

View File

@ -0,0 +1,58 @@
from os import environ
from os.path import exists, join
import sh
from pythonforandroid.logger import shprint, info_main, info
from pythonforandroid.recipe import PythonRecipe
# from pythonforandroid.util import ensure_dir
class KivyMDRecipe(PythonRecipe):
# This recipe installs KivyMD into the android dist from source
version = 'master'
url = 'https://gitlab.com/kivymd/KivyMD/repository/{version}/archive.zip'
depends = ['kivy']
site_packages_name = 'kivymd'
call_hostpython_via_targetpython = False
patches = ['kivymd-fix-dev-compatibility.patch']
def should_build(self, arch):
return True
# def unpack(self, arch):
# info_main('Unpacking {} for {}'.format(self.name, arch))
#
# build_dir = self.get_build_container_dir(arch)
#
# user_dir = environ.get('P4A_{}_DIR'.format(self.name.lower()))
#
# if user_dir is not None:
# info("Installing KivyMD development version (from modded source)")
# self.clean_build()
# shprint(sh.rm, '-rf', build_dir)
# shprint(sh.mkdir, '-p', build_dir)
# shprint(sh.rmdir, build_dir)
# ensure_dir(build_dir)
# ensure_dir(build_dir + "/kivymd")
# shprint(sh.cp, user_dir + '/setup.py', self.get_build_dir(arch) + "/setup.py")
# shprint(sh.cp, '-a', user_dir + "/kivymd", self.get_build_dir(arch) + "/kivymd")
# return
def get_recipe_env(self, arch):
env = super(KivyMDRecipe, self).get_recipe_env(arch)
env['PYTHON_ROOT'] = self.ctx.get_python_install_dir()
env['CFLAGS'] += ' -I' + env['PYTHON_ROOT'] + '/include/python2.7'
env['LDFLAGS'] += ' -L' + env['PYTHON_ROOT'] + '/lib' + \
' -lpython2.7'
if 'sdl2' in self.ctx.recipe_build_order:
env['USE_SDL2'] = '1'
env['KIVY_SDL2_PATH'] = ':'.join([
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL', 'include'),
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_image'),
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_mixer'),
join(self.ctx.bootstrap.build_dir, 'jni', 'SDL2_ttf'),
])
return env
recipe = KivyMDRecipe()

View File

@ -0,0 +1,36 @@
diff -Naurp KivyMD.orig/kivymd/button.py KivyMD/kivymd/button.py
--- KivyMD.orig/kivymd/button.py 2017-08-25 13:12:34.000000000 +0200
+++ KivyMD/kivymd/button.py 2018-07-10 10:37:55.719440354 +0200
@@ -175,7 +175,8 @@ class BaseButton(ThemableBehavior, Butto
self._current_button_color = self.md_bg_color_disabled
else:
self._current_button_color = self.md_bg_color
- super(BaseButton, self).on_disabled(instance, value)
+ # To add compatibility to last kivy (disabled is now an Alias property)
+ # super(BaseButton, self).on_disabled(instance, value)
class BasePressedButton(BaseButton):
diff -Naurp KivyMD.orig/kivymd/selectioncontrols.py KivyMD/kivymd/selectioncontrols.py
--- KivyMD.orig/kivymd/selectioncontrols.py 2017-08-25 13:12:34.000000000 +0200
+++ KivyMD/kivymd/selectioncontrols.py 2018-07-10 10:40:06.971439102 +0200
@@ -45,6 +45,7 @@ Builder.load_string('''
pos: self.pos
<MDSwitch>:
+ _thumb_pos: (self.right - dp(12), self.center_y - dp(12)) if self.active else (self.x - dp(12), self.center_y - dp(12))
canvas.before:
Color:
rgba: self._track_color_disabled if self.disabled else \
diff -Naurp KivyMD.orig/kivymd/tabs.py KivyMD/kivymd/tabs.py
--- KivyMD.orig/kivymd/tabs.py 2017-08-25 13:12:34.000000000 +0200
+++ KivyMD/kivymd/tabs.py 2018-07-10 10:39:20.603439544 +0200
@@ -185,7 +185,7 @@ class MDBottomNavigationBar(ThemableBeha
class MDTabHeader(MDFlatButton):
""" Internal widget for headers based on MDFlatButton"""
-
+
width = BoundedNumericProperty(dp(0), min=dp(72), max=dp(264), errorhandler=lambda x: dp(72))
tab = ObjectProperty(None)
panel = ObjectProperty(None)

View File

@ -106,6 +106,10 @@ NavigationLayout:
text: "new address" text: "new address"
icon:'account-plus' icon:'account-plus'
on_release: app.root.ids.scr_mngr.current = 'login' on_release: app.root.ids.scr_mngr.current = 'login'
NavigationDrawerIconButton:
text: "Network Status"
icon:'server-network'
on_release: app.root.ids.scr_mngr.current = 'networkstat'
NavigationDrawerIconButton: NavigationDrawerIconButton:
text: "My Addresses" text: "My Addresses"
icon:'account-multiple' icon:'account-multiple'
@ -159,6 +163,8 @@ NavigationLayout:
id:sc11 id:sc11
Payment: Payment:
id:sc12 id:sc12
NetworkStat:
id:sc13
<SwipeButton@Carousel>: <SwipeButton@Carousel>:
text: '' text: ''
@ -576,3 +582,56 @@ NavigationLayout:
size_hint: 1, None size_hint: 1, None
height: dp(40) height: dp(40)
text: 'Scan QR code' text: 'Scan QR code'
<NetworkStat>:
name: 'networkstat'
MDTabbedPanel:
id: tab_panel
tab_display_mode:'text'
MDTab:
name: 'connections'
text: "Total connections" # Why are these not set!!!
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.text_variable_1
halign: 'center'
MDTab:
name: 'processes'
text: 'Processes'
ScrollView:
do_scroll_x: False
MDList:
id: ml
size_hint_y: None
height: dp(500)
OneLineListItem:
text: "person-to-person"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .8, .6
text: root.text_variable_2
OneLineListItem:
text: "Brodcast"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .8, .6
text: root.text_variable_3
OneLineListItem:
text: "objects"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .8, .6
text: root.text_variable_4
OneLineListItem:
text: "publickeys"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .8, .6
text: root.text_variable_5

View File

@ -38,6 +38,7 @@ from kivy.uix.label import Label
from kivy.uix.recycleboxlayout import RecycleBoxLayout from kivy.uix.recycleboxlayout import RecycleBoxLayout
from kivy.uix.behaviors import FocusBehavior from kivy.uix.behaviors import FocusBehavior
from kivy.uix.recycleview.layout import LayoutSelectionBehavior from kivy.uix.recycleview.layout import LayoutSelectionBehavior
import time
class Navigatorss(MDNavigationDrawer): class Navigatorss(MDNavigationDrawer):
image_source = StringProperty('images/qidenticon_two.png') image_source = StringProperty('images/qidenticon_two.png')
@ -80,6 +81,11 @@ class Inbox(Screen):
if address.startswith(splitaddress[:-2]): if address.startswith(splitaddress[:-2]):
return address return address
def get_address_via_split(self, splitaddress):
for address in BMConfigParser().addresses():
if address.startswith(splitaddress[:-2]):
return address
class MyAddress(Screen): class MyAddress(Screen):
"""MyAddress Screen uses screen to show widgets of screens.""" """MyAddress Screen uses screen to show widgets of screens."""
@ -268,6 +274,26 @@ class MyTextInput(TextInput):
class Payment(Screen): class Payment(Screen):
pass pass
class Login(Screen):
pass
class NetworkStat(Screen):
text_variable_1 = StringProperty('{0}::{1}'.format('Total Connections', '0'))
text_variable_2 = StringProperty('Processed {0} per-to-per messages'.format('0'))
text_variable_3 = StringProperty('Processed {0} brodcast messages'.format('0'))
text_variable_4 = StringProperty('Processed {0} public keys'.format('0'))
text_variable_5 = StringProperty('Processed {0} object to be synced'.format('0'))
def __init__(self, *args, **kwargs):
super(NetworkStat, self).__init__(*args, **kwargs)
Clock.schedule_interval(self.init_ui, 1)
def init_ui(self, dt=0):
"""Clock Schdule for method inbox accounts."""
import network.stats
self.text_variable_1 = '{0} :: {1}'.format('Total Connections', str(len(network.stats.connectedHostsList())))
class Login(Screen): class Login(Screen):
pass pass
@ -523,4 +549,5 @@ class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton):
class IconRightSampleWidget(IRightBodyTouch, MDCheckbox): class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
pass pass

View File

@ -209,15 +209,16 @@ class Main:
if daemon: if daemon:
state.enableGUI = False # run without a UI state.enableGUI = False # run without a UI
# is the application already running? If yes then exit.
if state.enableGUI and not state.curses and not state.kivy and not depends.check_pyqt(): if state.enableGUI and not state.curses and not state.kivy and not depends.check_pyqt():
# is the application already running? If yes then exit.
sys.exit( sys.exit(
'PyBitmessage requires PyQt unless you want' 'PyBitmessage requires PyQt unless you want'
' to run it as a daemon and interact with it' ' to run it as a daemon and interact with it'
' using the API. You can download PyQt from ' ' using the API. You can download PyQt from '
'http://www.riverbankcomputing.com/software/pyqt/download' 'http://www.riverbankcomputing.com/software/pyqt/download'
' or by searching Google for \'PyQt Download\'.' ' or by searching Google for \'PyQt Download\'.'
' If you want to run in daemon mode, see ' ' If you want to riverbankcomputingun in daemon mode, see '
'https://bitmessage.org/wiki/Daemon\n' 'https://bitmessage.org/wiki/Daemon\n'
'You can also run PyBitmessage with' 'You can also run PyBitmessage with'
' the new curses interface by providing' ' the new curses interface by providing'
@ -380,7 +381,7 @@ class Main:
BMConfigParser().remove_option('bitmessagesettings', 'dontconnect') BMConfigParser().remove_option('bitmessagesettings', 'dontconnect')
print("Thread 408 begins.....................................................................") print("Thread 408 begins.....................................................................")
from bitmessagekivy.mpybit import NavigateApp from bitmessagekivy.mpybit import NavigateApp
print("Thread 410 begins.....................................................................") print("Thread 4100 begins.....................................................................")
NavigateApp().run() NavigateApp().run()
else: else:
print("Thread 417 begins.....................................................................") print("Thread 417 begins.....................................................................")

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

BIN
src/images/avatar.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
src/images/circular.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 111 KiB

BIN
src/images/circular1.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
src/images/images.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 144 B

BIN
src/images/images2.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
src/images/index.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

48
src/images/logo.png Normal file
View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 508.52 508.52" style="enable-background:new 0 0 508.52 508.52;" xml:space="preserve">
<g>
<g>
<g>
<path style="fill:#010002;" d="M254.26,0C113.845,0,0,113.845,0,254.26s113.845,254.26,254.26,254.26
s254.26-113.845,254.26-254.26C508.52,113.813,394.675,0,254.26,0z M274.092,323.005c-18.593-1.43-26.379-10.647-40.936-19.514
c-8.009,42.016-17.798,82.317-46.784,103.325c-8.963-63.47,13.126-111.143,23.392-161.773
c-17.48-29.462,2.098-88.673,38.965-74.085c45.354,17.957-39.315,109.427,17.544,120.869
c59.338,11.918,83.588-103.007,46.784-140.383c-53.204-53.967-154.781-1.24-142.29,76.024c3.051,18.879,22.534,24.6,7.787,50.693
c-34.039-7.501-44.209-34.389-42.906-70.176c2.098-58.575,52.632-99.575,103.325-105.264
c64.105-7.183,124.238,23.519,132.533,83.81C380.881,254.578,342.583,328.313,274.092,323.005z"/>
</g>
</g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/images/newaddress2.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

BIN
src/images/newadsdress.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
src/images/popup.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

BIN
src/images/presplas.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 88 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

@ -11,7 +11,7 @@ import sys
import time import time
from struct import pack, unpack from struct import pack, unpack
from subprocess import call from subprocess import call
from kivy.utils import platform
import openclpow import openclpow
import paths import paths
import queues import queues
@ -328,7 +328,6 @@ def init():
except Exception as e: except Exception as e:
bso = None bso = None
print(e) print(e)
else: else:
try: try:
bso = ctypes.CDLL(os.path.join(paths.codePath(), "bitmsghash", bitmsglib)) bso = ctypes.CDLL(os.path.join(paths.codePath(), "bitmsghash", bitmsglib))
@ -346,8 +345,11 @@ def init():
logger.info("Loaded C PoW DLL %s", bitmsglib) logger.info("Loaded C PoW DLL %s", bitmsglib)
if bso: if bso:
try: try:
print("hey I am on line 303 sucess.....................................................")
bmpow = bso.BitmessagePOW bmpow = bso.BitmessagePOW
print("hey I am on line 305 sucess.....................................................")
bmpow.restype = ctypes.c_ulonglong bmpow.restype = ctypes.c_ulonglong
print("hey I am on line 307 sucess.....................................................")
except: except:
bmpow = None bmpow = None
else: else:

View File

@ -1,7 +1,6 @@
import os import os
import state import state
# This is used so that the translateText function can be used when we are in daemon mode and not using any QT functions. # This is used so that the translateText function can be used when we are in daemon mode and not using any QT functions.
class translateClass: class translateClass:
def __init__(self, context, text): def __init__(self, context, text):