Merge pull request #8 from cis-navjot-g/newwork

Newwork
This commit is contained in:
cis-navjot-g 2019-08-07 13:33:59 +05:30 committed by GitHub
commit e4c1a57c22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 74 additions and 152 deletions

View File

@ -10,36 +10,14 @@ from pythonforandroid.recipe import PythonRecipe
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'
url = 'https://github.com/HeaTTheatR/KivyMD/archive/master.zip'
url = 'https://github.com/surbhicis/kivymd/archive/master.zip'
depends = ['kivy']
site_packages_name = 'kivymd'
call_hostpython_via_targetpython = False
# patches = ['kivymd-fix-dev-compatibility.patch']
# Made commented as use different repo for updates
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()

View File

@ -174,44 +174,6 @@ NavigationLayout:
background_palette: 'Primary'
background_hue: '500'
left_action_items: [['menu', lambda x: app.root.toggle_nav_drawer()]]
Button:
id: reset_navbar
size_hint_y: 0.35
size_hint_x: 0.2
opacity: 0
disabled: True
pos_hint: {'x': .1, 'y': 0.3}
color: 0,0,0,1
background_color: (0,0,0,0)
on_press:app.reset_navdrawer(self)
Image:
source: './images/left_arrow.png'
center_x: self.parent.center_x
center_y: self.parent.center_y
size: 40, 40
TextInput:
id: search_input
hint_text: 'search'
opacity: 0
size_hint: 1,None
height: dp(32)
disabled: True
pos_hint: {'center_x':.565,'center_y': .5}
multiline: False
padding_y: [self.height / 2.0 - (self.line_height / 2.0) * len(self._lines), 0]
padding_x: 20,20
Button:
id: serch_btn
size_hint_y: 0.35
size_hint_x: 0.2
pos_hint: {'x': .1, 'y': 0.3}
color: 0,0,0,1
background_color: (0,0,0,0)
Image:
source: './images/search_mail.png'
center_x: self.parent.center_x
center_y: self.parent.center_y
size: 55, 55
Button:
id: myButton
size_hint_y: 0.35
@ -282,7 +244,7 @@ NavigationLayout:
root_layout: root
MDList:
id: ml
ComposerButton
ComposerButton:
<Sent>:
name: 'sent'

View File

