diff --git a/src/bitmessagekivy/kv/composer.kv b/src/bitmessagekivy/kv/composer.kv index 93d8d248..180412ab 100644 --- a/src/bitmessagekivy/kv/composer.kv +++ b/src/bitmessagekivy/kv/composer.kv @@ -5,7 +5,7 @@ orientation: 'vertical' size_hint_y: None height: self.minimum_height + 2 * self.parent.height/4 - padding: dp(32) + padding: dp(20) spacing: 15 BoxLayout: orientation: 'vertical' @@ -14,7 +14,7 @@ hint_text: 'type or select sender address' size_hint_y: None height: 100 - font_size: '15sp' + font_size: dp(15) multiline: False required: True helper_text_mode: "on_error" diff --git a/src/bitmessagekivy/kv/login.kv b/src/bitmessagekivy/kv/login.kv index 01900970..2548a758 100644 --- a/src/bitmessagekivy/kv/login.kv +++ b/src/bitmessagekivy/kv/login.kv @@ -5,7 +5,7 @@ BoxLayout: orientation: 'vertical' size_hint_y: None - height: dp(400) + self.minimum_height + height: dp(450) + self.minimum_height padding: dp(10) BoxLayout: MDLabel: @@ -21,6 +21,9 @@ text: root.log_text2 halign: 'left' color:app.theme_cls.primary_dark + Widget: + size_hint: (None, None) + height: dp(10) MDCheckbox: id: grp_chkbox_1 group: 'test' @@ -55,7 +58,8 @@ BoxLayout: AnchorLayout: MDRaisedButton: - height: dp(40) + size_hint: (.2, None) + # height: dp(40) on_press: app.root.ids.scr_mngr.current = 'random' on_press: app.root.ids.sc7.reset_address_label() MDLabel: @@ -87,7 +91,7 @@ font_style: 'Subtitle2' theme_text_color: 'Primary' text: "Here you may generate as many addresses as you like, Indeed creating and abandoning addresses is encouraged" - halign: 'center' + halign: 'left' color:app.theme_cls.primary_dark MDTextField: @@ -104,7 +108,8 @@ BoxLayout: AnchorLayout: MDRaisedButton: - height: dp(40) + size_hint: (.2, None) + # height: dp(40) on_release: app.root.ids.sc7.generateaddress(app) opposite_colors: True MDLabel: diff --git a/src/bitmessagekivy/kv/maildetail.kv b/src/bitmessagekivy/kv/maildetail.kv index 018818f8..4072635f 100644 --- a/src/bitmessagekivy/kv/maildetail.kv +++ b/src/bitmessagekivy/kv/maildetail.kv @@ -7,7 +7,7 @@ orientation: 'vertical' # height: dp(bod.height) + self.minimum_height height: self.minimum_height - padding: dp(20) + padding: dp(10) # MDLabel: # size_hint_y: None # id: subj @@ -36,6 +36,7 @@ halign:'right' font_style:'Caption' pos_hint: {'center_y': .8} + _txt_right_pad: dp(70) MDChip: size_hint: (None, None) label: root.page_type diff --git a/src/bitmessagekivy/kv/network.kv b/src/bitmessagekivy/kv/network.kv index 25f2bacc..c7cb9a2f 100644 --- a/src/bitmessagekivy/kv/network.kv +++ b/src/bitmessagekivy/kv/network.kv @@ -19,12 +19,18 @@ size_hint_y: None height: dp(58) MDRaisedButton: - size_hint: .5, 0 + size_hint: .6, 0 height: dp(40) - text: root.text_variable_1 + # text: root.text_variable_1 elevation_normal: 2 opposite_colors: True pos_hint: {'center_x': .5} + MDLabel: + font_style: 'H6' + text: root.text_variable_1 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' Tab: text: 'Processes' ScrollView: @@ -40,12 +46,18 @@ size_hint_y: None height: dp(58) MDRaisedButton: - size_hint: .5, 0 + size_hint: .6, 0 height: dp(40) - text: root.text_variable_2 + # text: root.text_variable_2 elevation_normal: 2 opposite_colors: True pos_hint: {'center_x': .5} + MDLabel: + font_style: 'H6' + text: root.text_variable_2 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' OneLineListItem: text: "Brodcast" BoxLayout: @@ -53,12 +65,18 @@ size_hint_y: None height: dp(58) MDRaisedButton: - size_hint: .5, 0 + size_hint: .6, 0 height: dp(40) - text: root.text_variable_3 + # text: root.text_variable_3 elevation_normal: 2 opposite_colors: True pos_hint: {'center_x': .5} + MDLabel: + font_style: 'H6' + text: root.text_variable_3 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' OneLineListItem: text: "publickeys" BoxLayout: @@ -66,12 +84,18 @@ size_hint_y: None height: dp(58) MDRaisedButton: - size_hint: .5, 0 + size_hint: .6, 0 height: dp(40) - text: root.text_variable_4 + # text: root.text_variable_4 elevation_normal: 2 opposite_colors: True pos_hint: {'center_x': .5} + MDLabel: + font_style: 'H6' + text: root.text_variable_4 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' OneLineListItem: text: "objects" BoxLayout: @@ -79,9 +103,15 @@ size_hint_y: None height: dp(58) MDRaisedButton: - size_hint: .5, 0 + size_hint: .6, 0 height: dp(40) - text: root.text_variable_5 + # text: root.text_variable_5 elevation_normal: 2 opposite_colors: True pos_hint: {'center_x': .5} + MDLabel: + font_style: 'H6' + text: root.text_variable_5 + font_size: '13sp' + color: (1,1,1,1) + halign: 'center' diff --git a/src/bitmessagekivy/kv/payment.kv b/src/bitmessagekivy/kv/payment.kv index a5cb1047..4e41cd02 100644 --- a/src/bitmessagekivy/kv/payment.kv +++ b/src/bitmessagekivy/kv/payment.kv @@ -45,7 +45,7 @@ Rectangle: pos: self.pos size: self.size - size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1 + size: app.window_size[0] - 2*self.parent.parent.padding[0] - dp(10) , 1 height: dp(40) on_press: root.get_free_credits(self) MDLabel: @@ -91,7 +91,7 @@ Rectangle: pos: self.pos size: self.size - size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1 + size: app.window_size[0] - 2*self.parent.parent.padding[0] - dp(10) , 1 height: dp(40) on_press: root.create_hidden_payment_address(self) MDLabel: @@ -137,7 +137,7 @@ Rectangle: pos: self.pos size: self.size - size: dp(app.window_size[0] - 2*self.parent.parent.padding[0]) - 10 , 1 + size: app.window_size[0] - 2*self.parent.parent.padding[0] - dp(10) , 1 height: dp(40) on_press: root.create_hidden_payment_address(self) MDLabel: diff --git a/src/bitmessagekivy/kv/popup.kv b/src/bitmessagekivy/kv/popup.kv index f35ee211..e7ee48c3 100644 --- a/src/bitmessagekivy/kv/popup.kv +++ b/src/bitmessagekivy/kv/popup.kv @@ -338,6 +338,19 @@ id: myadd_popup_box size_hint_y: None orientation: 'vertical' + spacing:dp(8 if app.app_platform == 'android' else 3) + BoxLayout: + orientation: 'vertical' + MDLabel: + id: from_add_label + font_style: 'Subtitle2' + theme_text_color: 'Primary' + text: "From :" + font_size: '15sp' + halign: 'left' + Widget: + size_hint_y: None + height: dp(1 if app.app_platform == 'android' else 0) BoxLayout: size_hint_y: None height: 50 @@ -346,13 +359,23 @@ id: sd_label font_style: 'Body2' theme_text_color: 'Primary' - text: "From : [b]" + root.from_addr + "[/b]" + text: "[b]" + root.from_addr + "[/b]" font_size: '15sp' halign: 'left' markup: True IconRightSampleWidget: icon: 'content-copy' on_press: app.copy_composer_text(root.from_addr) + Widget: + id: space_1 + size_hint_y: None + height: dp(2 if app.app_platform == 'android' else 0) + BoxLayout: + id: to_addtitle + Widget: + id:space_2 + size_hint_y: None + height: dp(1 if app.app_platform == 'android' else 0) BoxLayout: id: to_addId BoxLayout: @@ -370,7 +393,8 @@ orientation: 'vertical' MDRaisedButton: on_press: root.dismiss() - pos_hint: {'x': 0.85, 'y': 0} + size_hint: .2, 0 + pos_hint: {'x': 0.8, 'y': 0} MDLabel: font_style: 'H6' text: 'Cancel' @@ -383,9 +407,19 @@ MDLabel: font_style: 'Body2' theme_text_color: 'Primary' - text: "To : " + root.to_addr + text: root.to_addr font_size: '15sp' halign: 'left' IconRightSampleWidget: icon: 'content-copy' - on_press: app.copy_composer_text(root.to_addr) \ No newline at end of file + on_press: app.copy_composer_text(root.to_addr) + +: + orientation: 'vertical' + MDLabel: + id: to_add_label + font_style: 'Subtitle2' + theme_text_color: 'Primary' + text: "To :" + font_size: '15sp' + halign: 'left' \ No newline at end of file diff --git a/src/bitmessagekivy/kv/settings.kv b/src/bitmessagekivy/kv/settings.kv index 0ca5c4ab..05d3486b 100644 --- a/src/bitmessagekivy/kv/settings.kv +++ b/src/bitmessagekivy/kv/settings.kv @@ -11,10 +11,12 @@ BoxLayout: size_hint_y: None orientation: 'vertical' - height: dp(400) + self.minimum_height + height: dp(250) + self.minimum_height padding: 10 BoxLayout: + size_hint_y: None orientation: 'horizontal' + height: self.minimum_height MDCheckbox: id: chkbox size_hint: None, None @@ -29,23 +31,6 @@ halign: 'left' pos_hint: {'center_x': 0, 'center_y': 0.6} disabled: True - BoxLayout: - orientation: 'vertical' - padding: [0, 10, 0, 0] - spacing: 10 - MDLabel: - font_style: 'Body1' - theme_text_color: 'Primary' - text: "Interface Language" - halign: 'right' - bold: True - MDDropDownItem: - id: dropdown_item - text: 'italiano' - dropdown_max_height: 150 - dropdown_bg: [1, 1, 1, 1] - pos_hint: {'center_x': 0.8, '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: size_hint_y: None orientation: 'vertical' @@ -105,51 +90,53 @@ 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} + size_hint_y: None + orientation: 'vertical' + height: dp(100) + self.minimum_height + 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.2} + 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.2} + 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.2} 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 + orientation: 'vertical' MDLabel: font_style: 'Body1' theme_text_color: 'Primary' @@ -157,74 +144,84 @@ # 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} + size_hint_y: None + orientation: 'vertical' + height: dp(100) + self.minimum_height + 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.2} + 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.2} + 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.2} Widget: size_hint_y: None height: 10 - # 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' - # dropdown_max_height: 150 - # 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: + size_hint_y: None + orientation: 'vertical' + # padding: [0, 10, 0, 0] + spacing: 10 + padding: [20, 0, 0, 0] + height: dp(20) + self.minimum_height + MDLabel: + font_style: 'Body1' + theme_text_color: 'Primary' + text: "Interface Language" + # halign: 'right' + bold: True + MDDropDownItem: + id: dropdown_item + text: 'italiano' + dropdown_max_height: 150 + dropdown_bg: [1, 1, 1, 1] + # pos_hint: {'center_x': 0.5, '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: 'Reset' - MDRaisedButton: - text: 'Ok' + # pos_hint: {'x':.76} + BoxLayout: + orientation: 'horizontal' + # padding: [0, 10, 0, 0] + spacing: 10 + MDRaisedButton: + text: 'Reset' + MDRaisedButton: + text: 'Ok' Tab: text: 'Network Settings' ScrollView: @@ -232,7 +229,7 @@ BoxLayout: size_hint_y: None orientation: 'vertical' - height: dp(550) + self.minimum_height + height: dp(500) + self.minimum_height padding: 10 BoxLayout: id: box_height @@ -275,7 +272,7 @@ theme_text_color: 'Primary' text: "UPnP" halign: 'left' - pos_hint: {'x': 0, 'y': 0.1} + pos_hint: {'x': 0, 'y': 0} BoxLayout: orientation: 'vertical' MDLabel: @@ -301,9 +298,11 @@ pos_hint: {'x': 0.9, 'y': 0} items: [f"{i}" for i in ['System Setting','U.S. English']] BoxLayout: - orientation: 'horizontal' + size_hint_y: None + orientation: 'vertical' padding: [30, 0, 0, 0] spacing: 10 + height: dp(100) + self.minimum_height BoxLayout: orientation: 'horizontal' MDLabel: @@ -337,10 +336,6 @@ hint_text: '9050' pos_hint: {'center_y': .5, 'center_x': .5} input_filter: "int" - BoxLayout: - orientation: 'horizontal' - padding: [30, 0, 0, 0] - spacing: 10 BoxLayout: orientation: 'horizontal' MDLabel: @@ -377,7 +372,7 @@ theme_text_color: 'Primary' text: "Authentication" halign: 'left' - pos_hint: {'x': 0, 'y': 0.1} + pos_hint: {'x': 0, 'y': 0} BoxLayout: orientation: 'horizontal' padding: [30, 0, 0, 0] @@ -392,7 +387,7 @@ theme_text_color: 'Primary' text: "Listen for incoming connections when using proxy" halign: 'left' - pos_hint: {'x': 0, 'y': 0.1} + pos_hint: {'x': 0, 'y': 0} BoxLayout: orientation: 'horizontal' padding: [30, 0, 0, 0] @@ -407,7 +402,7 @@ theme_text_color: 'Primary' text: "Only connect to onion services(*.onion)" halign: 'left' - pos_hint: {'x': 0, 'y': 0.1} + pos_hint: {'x': 0, 'y': 0} BoxLayout: orientation: 'vertical' MDLabel: @@ -417,8 +412,10 @@ halign: 'left' bold: True BoxLayout: + size_hint_y: None orientation: 'horizontal' padding: [30, 0, 0, 0] + height: dp(30) + self.minimum_height MDLabel: font_style: 'Body1' theme_text_color: 'Primary' @@ -426,13 +423,15 @@ halign: 'left' MDTextFieldRect: size_hint: None, None - size: dp(app.window_size[0]/2), dp(30) + size: app.window_size[0]/2, dp(30) hint_text: '0' pos_hint: {'center_y': .5, 'center_x': .5} input_filter: "int" BoxLayout: + size_hint_y: None orientation: 'horizontal' padding: [30, 0, 0, 0] + height: dp(30) + self.minimum_height MDLabel: font_style: 'Body1' theme_text_color: 'Primary' @@ -440,13 +439,15 @@ halign: 'left' MDTextFieldRect: size_hint: None, None - size: dp(app.window_size[0]/2), dp(30) + size: app.window_size[0]/2, dp(30) hint_text: '0' pos_hint: {'center_y': .5, 'center_x': .5} input_filter: "int" BoxLayout: + size_hint_y: None orientation: 'horizontal' padding: [30, 0, 0, 0] + height: dp(30) + self.minimum_height MDLabel: font_style: 'Body1' theme_text_color: 'Primary' @@ -454,14 +455,14 @@ halign: 'left' MDTextFieldRect: size_hint: None, None - size: dp(app.window_size[0]/2), dp(30) + size: 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} + # pos_hint: {'x':.76} MDRaisedButton: text: 'Reset' MDRaisedButton: @@ -473,28 +474,34 @@ BoxLayout: size_hint_y: None orientation: 'vertical' - height: dp(200) + self.minimum_height + height: dp(210 if app.app_platform == 'android' else 100)+ self.minimum_height padding: 20 - spacing: 10 + # spacing: 10 BoxLayout: - id: box_height + # size_hint_y: None + id: box1_height orientation: 'vertical' + # height: dp(100) + self.minimum_height MDLabel: font_style: 'Body1' theme_text_color: 'Primary' text: root.exp_text halign: 'left' BoxLayout: - id: box_height + id: box2_height + size_hint_y: None orientation: 'vertical' + height: dp(30) + self.minimum_height MDLabel: font_style: 'Body1' theme_text_color: 'Primary' text: "Leave these input fields blank for the default behavior." halign: 'left' BoxLayout: - orientation: 'horizontal' + size_hint_y: None + orientation: 'vertical' padding: [10, 0, 0, 0] + height: dp(50) + self.minimum_height BoxLayout: orientation: 'horizontal' MDLabel: @@ -525,10 +532,12 @@ text: "months" halign: 'left' BoxLayout: + size_hint_y: None spacing:5 orientation: 'horizontal' # pos_hint: {'left': 0} - pos_hint: {'x':.75} + # pos_hint: {'x':.75} + height: dp(50) + self.minimum_height MDRaisedButton: text: 'Reset' MDRaisedButton: diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 8a71dffa..dba77d71 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -98,7 +98,8 @@ text: "Accounts" height:"35dp" NavigationItem: - size: 50,50 + # size: 50,50 + height: dp(48) CustomSpinner: id: btn pos_hint:{"x":0,"y":0} @@ -301,7 +302,7 @@ NavigationLayout: orientation: 'vertical' size_hint: (None, None) pos_hint:{'center_x': .5, 'top': 0.9} - size: (app.window_size[0]/2, app.window_size[0]/2) + size: (app.window_size[0]/1.8, app.window_size[0]/1.8) id: qr BoxLayout: orientation: 'vertical' @@ -315,9 +316,9 @@ NavigationLayout: line_color_normal: [0,0,0,0] _current_line_color: [0,0,0,0] line_color_focus: [0,0,0,0] - font_size: '18sp' + halign: 'center' + font_size: dp(15) bold: True - pos_hint: {'x': .26, 'y': 0.5} # MDLabel: # size_hint_y: None # font_style: 'Body1' diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index 69c115ac..1b3a2b01 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -70,8 +70,10 @@ import state from addresses import decodeAddress from kivy.uix.modalview import ModalView from datetime import datetime -from kivy.config import Config -Config.set('input', 'mouse', 'mouse,multitouch_on_demand') + +if platform != 'android': + from kivy.config import Config + Config.set('input', 'mouse', 'mouse,multitouch_on_demand') # pylint: disable=too-few-public-methods,too-many-arguments,attribute-defined-outside-init KVFILES = [ @@ -219,6 +221,7 @@ class Inbox(Screen): text=item['text'], secondary_text=item['secondary_text'], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + meny._txt_right_pad=dp(70) meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item['secondary_text'].strip())))) @@ -404,6 +407,7 @@ class MyAddress(Screen): text=item['text'], secondary_text=item['secondary_text'], theme_text_color='Custom' if is_enable == 'true' else 'Primary', text_color=NavigateApp().theme_cls.primary_color,) + meny._txt_right_pad=dp(70) try: meny.canvas.children[6].rgba = [0, 0, 0, 0] if is_enable == 'true' else [0.5, 0.5, 0.5, 0.5] except Exception: @@ -414,13 +418,15 @@ class MyAddress(Screen): meny.bind(on_press=partial( self.myadd_detail, item['secondary_text'], item['text'])) if state.association == item['secondary_text']: - meny.add_widget( - BadgeText( + badge_obj = BadgeText( size_hint=(None, None), text='Active', halign='right', + # font_size = '50sp', font_style='Body1', size=[50, 60], theme_text_color='Custom', - text_color=NavigateApp().theme_cls.primary_color)) + text_color=NavigateApp().theme_cls.primary_color) + badge_obj.font_size = '13sp' + meny.add_widget(badge_obj) else: meny.add_widget(ToggleBtn(active=True if is_enable == 'true' else False)) # carousel = Carousel(direction='right') @@ -1137,6 +1143,7 @@ class Sent(Screen): text=item['text'], secondary_text=item['secondary_text'], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + meny._txt_right_pad=dp(70) meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(item['secondary_text'].strip())))) @@ -1355,6 +1362,7 @@ class Trash(Screen): subject) >= 50 else (subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''), theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + meny._txt_right_pad=dp(70) img_latter = './images/text_images/{}.png'.format( subject[0].upper() if (subject[0].upper() >= 'A' and subject[0].upper() <= 'Z') else '!') meny.add_widget(AvatarSampleWidget(source=img_latter)) @@ -1587,10 +1595,12 @@ class NavigateApp(MDApp): if platform == 'android': # android_path = os.path.expanduser # ("~/user/0/org.test.bitapp/files/app/") - android_path = os.path.join( - os.environ['ANDROID_PRIVATE'] + '/app/') - img.texture.save('{1}/images/default_identicon/{0}.png'.format( - BMConfigParser().addresses()[0], android_path)) + if not os.path.exists('./images/default_identicon/{}.png'.format( + BMConfigParser().addresses()[0])): + android_path = os.path.join( + os.environ['ANDROID_PRIVATE'] + '/app/') + img.texture.save('{1}/images/default_identicon/{0}.png'.format( + BMConfigParser().addresses()[0], android_path)) else: if not os.path.exists('./images/default_identicon/{}.png'.format( BMConfigParser().addresses()[0])): @@ -2018,29 +2028,56 @@ class NavigateApp(MDApp): self.manager = ModalView(size_hint=(1, 1), auto_dismiss=False) self.file_manager = MDFileManager( exit_manager=self.exit_manager, - select_path=self.select_path, + 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.file_manager.show(os.environ["HOME"]) + if platform == 'android': + from android.permissions import request_permissions, Permission + request_permissions([Permission.WRITE_EXTERNAL_STORAGE, Permission.READ_EXTERNAL_STORAGE]) + + # from android.storage import app_storage_path + # settings_path = app_storage_path() + # print('path1................................', settings_path) + + # from android.storage import primary_external_storage_path + # primary_ext_storage = primary_external_storage_path() + # print('path1................................', primary_ext_storage) + + # from android.storage import secondary_external_storage_path + # secondary_ext_storage = secondary_external_storage_path() + # print('path1................................', secondary_ext_storage) + + # from kivy.app import user_data_dir + # from os.path import dirname, join + # out = join(dirname(user_data_dir), 'DCIM') + # DCIM = join('/sdcard', 'DCIM') + self.file_manager.show(os.getenv('EXTERNAL_STORAGE') if platform == 'android' else os.environ["HOME"]) + # self.file_manager.show(os.getenv('EXTERNAL_STORAGE')) 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)) + if platform == 'android': + android_path = os.path.join( + os.environ['ANDROID_PRIVATE'] + '/app/') + newImg.save('{1}/images/default_identicon/{0}.png'.format( + state.association, android_path)) + else: + if not os.path.exists('./images/default_identicon/'): + os.makedirs('./images/default_identicon/') + 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 @@ -2577,6 +2614,7 @@ class Draft(Screen): text='Draft', secondary_text=item['text'], theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + meny._txt_right_pad=dp(70) meny.add_widget(AvatarSampleWidget( source='./images/avatar.png')) meny.bind(on_press=partial( @@ -2779,6 +2817,7 @@ class Allmails(Screen): subject + ',' + body)[0:50] + '........').replace('\t', '').replace(' ', ''), theme_text_color='Custom', text_color=NavigateApp().theme_cls.primary_color) + meny._txt_right_pad=dp(70) meny.add_widget(AvatarSampleWidget( source='./images/text_images/{}.png'.format( avatarImageFirstLetter(body.strip())))) @@ -3016,18 +3055,23 @@ class SenderDetailPopup(Popup): self.from_addr = from_addr time_obj = datetime.fromtimestamp(int(timeinseconds)) self.time_tag = time_obj.strftime("%d %b %Y, %I:%M %p") - pop_height = 1.2 * (self.ids.sd_label.height + self.ids.sd_btn.children[0].height) + device_type = 2 if platform == 'android' else 1.5 + pop_height = device_type * (self.ids.sd_label.height + self.ids.sd_btn.children[0].height) if len(to_addr) > 3: self.height = 0 self.height = pop_height self.ids.to_addId.size_hint_y = None self.ids.to_addId.height = 50 + self.ids.to_addtitle.add_widget(ToAddressTitle()) frmaddbox = ToAddrBoxlayout() frmaddbox.set_toAddress(to_addr) self.ids.to_addId.add_widget(frmaddbox) else: + self.ids.space_1.height = dp(0) + self.ids.space_2.height = dp(0) + self.ids.myadd_popup_box.spacing = dp(8 if platform == 'android' else 3) self.height = 0 - self.height = pop_height / 1.5 + self.height = pop_height / 1.2 class OneLineListTitle(OneLineListItem): @@ -3079,6 +3123,11 @@ class ToAddrBoxlayout(BoxLayout): self.to_addr = to_addr +class ToAddressTitle(BoxLayout): + """class for BoxLayout behaviour""" + pass + + class RandomBoxlayout(BoxLayout): """class for BoxLayout behaviour""" pass diff --git a/src/bitmessageqt/newaddresswizard.py b/src/bitmessageqt/newaddresswizard.py index 2311239c..2ecae305 100644 --- a/src/bitmessageqt/newaddresswizard.py +++ b/src/bitmessageqt/newaddresswizard.py @@ -234,7 +234,7 @@ class NewAddressWizardWaitPage(QtGui.QWizardPage): self.wizard().button(QtGui.QWizard.NextButton).click() return elif i == 101: - print "haha" + print("haha") return self.progressBar.setValue(i) if i == 50: @@ -347,8 +347,8 @@ if __name__ == '__main__': wizard = Ui_NewAddressWizard(["a", "b", "c", "d"]) if (wizard.exec_()): - print "Email: " + ("yes" if wizard.field("emailAsWell").toBool() else "no") - print "BM: " + ("yes" if wizard.field("onlyBM").toBool() else "no") + print("Email: " + ("yes" if wizard.field("emailAsWell").toBool() else "no")) + print("BM: " + ("yes" if wizard.field("onlyBM").toBool() else "no")) else: - print "Wizard cancelled" + print("Wizard cancelled") sys.exit() diff --git a/src/buildozer.spec b/src/buildozer.spec index 0dfeb191..3c4c0180 100644 --- a/src/buildozer.spec +++ b/src/buildozer.spec @@ -1,10 +1,10 @@ [app] # (str) Title of your application -title = bitapp +title = py3 # (str) Package name -package.name = bitapp +package.name = py3 # (str) Package domain (needed for android/ios packaging) package.domain = org.test @@ -37,12 +37,13 @@ version = 0.1 # (list) Application requirements # comma separated e.g. requirements = sqlite3,kivy requirements = + python3, openssl, sqlite3, - python2, kivy, - bitmsghash, - kivymd, + bitmsghash, + #git+https://github.com/surbhicis/KivyMD-1.git, + git+https://github.com/surbhicis/KivyMD-1#egg=kivymd, kivy-garden, qrcode, Pillow, @@ -206,7 +207,7 @@ android.arch = armeabi-v7a # # (str) python-for-android git clone directory (if empty, it will be automatically cloned from github) -#p4a.source_dir = +p4a.source_dir = /home/cis/Music/androidp4a/python-for-android # (str) The directory in which python-for-android should look for your own build recipes (if any) p4a.local_recipes = /home/cis/navjotrepo/PyBitmessage/src/bitmessagekivy/android/python-for-android/recipes/ diff --git a/src/class_sqlThread.py b/src/class_sqlThread.py index 9355391a..82bd79b4 100644 --- a/src/class_sqlThread.py +++ b/src/class_sqlThread.py @@ -390,7 +390,9 @@ class sqlThread(threading.Thread): logger.debug( 'In messages.dat database, done adding address field to the pubkeys table' ' and removing the hash field.') - self.cur.execute('''update settings set value=10 WHERE key='version';''') + query = '''update settings set value=? WHERE key='version';''' + parameters = (10,) + self.cur.execute(query, parameters) # Add a new table: chat and chatdata for storing chating conversation item = '''SELECT value FROM settings WHERE key='version';''' @@ -398,11 +400,10 @@ class sqlThread(threading.Thread): self.cur.execute(item, parameters) currentVersion = int(self.cur.fetchall()[0][0]) if currentVersion == 10: - self.cur.execute('''DROP TABLE chat''') self.cur.execute( '''CREATE TABLE chat''' ''' (msgid blob, senderaddress text, receiveraddress text, message text,''' - ''' senttime text, receivedtime text, image blob, audio blob, reference blob,''' + ''' receivedtime text, image blob, audio blob, reference blob,''' ''' UNIQUE(msgid) ON CONFLICT REPLACE)''') item = '''update settings set value=? WHERE key='version';''' parameters = (11,) diff --git a/src/namecoin.py b/src/namecoin.py index ae2bde79..c6afdb24 100644 --- a/src/namecoin.py +++ b/src/namecoin.py @@ -174,7 +174,7 @@ class namecoinConnection(object): message = ('failed', tr._translate("MainWindow", 'Couldn\'t understand NMControl.')) else: - print "Unsupported Namecoin type" + print("Unsupported Namecoin type") sys.exit(1) return message diff --git a/src/network/http.py b/src/network/http.py index 4a21b63e..9fe85255 100644 --- a/src/network/http.py +++ b/src/network/http.py @@ -19,19 +19,19 @@ class HttpConnection(AdvancedDispatcher): self.destination = (host, 80) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect(self.destination) - print "connecting in background to %s:%i" % (self.destination[0], self.destination[1]) + print("connecting in background to %s:%i" % (self.destination[0], self.destination[1])) def state_init(self): self.append_write_buf( "GET %s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n" % ( self.path, self.destination[0])) - print "Sending %ib" % (len(self.write_buf)) + print("Sending %ib" % (len(self.write_buf))) self.set_state("http_request_sent", 0) return False def state_http_request_sent(self): if self.read_buf: - print "Received %ib" % (len(self.read_buf)) + print("Received %ib" % (len(self.read_buf))) self.read_buf = b"" if not self.connected: self.set_state("close", 0) @@ -63,13 +63,13 @@ if __name__ == "__main__": for host in ("bootstrap8080.bitmessage.org", "bootstrap8444.bitmessage.org"): proxy = Socks5Resolver(host=host) while asyncore.socket_map: - print "loop %s, len %i" % (proxy.state, len(asyncore.socket_map)) + print("loop %s, len %i" % (proxy.state, len(asyncore.socket_map))) asyncore.loop(timeout=1, count=1) proxy.resolved() proxy = Socks4aResolver(host=host) while asyncore.socket_map: - print "loop %s, len %i" % (proxy.state, len(asyncore.socket_map)) + print("loop %s, len %i" % (proxy.state, len(asyncore.socket_map))) asyncore.loop(timeout=1, count=1) proxy.resolved() diff --git a/src/network/http_old.py b/src/network/http_old.py index c46a5d09..68d8b29b 100644 --- a/src/network/http_old.py +++ b/src/network/http_old.py @@ -49,7 +49,7 @@ if __name__ == "__main__": if len(asyncore.socket_map) < parallel: for i in range(parallel - len(asyncore.socket_map)): HTTPClient('127.0.0.1', '/') - print "Active connections: %i" % (len(asyncore.socket_map)) + print("Active connections: %i" % (len(asyncore.socket_map))) asyncore.loop(count=len(asyncore.socket_map) / 2) if requestCount % 100 == 0: - print "Processed %i total messages" % (requestCount) + print("Processed %i total messages" % (requestCount))