Update the origin by upstream and Made changes on the api file
This commit is contained in:
commit
31437f1f42
|
@ -6,12 +6,14 @@ addons:
|
||||||
packages:
|
packages:
|
||||||
- build-essential
|
- build-essential
|
||||||
- libcap-dev
|
- libcap-dev
|
||||||
|
- python-qt4
|
||||||
- tor
|
- tor
|
||||||
|
- xvfb
|
||||||
install:
|
install:
|
||||||
- pip install -r requirements.txt
|
- pip install -r requirements.txt
|
||||||
- ln -s src pybitmessage # tests environment
|
- ln -s src pybitmessage # tests environment
|
||||||
- python setup.py install
|
- python setup.py install
|
||||||
script:
|
script:
|
||||||
- python checkdeps.py
|
- python checkdeps.py
|
||||||
- src/bitmessagemain.py -t
|
- xvfb-run src/bitmessagemain.py -t
|
||||||
- python setup.py test
|
- python setup.py test
|
||||||
|
|
|
@ -15,7 +15,8 @@ import socket
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
from binascii import hexlify, unhexlify
|
from binascii import hexlify, unhexlify
|
||||||
from SimpleXMLRPCServer import SimpleXMLRPCRequestHandler, SimpleXMLRPCServer
|
from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler, \
|
||||||
|
SimpleXMLRPCServer
|
||||||
from struct import pack
|
from struct import pack
|
||||||
|
|
||||||
import defaults
|
import defaults
|
||||||
|
|
|
@ -193,8 +193,7 @@ def ShowTimeHistoy(act_time):
|
||||||
action_time.strftime("%d/%m/%Y")
|
action_time.strftime("%d/%m/%Y")
|
||||||
if duration.days >= 365
|
if duration.days >= 365
|
||||||
else action_time.strftime("%I:%M %p").lstrip("0")
|
else action_time.strftime("%I:%M %p").lstrip("0")
|
||||||
if duration.days == 0
|
if duration.days == 0 and crnt_date.strftime("%d/%m/%Y") == action_time.strftime("%d/%m/%Y")
|
||||||
and crnt_date.strftime("%d/%m/%Y") == action_time.strftime("%d/%m/%Y")
|
|
||||||
else action_time.strftime("%d %b")
|
else action_time.strftime("%d %b")
|
||||||
)
|
)
|
||||||
return display_data
|
return display_data
|
||||||
|
@ -311,33 +310,39 @@ class Inbox(Screen):
|
||||||
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
def inboxDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This method is used for retrieving inbox data"""
|
"""This method is used for retrieving inbox data"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = kivy_helper_search.search_sql(
|
||||||
xAddress, self.account, "inbox", where, what,
|
xAddress, self.account, "inbox", where, what, False, start_indx, end_indx
|
||||||
False, start_indx, end_indx)
|
)
|
||||||
|
|
||||||
def set_mdList(self, data):
|
def set_mdList(self, data):
|
||||||
"""This method is used to create the mdList"""
|
"""This method is used to create the mdList"""
|
||||||
total_message = len(self.ids.ml.children)
|
total_message = len(self.ids.ml.children)
|
||||||
for item in data:
|
for item in data:
|
||||||
meny = TwoLineAvatarIconListItem(
|
meny = TwoLineAvatarIconListItem(
|
||||||
text=item['text'], secondary_text=item['secondary_text'],
|
text=item["text"],
|
||||||
theme_text_color='Custom',
|
secondary_text=item["secondary_text"],
|
||||||
text_color=ThemeClsColor)
|
theme_text_color="Custom",
|
||||||
|
text_color=NavigateApp().theme_cls.primary_color
|
||||||
|
)
|
||||||
meny._txt_right_pad = dp(70)
|
meny._txt_right_pad = dp(70)
|
||||||
meny.add_widget(AvatarSampleWidget(
|
meny.add_widget(
|
||||||
source= state.imageDir +'/text_images/{}.png'.format(
|
AvatarSampleWidget(
|
||||||
avatarImageFirstLetter(item['secondary_text'].strip()))))
|
source="./images/text_images/{}.png".format(
|
||||||
meny.bind(on_press=partial(self.inbox_detail, item['msgid']))
|
avatarImageFirstLetter(item["secondary_text"].strip())
|
||||||
meny.add_widget(AddTimeWidget(item['received']))
|
)
|
||||||
carousel = Carousel(direction='right')
|
)
|
||||||
|
)
|
||||||
|
meny.bind(on_press=partial(self.inbox_detail, item["msgid"]))
|
||||||
|
meny.add_widget(AddTimeWidget(item["received"]))
|
||||||
|
carousel = Carousel(direction="right")
|
||||||
carousel.height = meny.height
|
carousel.height = meny.height
|
||||||
carousel.size_hint_y = None
|
carousel.size_hint_y = None
|
||||||
carousel.ignore_perpendicular_swipes = True
|
carousel.ignore_perpendicular_swipes = True
|
||||||
carousel.data_index = 0
|
carousel.data_index = 0
|
||||||
carousel.min_move = 0.2
|
carousel.min_move = 0.2
|
||||||
del_btn = Button(text='Delete')
|
del_btn = Button(text="Delete")
|
||||||
del_btn.background_normal = ''
|
del_btn.background_normal = ""
|
||||||
del_btn.background_color = (1, 0, 0, 1)
|
del_btn.background_color = (1, 0, 0, 1)
|
||||||
del_btn.bind(on_press=partial(self.delete, item['msgid']))
|
del_btn.bind(on_press=partial(self.delete, item["msgid"]))
|
||||||
carousel.add_widget(del_btn)
|
carousel.add_widget(del_btn)
|
||||||
carousel.add_widget(meny)
|
carousel.add_widget(meny)
|
||||||
# ach_btn = Button(text='Achieve')
|
# ach_btn = Button(text='Achieve')
|
||||||
|
@ -351,8 +356,9 @@ class Inbox(Screen):
|
||||||
|
|
||||||
def check_scroll_y(self, instance, somethingelse):
|
def check_scroll_y(self, instance, somethingelse):
|
||||||
"""Loads data on scroll"""
|
"""Loads data on scroll"""
|
||||||
if self.children[2].children[0].children[
|
if (
|
||||||
0].scroll_y <= -0.0 and self.has_refreshed:
|
self.children[2].children[0].children[0].scroll_y <= -0.0 and self.has_refreshed
|
||||||
|
):
|
||||||
self.children[2].children[0].children[0].scroll_y = 0.06
|
self.children[2].children[0].children[0].scroll_y = 0.06
|
||||||
total_message = len(self.ids.ml.children)
|
total_message = len(self.ids.ml.children)
|
||||||
self.update_inbox_screen_on_scroll(total_message)
|
self.update_inbox_screen_on_scroll(total_message)
|
||||||
|
@ -363,24 +369,27 @@ class Inbox(Screen):
|
||||||
"""This method is used to load more data on scroll down"""
|
"""This method is used to load more data on scroll down"""
|
||||||
data = []
|
data = []
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
where = ['subject', 'message']
|
where = ["subject", "message"]
|
||||||
what = state.searcing_text
|
what = state.searcing_text
|
||||||
self.inboxDataQuery('toaddress', where, what, total_message, 5)
|
self.inboxDataQuery("toaddress", where, what, total_message, 5)
|
||||||
for mail in self.queryreturn:
|
for mail in self.queryreturn:
|
||||||
# third_text = mail[3].replace('\n', ' ')
|
# third_text = mail[3].replace('\n', ' ')
|
||||||
subject = mail[3].decode() if isinstance(mail[3], bytes) else mail[3]
|
subject = mail[3].decode() if isinstance(mail[3], bytes) else mail[3]
|
||||||
body = mail[5].decode() if isinstance(mail[5], bytes) else mail[5]
|
body = mail[5].decode() if isinstance(mail[5], bytes) else mail[5]
|
||||||
data.append({
|
data.append(
|
||||||
'text': mail[4].strip(),
|
{
|
||||||
'secondary_text': body[:50] + '........' if len(
|
"text": mail[4].strip(),
|
||||||
body) >= 50 else (body + ',' + subject.replace(
|
"secondary_text": body[:50] + "........"
|
||||||
'\n', ''))[0:50] + '........',
|
if len(body) >= 50
|
||||||
'msgid': mail[1]})
|
else (body + "," + subject.replace("\n", ""))[0:50] + "........",
|
||||||
|
"msgid": mail[1]
|
||||||
|
}
|
||||||
|
)
|
||||||
self.set_mdList(data)
|
self.set_mdList(data)
|
||||||
|
|
||||||
def inbox_detail(self, msg_id, *args):
|
def inbox_detail(self, msg_id, *args):
|
||||||
"""Load inbox page details"""
|
"""Load inbox page details"""
|
||||||
state.detailPageType = 'inbox'
|
state.detailPageType = "inbox"
|
||||||
state.mail_id = msg_id
|
state.mail_id = msg_id
|
||||||
if self.manager:
|
if self.manager:
|
||||||
src_mng_obj = self.manager
|
src_mng_obj = self.manager
|
||||||
|
@ -388,34 +397,34 @@ class Inbox(Screen):
|
||||||
src_mng_obj = self.parent.parent
|
src_mng_obj = self.parent.parent
|
||||||
src_mng_obj.screens[13].clear_widgets()
|
src_mng_obj.screens[13].clear_widgets()
|
||||||
src_mng_obj.screens[13].add_widget(MailDetail())
|
src_mng_obj.screens[13].add_widget(MailDetail())
|
||||||
src_mng_obj.current = 'mailDetail'
|
src_mng_obj.current = "mailDetail"
|
||||||
|
|
||||||
def delete(self, data_index, instance, *args):
|
def delete(self, data_index, instance, *args):
|
||||||
"""Delete inbox mail from inbox listing"""
|
"""Delete inbox mail from inbox listing"""
|
||||||
sqlExecute(
|
sqlExecute("UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", data_index)
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", data_index)
|
|
||||||
msg_count_objs = self.parent.parent.ids.content_drawer.ids
|
msg_count_objs = self.parent.parent.ids.content_drawer.ids
|
||||||
if int(state.inbox_count) > 0:
|
if int(state.inbox_count) > 0:
|
||||||
msg_count_objs.inbox_cnt.children[0].children[0].text = showLimitedCnt(int(state.inbox_count) - 1)
|
msg_count_objs.inbox_cnt.children[0].children[0].text = showLimitedCnt(
|
||||||
msg_count_objs.trash_cnt.children[0].children[0].text = showLimitedCnt(int(state.trash_count) + 1)
|
int(state.inbox_count) - 1
|
||||||
msg_count_objs.allmail_cnt.children[0].children[0].text = showLimitedCnt(int(state.all_count) - 1)
|
)
|
||||||
state.inbox_count = str(
|
msg_count_objs.trash_cnt.children[0].children[0].text = showLimitedCnt(
|
||||||
int(state.inbox_count) - 1)
|
int(state.trash_count) + 1
|
||||||
state.trash_count = str(
|
)
|
||||||
int(state.trash_count) + 1)
|
msg_count_objs.allmail_cnt.children[0].children[0].text = showLimitedCnt(
|
||||||
state.all_count = str(
|
int(state.all_count) - 1
|
||||||
int(state.all_count) - 1)
|
)
|
||||||
|
state.inbox_count = str(int(state.inbox_count) - 1)
|
||||||
|
state.trash_count = str(int(state.trash_count) + 1)
|
||||||
|
state.all_count = str(int(state.all_count) - 1)
|
||||||
if int(state.inbox_count) <= 0:
|
if int(state.inbox_count) <= 0:
|
||||||
self.ids.identi_tag.children[0].text = ''
|
self.ids.identi_tag.children[0].text = ""
|
||||||
self.ids.ml.remove_widget(
|
self.ids.ml.remove_widget(instance.parent.parent)
|
||||||
instance.parent.parent)
|
toast("Deleted")
|
||||||
toast('Deleted')
|
|
||||||
self.update_trash()
|
self.update_trash()
|
||||||
|
|
||||||
def archive(self, data_index, instance, *args):
|
def archive(self, data_index, instance, *args):
|
||||||
"""Archive inbox mail from inbox listing"""
|
"""Archive inbox mail from inbox listing"""
|
||||||
sqlExecute(
|
sqlExecute("UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", data_index)
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;", data_index)
|
|
||||||
self.ids.ml.remove_widget(instance.parent.parent)
|
self.ids.ml.remove_widget(instance.parent.parent)
|
||||||
self.update_trash()
|
self.update_trash()
|
||||||
|
|
||||||
|
@ -431,20 +440,23 @@ class Inbox(Screen):
|
||||||
def refresh_callback(self, *args):
|
def refresh_callback(self, *args):
|
||||||
"""Method updates the state of application,
|
"""Method updates the state of application,
|
||||||
While the spinner remains on the screen"""
|
While the spinner remains on the screen"""
|
||||||
|
|
||||||
def refresh_callback(interval):
|
def refresh_callback(interval):
|
||||||
"""Method used for loading the inbox screen data"""
|
"""Method used for loading the inbox screen data"""
|
||||||
state.searcing_text = ''
|
state.searcing_text = ""
|
||||||
self.children[2].children[1].ids.search_field.text = ''
|
self.children[2].children[1].ids.search_field.text = ""
|
||||||
self.ids.ml.clear_widgets()
|
self.ids.ml.clear_widgets()
|
||||||
self.loadMessagelist(state.association)
|
self.loadMessagelist(state.association)
|
||||||
self.has_refreshed = True
|
self.has_refreshed = True
|
||||||
self.ids.refresh_layout.refresh_done()
|
self.ids.refresh_layout.refresh_done()
|
||||||
self.tick = 0
|
self.tick = 0
|
||||||
|
|
||||||
Clock.schedule_once(refresh_callback, 1)
|
Clock.schedule_once(refresh_callback, 1)
|
||||||
|
|
||||||
|
|
||||||
class CustomTwoLineAvatarIconListItem(TwoLineAvatarIconListItem):
|
class CustomTwoLineAvatarIconListItem(TwoLineAvatarIconListItem):
|
||||||
"""Custom Two Line Avatar Icon List"""
|
"""Custom Two Line Avatar Icon List"""
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -539,8 +551,9 @@ class MyAddress(Screen):
|
||||||
my_addresses = len(self.ids.ml.children)
|
my_addresses = len(self.ids.ml.children)
|
||||||
if my_addresses != len(self.addresses_list):
|
if my_addresses != len(self.addresses_list):
|
||||||
self.update_addressBook_on_scroll(my_addresses)
|
self.update_addressBook_on_scroll(my_addresses)
|
||||||
self.has_refreshed = True if my_addresses != len(
|
self.has_refreshed = (
|
||||||
self.addresses_list) else False
|
True if my_addresses != len(self.addresses_list) else False
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -551,7 +564,7 @@ class MyAddress(Screen):
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
def myadd_detail(self, fromaddress, label, *args):
|
def myadd_detail(self, fromaddress, label, *args):
|
||||||
"""Load myaddresses details"""
|
"""Load myaddresses details"""
|
||||||
if BMConfigParser().get(fromaddress, 'enabled') == 'true':
|
if BMConfigParser().get(fromaddress, "enabled") == "true":
|
||||||
p = MyaddDetailPopup()
|
p = MyaddDetailPopup()
|
||||||
p.open()
|
p.open()
|
||||||
p.set_address(fromaddress, label)
|
p.set_address(fromaddress, label)
|
||||||
|
@ -721,8 +734,9 @@ class AddressBook(Screen):
|
||||||
exist_addresses = len(self.ids.ml.children)
|
exist_addresses = len(self.ids.ml.children)
|
||||||
if exist_addresses != len(self.queryreturn):
|
if exist_addresses != len(self.queryreturn):
|
||||||
self.update_addressBook_on_scroll(exist_addresses)
|
self.update_addressBook_on_scroll(exist_addresses)
|
||||||
self.has_refreshed = True if exist_addresses != len(
|
self.has_refreshed = (
|
||||||
self.queryreturn) else False
|
True if exist_addresses != len(self.queryreturn) else False
|
||||||
|
)
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -749,14 +763,15 @@ class AddressBook(Screen):
|
||||||
self.ids.ml.remove_widget(instance.parent.parent)
|
self.ids.ml.remove_widget(instance.parent.parent)
|
||||||
# if len(self.ids.ml.children) == 0:
|
# if len(self.ids.ml.children) == 0:
|
||||||
if self.ids.ml.children is not None:
|
if self.ids.ml.children is not None:
|
||||||
self.ids.identi_tag.children[0].text = ''
|
self.ids.identi_tag.children[0].text = ""
|
||||||
sqlExecute(
|
sqlExecute("DELETE FROM addressbook WHERE address = '{}';".format(address))
|
||||||
"DELETE FROM addressbook WHERE address = '{}';".format(address))
|
|
||||||
|
|
||||||
|
|
||||||
class SelectableRecycleBoxLayout(
|
class SelectableRecycleBoxLayout(
|
||||||
FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout):
|
FocusBehavior, LayoutSelectionBehavior, RecycleBoxLayout
|
||||||
|
):
|
||||||
"""Adds selection and focus behaviour to the view"""
|
"""Adds selection and focus behaviour to the view"""
|
||||||
|
|
||||||
# pylint: disable = duplicate-bases
|
# pylint: disable = duplicate-bases
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
@ -772,8 +787,7 @@ class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
def refresh_view_attrs(self, rv, index, data):
|
def refresh_view_attrs(self, rv, index, data):
|
||||||
"""Catch and handle the view changes"""
|
"""Catch and handle the view changes"""
|
||||||
self.index = index
|
self.index = index
|
||||||
return super(SelectableLabel, self).refresh_view_attrs(
|
return super(SelectableLabel, self).refresh_view_attrs(rv, index, data)
|
||||||
rv, index, data)
|
|
||||||
|
|
||||||
def on_touch_down(self, touch): # pylint: disable=inconsistent-return-statements
|
def on_touch_down(self, touch): # pylint: disable=inconsistent-return-statements
|
||||||
"""Add selection on touch down"""
|
"""Add selection on touch down"""
|
||||||
|
@ -788,7 +802,8 @@ class SelectableLabel(RecycleDataViewBehavior, Label):
|
||||||
if is_selected:
|
if is_selected:
|
||||||
print("selection changed to {0}".format(rv.data[index]))
|
print("selection changed to {0}".format(rv.data[index]))
|
||||||
rv.parent.txt_input.text = rv.parent.txt_input.text.replace(
|
rv.parent.txt_input.text = rv.parent.txt_input.text.replace(
|
||||||
rv.parent.txt_input.text, rv.data[index]['text'])
|
rv.parent.txt_input.text, rv.data[index]["text"]
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
class RV(RecycleView):
|
class RV(RecycleView):
|
||||||
|
@ -801,6 +816,7 @@ class RV(RecycleView):
|
||||||
|
|
||||||
class DropDownWidget(BoxLayout):
|
class DropDownWidget(BoxLayout):
|
||||||
"""Adding Dropdown Widget"""
|
"""Adding Dropdown Widget"""
|
||||||
|
|
||||||
# pylint: disable=too-many-statements
|
# pylint: disable=too-many-statements
|
||||||
|
|
||||||
txt_input = ObjectProperty()
|
txt_input = ObjectProperty()
|
||||||
|
@ -816,13 +832,13 @@ class DropDownWidget(BoxLayout):
|
||||||
print("message: ", self.ids.body.text)
|
print("message: ", self.ids.body.text)
|
||||||
sendMessageToPeople = True
|
sendMessageToPeople = True
|
||||||
if sendMessageToPeople:
|
if sendMessageToPeople:
|
||||||
if toAddress != '' and subject and message:
|
if toAddress != "" and subject and message:
|
||||||
status, addressVersionNumber, streamNumber, ripe = (
|
status, addressVersionNumber, streamNumber, ripe = decodeAddress(
|
||||||
decodeAddress(toAddress))
|
toAddress
|
||||||
if status == 'success':
|
)
|
||||||
|
if status == "success":
|
||||||
navApp.root.ids.sc3.children[0].active = True
|
navApp.root.ids.sc3.children[0].active = True
|
||||||
if state.detailPageType == 'draft' \
|
if state.detailPageType == "draft" and state.send_draft_mail:
|
||||||
and state.send_draft_mail:
|
|
||||||
sqlExecute(
|
sqlExecute(
|
||||||
"UPDATE sent SET toaddress = ?"
|
"UPDATE sent SET toaddress = ?"
|
||||||
", fromaddress = ? , subject = ?"
|
", fromaddress = ? , subject = ?"
|
||||||
|
@ -907,7 +923,7 @@ class DropDownWidget(BoxLayout):
|
||||||
state.kivyapp.root.ids.sc3.children[0].active = False
|
state.kivyapp.root.ids.sc3.children[0].active = False
|
||||||
state.in_sent_method = True
|
state.in_sent_method = True
|
||||||
state.kivyapp.back_press()
|
state.kivyapp.back_press()
|
||||||
toast('sent')
|
toast("sent")
|
||||||
|
|
||||||
def address_error_message(self, msg):
|
def address_error_message(self, msg):
|
||||||
"""Generates error message"""
|
"""Generates error message"""
|
||||||
|
@ -927,6 +943,7 @@ class DropDownWidget(BoxLayout):
|
||||||
dialog_box.dismiss()
|
dialog_box.dismiss()
|
||||||
toast(text_item)
|
toast(text_item)
|
||||||
|
|
||||||
|
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
# def callback_for_menu_items(text_item, *arg):
|
# def callback_for_menu_items(text_item, *arg):
|
||||||
# """Callback of alert box"""
|
# """Callback of alert box"""
|
||||||
|
@ -934,11 +951,11 @@ class DropDownWidget(BoxLayout):
|
||||||
|
|
||||||
def reset_composer(self):
|
def reset_composer(self):
|
||||||
"""Method will reset composer"""
|
"""Method will reset composer"""
|
||||||
self.ids.ti.text = ''
|
self.ids.ti.text = ""
|
||||||
self.ids.btn.text = 'Select'
|
self.ids.btn.text = "Select"
|
||||||
self.ids.txt_input.text = ''
|
self.ids.txt_input.text = ""
|
||||||
self.ids.subject.text = ''
|
self.ids.subject.text = ""
|
||||||
self.ids.body.text = ''
|
self.ids.body.text = ""
|
||||||
toast("Reset message")
|
toast("Reset message")
|
||||||
|
|
||||||
def auto_fill_fromaddr(self):
|
def auto_fill_fromaddr(self):
|
||||||
|
@ -950,57 +967,60 @@ class DropDownWidget(BoxLayout):
|
||||||
"""This method is used for scanning Qr code"""
|
"""This method is used for scanning Qr code"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ScanScreen(Screen):
|
class ScanScreen(Screen):
|
||||||
def on_pre_enter(self):
|
def on_pre_enter(self):
|
||||||
'''
|
"""
|
||||||
on_pre_enter works little better on android
|
on_pre_enter works little better on android
|
||||||
It affects screen transition on linux
|
It affects screen transition on linux
|
||||||
'''
|
"""
|
||||||
if not self.children:
|
if not self.children:
|
||||||
tmp= Builder.load_file(os.path.join(os.path.dirname(__file__), "kv/{}.kv").format('scanner'))
|
tmp = Builder.load_file(
|
||||||
|
os.path.join(os.path.dirname(__file__), "kv/{}.kv").format("scanner")
|
||||||
|
)
|
||||||
self.add_widget(tmp)
|
self.add_widget(tmp)
|
||||||
if platform=='android':
|
if platform == "android":
|
||||||
Clock.schedule_once(self.start_camera, 0)
|
Clock.schedule_once(self.start_camera, 0)
|
||||||
|
|
||||||
def on_enter(self):
|
def on_enter(self):
|
||||||
'''
|
"""
|
||||||
on_enter works better on linux
|
on_enter works better on linux
|
||||||
It creates a black screen on android until camera gets loaded
|
It creates a black screen on android until camera gets loaded
|
||||||
'''
|
"""
|
||||||
#print(self.children)
|
# print(self.children)
|
||||||
if platform!='android':
|
if platform != "android":
|
||||||
#pass
|
# pass
|
||||||
Clock.schedule_once(self.start_camera, 0)
|
Clock.schedule_once(self.start_camera, 0)
|
||||||
|
|
||||||
def on_leave(self):
|
def on_leave(self):
|
||||||
#pass
|
# pass
|
||||||
|
|
||||||
Clock.schedule_once(self.stop_camera, 0)
|
Clock.schedule_once(self.stop_camera, 0)
|
||||||
|
|
||||||
def start_camera(self, *args):
|
def start_camera(self, *args):
|
||||||
self.xcam= self.children[0].ids.zbarcam.ids.xcamera
|
self.xcam = self.children[0].ids.zbarcam.ids.xcamera
|
||||||
#pass
|
# pass
|
||||||
#self.xxx= self.children[0].ids.zbarcam.ids.xcamera
|
# self.xxx= self.children[0].ids.zbarcam.ids.xcamera
|
||||||
#print(self.cam._device.isOpened())
|
# print(self.cam._device.isOpened())
|
||||||
if platform=='android':
|
if platform == "android":
|
||||||
self.xcam.play= True
|
self.xcam.play = True
|
||||||
|
|
||||||
else:
|
else:
|
||||||
Clock.schedule_once(self.open_cam, 0)
|
Clock.schedule_once(self.open_cam, 0)
|
||||||
|
|
||||||
|
|
||||||
def stop_camera(self, *args):
|
def stop_camera(self, *args):
|
||||||
#print(self.children[0].ids.zbarcam.ids.xcamera.play)
|
# print(self.children[0].ids.zbarcam.ids.xcamera.play)
|
||||||
self.xcam.play= False
|
self.xcam.play = False
|
||||||
#self.xcam._camera.stop()
|
# self.xcam._camera.stop()
|
||||||
#self.children[0].ids.zbarcam.stop()
|
# self.children[0].ids.zbarcam.stop()
|
||||||
if platform != 'android':
|
if platform != "android":
|
||||||
self.xcam._camera._device.release()
|
self.xcam._camera._device.release()
|
||||||
|
|
||||||
def open_cam(self, *args):
|
def open_cam(self, *args):
|
||||||
if not self.xcam._camera._device.isOpened():
|
if not self.xcam._camera._device.isOpened():
|
||||||
self.xcam._camera._device.open(self.xcam._camera._index)
|
self.xcam._camera._device.open(self.xcam._camera._index)
|
||||||
self.xcam.play= True
|
self.xcam.play = True
|
||||||
|
|
||||||
|
|
||||||
class MyTextInput(TextInput):
|
class MyTextInput(TextInput):
|
||||||
"""Takes the text input in the field"""
|
"""Takes the text input in the field"""
|
||||||
|
@ -1071,24 +1091,31 @@ class Payment(Screen):
|
||||||
payloadLengthExtraBytes))
|
payloadLengthExtraBytes))
|
||||||
toast('hidden payment address Creating for buying subscription....')
|
toast('hidden payment address Creating for buying subscription....')
|
||||||
|
|
||||||
|
|
||||||
class Category(BoxLayout, RectangularElevationBehavior):
|
class Category(BoxLayout, RectangularElevationBehavior):
|
||||||
elevation_normal= .01
|
elevation_normal = .01
|
||||||
|
|
||||||
|
|
||||||
class ProductLayout(BoxLayout, RectangularElevationBehavior):
|
class ProductLayout(BoxLayout, RectangularElevationBehavior):
|
||||||
elevation_normal= .01
|
elevation_normal = .01
|
||||||
|
|
||||||
|
|
||||||
class PaymentMethodLayout(BoxLayout):
|
class PaymentMethodLayout(BoxLayout):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ListItemWithLabel(OneLineAvatarIconListItem):
|
class ListItemWithLabel(OneLineAvatarIconListItem):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class RightLabel(IRightBodyTouch, MDLabel):
|
class RightLabel(IRightBodyTouch, MDLabel):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class HomeScreen(Screen):
|
class HomeScreen(Screen):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Credits(Screen):
|
class Credits(Screen):
|
||||||
"""Credits Method"""
|
"""Credits Method"""
|
||||||
|
|
||||||
|
@ -2284,23 +2311,24 @@ class NavigateApp(MDApp):
|
||||||
# self.root.ids.sc7.ids.add_random_bx.clear_widgets()
|
# self.root.ids.sc7.ids.add_random_bx.clear_widgets()
|
||||||
|
|
||||||
def open_payment_layout(self, sku):
|
def open_payment_layout(self, sku):
|
||||||
pml= PaymentMethodLayout()
|
pml = PaymentMethodLayout()
|
||||||
self.product_id= sku
|
self.product_id = sku
|
||||||
self.custom_sheet= MDCustomBottomSheet(screen= pml)
|
self.custom_sheet = MDCustomBottomSheet(screen=pml)
|
||||||
self.custom_sheet.open()
|
self.custom_sheet.open()
|
||||||
|
|
||||||
def initiate_purchase(self, method_name):
|
def initiate_purchase(self, method_name):
|
||||||
#self.custom_sheet.dismiss()
|
# self.custom_sheet.dismiss()
|
||||||
print("Purchasing {} through {}".format(self.product_id, method_name))
|
print("Purchasing {} through {}".format(self.product_id, method_name))
|
||||||
|
|
||||||
def _after_scan(self, text):
|
def _after_scan(self, text):
|
||||||
if platform=='android':
|
if platform == 'android':
|
||||||
text= cast(CharSequence, String(text))
|
text = cast(CharSequence, String(text))
|
||||||
show_toast(text,Toast.LENGTH_SHORT)
|
show_toast(text, Toast.LENGTH_SHORT)
|
||||||
else:
|
else:
|
||||||
self.root.ids.sc3.children[1].ids.txt_input.text = text
|
self.root.ids.sc3.children[1].ids.txt_input.text = text
|
||||||
self.root.ids.scr_mngr.current = 'create'
|
self.root.ids.scr_mngr.current = 'create'
|
||||||
|
|
||||||
|
|
||||||
class GrashofPopup(Popup):
|
class GrashofPopup(Popup):
|
||||||
"""Moule for save contacts and error messages"""
|
"""Moule for save contacts and error messages"""
|
||||||
|
|
||||||
|
@ -2415,9 +2443,11 @@ class GrashofPopup(Popup):
|
||||||
text = "Some data encoded in the address is malformed."
|
text = "Some data encoded in the address is malformed."
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
class InfoLayout(BoxLayout, RectangularElevationBehavior):
|
class InfoLayout(BoxLayout, RectangularElevationBehavior):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class AvatarSampleWidget(ILeftBody, Image):
|
class AvatarSampleWidget(ILeftBody, Image):
|
||||||
"""Avatar Sample Widget"""
|
"""Avatar Sample Widget"""
|
||||||
|
|
||||||
|
@ -2582,8 +2612,7 @@ class MailDetail(Screen): # pylint: disable=too-many-instance-attributes
|
||||||
# sender_name = BMConfigParser().get(data[0][1], 'label')
|
# sender_name = BMConfigParser().get(data[0][1], 'label')
|
||||||
sender_name = data[0][1]
|
sender_name = data[0][1]
|
||||||
composer_obj.body.text = (
|
composer_obj.body.text = (
|
||||||
'\n\n --------------On ' + time_tag + ', '
|
'\n\n --------------On ' + time_tag + ', ' + sender_name + ' wrote:--------------\n' + data[0][3])
|
||||||
+ sender_name + ' wrote:--------------\n' + data[0][3])
|
|
||||||
composer_obj.body.focus = True
|
composer_obj.body.focus = True
|
||||||
composer_obj.body.cursor = (0, 0)
|
composer_obj.body.cursor = (0, 0)
|
||||||
state.kivyapp.root.ids.sc3.children[1].ids.rv.data = ''
|
state.kivyapp.root.ids.sc3.children[1].ids.rv.data = ''
|
||||||
|
|
|
@ -362,11 +362,12 @@ class Main(object):
|
||||||
while state.shutdown == 0:
|
while state.shutdown == 0:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
if (
|
if (
|
||||||
state.testmode and time.time() -
|
state.testmode
|
||||||
state.last_api_response >= 30
|
and time.time() - state.last_api_response >= 30
|
||||||
):
|
):
|
||||||
self.stop()
|
self.stop()
|
||||||
elif not state.enableGUI:
|
elif not state.enableGUI:
|
||||||
|
state.enableGUI = True
|
||||||
# pylint: disable=relative-import
|
# pylint: disable=relative-import
|
||||||
from tests import core as test_core
|
from tests import core as test_core
|
||||||
test_core_result = test_core.run()
|
test_core_result = test_core.run()
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
"""
|
"""
|
||||||
src/bitmessageqt/dialogs.py
|
Custom dialog classes
|
||||||
===========================
|
|
||||||
"""
|
"""
|
||||||
|
# pylint: disable=too-few-public-methods
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
|
|
||||||
import paths
|
import paths
|
||||||
|
|
|
@ -4,6 +4,7 @@ This module setting file is for settings
|
||||||
import ConfigParser
|
import ConfigParser
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import tempfile
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
@ -15,7 +16,6 @@ import openclpow
|
||||||
import paths
|
import paths
|
||||||
import queues
|
import queues
|
||||||
import state
|
import state
|
||||||
import tempfile
|
|
||||||
import widgets
|
import widgets
|
||||||
from bmconfigparser import BMConfigParser
|
from bmconfigparser import BMConfigParser
|
||||||
from helper_sql import sqlExecute, sqlStoredProcedure
|
from helper_sql import sqlExecute, sqlStoredProcedure
|
||||||
|
@ -30,7 +30,7 @@ def getSOCKSProxyType(config):
|
||||||
result = ConfigParser.SafeConfigParser.get(
|
result = ConfigParser.SafeConfigParser.get(
|
||||||
config, 'bitmessagesettings', 'socksproxytype')
|
config, 'bitmessagesettings', 'socksproxytype')
|
||||||
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
|
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
|
||||||
return
|
return None
|
||||||
else:
|
else:
|
||||||
if result.lower() in ('', 'none', 'false'):
|
if result.lower() in ('', 'none', 'false'):
|
||||||
result = None
|
result = None
|
||||||
|
@ -436,8 +436,7 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
'bitmessagesettings', 'maxacceptablenoncetrialsperbyte'
|
'bitmessagesettings', 'maxacceptablenoncetrialsperbyte'
|
||||||
) != str(int(
|
) != str(int(
|
||||||
float(self.lineEditMaxAcceptableTotalDifficulty.text())
|
float(self.lineEditMaxAcceptableTotalDifficulty.text())
|
||||||
* defaults.networkDefaultProofOfWorkNonceTrialsPerByte)
|
* defaults.networkDefaultProofOfWorkNonceTrialsPerByte)):
|
||||||
):
|
|
||||||
# the user changed the max acceptable total difficulty
|
# the user changed the max acceptable total difficulty
|
||||||
acceptableDifficultyChanged = True
|
acceptableDifficultyChanged = True
|
||||||
self.config.set(
|
self.config.set(
|
||||||
|
@ -454,8 +453,7 @@ class SettingsDialog(QtGui.QDialog):
|
||||||
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes'
|
'bitmessagesettings', 'maxacceptablepayloadlengthextrabytes'
|
||||||
) != str(int(
|
) != str(int(
|
||||||
float(self.lineEditMaxAcceptableSmallMessageDifficulty.text())
|
float(self.lineEditMaxAcceptableSmallMessageDifficulty.text())
|
||||||
* defaults.networkDefaultPayloadLengthExtraBytes)
|
* defaults.networkDefaultPayloadLengthExtraBytes)):
|
||||||
):
|
|
||||||
# the user changed the max acceptable small message difficulty
|
# the user changed the max acceptable small message difficulty
|
||||||
acceptableDifficultyChanged = True
|
acceptableDifficultyChanged = True
|
||||||
self.config.set(
|
self.config.set(
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
"""Sound Module"""
|
||||||
|
|
||||||
# sound type constants
|
# sound type constants
|
||||||
SOUND_NONE = 0
|
SOUND_NONE = 0
|
||||||
|
@ -12,10 +13,12 @@ SOUND_CONNECTION_GREEN = 5
|
||||||
# returns true if the given sound category is a connection sound
|
# returns true if the given sound category is a connection sound
|
||||||
# rather than a received message sound
|
# rather than a received message sound
|
||||||
def is_connection_sound(category):
|
def is_connection_sound(category):
|
||||||
|
"""Check if sound type is related to connectivity"""
|
||||||
return category in (
|
return category in (
|
||||||
SOUND_CONNECTED,
|
SOUND_CONNECTED,
|
||||||
SOUND_DISCONNECTED,
|
SOUND_DISCONNECTED,
|
||||||
SOUND_CONNECTION_GREEN
|
SOUND_CONNECTION_GREEN
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
extensions = ('wav', 'mp3', 'oga')
|
extensions = ('wav', 'mp3', 'oga')
|
||||||
|
|
|
@ -88,7 +88,7 @@ def createAddressIfNeeded(myapp):
|
||||||
if not checkHasNormalAddress():
|
if not checkHasNormalAddress():
|
||||||
queues.addressGeneratorQueue.put((
|
queues.addressGeneratorQueue.put((
|
||||||
'createRandomAddress', 4, 1,
|
'createRandomAddress', 4, 1,
|
||||||
SUPPORT_MY_LABEL.toUtf8(),
|
str(SUPPORT_MY_LABEL.toUtf8()),
|
||||||
1, "", False,
|
1, "", False,
|
||||||
defaults.networkDefaultProofOfWorkNonceTrialsPerByte,
|
defaults.networkDefaultProofOfWorkNonceTrialsPerByte,
|
||||||
defaults.networkDefaultPayloadLengthExtraBytes
|
defaults.networkDefaultPayloadLengthExtraBytes
|
||||||
|
|
6
src/bitmessageqt/tests/__init__.py
Normal file
6
src/bitmessageqt/tests/__init__.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
"""bitmessageqt tests"""
|
||||||
|
|
||||||
|
from main import TestMain
|
||||||
|
from support import TestSupport
|
||||||
|
|
||||||
|
__all__ = ["TestMain", "TestSupport"]
|
30
src/bitmessageqt/tests/main.py
Normal file
30
src/bitmessageqt/tests/main.py
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
"""Common definitions for bitmessageqt tests"""
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
import bitmessageqt
|
||||||
|
from tr import _translate
|
||||||
|
|
||||||
|
|
||||||
|
class TestBase(unittest.TestCase):
|
||||||
|
"""Base class for bitmessageqt test case"""
|
||||||
|
|
||||||
|
def setUp(self):
|
||||||
|
self.app = QtGui.QApplication([])
|
||||||
|
self.window = bitmessageqt.MyForm()
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
self.app.deleteLater()
|
||||||
|
|
||||||
|
|
||||||
|
class TestMain(unittest.TestCase):
|
||||||
|
"""Test case for main window - basic features"""
|
||||||
|
|
||||||
|
def test_translate(self):
|
||||||
|
"""Check the results of _translate() with various args"""
|
||||||
|
self.assertIsInstance(
|
||||||
|
_translate("MainWindow", "Test"),
|
||||||
|
QtCore.QString
|
||||||
|
)
|
33
src/bitmessageqt/tests/support.py
Normal file
33
src/bitmessageqt/tests/support.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
# from PyQt4 import QtTest
|
||||||
|
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from shared import isAddressInMyAddressBook
|
||||||
|
|
||||||
|
from main import TestBase
|
||||||
|
|
||||||
|
|
||||||
|
class TestSupport(TestBase):
|
||||||
|
"""A test case for support module"""
|
||||||
|
SUPPORT_ADDRESS = 'BM-2cUdgkDDAahwPAU6oD2A7DnjqZz3hgY832'
|
||||||
|
SUPPORT_SUBJECT = 'Support request'
|
||||||
|
|
||||||
|
def test(self):
|
||||||
|
"""trigger menu action "Contact Support" and check the result"""
|
||||||
|
ui = self.window.ui
|
||||||
|
self.assertEqual(ui.lineEditTo.text(), '')
|
||||||
|
self.assertEqual(ui.lineEditSubject.text(), '')
|
||||||
|
|
||||||
|
ui.actionSupport.trigger()
|
||||||
|
|
||||||
|
self.assertTrue(
|
||||||
|
isAddressInMyAddressBook(self.SUPPORT_ADDRESS))
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
ui.tabWidget.currentIndex(), ui.tabWidget.indexOf(ui.send))
|
||||||
|
self.assertEqual(
|
||||||
|
ui.lineEditTo.text(), self.SUPPORT_ADDRESS)
|
||||||
|
self.assertEqual(
|
||||||
|
ui.lineEditSubject.text(), self.SUPPORT_SUBJECT)
|
||||||
|
self.assertIn(
|
||||||
|
sys.version, ui.textEditMessage.toPlainText())
|
|
@ -30,7 +30,6 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
stem_version = None
|
stem_version = None
|
||||||
|
|
||||||
|
|
||||||
knownnodes_file = os.path.join(state.appdata, 'knownnodes.dat')
|
knownnodes_file = os.path.join(state.appdata, 'knownnodes.dat')
|
||||||
|
|
||||||
|
|
||||||
|
@ -245,7 +244,14 @@ class TestCore(unittest.TestCase):
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
"""Starts all tests defined in this module"""
|
"""Starts all tests defined in this module"""
|
||||||
loader = unittest.TestLoader()
|
loader = unittest.defaultTestLoader
|
||||||
loader.sortTestMethodsUsing = None
|
loader.sortTestMethodsUsing = None
|
||||||
suite = loader.loadTestsFromTestCase(TestCore)
|
suite = loader.loadTestsFromTestCase(TestCore)
|
||||||
|
try:
|
||||||
|
import bitmessageqt.tests
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
qt_tests = loader.loadTestsFromModule(bitmessageqt.tests)
|
||||||
|
suite.addTests(qt_tests)
|
||||||
return unittest.TextTestRunner(verbosity=2).run(suite)
|
return unittest.TextTestRunner(verbosity=2).run(suite)
|
||||||
|
|
Reference in New Issue
Block a user