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 import kivy_helper_search
|
||||
from functools import partial
|
||||
from kivy.clock import Clock
|
||||
from kivy.properties import (
|
||||
ListProperty,
|
||||
|
@ -14,10 +11,7 @@ from kivy.uix.screenmanager import Screen
|
|||
|
||||
from pybitmessage import state
|
||||
|
||||
from pybitmessage.baseclass.common import (
|
||||
avatarImageFirstLetter, toast,
|
||||
ThemeClsColor, SwipeToDeleteItem
|
||||
)
|
||||
from pybitmessage.baseclass.common import toast
|
||||
from pybitmessage.baseclass.popup import AddbookDetailPopup
|
||||
|
||||
|
||||
|
@ -72,6 +66,7 @@ class AddressBook(Screen):
|
|||
"""Refresh the Widget"""
|
||||
# state.navinstance.ids.sc11.ids.ml.clear_widgets()
|
||||
# state.navinstance.ids.sc11.loadAddresslist(None, 'All', '')
|
||||
pass
|
||||
|
||||
# @staticmethod
|
||||
def addBook_detail(self, address, label, instance, *args):
|
||||
|
@ -123,7 +118,6 @@ class AddressBook(Screen):
|
|||
|
||||
def update_addbook_label(self, instance):
|
||||
"""Updating the label of address book address"""
|
||||
# address_list = kivy_helper_search.search_sql(folder="addressbook")
|
||||
address_list = []
|
||||
stored_labels = [labels[0] for labels in address_list]
|
||||
add_dict = dict(address_list)
|
||||
|
|
|
@ -14,8 +14,6 @@ from pybitmessage.baseclass.common import (
|
|||
avatarImageFirstLetter, CutsomSwipeToDeleteItem,
|
||||
ShowTimeHistoy
|
||||
)
|
||||
# from pybitmessage.baseclass.maildetail import MailDetail
|
||||
# from pybitmessage.baseclass.trash import Trash
|
||||
|
||||
|
||||
class Allmails(Screen):
|
||||
|
@ -43,17 +41,8 @@ class Allmails(Screen):
|
|||
"""Load Inbox, Sent anf Draft list of messages"""
|
||||
self.account = state.association
|
||||
self.ids.tag_label.text = ''
|
||||
self.allMessageQuery(0, 20)
|
||||
if self.all_mails:
|
||||
self.ids.tag_label.text = 'All Mails'
|
||||
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)
|
||||
pass
|
||||
else:
|
||||
self.set_AllmailCnt('0')
|
||||
content = MDLabel(
|
||||
|
@ -65,19 +54,6 @@ class Allmails(Screen):
|
|||
valign='top')
|
||||
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
|
||||
"""This method is used to set allmails message count"""
|
||||
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))
|
||||
message_row.ids.time_tag.text = str(ShowTimeHistoy(item[7]))
|
||||
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(
|
||||
self.swipe_delete, item[5], item[4]))
|
||||
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:
|
||||
self.ids.scroll_y.scroll_y = .06
|
||||
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):
|
||||
"""Load sent and inbox mail details"""
|
||||
|
@ -154,21 +108,12 @@ class Allmails(Screen):
|
|||
else:
|
||||
src_mng_obj = self.parent.parent
|
||||
src_mng_obj.screens[11].clear_widgets()
|
||||
# src_mng_obj.screens[11].add_widget(MailDetail())
|
||||
src_mng_obj.current = 'mailDetail'
|
||||
else:
|
||||
instance.ids.delete_msg.disabled = False
|
||||
|
||||
def swipe_delete(self, unique_id, folder, instance, *args):
|
||||
"""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)
|
||||
try:
|
||||
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)
|
||||
if int(state.all_count) <= 0:
|
||||
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)
|
||||
toast('Deleted')
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
from datetime import datetime
|
||||
from kivy.core.window import Window
|
||||
from kivy.lang import Builder
|
||||
from kivy.metrics import dp
|
||||
from kivymd.uix.list import (
|
||||
ILeftBody,
|
||||
|
@ -8,8 +7,6 @@ from kivymd.uix.list import (
|
|||
)
|
||||
from kivy.uix.image import Image
|
||||
from kivymd.uix.label import MDLabel
|
||||
# from pybitmessage.get_platform import platform
|
||||
platform = "linux"
|
||||
from kivymd.toast import kivytoast
|
||||
from kivymd.uix.card import MDCardSwipe
|
||||
from kivymd.uix.chip import MDChip
|
||||
|
@ -17,6 +14,8 @@ from kivy.properties import (
|
|||
NumericProperty,
|
||||
StringProperty
|
||||
)
|
||||
# from pybitmessage.get_platform import platform
|
||||
platform = "linux"
|
||||
|
||||
|
||||
ThemeClsColor = [0.12, 0.58, 0.95, 1]
|
||||
|
@ -54,6 +53,7 @@ def toast(text):
|
|||
"""Method will display the toast message"""
|
||||
kivytoast.toast(text)
|
||||
|
||||
|
||||
def showLimitedCnt(total_msg):
|
||||
"""This method set the total count limit in badge_text"""
|
||||
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 functools import partial
|
||||
from pybitmessage.addresses import decodeAddress
|
||||
|
@ -71,9 +70,7 @@ class Draft(Screen):
|
|||
|
||||
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||
"""This methosd is for retrieving draft messages"""
|
||||
self.queryreturn = kivy_helper_search.search_sql(
|
||||
xAddress, self.account, "draft", where, what,
|
||||
False, start_indx, end_indx)
|
||||
self.queryreturn = []
|
||||
|
||||
def set_draftCnt(self, Count): # pylint: disable=no-self-use
|
||||
"""This method set the count of draft mails"""
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
from datetime import datetime
|
||||
|
||||
# from pybitmessage.get_platform import platform
|
||||
platform = "linux"
|
||||
|
||||
from kivy.core.clipboard import Clipboard
|
||||
from kivy.clock import Clock
|
||||
from kivy.properties import (
|
||||
|
@ -25,6 +22,8 @@ from .common import (
|
|||
toast, avatarImageFirstLetter, ShowTimeHistoy
|
||||
)
|
||||
from .popup import SenderDetailPopup
|
||||
# from pybitmessage.get_platform import platform
|
||||
platform = "linux"
|
||||
|
||||
|
||||
class OneLineListTitle(OneLineListItem):
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import time
|
||||
|
||||
from pybitmessage.get_platform import platform
|
||||
from pybitmessage.bmconfigparser import BMConfigParser
|
||||
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.views import RecycleDataViewBehavior
|
||||
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 queues
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ class MyAddress(Screen):
|
|||
"""Loads more data on scroll down"""
|
||||
self.set_mdList(my_addresses, my_addresses + 20)
|
||||
|
||||
# @staticmethod
|
||||
@staticmethod
|
||||
def myadd_detail(self, fromaddress, label, *args):
|
||||
"""Load myaddresses details"""
|
||||
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.metrics import dp
|
||||
|
@ -15,6 +12,8 @@ from datetime import datetime
|
|||
|
||||
from pybitmessage.baseclass.common import toast
|
||||
|
||||
platform = "linux"
|
||||
|
||||
|
||||
class LoadingPopup(Popup):
|
||||
"""LoadingPopup class for kivy Ui"""
|
||||
|
@ -40,44 +39,10 @@ class GrashofPopup(BoxLayout):
|
|||
|
||||
def checkAddress_valid(self, instance):
|
||||
"""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
|
||||
|
||||
def checkLabel_valid(self, instance):
|
||||
"""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
|
||||
|
||||
def _onSuccess(self, addressVersion, streamNumber, ripe):
|
||||
|
@ -96,7 +61,6 @@ class GrashofPopup(BoxLayout):
|
|||
elif status == 'checksumfailed':
|
||||
text = (
|
||||
"The address is not typed or copied correctly"
|
||||
# " (the checksum failed)."
|
||||
)
|
||||
elif status == 'versiontoohigh':
|
||||
text = (
|
||||
|
@ -126,7 +90,7 @@ class AddbookDetailPopup(BoxLayout):
|
|||
def checkLabel_valid(self, instance):
|
||||
"""Checking address label is unique of not"""
|
||||
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]
|
||||
add_dict = dict(address_list)
|
||||
if self.address and entered_label in addr_labels \
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
# from pybitmessage import identiconGeneration
|
||||
from functools import partial
|
||||
from kivy.clock import Clock
|
||||
from kivy.factory import Factory
|
||||
|
@ -13,7 +12,6 @@ from pybitmessage.baseclass.common import (
|
|||
showLimitedCnt, ThemeClsColor, avatarImageFirstLetter,
|
||||
toast, SwipeToDeleteItem, ShowTimeHistoy
|
||||
)
|
||||
# from pybitmessage.baseclass.maildetail import MailDetail
|
||||
|
||||
|
||||
class Sent(Screen):
|
||||
|
@ -46,7 +44,6 @@ class Sent(Screen):
|
|||
xAddress = 'fromaddress'
|
||||
data = []
|
||||
self.ids.tag_label.text = ''
|
||||
self.sentDataQuery(xAddress, where, what)
|
||||
if self.queryreturn:
|
||||
self.ids.tag_label.text = 'Sent'
|
||||
self.set_sentCount(state.sent_count)
|
||||
|
@ -72,19 +69,6 @@ class Sent(Screen):
|
|||
valign='top')
|
||||
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):
|
||||
"""This method is used to create the mdList"""
|
||||
total_sent_msg = len(self.ids.ml.children)
|
||||
|
@ -121,7 +105,6 @@ class Sent(Screen):
|
|||
total_sent = int(state.sent_count)
|
||||
else:
|
||||
data = []
|
||||
self.sentDataQuery('fromaddress', '', '', 0, 1)
|
||||
if state.association == state.check_sent_acc:
|
||||
total_sent = 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:
|
||||
where = ['subject', 'message']
|
||||
what = state.searcing_text
|
||||
self.sentDataQuery('fromaddress', where, what, total_sent_msg, 5)
|
||||
data = []
|
||||
for mail in self.queryreturn:
|
||||
data.append({
|
||||
|
@ -217,10 +199,6 @@ class Sent(Screen):
|
|||
try:
|
||||
self.parent.screens[3].clear_widgets()
|
||||
self.parent.screens[3].add_widget(Factory.Trash())
|
||||
# self.parent.screens[14].clear_widgets()
|
||||
# self.parent.screens[14].add_widget(Factory.Allmails())
|
||||
except Exception:
|
||||
self.parent.parent.screens[3].clear_widgets()
|
||||
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
|
||||
import os
|
||||
from pybitmessage import identiconGeneration
|
||||
from pybitmessage import kivy_helper_search
|
||||
from pybitmessage.uikivysignaler import UIkivySignaler
|
||||
from pybitmessage.bmconfigparser import BMConfigParser
|
||||
# from debug import logger
|
||||
from functools import partial
|
||||
from kivymd.app import MDApp
|
||||
from kivy.clock import Clock
|
||||
|
@ -44,21 +40,14 @@ from kivymd.uix.list import (
|
|||
from kivy.uix.screenmanager import RiseInTransition, SlideTransition, FallOutTransition
|
||||
|
||||
from pybitmessage import queues
|
||||
from pybitmessage.semaphores import kivyuisignaler
|
||||
|
||||
from pybitmessage import state
|
||||
from kivymd.uix.bottomsheet import MDCustomBottomSheet
|
||||
|
||||
from kivy.lang import Observable
|
||||
# import gettext
|
||||
# import l10n
|
||||
# import locale
|
||||
import ast
|
||||
|
||||
from pybitmessage.baseclass.common import toast
|
||||
|
||||
# from qr_scanner.zbarcam import ZBarCam
|
||||
# from pyzbar.pyzbar import ZBarSymbol
|
||||
|
||||
if platform != "android":
|
||||
from kivy.config import Config
|
||||
|
@ -238,16 +227,15 @@ class NavigateApp(MDApp):
|
|||
)
|
||||
)
|
||||
# self.obj_1 = AddressBook()
|
||||
kivysignalthread = UIkivySignaler()
|
||||
kivysignalthread.daemon = True
|
||||
kivysignalthread.start()
|
||||
# kivysignalthread = UIkivySignaler()
|
||||
# kivysignalthread.daemon = True
|
||||
# kivysignalthread.start()
|
||||
Window.bind(on_keyboard=self.on_key, on_request_close=self.on_request_close)
|
||||
return Builder.load_file(
|
||||
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
||||
|
||||
def run(self):
|
||||
"""Running the widgets"""
|
||||
kivyuisignaler.release()
|
||||
super(NavigateApp, self).run()
|
||||
|
||||
@staticmethod
|
||||
|
@ -269,7 +257,6 @@ class NavigateApp(MDApp):
|
|||
if os.path.exists(state.imageDir + '/default_identicon/{}.png'.format(text)):
|
||||
self.load_selected_Image(text)
|
||||
else:
|
||||
# self.set_identicon(text)
|
||||
self.root.ids.content_drawer.ids.reset_image.opacity = 0
|
||||
self.root.ids.content_drawer.ids.reset_image.disabled = True
|
||||
address_label = self.current_address_label(
|
||||
|
@ -387,10 +374,8 @@ class NavigateApp(MDApp):
|
|||
pupup_obj.ids.address.focus = True
|
||||
# pupup_obj.ids.label.focus = True
|
||||
|
||||
stored_address = [addr[1] for addr in kivy_helper_search.search_sql(
|
||||
folder="addressbook")]
|
||||
stored_labels = [labels[0] for labels in kivy_helper_search.search_sql(
|
||||
folder="addressbook")]
|
||||
stored_address = [addr[1] for addr in []]
|
||||
stored_labels = [labels[0] for labels in []]
|
||||
if label and address and address not in stored_address \
|
||||
and label not in stored_labels and pupup_obj.valid:
|
||||
queues.UISignalQueue.put(('rerenderAddressBook', ''))
|
||||
|
@ -413,26 +398,6 @@ class NavigateApp(MDApp):
|
|||
"""Getting Default Account Data"""
|
||||
if self.variable_1:
|
||||
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 'Select Address'
|
||||
|
||||
|
@ -446,8 +411,6 @@ class NavigateApp(MDApp):
|
|||
return state.imageDir + '/default_identicon/{}.png'.format(
|
||||
first_addr)
|
||||
else:
|
||||
# img = identiconGeneration.generate(first_addr)
|
||||
# instance.texture = img.texture
|
||||
return
|
||||
return state.imageDir + '/drawer_logo1.png'
|
||||
|
||||
|
@ -743,14 +706,6 @@ class NavigateApp(MDApp):
|
|||
Clock.schedule_once(self.search_callback, 0.5)
|
||||
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):
|
||||
"""Setting the details of the page"""
|
||||
if state.association and state.in_search_mode:
|
||||
|
@ -887,7 +842,6 @@ class NavigateApp(MDApp):
|
|||
|
||||
def rest_default_avatar_img(self):
|
||||
"""set default avatar generated image"""
|
||||
# self.set_identicon(state.association)
|
||||
img_path = state.imageDir + '/default_identicon/{}.png'.format(state.association)
|
||||
try:
|
||||
if os.path.exists(img_path):
|
||||
|
|
|
@ -5,11 +5,6 @@ import time
|
|||
|
||||
from six.moves import queue
|
||||
|
||||
# try:
|
||||
# from multiqueue import MultiQueue
|
||||
# except ImportError:
|
||||
# from .multiqueue import MultiQueue
|
||||
|
||||
|
||||
class ObjectProcessorQueue(queue.Queue):
|
||||
"""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