commenting methods and adding pass in mpybit
This commit is contained in:
parent
ec77ea9fa6
commit
5a7c601e8b
|
@ -1,6 +1,6 @@
|
||||||
from pybitmessage.get_platform import platform
|
from pybitmessage.get_platform import platform
|
||||||
from functools import partial
|
from functools import partial
|
||||||
from bmconfigparser import BMConfigParser
|
from pybitmessage.bmconfigparser import BMConfigParser
|
||||||
from kivy.clock import Clock
|
from kivy.clock import Clock
|
||||||
# from kivy.metrics import dp
|
# from kivy.metrics import dp
|
||||||
from kivy.properties import (
|
from kivy.properties import (
|
||||||
|
@ -17,7 +17,7 @@ from kivymd.uix.list import (
|
||||||
from kivymd.uix.selectioncontrol import MDSwitch
|
from kivymd.uix.selectioncontrol import MDSwitch
|
||||||
from kivy.uix.screenmanager import Screen
|
from kivy.uix.screenmanager import Screen
|
||||||
|
|
||||||
import state
|
from pybitmessage import state
|
||||||
|
|
||||||
from pybitmessage.baseclass.common import (
|
from pybitmessage.baseclass.common import (
|
||||||
avatarImageFirstLetter, AvatarSampleWidget, ThemeClsColor,
|
avatarImageFirstLetter, AvatarSampleWidget, ThemeClsColor,
|
||||||
|
|
|
@ -1,40 +1,41 @@
|
||||||
from pybitmessage import state
|
# from pybitmessage import state
|
||||||
|
|
||||||
from kivy.clock import Clock
|
# from kivy.clock import Clock
|
||||||
from kivy.properties import StringProperty
|
# from kivy.properties import StringProperty
|
||||||
from kivy.uix.screenmanager import Screen
|
from kivy.uix.screenmanager import Screen
|
||||||
|
|
||||||
from pybitmessage.network import objectracker, stats
|
# from pybitmessage.network import objectracker, stats
|
||||||
|
|
||||||
|
|
||||||
class NetworkStat(Screen):
|
class NetworkStat(Screen):
|
||||||
"""NetworkStat class for kivy Ui"""
|
"""NetworkStat class for kivy Ui"""
|
||||||
|
|
||||||
text_variable_1 = StringProperty(
|
# text_variable_1 = StringProperty(
|
||||||
'{0}::{1}'.format('Total Connections', '0'))
|
# '{0}::{1}'.format('Total Connections', '0'))
|
||||||
text_variable_2 = StringProperty(
|
# text_variable_2 = StringProperty(
|
||||||
'Processed {0} per-to-per messages'.format('0'))
|
# 'Processed {0} per-to-per messages'.format('0'))
|
||||||
text_variable_3 = StringProperty(
|
# text_variable_3 = StringProperty(
|
||||||
'Processed {0} brodcast messages'.format('0'))
|
# 'Processed {0} brodcast messages'.format('0'))
|
||||||
text_variable_4 = StringProperty(
|
# text_variable_4 = StringProperty(
|
||||||
'Processed {0} public keys'.format('0'))
|
# 'Processed {0} public keys'.format('0'))
|
||||||
text_variable_5 = StringProperty(
|
# text_variable_5 = StringProperty(
|
||||||
'Processed {0} object to be synced'.format('0'))
|
# 'Processed {0} object to be synced'.format('0'))
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
# def __init__(self, *args, **kwargs):
|
||||||
"""Init method for network stat"""
|
# """Init method for network stat"""
|
||||||
super(NetworkStat, self).__init__(*args, **kwargs)
|
# super(NetworkStat, self).__init__(*args, **kwargs)
|
||||||
Clock.schedule_interval(self.init_ui, 1)
|
# Clock.schedule_interval(self.init_ui, 1)
|
||||||
|
|
||||||
def init_ui(self, dt=0):
|
# def init_ui(self, dt=0):
|
||||||
"""Clock Schdule for method networkstat screen"""
|
# """Clock Schdule for method networkstat screen"""
|
||||||
self.text_variable_1 = '{0} :: {1}'.format(
|
# self.text_variable_1 = '{0} :: {1}'.format(
|
||||||
'Total Connections', str(len(stats.connectedHostsList())))
|
# 'Total Connections', str(len(stats.connectedHostsList())))
|
||||||
self.text_variable_2 = 'Processed {0} per-to-per messages'.format(
|
# self.text_variable_2 = 'Processed {0} per-to-per messages'.format(
|
||||||
str(state.numberOfMessagesProcessed))
|
# str(state.numberOfMessagesProcessed))
|
||||||
self.text_variable_3 = 'Processed {0} brodcast messages'.format(
|
# self.text_variable_3 = 'Processed {0} brodcast messages'.format(
|
||||||
str(state.numberOfBroadcastsProcessed))
|
# str(state.numberOfBroadcastsProcessed))
|
||||||
self.text_variable_4 = 'Processed {0} public keys'.format(
|
# self.text_variable_4 = 'Processed {0} public keys'.format(
|
||||||
str(state.numberOfPubkeysProcessed))
|
# str(state.numberOfPubkeysProcessed))
|
||||||
self.text_variable_5 = '{0} object to be synced'.format(
|
# self.text_variable_5 = '{0} object to be synced'.format(
|
||||||
len(objectracker.missingObjects))
|
# len(objectracker.missingObjects))
|
||||||
|
pass
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
Bitmessage android(mobile) interface
|
Bitmessage android(mobile) interface
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from pybitmessage.get_platform import platform
|
# from pybitmessage.get_platform import platform
|
||||||
|
platform = 'linux'
|
||||||
import os
|
import os
|
||||||
# from pybitmessage import identiconGeneration
|
# from pybitmessage import identiconGeneration
|
||||||
from pybitmessage import kivy_helper_search
|
from pybitmessage import kivy_helper_search
|
||||||
|
@ -61,32 +62,32 @@ from pybitmessage.baseclass.common import toast
|
||||||
# from qr_scanner.zbarcam import ZBarCam
|
# from qr_scanner.zbarcam import ZBarCam
|
||||||
# from pyzbar.pyzbar import ZBarSymbol
|
# from pyzbar.pyzbar import ZBarSymbol
|
||||||
|
|
||||||
if platform != "android":
|
# if platform != "android":
|
||||||
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")
|
||||||
elif platform == "android":
|
# elif platform == "android":
|
||||||
from jnius import autoclass, cast
|
# from jnius import autoclass, cast
|
||||||
from android.runnable import run_on_ui_thread
|
# from android.runnable import run_on_ui_thread
|
||||||
from android import python_act as PythonActivity
|
# from android import python_act as PythonActivity
|
||||||
|
|
||||||
Toast = autoclass("android.widget.Toast")
|
# Toast = autoclass("android.widget.Toast")
|
||||||
String = autoclass("java.lang.String")
|
# String = autoclass("java.lang.String")
|
||||||
CharSequence = autoclass("java.lang.CharSequence")
|
# CharSequence = autoclass("java.lang.CharSequence")
|
||||||
context = PythonActivity.mActivity
|
# context = PythonActivity.mActivity
|
||||||
|
|
||||||
@run_on_ui_thread
|
# @run_on_ui_thread
|
||||||
def show_toast(text, length):
|
# def show_toast(text, length):
|
||||||
"""Its showing toast on screen"""
|
# """Its showing toast on screen"""
|
||||||
t = Toast.makeText(context, text, length)
|
# t = Toast.makeText(context, text, length)
|
||||||
t.show()
|
# t.show()
|
||||||
|
|
||||||
|
|
||||||
with open(os.path.join(os.path.dirname(__file__), "screens_data.json")) as read_file:
|
with open(os.path.join(os.path.dirname(__file__), "screens_data.json")) as read_file:
|
||||||
all_data = ast.literal_eval(read_file.read())
|
all_data = ast.literal_eval(read_file.read())
|
||||||
data_screens = list(all_data.keys())
|
data_screens = list(all_data.keys())
|
||||||
|
|
||||||
for modules in data_screens:
|
# for modules in data_screens:
|
||||||
exec(all_data[modules]['Import'])
|
# exec(all_data[modules]['Import'])
|
||||||
|
|
||||||
# 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
|
||||||
|
|
||||||
|
@ -217,7 +218,7 @@ class NavigateApp(MDApp):
|
||||||
nav_drawer = ObjectProperty()
|
nav_drawer = ObjectProperty()
|
||||||
state.screen_density = Window.size
|
state.screen_density = Window.size
|
||||||
window_size = state.screen_density
|
window_size = state.screen_density
|
||||||
app_platform = platform
|
app_platform = 'linux'
|
||||||
title = "PyBitmessage"
|
title = "PyBitmessage"
|
||||||
imgstatus = False
|
imgstatus = False
|
||||||
count = 0
|
count = 0
|
||||||
|
@ -239,15 +240,15 @@ class NavigateApp(MDApp):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
print('{0}.kv'.format(all_data[kv]["kv_string"]))
|
print('{0}.kv'.format(all_data[kv]["kv_string"]))
|
||||||
# import pdb; pdb.set_trace()
|
import pdb; pdb.set_trace()
|
||||||
# self.obj_1 = AddressBook()
|
self.obj_1 = AddressBook()
|
||||||
kivysignalthread = UIkivySignaler()
|
kivysignalthread = UIkivySignaler()
|
||||||
kivysignalthread.daemon = True
|
kivysignalthread.daemon = True
|
||||||
kivysignalthread.start()
|
kivysignalthread.start()
|
||||||
Window.bind(on_keyboard=self.on_key, on_request_close=self.on_request_close)
|
Window.bind(on_keyboard=self.on_key, on_request_close=self.on_request_close)
|
||||||
return Builder.load_file(
|
# return Builder.load_file(
|
||||||
os.path.join(os.path.dirname(__file__), 'main.kv'))
|
# os.path.join(os.path.dirname(__file__), 'main.kv'))
|
||||||
# return Builder.load_file('/home/cis/Bitmessagepeter/KivyPoject/PyBitmessage/src/tests/mock/pybitmessage/main.kv')
|
return Builder.load_file('/home/cis/Bitmessagepeter/KivyPoject/PyBitmessage/src/tests/mock/pybitmessage/main.kv')
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
|
@ -725,24 +726,24 @@ class NavigateApp(MDApp):
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def current_address_label(current_add_label=None, current_addr=None):
|
def current_address_label(current_add_label=None, current_addr=None):
|
||||||
"""Getting current address labels"""
|
"""Getting current address labels"""
|
||||||
addresses = [addr for addr in BMConfigParser().addresses()
|
# addresses = [addr for addr in BMConfigParser().addresses()
|
||||||
if BMConfigParser().get(str(addr), 'enabled') == 'true']
|
# if BMConfigParser().get(str(addr), 'enabled') == 'true']
|
||||||
if addresses:
|
# if addresses:
|
||||||
if current_add_label:
|
# if current_add_label:
|
||||||
first_name = current_add_label
|
# first_name = current_add_label
|
||||||
addr = current_addr
|
# addr = current_addr
|
||||||
else:
|
# else:
|
||||||
addr = addresses[0]
|
# addr = addresses[0]
|
||||||
first_name = BMConfigParser().get(addr, 'label')
|
# first_name = BMConfigParser().get(addr, 'label')
|
||||||
if BMConfigParser().get(addr, 'enabled') != 'true':
|
# if BMConfigParser().get(addr, 'enabled') != 'true':
|
||||||
return ''
|
# return ''
|
||||||
f_name = first_name.split()
|
# f_name = first_name.split()
|
||||||
label = f_name[0][:14].capitalize() + '...' if len(
|
# label = f_name[0][:14].capitalize() + '...' if len(
|
||||||
f_name[0]) > 15 else f_name[0].capitalize()
|
# f_name[0]) > 15 else f_name[0].capitalize()
|
||||||
address = ' (' + addr + ')'
|
# address = ' (' + addr + ')'
|
||||||
return label + address
|
# return label + address
|
||||||
return ''
|
# return ''
|
||||||
|
|
||||||
def searchQuery(self, instance):
|
def searchQuery(self, instance):
|
||||||
# """Showing searched mails"""
|
# """Showing searched mails"""
|
||||||
# state.search_screen = self.root.ids.scr_mngr.current
|
# state.search_screen = self.root.ids.scr_mngr.current
|
||||||
|
@ -842,48 +843,47 @@ class NavigateApp(MDApp):
|
||||||
# toolbar_obj.right_action_items = dynamic_list
|
# toolbar_obj.right_action_items = dynamic_list
|
||||||
pass
|
pass
|
||||||
def load_screen(self, instance):
|
def load_screen(self, instance):
|
||||||
# """This method is used for loading screen on every click"""
|
"""This method is used for loading screen on every click"""
|
||||||
# if instance.text == 'Inbox':
|
if instance.text == 'Inbox':
|
||||||
# self.root.ids.scr_mngr.current = 'inbox'
|
self.root.ids.scr_mngr.current = 'inbox'
|
||||||
# self.root.ids.sc1.children[1].active = True
|
self.root.ids.sc1.children[1].active = True
|
||||||
# elif instance.text == 'All Mails':
|
elif instance.text == 'All Mails':
|
||||||
# self.root.ids.scr_mngr.current = 'allmails'
|
self.root.ids.scr_mngr.current = 'allmails'
|
||||||
# try:
|
try:
|
||||||
# self.root.ids.sc17.children[1].active = True
|
self.root.ids.sc17.children[1].active = True
|
||||||
# except Exception:
|
except Exception:
|
||||||
# self.root.ids.sc17.children[0].children[1].active = True
|
self.root.ids.sc17.children[0].children[1].active = True
|
||||||
# elif instance.text == 'Trash':
|
elif instance.text == 'Trash':
|
||||||
# self.root.ids.scr_mngr.current = 'trash'
|
self.root.ids.scr_mngr.current = 'trash'
|
||||||
# try:
|
try:
|
||||||
# self.root.ids.sc5.children[1].active = True
|
self.root.ids.sc5.children[1].active = True
|
||||||
# except Exception as e:
|
except Exception as e:
|
||||||
# self.root.ids.sc5.children[0].children[1].active = True
|
self.root.ids.sc5.children[0].children[1].active = True
|
||||||
# Clock.schedule_once(partial(self.load_screen_callback, instance), 1)
|
Clock.schedule_once(partial(self.load_screen_callback, instance), 1)
|
||||||
pass
|
|
||||||
|
|
||||||
def load_screen_callback(self, instance, dt=0):
|
def load_screen_callback(self, instance, dt=0):
|
||||||
# """This method is rotating loader for few seconds"""
|
"""This method is rotating loader for few seconds"""
|
||||||
# if instance.text == 'Inbox':
|
if instance.text == 'Inbox':
|
||||||
# self.root.ids.sc1.ids.ml.clear_widgets()
|
self.root.ids.sc1.ids.ml.clear_widgets()
|
||||||
# self.root.ids.sc1.loadMessagelist(state.association)
|
self.root.ids.sc1.loadMessagelist(state.association)
|
||||||
# self.root.ids.sc1.children[1].active = False
|
self.root.ids.sc1.children[1].active = False
|
||||||
# elif instance.text == 'All Mails':
|
elif instance.text == 'All Mails':
|
||||||
# self.root.ids.sc17.clear_widgets()
|
self.root.ids.sc17.clear_widgets()
|
||||||
# self.root.ids.sc17.add_widget(Allmails())
|
self.root.ids.sc17.add_widget(Allmails())
|
||||||
# try:
|
try:
|
||||||
# self.root.ids.sc17.children[1].active = False
|
self.root.ids.sc17.children[1].active = False
|
||||||
# except Exception:
|
except Exception:
|
||||||
# self.root.ids.sc17.children[0].children[1].active = False
|
self.root.ids.sc17.children[0].children[1].active = False
|
||||||
# elif instance.text == 'Trash':
|
elif instance.text == 'Trash':
|
||||||
# # self.root.ids.sc5.ids.ml.clear_widgets()
|
# self.root.ids.sc5.ids.ml.clear_widgets()
|
||||||
# # self.root.ids.sc5.init_ui(0)
|
# self.root.ids.sc5.init_ui(0)
|
||||||
# self.root.ids.sc5.clear_widgets()
|
self.root.ids.sc5.clear_widgets()
|
||||||
# self.root.ids.sc5.add_widget(Trash())
|
self.root.ids.sc5.add_widget(Trash())
|
||||||
# try:
|
try:
|
||||||
# self.root.ids.sc5.children[1].active = False
|
self.root.ids.sc5.children[1].active = False
|
||||||
# except Exception as e:
|
except Exception as e:
|
||||||
# self.root.ids.sc5.children[0].children[1].active = False
|
self.root.ids.sc5.children[0].children[1].active = False
|
||||||
pass
|
|
||||||
def on_request_close(self, *args): # pylint: disable=no-self-use
|
def on_request_close(self, *args): # pylint: disable=no-self-use
|
||||||
"""This method is for app closing request"""
|
"""This method is for app closing request"""
|
||||||
AppClosingPopup().open()
|
AppClosingPopup().open()
|
||||||
|
|
Reference in New Issue
Block a user