@ -45,6 +45,7 @@ from functools import partial
from kivy.uix.carousel import Carousel
from kivy.utils import platform
from kivy.uix.spinner import Spinner
from kivymd.textfields import MDTextField
class Navigatorss(MDNavigationDrawer):
@ -147,6 +148,7 @@ class Inbox(Screen):
def inbox_detail(self, receivedTime, *args):
"""Load inbox page details."""
remove_search_bar(self)
state.detailPageType = 'inbox'
state.sentMailTime = receivedTime
if self.manager:
@ -154,7 +156,6 @@ class Inbox(Screen):
else:
src_mng_obj = self.parent.parent
hide_search_btn(src_mng_obj)
src_mng_obj.screens[13].clear_widgets()
src_mng_obj.screens[13].add_widget(MailDetail())
src_mng_obj.current = 'mailDetail'
@ -463,10 +464,6 @@ class DropDownWidget(BoxLayout):
self.parent.parent.current = 'sent'
self.ids.btn.text = 'select'
self.ids.ti.text = ''
self.parent.parent.parent.parent.parent\
.ids.serch_btn.opacity = 1
self.parent.parent.parent.parent.parent\
.ids.serch_btn.disabled = False
return None
else:
@ -727,13 +724,13 @@ class Sent(Screen):
def sent_detail(self, lastsenttime, *args):
"""Load sent mail details."""
remove_search_bar(self)
state.detailPageType = 'sent'
state.sentMailTime = lastsenttime
if self.manager:
src_mng_obj = self.manager
else:
src_mng_obj = self.parent.parent
hide_search_btn(src_mng_obj)
src_mng_obj.screens[13].clear_widgets()
src_mng_obj.screens[13].add_widget(MailDetail())
src_mng_obj.current = 'mailDetail'
@ -993,7 +990,7 @@ class NavigateApp(App):
if self.root.ids.scr_mngr.current == "mailDetail":
self.root.ids.scr_mngr.current = \
'sent' if state.detailPageType == 'sent' else 'inbox'
show_search_btn(self)
self.add_search_bar()
elif self.root.ids.scr_mngr.current == "create":
composer_objs = self.root
from_addr = str(self.root.children[1].children[0].children[
@ -1002,16 +999,15 @@ class NavigateApp(App):
0].children[0].children[0].ids.txt_input.text)
if from_addr and to_addr:
Draft().draft_msg(composer_objs)
self.root.ids.serch_btn.opacity = 1
self.root.ids.serch_btn.disabled = False
self.root.ids.scr_mngr.current = 'inbox'
self.add_search_bar()
elif self.root.ids.scr_mngr.current == "showqrcode":
self.root.ids.scr_mngr.current = 'myaddress'
elif self.root.ids.scr_mngr.current == "random":
self.root.ids.scr_mngr.current = 'login'
else:
self.root.ids.scr_mngr.current = 'inbox'
show_search_btn(self)
self.add_search_bar()
self.root.ids.scr_mngr.transition.direction = 'right'
self.root.ids.scr_mngr.transition.bind(on_complete=self.restart)
return True
@ -1029,8 +1025,7 @@ class NavigateApp(App):
def clear_composer(self):
"""If slow down the nwe will make new composer edit screen."""
self.root.ids.serch_btn.opacity = 0
self.root.ids.serch_btn.disabled = True
self.root.ids.search_bar.clear_widgets()
composer_obj = self.root.ids.sc3.children[0].ids
composer_obj.ti.text = ''
composer_obj.btn.text = 'Select'
@ -1085,8 +1080,8 @@ class NavigateApp(App):
return f_name[0][:14] + '...' if len(f_name[0]) > 15 else f_name[0]
return ''
def searchQuery(self, instance):
"""Method used for showing searched mails."""
def searchQuery(self, instance, *args):
'''This method is used for showing searched mails'''
state.search_screen = self.root.ids.scr_mngr.current
state.searcing_text = str(instance.text).strip()
if state.search_screen == 'inbox':
@ -1097,35 +1092,14 @@ class NavigateApp(App):
self.root.ids.sc4.add_widget(Sent())
self.root.ids.scr_mngr.current = state.search_screen
def reset_navdrawer(self, instance):
"""Method used for reseting navigation drawer."""
self.root.ids.search_input.text = ''
self.root.ids.search_input.opacity = 0
self.root.ids.search_input.size_hint = 1, None
self.root.ids.search_input.disabled = True
self.root.ids.toolbar.left_action_items = [
['menu', lambda x: self.root.toggle_nav_drawer()]]
self.root.ids.toolbar.title = self.current_address_label()
self.root.ids.myButton.opacity = 1
self.root.ids.myButton.disabled = False
self.root.ids.reset_navbar.opacity = 0
self.root.ids.reset_navbar.disabled = True
state.searcing_text = ''
if state.search_screen == 'inbox':
self.root.ids.sc1.clear_widgets()
self.root.ids.sc1.add_widget(Inbox())
else:
self.root.ids.sc4.clear_widgets()
self.root.ids.sc4.add_widget(Sent())
def check_search_screen(self, instance):
"""Method shows search button on inbox and sent screen only."""
"""Method used for showing search button only on inbox or sent screen."""
if instance.text == 'Inbox' or instance.text == 'Sent':
if not self.root.ids.search_bar.children:
self.root.ids.search_bar.add_widget(
MDIconButton(icon='magnify'))
self.root.ids.serch_btn.opacity = 1
self.root.ids.serch_btn.disabled = False
self.root.ids.search_bar.add_widget(MDIconButton(icon = 'magnify'))
text_field = MDTextField(id='search_field', hint_text='Search icon')
text_field.bind(text = self.searchQuery)
self.root.ids.search_bar.add_widget(text_field)
state.searcing_text = ''
self.root.ids.sc1.clear_widgets()
self.root.ids.sc4.clear_widgets()
@ -1133,10 +1107,15 @@ class NavigateApp(App):
self.root.ids.sc4.add_widget(Sent())
else:
self.root.ids.search_bar.clear_widgets()
self.root.ids.serch_btn.opacity = 0
self.root.ids.serch_btn.disabled = True
return
def add_search_bar(self):
"""This method is used for adding search function on screen"""
if not self.root.ids.search_bar.children:
self.root.ids.search_bar.add_widget(MDIconButton(icon = 'magnify'))
text_field = MDTextField(id='search_field', hint_text='Search icon')
text_field.bind(text = self.searchQuery)
self.root.ids.search_bar.add_widget(text_field)
class GrashofPopup(Popup):
"""Methods for saving contacts, error messages."""
@ -1170,8 +1149,6 @@ class GrashofPopup(Popup):
queues.UISignalQueue.put(('rerenderAddressBook', ''))
self.dismiss()
sqlExecute("INSERT INTO addressbook VALUES(?,?)", label, address)
self.parent.children[1].ids.serch_btn.opacity = 0
self.parent.children[1].ids.serch_btn.disabled = True
self.parent.children[1].ids.scr_mngr.current = 'addressbook'
def show_error_message(self):
@ -1306,8 +1283,6 @@ class MailDetail(Screen):
state.trash_count = str(int(state.trash_count) + 1)
self.parent.parent.screens[4].clear_widgets()
self.parent.parent.screens[4].add_widget(Trash())
self.parent.parent.parent.parent.parent.ids.serch_btn.opacity = 1
self.parent.parent.parent.parent.parent.ids.serch_btn.disabled = False
def inbox_reply(self):
"""Method used for replying inbox messages."""
@ -1554,29 +1529,6 @@ class Draft(Screen):
return
def show_search_btn(self):
"""Method used to show search button."""
self.root.ids.serch_btn.opacity = 1
self.root.ids.serch_btn.disabled = False
def hide_search_btn(mgr_objs):
"""Method used to hide search button and search box."""
mgr_objs.parent.parent.parent.ids.serch_btn.opacity = 0
mgr_objs.parent.parent.parent.ids.serch_btn.disabled = True
mgr_objs.parent.parent.parent.ids.search_input.size_hint = 1, None
mgr_objs.parent.parent.parent.ids.search_input.disabled = True
mgr_objs.parent.parent.parent.ids.search_input.opacity = 0
mgr_objs.parent.parent.parent.ids.toolbar.left_action_items = \
[['menu', lambda x: mgr_objs.parent.parent.parent.toggle_nav_drawer()]]
mgr_objs.parent.parent.parent.ids.toolbar.title = \
NavigateApp().current_address_label()
mgr_objs.parent.parent.parent.ids.myButton.opacity = 1
mgr_objs.parent.parent.parent.ids.myButton.disabled = False
mgr_objs.parent.parent.parent.ids.reset_navbar.opacity = 0
mgr_objs.parent.parent.parent.ids.reset_navbar.disabled = True
class CustomSpinner(Spinner):
"""This class is used for setting spinner size."""
@ -1585,3 +1537,7 @@ class CustomSpinner(Spinner):
super(CustomSpinner, self).__init__(*args, **kwargs)
max = 2.8
self.dropdown_cls.max_height = self.height * max + max * 4
def remove_search_bar(self):
self.parent.parent.parent.parent.parent.ids.search_bar.clear_widgets()

