Merge pull request #44 from jaicis/kivyfixes

Implemented new featues
This commit is contained in:
navjotcis 2020-02-19 21:26:42 +05:30 committed by GitHub
commit 1278342d8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 776 additions and 158 deletions

View File

@ -44,20 +44,6 @@
on_press: app.clear_composer() on_press: app.clear_composer()
<CopyTextBtn@Button>:
id: cpyButton
color: 0,0,0,1
background_color: (0,0,0,0)
center_x: self.parent.center_x * 2 - self.parent.parent.padding[0]/2
center_y: self.parent.center_y
on_press:app.root.ids.sc14.copy_composer_text(self)
Image:
source: './images/copy_text.png'
center_x: self.parent.center_x
center_y: self.parent.center_y
size: 20, 20
<ToggleBtn>: <ToggleBtn>:
#size_hint: None, None #size_hint: None, None
size: dp(36), dp(48) size: dp(36), dp(48)

View File

@ -1,84 +1,65 @@
<MailDetail>: <MailDetail>:
name: 'mailDetail' name: 'mailDetail'
# ScrollView:
# do_scroll_x: False
# BoxLayout:
# orientation: 'vertical'
# size_hint_y: None
# height: dp(500) + self.minimum_height
# padding: dp(32)
# MDLabel:
# font_style: 'Subtitle1'
# theme_text_color: 'Primary'
# text: root.subject
# halign: 'left'
# font_size: '20sp'
# CopyTextBtn:
# MDLabel:
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: "From: " + root.from_addr
# halign: 'left'
# CopyTextBtn:
# MDLabel:
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: "To: " + root.to_addr
# halign: 'left'
# CopyTextBtn:
# MDLabel:
# font_style: 'Body1'
# theme_text_color: 'Primary'
# text: root.status
# halign: 'left'
# MDLabel:
# font_style: 'Subtitle2'
# theme_text_color: 'Primary'
# text: root.message
# halign: 'left'
# bold: True
# CopyTextBtn:
# BoxLayout:
# orientation: 'vertical'
# size_hint_y: None
# height: dp(100) + self.minimum_height
ScrollView: ScrollView:
do_scroll_x: False do_scroll_x: False
BoxLayout: BoxLayout:
size_hint_y: None size_hint_y: None
orientation: 'vertical' orientation: 'vertical'
height: dp(bod.height) + self.minimum_height # height: dp(bod.height) + self.minimum_height
height: self.minimum_height
padding: dp(20) padding: dp(20)
OneLineListItem: # MDLabel:
# size_hint_y: None
# id: subj
# text: root.subject
# theme_text_color: 'Primary'
# halign: 'left'
# font_style: 'H5'
# height: dp(40)
# on_touch_down: root.allclick(self)
OneLineListTitle:
id: subj id: subj
text: root.subject text: root.subject
divider: None divider: None
disabled: True
font_style: 'H5' font_style: 'H5'
theme_text_color: 'Primary' theme_text_color: 'Primary'
_no_ripple_effect: True
long_press_time: 1
TwoLineAvatarIconListItem: TwoLineAvatarIconListItem:
id: subaft id: subaft
text: root.from_addr text: root.from_addr
secondary_text: 'to ' + root.to_addr secondary_text: 'to ' + root.to_addr
divider: None divider: None
on_press: root.detailedPopup()
BadgeText: BadgeText:
text: root.time_tag text: root.time_tag
halign:'right' halign:'right'
font_style:'Caption' font_style:'Caption'
AvatarSampleWidget: AvatarSampleWidget:
source: root.avatarImg source: root.avatarImg
OneLineListItem: MDLabel:
text: root.status text: root.status
divider: None
disabled: True disabled: True
font_style: 'Body2' font_style: 'Body2'
theme_text_color: 'Primary'
halign:'left' halign:'left'
MDLabel: padding_x: 20
# MDLabel:
# id: bod
# font_style: 'Subtitle2'
# theme_text_color: 'Primary'
# text: root.message
# halign: 'left'
# height: self.texture_size[1]
MyMDTextField:
id: bod id: bod
size_hint_y: None
font_style: 'Subtitle2' font_style: 'Subtitle2'
theme_text_color: 'Primary'
text: root.message text: root.message
halign: 'left' multiline: True
height: self.texture_size[1] readonly: True
line_color_normal: [0,0,0,0]
_current_line_color: [0,0,0,0]
line_color_focus: [0,0,0,0]
markup: True
font_size: '15sp'
Loader: Loader:

View File

@ -91,7 +91,7 @@
height: 4*(add_label.height) height: 4*(add_label.height)
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4) width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4)
background: './images/popup.jpeg' background: './images/popup.jpeg'
separator_height: 0 separator_height: 0
auto_dismiss: False auto_dismiss: False
BoxLayout: BoxLayout:
size_hint_y: None size_hint_y: None
@ -306,6 +306,69 @@
height: dp(40) height: dp(40)
#on_press: root.dismiss() #on_press: root.dismiss()
on_press: root.closingAction(self.children[0].text) on_press: root.closingAction(self.children[0].text)
MDLabel:
font_style: 'H6'
text: 'Cancel'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
<SenderDetailPopup>:
id: myadd_popup
size_hint : (None,None)
height: 2*(sd_label.height+ sd_btn.children[0].height)
width :app.window_size[0] - (app.window_size[0]/10 if app.app_platform == 'android' else app.window_size[0]/4)
background: './images/popup.jpeg'
auto_dismiss: False
separator_height: 0
BoxLayout:
id: myadd_popup_box
size_hint_y: None
orientation: 'vertical'
BoxLayout:
size_hint_y: None
height: 50
orientation: 'horizontal'
MDLabel:
id: sd_label
font_style: 'Body2'
theme_text_color: 'Primary'
text: "From : [b]" + root.from_addr + "[/b]"
font_size: '15sp'
halign: 'left'
markup: True
IconReftSampleWidget:
icon: 'content-copy'
on_press: root.copy_composer_text(root.from_addr)
BoxLayout:
size_hint_y: None
orientation: 'horizontal'
height: 50
MDLabel:
font_style: 'Body2'
theme_text_color: 'Primary'
text: "To : " + root.to_addr
font_size: '15sp'
halign: 'left'
IconReftSampleWidget:
icon: 'content-copy'
on_press: root.copy_composer_text(root.to_addr)
BoxLayout:
size_hint_y: None
orientation: 'vertical'
height: 50
MDLabel:
font_style: 'Body2'
theme_text_color: 'Primary'
text: "Date : " + root.time_tag
font_size: '15sp'
halign: 'left'
BoxLayout:
id: sd_btn
orientation: 'vertical'
MDRaisedButton:
on_press: root.dismiss()
pos_hint: {'x': 0.85, 'y': 0}
MDLabel: MDLabel:
font_style: 'H6' font_style: 'H6'
text: 'Cancel' text: 'Cancel'

View File

