removed useless functions & files with testing
This commit is contained in:
parent
98720a4aa4
commit
c37efbdb07
|
@ -1,7 +1,4 @@
|
||||||
from turtle import pd
|
|
||||||
from pybitmessage.get_platform import platform
|
from pybitmessage.get_platform import platform
|
||||||
from pybitmessage import kivy_helper_search
|
|
||||||
from functools import partial
|
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
from kivy.properties import (
|
from kivy.properties import (
|
||||||
ListProperty,
|
ListProperty,
|
||||||
|
@ -14,10 +11,7 @@ from kivy.uix.screenmanager import Screen
|
||||||
|
|
||||||
from pybitmessage import state
|
from pybitmessage import state
|
||||||
|
|
||||||
from pybitmessage.baseclass.common import (
|
from pybitmessage.baseclass.common import toast
|
||||||
avatarImageFirstLetter, toast,
|
|
||||||
ThemeClsColor, SwipeToDeleteItem
|
|
||||||
)
|
|
||||||
from pybitmessage.baseclass.popup import AddbookDetailPopup
|
from pybitmessage.baseclass.popup import AddbookDetailPopup
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,6 +66,7 @@ class AddressBook(Screen):
|
||||||
"""Refresh the Widget"""
|
"""Refresh the Widget"""
|
||||||
# state.navinstance.ids.sc11.ids.ml.clear_widgets()
|
# state.navinstance.ids.sc11.ids.ml.clear_widgets()
|
||||||
# state.navinstance.ids.sc11.loadAddresslist(None, 'All', '')
|
# state.navinstance.ids.sc11.loadAddresslist(None, 'All', '')
|
||||||
|
pass
|
||||||
|
|
||||||
# @staticmethod
|
# @staticmethod
|
||||||
def addBook_detail(self, address, label, instance, *args):
|
def addBook_detail(self, address, label, instance, *args):
|
||||||
|
@ -123,7 +118,6 @@ class AddressBook(Screen):
|
||||||
|
|
||||||
def update_addbook_label(self, instance):
|
def update_addbook_label(self, instance):
|
||||||
"""Updating the label of address book address"""
|
"""Updating the label of address book address"""
|
||||||
# address_list = kivy_helper_search.search_sql(folder="addressbook")
|
|
||||||
address_list = []
|
address_list = []
|
||||||
stored_labels = [labels[0] for labels in address_list]
|
stored_labels = [labels[0] for labels in address_list]
|
||||||
add_dict = dict(address_list)
|
add_dict = dict(address_list)
|
||||||
|
|
|
@ -14,8 +14,6 @@ from pybitmessage.baseclass.common import (
|
||||||
avatarImageFirstLetter, CutsomSwipeToDeleteItem,
|
avatarImageFirstLetter, CutsomSwipeToDeleteItem,
|
||||||
ShowTimeHistoy
|
ShowTimeHistoy
|
||||||
)
|
)
|
||||||
# from pybitmessage.baseclass.maildetail import MailDetail
|
|
||||||
# from pybitmessage.baseclass.trash import Trash
|
|
||||||
|
|
||||||
|
|
||||||
class Allmails(Screen):
|
class Allmails(Screen):
|
||||||
|
@ -43,17 +41,8 @@ class Allmails(Screen):
|
||||||
"""Load Inbox, Sent anf Draft list of messages"""
|
"""Load Inbox, Sent anf Draft list of messages"""
|
||||||
self.account = state.association
|
self.account = state.association
|
||||||
self.ids.tag_label.text = ''
|
self.ids.tag_label.text = ''
|
||||||
self.allMessageQuery(0, 20)
|
|
||||||
if self.all_mails:
|
if self.all_mails:
|
||||||
self.ids.tag_label.text = 'All Mails'
|
pass
|
||||||
state.kivyapp.get_inbox_count()
|
|
||||||
state.kivyapp.get_sent_count()
|
|
||||||
state.all_count = str(
|
|
||||||
int(state.sent_count) + int(state.inbox_count))
|
|
||||||
self.set_AllmailCnt(state.all_count)
|
|
||||||
self.set_mdlist()
|
|
||||||
# self.ids.refresh_layout.bind(scroll_y=self.check_scroll_y)
|
|
||||||
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
|
||||||
else:
|
else:
|
||||||
self.set_AllmailCnt('0')
|
self.set_AllmailCnt('0')
|
||||||
content = MDLabel(
|
content = MDLabel(
|
||||||
|
@ -65,19 +54,6 @@ class Allmails(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
def allMessageQuery(self, start_indx, end_indx):
|
|
||||||
"""Retrieving data from inbox or sent both tables"""
|
|
||||||
self.all_mails = []
|
|
||||||
# sqlQuery(
|
|
||||||
# "SELECT toaddress, fromaddress, subject, message, folder, ackdata"
|
|
||||||
# " As id, DATE(senttime) As actionTime, senttime as msgtime FROM sent WHERE"
|
|
||||||
# " folder = 'sent' and fromaddress = '{0}'"
|
|
||||||
# " UNION SELECT toaddress, fromaddress, subject, message, folder,"
|
|
||||||
# " msgid As id, DATE(received) As actionTime, received as msgtime FROM inbox"
|
|
||||||
# " WHERE folder = 'inbox' and toaddress = '{0}'"
|
|
||||||
# " ORDER BY actionTime DESC limit {1}, {2}".format(
|
|
||||||
# self.account, start_indx, end_indx))
|
|
||||||
|
|
||||||
def set_AllmailCnt(self, Count): # pylint: disable=no-self-use
|
def set_AllmailCnt(self, Count): # pylint: disable=no-self-use
|
||||||
"""This method is used to set allmails message count"""
|
"""This method is used to set allmails message count"""
|
||||||
allmailCnt_obj = state.kivyapp.root.ids.content_drawer.ids.allmail_cnt
|
allmailCnt_obj = state.kivyapp.root.ids.content_drawer.ids.allmail_cnt
|
||||||
|
@ -107,21 +83,6 @@ class Allmails(Screen):
|
||||||
self.mail_detail, item[5], item[4], message_row))
|
self.mail_detail, item[5], item[4], message_row))
|
||||||
message_row.ids.time_tag.text = str(ShowTimeHistoy(item[7]))
|
message_row.ids.time_tag.text = str(ShowTimeHistoy(item[7]))
|
||||||
message_row.ids.chip_tag.text = item[4]
|
message_row.ids.chip_tag.text = item[4]
|
||||||
# listItem = message_row.ids.content
|
|
||||||
# secondary_text = (subject[:50] + '........' if len(
|
|
||||||
# subject) >= 50 else (
|
|
||||||
# subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', '')
|
|
||||||
# listItem.secondary_text = secondary_text
|
|
||||||
# listItem.theme_text_color = "Custom"
|
|
||||||
# listItem.text_color = ThemeClsColor
|
|
||||||
|
|
||||||
# listItem.add_widget(AvatarSampleWidget(
|
|
||||||
# source=state.imageDir + '/text_images/{}.png'.format(
|
|
||||||
# avatarImageFirstLetter(body.strip()))))
|
|
||||||
# listItem.bind(on_release=partial(
|
|
||||||
# self.mail_detail, item[5], item[4], message_row))
|
|
||||||
# listItem.add_widget(AddTimeWidget(item[7]))
|
|
||||||
# listItem.add_widget(chipTag(item[4]))
|
|
||||||
message_row.ids.delete_msg.bind(on_press=partial(
|
message_row.ids.delete_msg.bind(on_press=partial(
|
||||||
self.swipe_delete, item[5], item[4]))
|
self.swipe_delete, item[5], item[4]))
|
||||||
self.ids.ml.add_widget(message_row)
|
self.ids.ml.add_widget(message_row)
|
||||||
|
@ -133,13 +94,6 @@ class Allmails(Screen):
|
||||||
if self.ids.scroll_y.scroll_y <= -0.00 and self.has_refreshed:
|
if self.ids.scroll_y.scroll_y <= -0.00 and self.has_refreshed:
|
||||||
self.ids.scroll_y.scroll_y = .06
|
self.ids.scroll_y.scroll_y = .06
|
||||||
load_more = len(self.ids.ml.children)
|
load_more = len(self.ids.ml.children)
|
||||||
self.updating_allmail(load_more)
|
|
||||||
|
|
||||||
def updating_allmail(self, load_more):
|
|
||||||
"""This method is used to update the all mail
|
|
||||||
listing value on the scroll of screen"""
|
|
||||||
self.allMessageQuery(load_more, 5)
|
|
||||||
self.set_mdlist()
|
|
||||||
|
|
||||||
def mail_detail(self, unique_id, folder, instance, *args):
|
def mail_detail(self, unique_id, folder, instance, *args):
|
||||||
"""Load sent and inbox mail details"""
|
"""Load sent and inbox mail details"""
|
||||||
|
@ -154,21 +108,12 @@ class Allmails(Screen):
|
||||||
else:
|
else:
|
||||||
src_mng_obj = self.parent.parent
|
src_mng_obj = self.parent.parent
|
||||||
src_mng_obj.screens[11].clear_widgets()
|
src_mng_obj.screens[11].clear_widgets()
|
||||||
# src_mng_obj.screens[11].add_widget(MailDetail())
|
|
||||||
src_mng_obj.current = 'mailDetail'
|
src_mng_obj.current = 'mailDetail'
|
||||||
else:
|
else:
|
||||||
instance.ids.delete_msg.disabled = False
|
instance.ids.delete_msg.disabled = False
|
||||||
|
|
||||||
def swipe_delete(self, unique_id, folder, instance, *args):
|
def swipe_delete(self, unique_id, folder, instance, *args):
|
||||||
"""Delete inbox mail from all mail listing"""
|
"""Delete inbox mail from all mail listing"""
|
||||||
if folder == 'inbox':
|
|
||||||
sqlExecute(
|
|
||||||
"UPDATE inbox SET folder = 'trash' WHERE msgid = ?;",
|
|
||||||
unique_id)
|
|
||||||
else:
|
|
||||||
sqlExecute(
|
|
||||||
"UPDATE sent SET folder = 'trash' WHERE ackdata = ?;",
|
|
||||||
unique_id)
|
|
||||||
self.ids.ml.remove_widget(instance.parent.parent)
|
self.ids.ml.remove_widget(instance.parent.parent)
|
||||||
try:
|
try:
|
||||||
msg_count_objs = self.parent.parent.ids.content_drawer.ids
|
msg_count_objs = self.parent.parent.ids.content_drawer.ids
|
||||||
|
@ -193,8 +138,5 @@ class Allmails(Screen):
|
||||||
state.trash_count = str(int(state.trash_count) + 1)
|
state.trash_count = str(int(state.trash_count) + 1)
|
||||||
if int(state.all_count) <= 0:
|
if int(state.all_count) <= 0:
|
||||||
self.ids.tag_label.text = ''
|
self.ids.tag_label.text = ''
|
||||||
# nav_lay_obj.sc5.clear_widgets()
|
|
||||||
# nav_lay_obj.sc5.add_widget(Trash())
|
|
||||||
nav_lay_obj.sc17.remove_widget(instance.parent.parent)
|
nav_lay_obj.sc17.remove_widget(instance.parent.parent)
|
||||||
toast('Deleted')
|
toast('Deleted')
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from kivy.core.window import Window
|
from kivy.core.window import Window
|
||||||
from kivy.lang import Builder
|
|
||||||
from kivy.metrics import dp
|
from kivy.metrics import dp
|
||||||
from kivymd.uix.list import (
|
from kivymd.uix.list import (
|
||||||
ILeftBody,
|
ILeftBody,
|
||||||
|
@ -8,8 +7,6 @@ from kivymd.uix.list import (
|
||||||
)
|
)
|
||||||
from kivy.uix.image import Image
|
from kivy.uix.image import Image
|
||||||
from kivymd.uix.label import MDLabel
|
from kivymd.uix.label import MDLabel
|
||||||
# from pybitmessage.get_platform import platform
|
|
||||||
platform = "linux"
|
|
||||||
from kivymd.toast import kivytoast
|
from kivymd.toast import kivytoast
|
||||||
from kivymd.uix.card import MDCardSwipe
|
from kivymd.uix.card import MDCardSwipe
|
||||||
from kivymd.uix.chip import MDChip
|
from kivymd.uix.chip import MDChip
|
||||||
|
@ -17,6 +14,8 @@ from kivy.properties import (
|
||||||
NumericProperty,
|
NumericProperty,
|
||||||
StringProperty
|
StringProperty
|
||||||
)
|
)
|
||||||
|
# from pybitmessage.get_platform import platform
|
||||||
|
platform = "linux"
|
||||||
|
|
||||||
|
|
||||||
ThemeClsColor = [0.12, 0.58, 0.95, 1]
|
ThemeClsColor = [0.12, 0.58, 0.95, 1]
|
||||||
|
@ -54,6 +53,7 @@ def toast(text):
|
||||||
"""Method will display the toast message"""
|
"""Method will display the toast message"""
|
||||||
kivytoast.toast(text)
|
kivytoast.toast(text)
|
||||||
|
|
||||||
|
|
||||||
def showLimitedCnt(total_msg):
|
def showLimitedCnt(total_msg):
|
||||||
"""This method set the total count limit in badge_text"""
|
"""This method set the total count limit in badge_text"""
|
||||||
return "99+" if total_msg > 99 else str(total_msg)
|
return "99+" if total_msg > 99 else str(total_msg)
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from pybitmessage import kivy_helper_search
|
|
||||||
from pybitmessage.bmconfigparser import BMConfigParser
|
from pybitmessage.bmconfigparser import BMConfigParser
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from pybitmessage.addresses import decodeAddress
|
from pybitmessage.addresses import decodeAddress
|
||||||
|
@ -71,9 +70,7 @@ class Draft(Screen):
|
||||||
|
|
||||||
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||||
"""This methosd is for retrieving draft messages"""
|
"""This methosd is for retrieving draft messages"""
|
||||||
self.queryreturn = kivy_helper_search.search_sql(
|
self.queryreturn = []
|
||||||
xAddress, self.account, "draft", where, what,
|
|
||||||
False, start_indx, end_indx)
|
|
||||||
|
|
||||||
def set_draftCnt(self, Count): # pylint: disable=no-self-use
|
def set_draftCnt(self, Count): # pylint: disable=no-self-use
|
||||||
"""This method set the count of draft mails"""
|
"""This method set the count of draft mails"""
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
# from pybitmessage.get_platform import platform
|
|
||||||
platform = "linux"
|
|
||||||
|
|
||||||
from kivy.core.clipboard import Clipboard
|
from kivy.core.clipboard import Clipboard
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
from kivy.properties import (
|
from kivy.properties import (
|
||||||
|
@ -25,6 +22,8 @@ from .common import (
|
||||||
toast, avatarImageFirstLetter, ShowTimeHistoy
|
toast, avatarImageFirstLetter, ShowTimeHistoy
|
||||||
)
|
)
|
||||||
from .popup import SenderDetailPopup
|
from .popup import SenderDetailPopup
|
||||||
|
# from pybitmessage.get_platform import platform
|
||||||
|
platform = "linux"
|
||||||
|
|
||||||
|
|
||||||
class OneLineListTitle(OneLineListItem):
|
class OneLineListTitle(OneLineListItem):
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import time
|
|
||||||
|
|
||||||
from pybitmessage.get_platform import platform
|
from pybitmessage.get_platform import platform
|
||||||
from pybitmessage.bmconfigparser import BMConfigParser
|
from pybitmessage.bmconfigparser import BMConfigParser
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
@ -21,10 +19,6 @@ from kivy.uix.recycleboxlayout import RecycleBoxLayout
|
||||||
from kivy.uix.recycleview.layout import LayoutSelectionBehavior
|
from kivy.uix.recycleview.layout import LayoutSelectionBehavior
|
||||||
from kivy.uix.recycleview.views import RecycleDataViewBehavior
|
from kivy.uix.recycleview.views import RecycleDataViewBehavior
|
||||||
from kivy.uix.screenmanager import Screen
|
from kivy.uix.screenmanager import Screen
|
||||||
from kivy.uix.textinput import TextInput
|
|
||||||
from kivymd.uix.behaviors.hover_behavior import HoverBehavior
|
|
||||||
from kivymd.uix.boxlayout import MDBoxLayout
|
|
||||||
from kivymd.theming import ThemableBehavior
|
|
||||||
from pybitmessage import state
|
from pybitmessage import state
|
||||||
from pybitmessage import queues
|
from pybitmessage import queues
|
||||||
|
|
||||||
|
@ -104,7 +98,7 @@ class DropDownWidget(BoxLayout):
|
||||||
print("streamNumber > 1 or streamNumber == 0")
|
print("streamNumber > 1 or streamNumber == 0")
|
||||||
stealthLevel = BMConfigParser().safeGetInt(
|
stealthLevel = BMConfigParser().safeGetInt(
|
||||||
'bitmessagesettings', 'ackstealthlevel')
|
'bitmessagesettings', 'ackstealthlevel')
|
||||||
|
|
||||||
state.check_sent_acc = fromAddress
|
state.check_sent_acc = fromAddress
|
||||||
if state.detailPageType == 'draft' \
|
if state.detailPageType == 'draft' \
|
||||||
and state.send_draft_mail:
|
and state.send_draft_mail:
|
||||||
|
|
|
@ -139,7 +139,7 @@ class MyAddress(Screen):
|
||||||
"""Loads more data on scroll down"""
|
"""Loads more data on scroll down"""
|
||||||
self.set_mdList(my_addresses, my_addresses + 20)
|
self.set_mdList(my_addresses, my_addresses + 20)
|
||||||
|
|
||||||
# @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':
|
||||||
|
|
|
@ -1,6 +1,3 @@
|
||||||
# from ..get_platform import platform
|
|
||||||
platform = "linux"
|
|
||||||
# from pybitmessage import kivy_helper_search
|
|
||||||
|
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
from kivy.metrics import dp
|
from kivy.metrics import dp
|
||||||
|
@ -15,6 +12,8 @@ from datetime import datetime
|
||||||
|
|
||||||
from pybitmessage.baseclass.common import toast
|
from pybitmessage.baseclass.common import toast
|
||||||
|
|
||||||
|
platform = "linux"
|
||||||
|
|
||||||
|
|
||||||
class LoadingPopup(Popup):
|
class LoadingPopup(Popup):
|
||||||
"""LoadingPopup class for kivy Ui"""
|
"""LoadingPopup class for kivy Ui"""
|
||||||
|
@ -40,44 +39,10 @@ class GrashofPopup(BoxLayout):
|
||||||
|
|
||||||
def checkAddress_valid(self, instance):
|
def checkAddress_valid(self, instance):
|
||||||
"""Checking address is valid or not"""
|
"""Checking address is valid or not"""
|
||||||
# my_addresses = (
|
|
||||||
# state.kivyapp.root.ids.content_drawer.ids.btn.values)
|
|
||||||
# add_book = [addr[1] for addr in kivy_helper_search.search_sql(
|
|
||||||
# folder="addressbook")]
|
|
||||||
# entered_text = str(instance.text).strip()
|
|
||||||
# if entered_text in add_book:
|
|
||||||
# text = 'Address is already in the addressbook.'
|
|
||||||
# elif entered_text in my_addresses:
|
|
||||||
# text = 'You can not save your own address.'
|
|
||||||
# elif entered_text:
|
|
||||||
# text = self.addressChanged(entered_text)
|
|
||||||
|
|
||||||
# if entered_text in my_addresses or entered_text in add_book:
|
|
||||||
# self.ids.address.error = True
|
|
||||||
# self.ids.address.helper_text = text
|
|
||||||
# elif entered_text and self.valid:
|
|
||||||
# self.ids.address.error = False
|
|
||||||
# elif entered_text:
|
|
||||||
# self.ids.address.error = True
|
|
||||||
# self.ids.address.helper_text = text
|
|
||||||
# else:
|
|
||||||
# self.ids.address.error = False
|
|
||||||
# self.ids.address.helper_text = 'This field is required'
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def checkLabel_valid(self, instance):
|
def checkLabel_valid(self, instance):
|
||||||
"""Checking address label is unique or not"""
|
"""Checking address label is unique or not"""
|
||||||
# entered_label = instance.text.strip()
|
|
||||||
# addr_labels = [labels[0] for labels in kivy_helper_search.search_sql(
|
|
||||||
# folder="addressbook")]
|
|
||||||
# if entered_label in addr_labels:
|
|
||||||
# self.ids.label.error = True
|
|
||||||
# self.ids.label.helper_text = 'label name already exists.'
|
|
||||||
# elif entered_label:
|
|
||||||
# self.ids.label.error = False
|
|
||||||
# else:
|
|
||||||
# self.ids.label.error = False
|
|
||||||
# self.ids.label.helper_text = 'This field is required'
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
||||||
|
@ -96,7 +61,6 @@ class GrashofPopup(BoxLayout):
|
||||||
elif status == 'checksumfailed':
|
elif status == 'checksumfailed':
|
||||||
text = (
|
text = (
|
||||||
"The address is not typed or copied correctly"
|
"The address is not typed or copied correctly"
|
||||||
# " (the checksum failed)."
|
|
||||||
)
|
)
|
||||||
elif status == 'versiontoohigh':
|
elif status == 'versiontoohigh':
|
||||||
text = (
|
text = (
|
||||||
|
@ -126,7 +90,7 @@ class AddbookDetailPopup(BoxLayout):
|
||||||
def checkLabel_valid(self, instance):
|
def checkLabel_valid(self, instance):
|
||||||
"""Checking address label is unique of not"""
|
"""Checking address label is unique of not"""
|
||||||
entered_label = str(instance.text.strip())
|
entered_label = str(instance.text.strip())
|
||||||
address_list = kivy_helper_search.search_sql(folder="addressbook")
|
address_list = []
|
||||||
addr_labels = [labels[0] for labels in address_list]
|
addr_labels = [labels[0] for labels in address_list]
|
||||||
add_dict = dict(address_list)
|
add_dict = dict(address_list)
|
||||||
if self.address and entered_label in addr_labels \
|
if self.address and entered_label in addr_labels \
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
# from pybitmessage import identiconGeneration
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
from kivy.factory import Factory
|
from kivy.factory import Factory
|
||||||
|
@ -13,7 +12,6 @@ from pybitmessage.baseclass.common import (
|
||||||
showLimitedCnt, ThemeClsColor, avatarImageFirstLetter,
|
showLimitedCnt, ThemeClsColor, avatarImageFirstLetter,
|
||||||
toast, SwipeToDeleteItem, ShowTimeHistoy
|
toast, SwipeToDeleteItem, ShowTimeHistoy
|
||||||
)
|
)
|
||||||
# from pybitmessage.baseclass.maildetail import MailDetail
|
|
||||||
|
|
||||||
|
|
||||||
class Sent(Screen):
|
class Sent(Screen):
|
||||||
|
@ -46,7 +44,6 @@ class Sent(Screen):
|
||||||
xAddress = 'fromaddress'
|
xAddress = 'fromaddress'
|
||||||
data = []
|
data = []
|
||||||
self.ids.tag_label.text = ''
|
self.ids.tag_label.text = ''
|
||||||
self.sentDataQuery(xAddress, where, what)
|
|
||||||
if self.queryreturn:
|
if self.queryreturn:
|
||||||
self.ids.tag_label.text = 'Sent'
|
self.ids.tag_label.text = 'Sent'
|
||||||
self.set_sentCount(state.sent_count)
|
self.set_sentCount(state.sent_count)
|
||||||
|
@ -72,19 +69,6 @@ class Sent(Screen):
|
||||||
valign='top')
|
valign='top')
|
||||||
self.ids.ml.add_widget(content)
|
self.ids.ml.add_widget(content)
|
||||||
|
|
||||||
def sentDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
|
||||||
"""This method is used to retrieving data from sent table"""
|
|
||||||
# self.queryreturn = kivy_helper_search.search_sql(
|
|
||||||
# xAddress,
|
|
||||||
# self.account,
|
|
||||||
# 'sent',
|
|
||||||
# where,
|
|
||||||
# what,
|
|
||||||
# False,
|
|
||||||
# start_indx,
|
|
||||||
# end_indx)
|
|
||||||
pass
|
|
||||||
|
|
||||||
def set_mdlist(self, data, set_index=0):
|
def set_mdlist(self, data, set_index=0):
|
||||||
"""This method is used to create the mdList"""
|
"""This method is used to create the mdList"""
|
||||||
total_sent_msg = len(self.ids.ml.children)
|
total_sent_msg = len(self.ids.ml.children)
|
||||||
|
@ -121,7 +105,6 @@ class Sent(Screen):
|
||||||
total_sent = int(state.sent_count)
|
total_sent = int(state.sent_count)
|
||||||
else:
|
else:
|
||||||
data = []
|
data = []
|
||||||
self.sentDataQuery('fromaddress', '', '', 0, 1)
|
|
||||||
if state.association == state.check_sent_acc:
|
if state.association == state.check_sent_acc:
|
||||||
total_sent = int(state.sent_count) + 1
|
total_sent = int(state.sent_count) + 1
|
||||||
state.sent_count = str(int(state.sent_count) + 1)
|
state.sent_count = str(int(state.sent_count) + 1)
|
||||||
|
@ -154,7 +137,6 @@ class Sent(Screen):
|
||||||
if state.searcing_text:
|
if state.searcing_text:
|
||||||
where = ['subject', 'message']
|
where = ['subject', 'message']
|
||||||
what = state.searcing_text
|
what = state.searcing_text
|
||||||
self.sentDataQuery('fromaddress', where, what, total_sent_msg, 5)
|
|
||||||
data = []
|
data = []
|
||||||
for mail in self.queryreturn:
|
for mail in self.queryreturn:
|
||||||
data.append({
|
data.append({
|
||||||
|
@ -217,10 +199,6 @@ class Sent(Screen):
|
||||||
try:
|
try:
|
||||||
self.parent.screens[3].clear_widgets()
|
self.parent.screens[3].clear_widgets()
|
||||||
self.parent.screens[3].add_widget(Factory.Trash())
|
self.parent.screens[3].add_widget(Factory.Trash())
|
||||||
# self.parent.screens[14].clear_widgets()
|
|
||||||
# self.parent.screens[14].add_widget(Factory.Allmails())
|
|
||||||
except Exception:
|
except Exception:
|
||||||
self.parent.parent.screens[3].clear_widgets()
|
self.parent.parent.screens[3].clear_widgets()
|
||||||
self.parent.parent.screens[3].add_widget(Factory.Trash())
|
self.parent.parent.screens[3].add_widget(Factory.Trash())
|
||||||
# self.parent.parent.screens[14].clear_widgets()
|
|
||||||
# self.parent.parent.screens[14].add_widget(Factory.Allmails())
|
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
"""
|
|
||||||
Core classes for loading images and converting them to a Texture.
|
|
||||||
The raw image data can be keep in memory for further access
|
|
||||||
"""
|
|
||||||
import hashlib
|
|
||||||
from io import BytesIO
|
|
||||||
|
|
||||||
# from PIL import Image
|
|
||||||
from kivy.core.image import Image as CoreImage
|
|
||||||
from kivy.uix.image import Image as kiImage
|
|
||||||
# pylint: disable=import-error
|
|
||||||
|
|
||||||
|
|
||||||
# constants
|
|
||||||
RESOLUTION = 300, 300
|
|
||||||
V_RESOLUTION = 7, 7
|
|
||||||
BACKGROUND_COLOR = 255, 255, 255, 255
|
|
||||||
MODE = "RGB"
|
|
||||||
|
|
||||||
|
|
||||||
def generate(Generate_string=None):
|
|
||||||
"""Generating string"""
|
|
||||||
# hash_string = generate_hash(Generate_string)
|
|
||||||
# color = random_color(hash_string)
|
|
||||||
# # image = Image.new(MODE, V_RESOLUTION, BACKGROUND_COLOR)
|
|
||||||
# # image = generate_image(image, color, hash_string)
|
|
||||||
# image = open("/home/cis/Downloads/1.png")
|
|
||||||
# # image = image.resize(RESOLUTION, 0)
|
|
||||||
# data = BytesIO()
|
|
||||||
# image.save(data, format='png')
|
|
||||||
# data.seek(0)
|
|
||||||
# # yes you actually need this
|
|
||||||
# im = CoreImage(BytesIO(data.read()), ext='png')
|
|
||||||
# beeld = kiImage()
|
|
||||||
# # only use this line in first code instance
|
|
||||||
# beeld.texture = im.texture
|
|
||||||
# return beeld
|
|
||||||
pass
|
|
||||||
# image.show()
|
|
||||||
|
|
||||||
|
|
||||||
def generate_hash(string):
|
|
||||||
"""Generating hash"""
|
|
||||||
try:
|
|
||||||
# make input case insensitive
|
|
||||||
string = str.lower(string)
|
|
||||||
hash_object = hashlib.md5(str.encode(string))
|
|
||||||
print(hash_object.hexdigest())
|
|
||||||
# returned object is a hex string
|
|
||||||
return hash_object.hexdigest()
|
|
||||||
except IndexError:
|
|
||||||
print("Error: Please enter a string as an argument.")
|
|
||||||
|
|
||||||
|
|
||||||
def random_color(hash_string):
|
|
||||||
"""Getting random color"""
|
|
||||||
# remove first three digits from hex string
|
|
||||||
split = 6
|
|
||||||
rgb = hash_string[:split]
|
|
||||||
split = 2
|
|
||||||
r = rgb[:split]
|
|
||||||
g = rgb[split:2 * split]
|
|
||||||
b = rgb[2 * split:3 * split]
|
|
||||||
color = (int(r, 16), int(g, 16), int(b, 16), 0xFF)
|
|
||||||
return color
|
|
||||||
|
|
||||||
|
|
||||||
def generate_image(image, color, hash_string):
|
|
||||||
"""Generating images"""
|
|
||||||
hash_string = hash_string[6:]
|
|
||||||
lower_x = 1
|
|
||||||
lower_y = 1
|
|
||||||
upper_x = int(V_RESOLUTION[0] / 2) + 1
|
|
||||||
upper_y = V_RESOLUTION[1] - 1
|
|
||||||
limit_x = V_RESOLUTION[0] - 1
|
|
||||||
index = 0
|
|
||||||
for x in range(lower_x, upper_x):
|
|
||||||
for y in range(lower_y, upper_y):
|
|
||||||
if int(hash_string[index], 16) % 2 == 0:
|
|
||||||
image.putpixel((x, y), color)
|
|
||||||
image.putpixel((limit_x - x, y), color)
|
|
||||||
index = index + 1
|
|
||||||
return image
|
|
|
@ -1,71 +0,0 @@
|
||||||
"""
|
|
||||||
Sql queries for bitmessagekivy
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def search_sql(
|
|
||||||
xAddress="toaddress", account=None, folder="inbox", where=None,
|
|
||||||
what=None, unreadOnly=False, start_indx=0, end_indx=20):
|
|
||||||
# pylint: disable=too-many-arguments, too-many-branches
|
|
||||||
"""Method helping for searching mails"""
|
|
||||||
if what is not None and what != "":
|
|
||||||
what = "%" + what + "%"
|
|
||||||
else:
|
|
||||||
what = None
|
|
||||||
if folder in ("sent", "draft"):
|
|
||||||
sqlStatementBase = (
|
|
||||||
'''SELECT toaddress, fromaddress, subject, message, status,'''
|
|
||||||
''' ackdata, senttime FROM sent '''
|
|
||||||
)
|
|
||||||
elif folder == "addressbook":
|
|
||||||
sqlStatementBase = '''SELECT label, address From addressbook '''
|
|
||||||
else:
|
|
||||||
sqlStatementBase = (
|
|
||||||
'''SELECT folder, msgid, toaddress, message, fromaddress,'''
|
|
||||||
''' subject, received, read FROM inbox '''
|
|
||||||
)
|
|
||||||
sqlStatementParts = []
|
|
||||||
sqlArguments = []
|
|
||||||
if account is not None:
|
|
||||||
if xAddress == 'both':
|
|
||||||
sqlStatementParts.append("(fromaddress = ? OR toaddress = ?)")
|
|
||||||
sqlArguments.append(account)
|
|
||||||
sqlArguments.append(account)
|
|
||||||
else:
|
|
||||||
sqlStatementParts.append(xAddress + " = ? ")
|
|
||||||
sqlArguments.append(account)
|
|
||||||
if folder != "addressbook":
|
|
||||||
if folder is not None:
|
|
||||||
if folder == "new":
|
|
||||||
folder = "inbox"
|
|
||||||
unreadOnly = True
|
|
||||||
sqlStatementParts.append("folder = ? ")
|
|
||||||
sqlArguments.append(folder)
|
|
||||||
else:
|
|
||||||
sqlStatementParts.append("folder != ?")
|
|
||||||
sqlArguments.append("trash")
|
|
||||||
if what is not None:
|
|
||||||
for colmns in where:
|
|
||||||
if len(where) > 1:
|
|
||||||
if where[0] == colmns:
|
|
||||||
filter_col = "(%s LIKE ?" % (colmns)
|
|
||||||
else:
|
|
||||||
filter_col += " or %s LIKE ? )" % (colmns)
|
|
||||||
else:
|
|
||||||
filter_col = "%s LIKE ?" % (colmns)
|
|
||||||
sqlArguments.append(what)
|
|
||||||
sqlStatementParts.append(filter_col)
|
|
||||||
if unreadOnly:
|
|
||||||
sqlStatementParts.append("read = 0")
|
|
||||||
if sqlStatementParts:
|
|
||||||
sqlStatementBase += "WHERE " + " AND ".join(sqlStatementParts)
|
|
||||||
# if folder in ("sent", "draft"):
|
|
||||||
if folder in ("sent", "draft"):
|
|
||||||
sqlStatementBase += \
|
|
||||||
"ORDER BY senttime DESC limit {0}, {1}".format(
|
|
||||||
start_indx, end_indx)
|
|
||||||
elif folder == "inbox":
|
|
||||||
sqlStatementBase += \
|
|
||||||
"ORDER BY received DESC limit {0}, {1}".format(
|
|
||||||
start_indx, end_indx)
|
|
||||||
return []
|
|
|
@ -1,28 +0,0 @@
|
||||||
"""
|
|
||||||
Dummy implementation for kivy Desktop and android(mobile) interface
|
|
||||||
"""
|
|
||||||
# pylint: disable=too-few-public-methods
|
|
||||||
|
|
||||||
from kivy.app import App
|
|
||||||
from kivy.uix.label import Label
|
|
||||||
|
|
||||||
|
|
||||||
class NavigateApp(App):
|
|
||||||
"""Navigation Layout of class"""
|
|
||||||
|
|
||||||
def build(self):
|
|
||||||
"""Method builds the widget"""
|
|
||||||
# pylint: disable=no-self-use
|
|
||||||
return Label(text="Hello World !")
|
|
||||||
|
|
||||||
def clickNavDrawer(self):
|
|
||||||
"""method for clicking navigation drawer"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
def addingtoaddressbook(self):
|
|
||||||
"""method for clicking address book popup"""
|
|
||||||
pass
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
NavigateApp().run()
|
|
|
@ -11,11 +11,7 @@ Bitmessage android(mobile) interface
|
||||||
|
|
||||||
from pybitmessage.get_platform import platform
|
from pybitmessage.get_platform import platform
|
||||||
import os
|
import os
|
||||||
from pybitmessage import identiconGeneration
|
|
||||||
from pybitmessage import kivy_helper_search
|
|
||||||
from pybitmessage.uikivysignaler import UIkivySignaler
|
|
||||||
from pybitmessage.bmconfigparser import BMConfigParser
|
from pybitmessage.bmconfigparser import BMConfigParser
|
||||||
# from debug import logger
|
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from kivymd.app import MDApp
|
from kivymd.app import MDApp
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
|
@ -44,21 +40,14 @@ from kivymd.uix.list import (
|
||||||
from kivy.uix.screenmanager import RiseInTransition, SlideTransition, FallOutTransition
|
from kivy.uix.screenmanager import RiseInTransition, SlideTransition, FallOutTransition
|
||||||
|
|
||||||
from pybitmessage import queues
|
from pybitmessage import queues
|
||||||
from pybitmessage.semaphores import kivyuisignaler
|
|
||||||
|
|
||||||
from pybitmessage import state
|
from pybitmessage import state
|
||||||
from kivymd.uix.bottomsheet import MDCustomBottomSheet
|
from kivymd.uix.bottomsheet import MDCustomBottomSheet
|
||||||
|
|
||||||
from kivy.lang import Observable
|
from kivy.lang import Observable
|
||||||
# import gettext
|
|
||||||
# import l10n
|
|
||||||
# import locale
|
|
||||||
import ast
|
import ast
|
||||||
|
|
||||||
from pybitmessage.baseclass.common import toast
|
from pybitmessage.baseclass.common import toast
|
||||||
|
|
||||||
# from qr_scanner.zbarcam import ZBarCam
|
|
||||||
# from pyzbar.pyzbar import ZBarSymbol
|
|
||||||
|
|
||||||
if platform != "android":
|
if platform != "android":
|
||||||
from kivy.config import Config
|
from kivy.config import Config
|
||||||
|
@ -238,16 +227,15 @@ class NavigateApp(MDApp):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
# self.obj_1 = AddressBook()
|
# self.obj_1 = AddressBook()
|
||||||
kivysignalthread = UIkivySignaler()
|
# kivysignalthread = UIkivySignaler()
|
||||||
kivysignalthread.daemon = True
|
# kivysignalthread.daemon = True
|
||||||
kivysignalthread.start()
|
# kivysignalthread.start()
|
||||||
Window.bind(on_keyboard=self.on_key, on_request_close=self.on_request_close)
|
Window.bind(on_keyboard=self.on_key, on_request_close=self.on_request_close)
|
||||||
return Builder.load_file(
|
return Builder.load_file(
|
||||||
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
"""Running the widgets"""
|
"""Running the widgets"""
|
||||||
kivyuisignaler.release()
|
|
||||||
super(NavigateApp, self).run()
|
super(NavigateApp, self).run()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -269,7 +257,6 @@ class NavigateApp(MDApp):
|
||||||
if os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(text)):
|
if os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(text)):
|
||||||
self.load_selected_Image(text)
|
self.load_selected_Image(text)
|
||||||
else:
|
else:
|
||||||
# self.set_identicon(text)
|
|
||||||
self.root.ids.content_drawer.ids.reset_image.opacity = 0
|
self.root.ids.content_drawer.ids.reset_image.opacity = 0
|
||||||
self.root.ids.content_drawer.ids.reset_image.disabled = True
|
self.root.ids.content_drawer.ids.reset_image.disabled = True
|
||||||
address_label = self.current_address_label(
|
address_label = self.current_address_label(
|
||||||
|
@ -387,10 +374,8 @@ class NavigateApp(MDApp):
|
||||||
pupup_obj.ids.address.focus = True
|
pupup_obj.ids.address.focus = True
|
||||||
# pupup_obj.ids.label.focus = True
|
# pupup_obj.ids.label.focus = True
|
||||||
|
|
||||||
stored_address = [addr[1] for addr in kivy_helper_search.search_sql(
|
stored_address = [addr[1] for addr in []]
|
||||||
folder="addressbook")]
|
stored_labels = [labels[0] for labels in []]
|
||||||
stored_labels = [labels[0] for labels in kivy_helper_search.search_sql(
|
|
||||||
folder="addressbook")]
|
|
||||||
if label and address and address not in stored_address \
|
if label and address and address not in stored_address \
|
||||||
and label not in stored_labels and pupup_obj.valid:
|
and label not in stored_labels and pupup_obj.valid:
|
||||||
queues.UISignalQueue.put(('rerenderAddressBook', ''))
|
queues.UISignalQueue.put(('rerenderAddressBook', ''))
|
||||||
|
@ -413,26 +398,6 @@ class NavigateApp(MDApp):
|
||||||
"""Getting Default Account Data"""
|
"""Getting Default Account Data"""
|
||||||
if self.variable_1:
|
if self.variable_1:
|
||||||
state.association = first_addr = self.variable_1[0]
|
state.association = first_addr = self.variable_1[0]
|
||||||
# if BMConfigParser().get(str(first_addr), 'enabled') == 'true':
|
|
||||||
# img = identiconGeneration.generate(first_addr)
|
|
||||||
# print('line...........................................426')
|
|
||||||
# self.createFolder(state.imageDir + '/default_identicon/')
|
|
||||||
# if platform == 'android':
|
|
||||||
# # android_path = os.path.expanduser
|
|
||||||
# # ("~/user/0/org.test.bitapp/files/app/")
|
|
||||||
# if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(
|
|
||||||
# BMConfigParser().addresses()[0])):
|
|
||||||
# android_path = os.path.join(
|
|
||||||
# os.environ['ANDROID_PRIVATE'] + '/app/')
|
|
||||||
# img.texture.save('{1}/images/kivy/default_identicon/{0}.png'.format(
|
|
||||||
# BMConfigParser().addresses()[0], android_path))
|
|
||||||
# else:
|
|
||||||
# if not os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(
|
|
||||||
# BMConfigParser().addresses()[0])):
|
|
||||||
# img.texture.save(state.imageDir + '/default_identicon/{}.png'.format(
|
|
||||||
# BMConfigParser().addresses()[0]))
|
|
||||||
# instance.parent.parent.parent.parent.parent.ids.top_box.children[0].texture = (
|
|
||||||
# img.texture)
|
|
||||||
return first_addr
|
return first_addr
|
||||||
return 'Select Address'
|
return 'Select Address'
|
||||||
|
|
||||||
|
@ -446,8 +411,6 @@ class NavigateApp(MDApp):
|
||||||
return state.imageDir + '/default_identicon/{}.png'.format(
|
return state.imageDir + '/default_identicon/{}.png'.format(
|
||||||
first_addr)
|
first_addr)
|
||||||
else:
|
else:
|
||||||
# img = identiconGeneration.generate(first_addr)
|
|
||||||
# instance.texture = img.texture
|
|
||||||
return
|
return
|
||||||
return state.imageDir + '/drawer_logo1.png'
|
return state.imageDir + '/drawer_logo1.png'
|
||||||
|
|
||||||
|
@ -743,14 +706,6 @@ class NavigateApp(MDApp):
|
||||||
Clock.schedule_once(self.search_callback, 0.5)
|
Clock.schedule_once(self.search_callback, 0.5)
|
||||||
return
|
return
|
||||||
|
|
||||||
def set_identicon(self, text):
|
|
||||||
"""Show identicon in address spinner"""
|
|
||||||
# img = identiconGeneration.generate(text)
|
|
||||||
# self.root.children[0].children[0].ids.btn.children[1].texture = (img.texture)
|
|
||||||
# below line is for displaing logo
|
|
||||||
# self.root.ids.content_drawer.ids.top_box.children[0].texture = (img.texture)
|
|
||||||
pass
|
|
||||||
|
|
||||||
def set_mail_detail_header(self):
|
def set_mail_detail_header(self):
|
||||||
"""Setting the details of the page"""
|
"""Setting the details of the page"""
|
||||||
if state.association and state.in_search_mode:
|
if state.association and state.in_search_mode:
|
||||||
|
@ -887,7 +842,6 @@ class NavigateApp(MDApp):
|
||||||
|
|
||||||
def rest_default_avatar_img(self):
|
def rest_default_avatar_img(self):
|
||||||
"""set default avatar generated image"""
|
"""set default avatar generated image"""
|
||||||
# self.set_identicon(state.association)
|
|
||||||
img_path = state.imageDir + '/default_identicon/{}.png'.format(state.association)
|
img_path = state.imageDir + '/default_identicon/{}.png'.format(state.association)
|
||||||
try:
|
try:
|
||||||
if os.path.exists(img_path):
|
if os.path.exists(img_path):
|
||||||
|
|
|
@ -5,11 +5,6 @@ import time
|
||||||
|
|
||||||
from six.moves import queue
|
from six.moves import queue
|
||||||
|
|
||||||
# try:
|
|
||||||
# from multiqueue import MultiQueue
|
|
||||||
# except ImportError:
|
|
||||||
# from .multiqueue import MultiQueue
|
|
||||||
|
|
||||||
|
|
||||||
class ObjectProcessorQueue(queue.Queue):
|
class ObjectProcessorQueue(queue.Queue):
|
||||||
"""Special queue class using lock for `.threads.objectProcessor`"""
|
"""Special queue class using lock for `.threads.objectProcessor`"""
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
from threading import Semaphore
|
|
||||||
|
|
||||||
kivyuisignaler = Semaphore(0)
|
|
|
@ -1,34 +0,0 @@
|
||||||
"""
|
|
||||||
Ui Singnaler for kivy interface
|
|
||||||
"""
|
|
||||||
from threading import Thread
|
|
||||||
|
|
||||||
from pybitmessage import queues
|
|
||||||
from pybitmessage import state
|
|
||||||
# from semaphores import kivyuisignaler
|
|
||||||
|
|
||||||
from threading import Semaphore
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class UIkivySignaler(Thread):
|
|
||||||
"""Kivy ui signaler"""
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
kivyuisignaler = Semaphore(0)
|
|
||||||
kivyuisignaler.acquire()
|
|
||||||
while state.shutdown == 0:
|
|
||||||
try:
|
|
||||||
command, data = queues.UISignalQueue.get()
|
|
||||||
if command == 'writeNewAddressToTable':
|
|
||||||
address = data[1]
|
|
||||||
state.kivyapp.variable_1.append(address)
|
|
||||||
# elif command == 'rerenderAddressBook':
|
|
||||||
# state.kivyapp.obj_1.refreshs()
|
|
||||||
# Need to discuss this
|
|
||||||
elif command == 'writeNewpaymentAddressToTable':
|
|
||||||
pass
|
|
||||||
elif command == 'updateSentItemStatusByAckdata':
|
|
||||||
state.kivyapp.status_dispatching(data)
|
|
||||||
except Exception as e:
|
|
||||||
print(e)
|
|
Reference in New Issue
Block a user