View File

@ -247,7 +247,10 @@ class Main:
' \'-c\' as a commandline argument.'
)
# is the application already running? If yes then exit.
shared.thisapp = singleinstance("", daemon)
try:
shared.thisapp = singleinstance("", daemon)
except Exception as e:
pass
if daemon:
with shared.printLock:

View File

@ -1,10 +1,10 @@
[app]
# (str) Title of your application
title = bluewhale
title = messageapp
# (str) Package name
package.name = bluewhale
package.name = messageapp
# (str) Package domain (needed for android/ios packaging)
package.domain = org.test
@ -35,21 +35,29 @@ version = 0.1
# version.filename = %(source.dir)s/main.py
# (list) Application requirements
# comma seperated e.g. requirements = sqlite3,kivy
requirements = python2, sqlite3, kivy, openssl, bitmsghash, libexpat, kivymd
# comma separated e.g. requirements = sqlite3,kivy
requirements =
openssl,
sqlite3,
python2,
kivy,
bitmsghash,
kivymd,
kivy-garden,
qrcode
# (str) Custom source folders for requirements
# Sets custom source for any requirements with recipes
# requirements.source.kivy = ../../kivy
# (list) Garden requirements
#garden_requirements =
garden_requirements = qrcode
# (str) Presplash of the application
presplash.filename = "images/presplas.gif"
#presplash.filename = %(source.dir)s/data/presplash.png
# (str) Icon of the application
icon.filename ='images/if_android_1220385.png'
#icon.filename = %(source.dir)s/data/icon.png
# (str) Supported orientation (one of landscape, portrait or all)
orientation = portrait
@ -88,28 +96,28 @@ fullscreen = 0
android.permissions = INTERNET, WRITE_EXTERNAL_STORAGE, READ_EXTERNAL_STORAGE
# (int) Android API to use
android.api = 19
android.api = 27
# (int) Minimum API required
#android.minapi = 9
android.minapi = 21
# (int) Android SDK version to use
android.sdk = 20
# (str) Android NDK version to use
android.ndk = 10e
android.ndk = 17c
# (bool) Use --private data storage (True) or --dir public storage (False)
#android.private_storage = True
# android.private_storage = True
# (str) Android NDK directory (if empty, it will be automatically downloaded.)
android.ndk_path =/home/cis/Downloads/android-ndk-r10e
#android.ndk_path =
# (str) Android SDK directory (if empty, it will be automatically downloaded.)
android.sdk_path =/home/cis/Android/Sdk
#android.sdk_path =
# (str) ANT directory (if empty, it will be automatically downloaded.)
android.ant_path =/home/cis/apache-ant-1.10.5
#android.ant_path =
# (bool) If True, then skip trying to update the Android sdk
# This can be useful to avoid excess Internet downloads or save time
@ -146,7 +154,10 @@ android.ant_path =/home/cis/apache-ant-1.10.5
# bootstrap)
#android.gradle_dependencies =
# (str) python-for-android branch to use, defaults to master
# (list) Java classes to add as activities to the manifest.
#android.add_activites = com.example.ExampleActivity
# (str) python-for-android branch to use, defaults to stable
p4a.branch = master
# (str) OUYA Console category. Should be one of GAME or APP
@ -159,7 +170,10 @@ p4a.branch = master
# (str) XML file to include as an intent filters in <activity> tag
#android.manifest.intent_filters =
# (list) Android additionnal libraries to copy into libs/armeabi
# (str) launchMode to set for the main activity
#android.manifest.launch_mode = standard
# (list) Android additional libraries to copy into libs/armeabi
#android.add_libs_armeabi = libs/android/*.so
#android.add_libs_armeabi_v7a = libs/android-v7/*.so
#android.add_libs_x86 = libs/android-x86/*.so
@ -193,7 +207,7 @@ android.arch = armeabi-v7a
#p4a.source_dir =
# (str) The directory in which python-for-android should look for your own build recipes (if any)
p4a.local_recipes =/home/cis/Desktop/Mobileandroid/peter_android/PyBitmessage/src/bitmessagekivy/android/python-for-android/recipes/
p4a.local_recipes = /home/cis/navjotrepo/PyBitmessage/src/bitmessagekivy/android/python-for-android/recipes/
# (str) Filename to the hook for p4a
#p4a.hook =
@ -201,6 +215,9 @@ p4a.local_recipes =/home/cis/Desktop/Mobileandroid/peter_android/PyBitmessage/sr
# (str) Bootstrap to use for android builds
# p4a.bootstrap = sdl2
# (int) port number to specify an explicit --port= p4a argument (eg for bootstrap flask)
#p4a.port =
#
# iOS specific