@ -1,68 +1,507 @@
<Setting>: <Setting>:
name: 'set' name: 'set'
ScrollView: MDTabs:
do_scroll_x: False id: tab_panel
MDList: tab_display_mode:'text'
id: ml
size_hint_y: None
height: dp(500)
OneLineListItem:
text: "SERVER SETTINGS"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .6, .55
height: dp(40)
MDLabel:
font_style: 'H6'
text: 'Server'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
OneLineListItem:
text: "DATA SETTINGS"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .6, .55
height: dp(40)
MDLabel:
font_style: 'H6'
text: 'Import or export data'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
OneLineListItem:
text: "OTHER SETTINGS"
BoxLayout:
AnchorLayout:
MDRaisedButton:
size_hint: .6, .55
height: dp(40)
MDLabel:
font_style: 'H6'
text: 'Restart background service'
font_size: '13sp'
color: (1,1,1,1)
halign: 'center'
BoxLayout:
AnchorLayout:
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "bitmessage is 11 seconds behind the network"
halign: 'center'
color: [0.941, 0, 0,1]
BoxLayout: Tab:
MDCheckbox: text: "User Interface"
id: chkbox ScrollView:
size_hint: None, None do_scroll_x: False
size: dp(48), dp(64) BoxLayout:
active: True size_hint_y: None
MDLabel: orientation: 'vertical'
font_style: 'Body1' height: dp(400) + self.minimum_height
theme_text_color: 'Primary' padding: 10
text: "show settings (for advanced users only)" BoxLayout:
halign: 'left' orientation: 'horizontal'
color: app.theme_cls.primary_dark MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
disabled: True
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Start-on-login not yet supported on your OS"
halign: 'left'
pos_hint: {'center_x': 0, 'center_y': 0.6}
disabled: True
BoxLayout:
size_hint_y: None
orientation: 'vertical'
padding: [20, 0, 0, 0]
spacing: dp(10)
height: dp(100) + self.minimum_height
# pos_hint: {'center_x': 0, 'center_y': 0.6}
BoxLayout:
id: box_height
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Tray"
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Start Bitmessage in the tray(don't show main window)"
halign: 'left'
pos_hint: {'x': 0, 'y': .5}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Minimize to tray"
halign: 'left'
pos_hint: {'x': 0, 'y': .5}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Close to tray"
halign: 'left'
pos_hint: {'x': 0, 'y': .5}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Hide connection notifications"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Show notification when message received"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Run in Portable Mode"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
# id: box_height
orientation: 'horizontal'
padding: 10
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: 'In portable Mode, messages and config files are stored in the same directory as the program rather then the normal application-data folder. This makes it convenient to run Bitmessage from a USB thumb drive.'
# text: 'huiiiii'
halign: 'left'
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Willingly include unencrypted destination address when sending to a mobile device"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Use identicons"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Reply below Quote"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'vertical'
spacing: 10
padding: 10
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Interface Language"
halign: 'left'
bold: True
MDDropDownItem:
id: dropdown_item
# on_select
text: 'italiano'
pos_hint: {'center_x': 0.1, 'center_y': 0}
items: [f"{i}" for i in ['System Setting','U.S. English','italiano','Esperanto','dansk','Deutsch','Pirate English','francais','Nederlands','norsk bokmal','polski','portugues europeu']]
BoxLayout:
spacing:5
orientation: 'horizontal'
pos_hint: {'x':.76}
MDRaisedButton:
text: 'Cancel'
MDRaisedButton:
text: 'Ok'
Tab:
text: 'Network Settings'
ScrollView:
do_scroll_x: False
BoxLayout:
size_hint_y: None
orientation: 'vertical'
height: dp(550) + self.minimum_height
padding: 10
BoxLayout:
id: box_height
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Listening port"
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
padding: [10, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Listen for connections on port:"
halign: 'left'
BoxLayout:
orientation: 'horizontal'
MDTextFieldRect:
size_hint: None, None
size: dp(100), dp(30)
text: '8444'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
orientation: 'horizontal'
padding_left: 10
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "UPnP"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Proxy server / Tor"
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
padding: [10, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Type:"
halign: 'left'
BoxLayout:
orientation: 'horizontal'
MDDropDownItem:
id: dropdown_item
# on_select
dropdown_bg: [1, 1, 1, 1]
text: 'none'
# pos_hint: {'left': 1}
items: [f"{i}" for i in ['System Setting','U.S. English']]
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Server hostname:"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
hint_text: 'localhost'
pos_hint: {'center_y': .5, 'center_x': .5}
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Port:"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
hint_text: '9050'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Username:"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
pos_hint: {'center_y': .5, 'center_x': .5}
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Pass:"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/4), dp(30)
pos_hint: {'center_y': .5, 'center_x': .5}
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Authentication"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Listen for incoming connections when using proxy"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDCheckbox:
id: chkbox
size_hint: None, None
size: dp(48), dp(50)
# active: True
halign: 'center'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Only connect to onion services(*.onion)"
halign: 'left'
pos_hint: {'x': 0, 'y': 0.1}
BoxLayout:
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Bandwidth limit"
halign: 'left'
bold: True
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Maximum download rate (kB/s):[0:unlimited]"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/2), dp(30)
hint_text: '0'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Maximum upload rate (kB/s):[0:unlimited]"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/2), dp(30)
hint_text: '0'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
orientation: 'horizontal'
padding: [30, 0, 0, 0]
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Maximum outbound connections:[0:none]"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(app.window_size[0]/2), dp(30)
hint_text: '8'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
BoxLayout:
spacing:5
orientation: 'horizontal'
pos_hint: {'x':.76}
MDRaisedButton:
text: 'Cancel'
MDRaisedButton:
text: 'Ok'
Tab:
text: 'Resends Expire'
ScrollView:
do_scroll_x: False
BoxLayout:
size_hint_y: None
orientation: 'vertical'
height: dp(200) + self.minimum_height
padding: 20
spacing: 10
BoxLayout:
id: box_height
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: root.exp_text
halign: 'left'
BoxLayout:
id: box_height
orientation: 'vertical'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Leave these input fields blank for the default behavior."
halign: 'left'
BoxLayout:
orientation: 'horizontal'
padding: [10, 0, 0, 0]
BoxLayout:
orientation: 'horizontal'
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "Give up after"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(70), dp(30)
text: '0'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "days and"
halign: 'left'
MDTextFieldRect:
size_hint: None, None
size: dp(70), dp(30)
text: '0'
pos_hint: {'center_y': .5, 'center_x': .5}
input_filter: "int"
MDLabel:
font_style: 'Body1'
theme_text_color: 'Primary'
text: "months"
halign: 'left'
BoxLayout:
spacing:5
orientation: 'horizontal'
# pos_hint: {'left': 0}
pos_hint: {'x':.75}
MDRaisedButton:
text: 'Cancel'
MDRaisedButton:
text: 'Ok'

View File

@ -62,6 +62,16 @@
size_hint_y: None size_hint_y: None
height: "200dp" height: "200dp"
MDIconButton:
icon: "file-image"
x: root.parent.x + dp(10)
pos_hint: {"top": 1, 'right': 1}
color: [1,0,0,1]
on_release: app.file_manager_open()
# md_bg_color: app.theme_cls.primary_color
theme_text_color: "Custom"
text_color: app.theme_cls.primary_color
BoxLayout: BoxLayout:
id: top_box id: top_box
size_hint_y: None size_hint_y: None

View File

@ -56,12 +56,15 @@ from kivymd.uix.list import (
# NavigationDrawerHeaderBase # NavigationDrawerHeaderBase
# ) # )
from kivymd.uix.selectioncontrol import MDCheckbox, MDSwitch from kivymd.uix.selectioncontrol import MDCheckbox, MDSwitch
from kivymd.uix.chip import MDChip
import queues import queues
from semaphores import kivyuisignaler from semaphores import kivyuisignaler
import state import state
from addresses import decodeAddress from addresses import decodeAddress
from kivy.uix.modalview import ModalView
from datetime import datetime
from kivy.config import Config from kivy.config import Config
Config.set('input', 'mouse', 'mouse,multitouch_on_demand') Config.set('input', 'mouse', 'mouse,multitouch_on_demand')
# pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init # pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init
@ -89,7 +92,6 @@ def showLimitedCnt(total_msg):
def ShowTimeHistoy(act_time): def ShowTimeHistoy(act_time):
"""This method is used to return the message sent or receive time""" """This method is used to return the message sent or receive time"""
from datetime import datetime
action_time = datetime.fromtimestamp(int(act_time)) action_time = datetime.fromtimestamp(int(act_time))
crnt_date = datetime.now() crnt_date = datetime.now()
duration = crnt_date - action_time duration = crnt_date - action_time
@ -111,6 +113,18 @@ def AddTimeWidget(time):
return action_time return action_time
def chipTag(text):
"""This method is used for showing chip tag"""
obj = MDChip()
obj.size_hint= (None, None)
obj.label= text
obj.icon= ''
obj.pos_hint= {'center_x': .96, 'center_y': .2}
obj.height= dp(18)
obj.radius= 8
return obj
class Inbox(Screen): class Inbox(Screen):
"""Inbox Screen uses screen to show widgets of screens""" """Inbox Screen uses screen to show widgets of screens"""
@ -735,7 +749,7 @@ class DropDownWidget(BoxLayout):
# state.draft_count) # state.draft_count)
state.detailPageType = '' state.detailPageType = ''
state.send_draft_mail = None state.send_draft_mail = None
self.parent.parent.screens[3].update_sent_messagelist() self.parent.parent.parent.ids.sc4.update_sent_messagelist()
Clock.schedule_once(self.callback_for_msgsend, 3) Clock.schedule_once(self.callback_for_msgsend, 3)
queues.workerQueue.put(('sendmessage', toAddress)) queues.workerQueue.put(('sendmessage', toAddress))
print("sqlExecute successfully #######################") print("sqlExecute successfully #######################")
@ -1068,11 +1082,13 @@ class Sent(Screen):
self.ids.ml.clear_widgets() self.ids.ml.clear_widgets()
self.loadSent() self.loadSent()
total_sent = int(state.sent_count) + 1 total_sent = int(state.sent_count) + 1
state.sent_count = str(int(state.sent_count) +1)
self.set_sentCount(total_sent) self.set_sentCount(total_sent)
else: else:
data = [] data = []
self.sentDataQuery('fromaddress', '', '', 0, 1) self.sentDataQuery('fromaddress', '', '', 0, 1)
total_sent = int(state.sent_count) + 1 total_sent = int(state.sent_count) + 1
state.sent_count = str(int(state.sent_count) +1)
self.set_sentCount(total_sent) self.set_sentCount(total_sent)
for mail in self.queryreturn: for mail in self.queryreturn:
data.append({ data.append({
@ -1119,7 +1135,7 @@ class Sent(Screen):
src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.send_cnt src_mng_obj = state.kivyapp.root.ids.content_drawer.ids.send_cnt
if state.association: if state.association:
src_mng_obj.children[0].children[0].text = showLimitedCnt(int(total_sent)) src_mng_obj.children[0].children[0].text = showLimitedCnt(int(total_sent))
state.kivyapp.get_sent_count() # state.kivyapp.get_sent_count()
else: else:
src_mng_obj.children[0].children[0].text = '0' src_mng_obj.children[0].children[0].text = '0'
@ -1250,6 +1266,7 @@ class Trash(Screen):
subject[0].upper() if (subject[0].upper() >= 'A' and subject[0].upper() <= 'Z') else '!') subject[0].upper() if (subject[0].upper() >= 'A' and subject[0].upper() <= 'Z') else '!')
meny.add_widget(AvatarSampleWidget(source=img_latter)) meny.add_widget(AvatarSampleWidget(source=img_latter))
meny.add_widget(AddTimeWidget(item[7])) meny.add_widget(AddTimeWidget(item[7]))
meny.add_widget(chipTag('inbox 'if 'inbox' in item[4] else 'sent'))
carousel = Carousel(direction='right') carousel = Carousel(direction='right')
carousel.height = meny.height carousel.height = meny.height
carousel.size_hint_y = None carousel.size_hint_y = None
@ -1354,8 +1371,10 @@ class Create(Screen):
class Setting(Screen): class Setting(Screen):
"""Setting the Screen components""" """Setting the Screen components"""
exp_text = "By default, if you send a message to someone and he is offline for more than two days, Bitmessage will\
pass send the message again after an additional two days. This will be continued with exponential backoff\
forever; messages will be resent after 5, 10, 20 days ect. until the receiver acknowledges them. Here you\
may change that behavior by having Bitmessage give up after a certain number of days or months."
class NavigateApp(MDApp): class NavigateApp(MDApp):
@ -1374,6 +1393,7 @@ class NavigateApp(MDApp):
title = "PyBitmessage" title = "PyBitmessage"
imgstatus = False imgstatus = False
count = 0 count = 0
manager_open = False
def build(self): def build(self):
"""Method builds the widget""" """Method builds the widget"""
@ -1407,7 +1427,10 @@ class NavigateApp(MDApp):
def getCurrentAccountData(self, text): def getCurrentAccountData(self, text):
"""Get Current Address Account Data""" """Get Current Address Account Data"""
self.set_identicon(text) if os.path.exists('./images/default_identicon/{}.png'.format(text)):
self.load_selected_Image(text)
else:
self.set_identicon(text)
address_label = self.current_address_label( address_label = self.current_address_label(
BMConfigParser().get(text, 'label'), text) BMConfigParser().get(text, 'label'), text)
self.root_window.children[1].ids.toolbar.title = address_label self.root_window.children[1].ids.toolbar.title = address_label
@ -1469,8 +1492,10 @@ class NavigateApp(MDApp):
img.texture.save('{1}/images/default_identicon/{0}.png'.format( img.texture.save('{1}/images/default_identicon/{0}.png'.format(
BMConfigParser().addresses()[0], android_path)) BMConfigParser().addresses()[0], android_path))
else: else:
img.texture.save('./images/default_identicon/{}.png'.format( if not os.path.exists('./images/default_identicon/{}.png'.format(
BMConfigParser().addresses()[0])) BMConfigParser().addresses()[0])):
img.texture.save('./images/default_identicon/{}.png'.format(
BMConfigParser().addresses()[0]))
return BMConfigParser().addresses()[0] return BMConfigParser().addresses()[0]
return 'Select Address' return 'Select Address'
@ -1850,6 +1875,48 @@ class NavigateApp(MDApp):
AppClosingPopup().open() AppClosingPopup().open()
return True return True
def file_manager_open(self):
"""This method open the file manager of local system"""
from kivymd.uix.filemanager import MDFileManager
from kivymd.uix.dialog import MDDialog
self.manager = ModalView(size_hint=(1, 1), auto_dismiss=False)
self.file_manager = MDFileManager(
exit_manager=self.exit_manager,
select_path=self.select_path,
previous=False,
ext=['.png', '.jpg']
)
self.manager.add_widget(self.file_manager)
self.file_manager.show(os.environ["HOME"])
self.manager_open = True
self.manager.open()
def select_path(self, path):
"""This method is used to save the select image"""
from PIL import Image as PilImage
if not os.path.exists('./images/default_identicon/'):
os.makedirs('./images/default_identicon/')
newImg = PilImage.open(path).resize((300,300))
newImg.save('./images/default_identicon/{0}.png'.format(state.association))
self.load_selected_Image(state.association)
self.exit_manager()
toast('Image changed')
def exit_manager(self, *args):
"""Called when the user reaches the root of the directory tree."""
self.manager.dismiss()
self.manager_open = False
def load_selected_Image(self, curerentAddr):
"""This method load the selected image on screen"""
top_box_obj = self.root.ids.content_drawer.ids.top_box.children[0]
spinner_img_obj = self.root.ids.content_drawer.ids.btn.children[1]
spinner_img_obj.source = top_box_obj.source ='./images/default_identicon/{0}.png'.format(curerentAddr)
top_box_obj.reload()
spinner_img_obj.reload()
class GrashofPopup(Popup): class GrashofPopup(Popup):
"""Moule for save contacts and error messages""" """Moule for save contacts and error messages"""
@ -1978,6 +2045,12 @@ class IconLeftSampleWidget(ILeftBodyTouch, MDIconButton):
pass pass
class IconReftSampleWidget(IRightBodyTouch, MDIconButton):
"""Right icon sample widget"""
pass
class IconRightSampleWidget(IRightBodyTouch, MDCheckbox): class IconRightSampleWidget(IRightBodyTouch, MDCheckbox):
"""Right icon sample widget""" """Right icon sample widget"""
@ -2031,14 +2104,15 @@ class MailDetail(Screen):
self.to_addr = data[0][0] self.to_addr = data[0][0]
self.from_addr = data[0][1] self.from_addr = data[0][1]
self.subject = subject.upper( self.subject = subject.capitalize(
) if subject.upper() else '(no subject)' ) if subject.capitalize() else '(no subject)'
self.message = body self.message = body
if len(data[0]) == 7: if len(data[0]) == 7:
self.status = data[0][4] self.status = data[0][4]
self.time_tag = ShowTimeHistoy(data[0][4]) if state.detailPageType == 'inbox' else ShowTimeHistoy(data[0][6]) self.time_tag = ShowTimeHistoy(data[0][4]) if state.detailPageType == 'inbox' else ShowTimeHistoy(data[0][6])
self.avatarImg = './images/text_images/{0}.png'.format( self.avatarImg= './images/avatar.png' if state.detailPageType == 'draft' else (
'avatar.png' if state.detailPageType == 'draft' else avatarImageFirstLetter(self.subject.strip())) './images/text_images/{0}.png'.format(avatarImageFirstLetter(self.subject.strip())))
self.timeinseconds = data[0][4] if state.detailPageType == 'inbox' else data[0][6]
def delete_mail(self): def delete_mail(self):
"""Method for mail delete""" """Method for mail delete"""
@ -2092,12 +2166,15 @@ class MailDetail(Screen):
def callback_for_delete(self, dt=0): def callback_for_delete(self, dt=0):
"""Delete method from allmails""" """Delete method from allmails"""
self.children[0].children[0].active = False try:
state.kivyapp.set_common_header() self.children[0].children[0].active = False
self.parent.current = 'allmails' \ state.kivyapp.set_common_header()
if state.is_allmail else state.detailPageType self.parent.current = 'allmails' \
state.detailPageType = '' if state.is_allmail else state.detailPageType
toast('Deleted') state.detailPageType = ''
toast('Deleted')
except Exception as e:
print("Exception occures..........")
def inbox_reply(self): def inbox_reply(self):
"""Reply inbox messages""" """Reply inbox messages"""
@ -2130,15 +2207,16 @@ class MailDetail(Screen):
self.parent.current = 'create' self.parent.current = 'create'
navApp.set_navbar_for_composer() navApp.set_navbar_for_composer()
def detailedPopup(self):
obj = SenderDetailPopup()
obj.open()
arg = (self.to_addr, self.from_addr, self.timeinseconds)
obj.assignDetail(*arg)
@staticmethod @staticmethod
def copy_composer_text(instance, *args): def callback_for_menu_items(text_item, *arg):
"""Copy the data from mail detail page""" """Callback of alert box"""
if len(instance.parent.text.split(':')) > 1: toast(text_item)
cpy_text = instance.parent.text.split(':')[1].strip()
else:
cpy_text = instance.parent.text
Clipboard.copy(cpy_text)
toast('Copied')
class MyaddDetailPopup(Popup): class MyaddDetailPopup(Popup):
@ -2543,6 +2621,7 @@ class Allmails(Screen):
meny.bind(on_press=partial( meny.bind(on_press=partial(
self.mail_detail, item[5], item[4])) self.mail_detail, item[5], item[4]))
meny.add_widget(AddTimeWidget(item[7])) meny.add_widget(AddTimeWidget(item[7]))
meny.add_widget(chipTag(item[4]))
carousel = Carousel(direction='right') carousel = Carousel(direction='right')
carousel.height = meny.height carousel.height = meny.height
carousel.size_hint_y = None carousel.size_hint_y = None
@ -2752,3 +2831,63 @@ class AppClosingPopup(Popup):
else: else:
self.dismiss() self.dismiss()
toast(text) toast(text)
class SenderDetailPopup(Popup):
"""SenderDetailPopup pop is used for showing my address detail"""
to_addr = StringProperty()
from_addr = StringProperty()
time_tag = StringProperty()
def __init__(self, **kwargs):
"""this metthod initialized the send message detial popup"""
super(SenderDetailPopup, self).__init__(**kwargs)
def assignDetail(self, to_addr, from_addr, timeinseconds):
self.to_addr = to_addr
self.from_addr = from_addr
time_obj = datetime.fromtimestamp(int(timeinseconds))
self.time_tag = time_obj.strftime("%d %b %Y, %I:%M %p")
def copy_composer_text(self, text):
"""Copy the data from mail detail page"""
Clipboard.copy(text)
toast('Copied')
class OneLineListTitle(OneLineListItem):
"""class for long press behaviour"""
__events__ = ('on_long_press', )
long_press_time = NumericProperty(1)
def on_state(self, instance, value):
if value == 'down':
lpt = self.long_press_time
self._clockev = Clock.schedule_once(self._do_long_press, lpt)
else:
self._clockev.cancel()
def _do_long_press(self, dt):
self.dispatch('on_long_press')
def on_long_press(self, *largs):
self.copymessageTitle(self.text)
def copymessageTitle(self, text):
"""this method is for displaying dialog box"""
width = .8 if platform == 'android' else .55
msg_dialog = MDDialog(
text=text,
title='', size_hint=(width, .25),
text_button_cancel='Cancel',
text_button_ok='Copy',
events_callback=self.callback_for_copy_title)
msg_dialog.open()
@staticmethod
def callback_for_copy_title(text_item, *arg):
"""Callback of alert box"""
if text_item == 'Copy':
Clipboard.copy(str(arg[0].text))
toast(text_item)