Add an additional file for addressbook widgets
This commit is contained in:
parent
b2fd30c338
commit
8a49e1ab6b
|
@ -1,4 +1,3 @@
|
||||||
from turtle import pd
|
|
||||||
from bitmessagekivy.get_platform import platform
|
from bitmessagekivy.get_platform import platform
|
||||||
from bitmessagekivy import kivy_helper_search
|
from bitmessagekivy import kivy_helper_search
|
||||||
from helper_sql import sqlExecute
|
from helper_sql import sqlExecute
|
||||||
|
@ -22,7 +21,8 @@ from bitmessagekivy.baseclass.common import (
|
||||||
from bitmessagekivy.baseclass.popup import AddbookDetailPopup
|
from bitmessagekivy.baseclass.popup import AddbookDetailPopup
|
||||||
from bitmessagekivy.baseclass.addressbook_widgets import HelperAddressBook
|
from bitmessagekivy.baseclass.addressbook_widgets import HelperAddressBook
|
||||||
|
|
||||||
class AddressBook(Screen):
|
|
||||||
|
class AddressBook(Screen, HelperAddressBook):
|
||||||
"""AddressBook Screen class for kivy Ui"""
|
"""AddressBook Screen class for kivy Ui"""
|
||||||
|
|
||||||
queryreturn = ListProperty()
|
queryreturn = ListProperty()
|
||||||
|
@ -58,6 +58,7 @@ class AddressBook(Screen):
|
||||||
self.set_mdList(0, 20)
|
self.set_mdList(0, 20)
|
||||||
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
self.ids.scroll_y.bind(scroll_y=self.check_scroll_y)
|
||||||
else:
|
else:
|
||||||
|
"""This is still exprimental, may need to make changes somewhere"""
|
||||||
# content = MDLabel(
|
# content = MDLabel(
|
||||||
# font_style='Caption',
|
# font_style='Caption',
|
||||||
# theme_text_color='Primary',
|
# theme_text_color='Primary',
|
||||||
|
@ -66,18 +67,7 @@ class AddressBook(Screen):
|
||||||
# halign='center',
|
# halign='center',
|
||||||
# size_hint_y=None,
|
# size_hint_y=None,
|
||||||
# valign='top')
|
# valign='top')
|
||||||
self.ids.ml.add_widget(HelperAddressBook.default_label_while_empty())
|
self.ids.ml.add_widget(self.default_label_when_empty())
|
||||||
|
|
||||||
# def show_default_content(self):
|
|
||||||
# content = MDLabel(
|
|
||||||
# font_style='Caption',
|
|
||||||
# theme_text_color='Primary',
|
|
||||||
# text="No contact found!" if state.searcing_text
|
|
||||||
# else "No contact found yet...... ",
|
|
||||||
# halign='center',
|
|
||||||
# size_hint_y=None,
|
|
||||||
# valign='top')
|
|
||||||
# return content
|
|
||||||
|
|
||||||
def set_mdList(self, start_index, end_index):
|
def set_mdList(self, start_index, end_index):
|
||||||
"""Creating the mdList"""
|
"""Creating the mdList"""
|
||||||
|
@ -127,34 +117,34 @@ class AddressBook(Screen):
|
||||||
if instance.state == 'closed':
|
if instance.state == 'closed':
|
||||||
instance.ids.delete_msg.disabled = True
|
instance.ids.delete_msg.disabled = True
|
||||||
if instance.open_progress == 0.0:
|
if instance.open_progress == 0.0:
|
||||||
HelperAddressBook.address_detail_popup(self, address, label, instance)
|
obj = AddbookDetailPopup()
|
||||||
# obj = AddbookDetailPopup()
|
self.address_label = obj.address_label = label
|
||||||
# self.address_label = obj.address_label = label
|
self.address = obj.address = address
|
||||||
# self.address = obj.address = address
|
width = .9 if platform == 'android' else .8
|
||||||
# width = .9 if platform == 'android' else .8
|
self.addbook_popup = MDDialog(
|
||||||
# self.addbook_popup = MDDialog(
|
type="custom",
|
||||||
# type="custom",
|
size_hint=(width, .25),
|
||||||
# size_hint=(width, .25),
|
content_cls=obj,
|
||||||
# content_cls=obj,
|
buttons=[
|
||||||
# buttons=[
|
MDRaisedButton(
|
||||||
# MDRaisedButton(
|
text="Send message to",
|
||||||
# text="Send message to",
|
on_release=self.send_message_to,
|
||||||
# on_release=self.send_message_to,
|
),
|
||||||
# ),
|
MDRaisedButton(
|
||||||
# MDRaisedButton(
|
text="Save",
|
||||||
# text="Save",
|
on_release=self.update_addbook_label,
|
||||||
# on_release=self.update_addbook_label,
|
),
|
||||||
# ),
|
MDRaisedButton(
|
||||||
# MDRaisedButton(
|
text="Cancel",
|
||||||
# text="Cancel",
|
on_release=self.close_pop,
|
||||||
# on_release=self.close_pop,
|
),
|
||||||
# ),
|
],
|
||||||
# ],
|
)
|
||||||
# )
|
# self.addbook_popup.set_normal_height()
|
||||||
# # self.addbook_popup.set_normal_height()
|
self.addbook_popup = HelperAddressBook.address_detail_popup(self)
|
||||||
# self.addbook_popup = HelperAddressBook.address_detail_popup(self)
|
self.addbook_popup.auto_dismiss = False
|
||||||
# self.addbook_popup.auto_dismiss = False
|
self.addbook_popup.open()
|
||||||
# self.addbook_popup.open()
|
# HelperAddressBook.address_detail_popup(address, label, instance,)
|
||||||
else:
|
else:
|
||||||
instance.ids.delete_msg.disabled = False
|
instance.ids.delete_msg.disabled = False
|
||||||
|
|
||||||
|
@ -202,3 +192,6 @@ class AddressBook(Screen):
|
||||||
window_obj.sc3.children[1].ids.body.text = ''
|
window_obj.sc3.children[1].ids.body.text = ''
|
||||||
window_obj.scr_mngr.current = 'create'
|
window_obj.scr_mngr.current = 'create'
|
||||||
self.addbook_popup.dismiss()
|
self.addbook_popup.dismiss()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,13 @@ from kivymd.uix.dialog import MDDialog
|
||||||
from kivymd.uix.label import MDLabel
|
from kivymd.uix.label import MDLabel
|
||||||
|
|
||||||
from bitmessagekivy.baseclass.popup import AddbookDetailPopup
|
from bitmessagekivy.baseclass.popup import AddbookDetailPopup
|
||||||
|
# from bitmessagekivy.baseclass.addressbook import AddressBook
|
||||||
|
|
||||||
class HelperAddressBook:
|
class HelperAddressBook:
|
||||||
def default_label_while_empty():
|
"""Widget used in Addressbook are here"""
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def default_label_when_empty():
|
||||||
content = MDLabel(
|
content = MDLabel(
|
||||||
font_style='Caption',
|
font_style='Caption',
|
||||||
theme_text_color='Primary',
|
theme_text_color='Primary',
|
||||||
|
@ -20,29 +24,30 @@ class HelperAddressBook:
|
||||||
valign='top')
|
valign='top')
|
||||||
return content
|
return content
|
||||||
|
|
||||||
def address_detail_popup(self, address, label, instance):
|
# @staticmethod
|
||||||
obj = AddbookDetailPopup()
|
# def address_detail_popup(address, label, instance, **args):
|
||||||
self.address_label = obj.address_label = label
|
# obj = AddbookDetailPopup()
|
||||||
self.address = obj.address = address
|
# address_label = obj.address_label = label
|
||||||
width = .9 if platform == 'android' else .8
|
# address = obj.address = address
|
||||||
self.addbook_popup = MDDialog(
|
# width = .9 if platform == 'android' else .8
|
||||||
type="custom",
|
# addbook_popup = MDDialog(
|
||||||
size_hint=(width, .25),
|
# type="custom",
|
||||||
content_cls=obj,
|
# size_hint=(width, .25),
|
||||||
buttons=[
|
# content_cls=obj,
|
||||||
MDRaisedButton(
|
# buttons=[
|
||||||
text="Send message to",
|
# MDRaisedButton(
|
||||||
on_release=self.send_message_to,
|
# text="Send message to",
|
||||||
),
|
# on_release=AddressBook.send_message_to,
|
||||||
MDRaisedButton(
|
# ),
|
||||||
text="Save",
|
# MDRaisedButton(
|
||||||
on_release=self.update_addbook_label,
|
# text="Save",
|
||||||
),
|
# on_release=AddressBook.update_addbook_label,
|
||||||
MDRaisedButton(
|
# ),
|
||||||
text="Cancel",
|
# MDRaisedButton(
|
||||||
on_release=self.close_pop,
|
# text="Cancel",
|
||||||
),
|
# on_release=AddressBook.close_pop,
|
||||||
],
|
# ),
|
||||||
)
|
# ],
|
||||||
self.addbook_popup.auto_dismiss = False
|
# )
|
||||||
self.addbook_popup.open()
|
# addbook_popup.auto_dismiss = False
|
||||||
|
# addbook_popup.open()
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
icon: "chevron-double-right"
|
icon: "chevron-double-right"
|
||||||
text: app.tr._("Proceed Next")
|
text: app.tr._("Proceed Next")
|
||||||
on_release:
|
on_release:
|
||||||
app.root.set_screen('random')
|
app.set_screen('random')
|
||||||
on_press:
|
on_press:
|
||||||
app.root.ids.sc7.reset_address_label()
|
app.root.ids.sc7.reset_address_label()
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user