View File

@ -43,7 +43,8 @@ def lookupAppdataFolder():
sys.exit()
elif platform == 'android':
# dataFolder = path.join(os.path.dirname(os.path.abspath("__file__")), "PyBitmessage") + '/'
dataFolder = path.join('/sdcard/', 'DCIM/', APPNAME) + '/'
dataFolder = path.join(os.environ['ANDROID_PRIVATE'] + '/', APPNAME) + '/'
# dataFolder = path.join('/sdcard/', 'DCIM/', APPNAME) + '/'
elif 'win32' in sys.platform or 'win64' in sys.platform:
dataFolder = path.join(environ['APPDATA'].decode(sys.getfilesystemencoding(), 'ignore'), APPNAME) + path.sep

View File

@ -534,6 +534,8 @@ def loadOpenSSL():
elif platform == "android":
libdir.append('libcrypto1.0.2p.so')
libdir.append('libssl1.0.2p.so')
libdir.append('libcrypto1.1.so')
libdir.append('libssl1.1.so')
else:
libdir.append('libcrypto.so')
@ -541,7 +543,10 @@ def loadOpenSSL():
libdir.append('libcrypto.so.1.0.0')
libdir.append('libssl.so.1.0.0')
if 'linux' in sys.platform or 'darwin' in sys.platform or 'bsd' in sys.platform:
libdir.append(find_library('ssl'))
try:
libdir.append(find_library('ssl'))
except OSError:
pass
elif 'win32' in sys.platform or 'win64' in sys.platform:
libdir.append(find_library('libeay32'))
for library in libdir: