Added delete() in helper_sent, common method for empty screen in common.py and called in draft.py
This commit is contained in:
parent
3369379eba
commit
293e171a47
|
@ -17,6 +17,7 @@ from kivy.properties import (
|
|||
StringProperty
|
||||
)
|
||||
|
||||
from kivymd.uix.label import MDLabel
|
||||
|
||||
ThemeClsColor = [0.12, 0.58, 0.95, 1]
|
||||
|
||||
|
@ -142,3 +143,16 @@ class CutsomSwipeToDeleteItem(MDCardSwipe):
|
|||
cla = Window.size[0] / 2
|
||||
swipe_distance = NumericProperty(cla)
|
||||
opening_time = NumericProperty(0.5)
|
||||
|
||||
|
||||
def empty_screen_label(label_str):
|
||||
"""This function returns default message while no address is there."""
|
||||
# empty_screen_msg = "yet no message for this account!!!!!!!!!!!!!"
|
||||
content = MDLabel(
|
||||
font_style='Caption',
|
||||
theme_text_color='Primary',
|
||||
text=label_str,
|
||||
halign='center',
|
||||
size_hint_y=None,
|
||||
valign='top')
|
||||
return content
|
||||
|
|
|
@ -24,7 +24,7 @@ from kivy.uix.screenmanager import Screen
|
|||
from bitmessagekivy import kivy_helper_search
|
||||
from bitmessagekivy.baseclass.common import (
|
||||
showLimitedCnt, toast, ThemeClsColor,
|
||||
SwipeToDeleteItem, ShowTimeHistoy
|
||||
SwipeToDeleteItem, ShowTimeHistoy, empty_screen_label
|
||||
)
|
||||
from bitmessagekivy.baseclass.maildetail import MailDetail
|
||||
from bitmessagekivy.baseclass.draft_widgets import HelperDraft
|
||||
|
@ -34,7 +34,7 @@ from addresses import decodeAddress
|
|||
|
||||
import state
|
||||
from helper_sql import sqlExecute
|
||||
|
||||
import helper_sent
|
||||
|
||||
class Draft(Screen, HelperDraft):
|
||||
"""Draft screen class for kivy Ui"""
|
||||
|
@ -85,7 +85,8 @@ class Draft(Screen, HelperDraft):
|
|||
# halign='center',
|
||||
# size_hint_y=None,
|
||||
# valign='top')
|
||||
self.ids.ml.add_widget(self.default_label_when_empty())
|
||||
label_str = "yet no message for this account!!!!!!!!!!!!!2"
|
||||
self.ids.ml.add_widget(empty_screen_label(label_str))
|
||||
|
||||
def draftDataQuery(self, xAddress, where, what, start_indx=0, end_indx=20):
|
||||
"""This methosd is for retrieving draft messages"""
|
||||
|
@ -160,7 +161,7 @@ class Draft(Screen, HelperDraft):
|
|||
|
||||
def delete_draft(self, data_index, instance, *args):
|
||||
"""Delete draft message permanently"""
|
||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?", data_index)
|
||||
helper_sent.delete(data_index)
|
||||
if int(state.draft_count) > 0:
|
||||
state.draft_count = str(int(state.draft_count) - 1)
|
||||
self.set_draftCnt(state.draft_count)
|
||||
|
|
|
@ -16,15 +16,15 @@ class HelperDraft(object):
|
|||
def __init__(self):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def default_label_when_empty():
|
||||
"""This function returns default message while no address is there."""
|
||||
empty_screen_msg = "yet no message for this account!!!!!!!!!!!!!"
|
||||
content = MDLabel(
|
||||
font_style='Caption',
|
||||
theme_text_color='Primary',
|
||||
text=empty_screen_msg,
|
||||
halign='center',
|
||||
size_hint_y=None,
|
||||
valign='top')
|
||||
return content
|
||||
# @staticmethod
|
||||
# def default_label_when_empty():
|
||||
# """This function returns default message while no address is there."""
|
||||
# empty_screen_msg = "yet no message for this account!!!!!!!!!!!!!"
|
||||
# content = MDLabel(
|
||||
# font_style='Caption',
|
||||
# theme_text_color='Primary',
|
||||
# text=empty_screen_msg,
|
||||
# halign='center',
|
||||
# size_hint_y=None,
|
||||
# valign='top')
|
||||
# return content
|
||||
|
|
|
@ -7,3 +7,6 @@ from helper_sql import sqlExecute
|
|||
def insert(t):
|
||||
"""Perform an insert into the `sent` table"""
|
||||
sqlExecute('''INSERT INTO sent VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)''', *t)
|
||||
|
||||
def delete(data_index):
|
||||
sqlExecute("DELETE FROM sent WHERE ackdata = ?", data_index)
|
Reference in New Issue
Block a user