diff --git a/desktop/icons/24x24/pybitmessage.png b/desktop/icons/24x24/pybitmessage.png new file mode 100644 index 00000000..30f7313e Binary files /dev/null and b/desktop/icons/24x24/pybitmessage.png differ diff --git a/desktop/icons/scalable/pybitmessage.svg b/desktop/icons/scalable/pybitmessage.svg new file mode 100644 index 00000000..7c854e34 --- /dev/null +++ b/desktop/icons/scalable/pybitmessage.svg @@ -0,0 +1,149 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/keys.dat b/keys.dat new file mode 100644 index 00000000..2ce6148b --- /dev/null +++ b/keys.dat @@ -0,0 +1,6 @@ +[BM-2cUgQGcTLWAkC6dNsv2Bc8XB3Y1GEesVLV] +label = sad +enabled = true +privsigningkey = 5KWXwYq1oJMzghUSJaJoWPn8VdeBbhDN8zFot1cBd6ezKKReqBd +privencryptionkey = 5JaeFJs8iPcQT3N8676r3gHKvJ5mTWXy1VLhGCEDqRs4vpvpxV8 + diff --git a/src/bitmessagekivy/main.kv b/src/bitmessagekivy/main.kv index 1c921a8d..c487b22f 100644 --- a/src/bitmessagekivy/main.kv +++ b/src/bitmessagekivy/main.kv @@ -216,8 +216,52 @@ MDNavigationLayout: id: scr_mngr size_hint_y: None height: root.height - toolbar.height + # Inbox: + # id:sc1 +# # Page: +# # id:sc2 + # Create: + # id:sc3 + # Sent: + # id:sc4 + # Trash: + # id:sc5 + Login: + id:sc6 + Random: + id:sc7 + # Spam: + # id:sc8 + # Setting: + # id:sc9 + MyAddress: + id:sc10 + # AddressBook: + # id:sc11 + # Payment: + # id:sc12 NetworkStat: id:sc13 + # MailDetail: + # id:sc14 + ShowQRCode: + id:sc15 + Draft: + id:sc16 + Allmails: + id:sc17 + # Credits: + # id:sc18 + # Starred: + # id:sc19 + # Archieve: + # id:sc20 + # ChatRoom: + # id:sc21 + # ChatList: + # id:sc22 + ScanScreen: + id:sc23 MDNavigationDrawer: id: nav_drawer diff --git a/src/bitmessagekivy/mpybit.py b/src/bitmessagekivy/mpybit.py index f826123a..9789cc1e 100644 --- a/src/bitmessagekivy/mpybit.py +++ b/src/bitmessagekivy/mpybit.py @@ -9,7 +9,7 @@ Bitmessage android(mobile) interface """ -from pybitmessage.bitmessagekivy.get_platform import platform +from pybitmessage.get_platform import platform import os from pybitmessage.bmconfigparser import BMConfigParser from functools import partial @@ -41,13 +41,13 @@ from kivy.uix.screenmanager import SlideTransition, FallOutTransition from pybitmessage import queues from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state from kivymd.uix.bottomsheet import MDCustomBottomSheet from kivy.lang import Observable import ast -# from pybitmessage.bitmessagekivy.baseclass.common import toast +# from pybitmessage.baseclass.common import toast if platform != "android": @@ -207,7 +207,7 @@ class NavigateApp(MDApp): state.screen_density = Window.size window_size = state.screen_density app_platform = platform - title = "PyBitmessageChange" + title = "PyBitmessageChange123" imgstatus = False count = 0 manager_open = False @@ -219,12 +219,7 @@ class NavigateApp(MDApp): def build(self): """Method builds the widget""" for kv in data_screens: - Builder.load_file( - os.path.join( - os.path.dirname(__file__), - 'kv', - # f'{all_data[kv]["kv_string"]}.kv', - '{0}.kv'.format(all_data[kv]["kv_string"]), + Builder.load_file(os.path.join(os.path.dirname(__file__),'kv','{0}.kv'.format(all_data[kv]["kv_string"]), ) ) # self.obj_1 = AddressBook() @@ -234,6 +229,9 @@ class NavigateApp(MDApp): Window.bind(on_keyboard=self.on_key, on_request_close=self.on_request_close) return Builder.load_file(os.path.join(os.path.dirname(__file__), 'main.kv')) + def set_screen(self, screen_name): + self.root.ids.scr_mngr.current = screen_name + def run(self): """Running the widgets""" super(NavigateApp, self).run() diff --git a/src/mock/baseclass/addressbook.py b/src/mock/baseclass/addressbook.py index 17671f40..871edcac 100644 --- a/src/mock/baseclass/addressbook.py +++ b/src/mock/baseclass/addressbook.py @@ -19,9 +19,9 @@ from kivymd.uix.button import MDRaisedButton from kivymd.uix.dialog import MDDialog from kivymd.uix.label import MDLabel -from pybitmessage.bitmessagekivy.get_platform import platform +from pybitmessage.get_platform import platform from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state class AddressBook(Screen): diff --git a/src/mock/baseclass/allmail.py b/src/mock/baseclass/allmail.py index 96438e56..b172197e 100644 --- a/src/mock/baseclass/allmail.py +++ b/src/mock/baseclass/allmail.py @@ -23,7 +23,7 @@ from baseclass.common import ( from kivymd.uix.label import MDLabel from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state class Allmails(Screen): diff --git a/src/mock/baseclass/draft.py b/src/mock/baseclass/draft.py index 5bf80837..17647de9 100644 --- a/src/mock/baseclass/draft.py +++ b/src/mock/baseclass/draft.py @@ -22,7 +22,7 @@ from baseclass.common import ( from kivymd.uix.label import MDLabel from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state class Draft(Screen): diff --git a/src/mock/baseclass/inbox.py b/src/mock/baseclass/inbox.py index 218bee38..847201bc 100644 --- a/src/mock/baseclass/inbox.py +++ b/src/mock/baseclass/inbox.py @@ -17,7 +17,7 @@ from baseclass.common import showLimitedCnt from kivymd.uix.label import MDLabel from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state class Inbox(Screen): diff --git a/src/mock/baseclass/maildetail.py b/src/mock/baseclass/maildetail.py index 2f62bb87..19c02d5b 100644 --- a/src/mock/baseclass/maildetail.py +++ b/src/mock/baseclass/maildetail.py @@ -25,7 +25,7 @@ from kivymd.uix.list import ( ) from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state from .common import ( toast, avatarImageFirstLetter, ShowTimeHistoy diff --git a/src/mock/baseclass/msg_composer.py b/src/mock/baseclass/msg_composer.py index 9e030b0a..f6c2196e 100644 --- a/src/mock/baseclass/msg_composer.py +++ b/src/mock/baseclass/msg_composer.py @@ -32,11 +32,11 @@ from kivymd.uix.button import MDFlatButton from kivymd.uix.dialog import MDDialog from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state from pybitmessage import queues from pybitmessage.addresses import decodeAddress, addBMIfNotPresent -from pybitmessage.bitmessagekivy.get_platform import platform +from pybitmessage.get_platform import platform from pybitmessage.bmconfigparser import BMConfigParser diff --git a/src/mock/baseclass/myaddress.py b/src/mock/baseclass/myaddress.py index ca477c96..4182fa06 100644 --- a/src/mock/baseclass/myaddress.py +++ b/src/mock/baseclass/myaddress.py @@ -5,7 +5,7 @@ Kivy My Address Book screen """ -from pybitmessage.bitmessagekivy.get_platform import platform +from pybitmessage.get_platform import platform from functools import partial from pybitmessage.bmconfigparser import BMConfigParser from kivy.clock import Clock diff --git a/src/mock/baseclass/scan_screen.py b/src/mock/baseclass/scan_screen.py index 5ea2654a..5f36202e 100644 --- a/src/mock/baseclass/scan_screen.py +++ b/src/mock/baseclass/scan_screen.py @@ -16,7 +16,7 @@ from kivy.properties import ( ) from kivy.uix.screenmanager import Screen -from pybitmessage.bitmessagekivy.get_platform import platform +from pybitmessage.get_platform import platform class ScanScreen(Screen): diff --git a/src/mock/baseclass/sent.py b/src/mock/baseclass/sent.py index 5c2aab30..c79e2b6b 100644 --- a/src/mock/baseclass/sent.py +++ b/src/mock/baseclass/sent.py @@ -20,7 +20,7 @@ from baseclass.common import ( from kivymd.uix.label import MDLabel from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state class Sent(Screen): diff --git a/src/mock/baseclass/trash.py b/src/mock/baseclass/trash.py index 3030a4f2..11084673 100644 --- a/src/mock/baseclass/trash.py +++ b/src/mock/baseclass/trash.py @@ -17,7 +17,7 @@ from baseclass.common import showLimitedCnt from kivymd.uix.label import MDLabel from pybitmessage import state -from pybitmessage.bitmessagekivy import kivy_state +from pybitmessage import kivy_state class Trash(Screen): diff --git a/src/mock/kivy_main.py b/src/mock/kivy_main.py index badc1dc1..fb9ac790 100644 --- a/src/mock/kivy_main.py +++ b/src/mock/kivy_main.py @@ -1,7 +1,7 @@ """Mock kivy app with mock threads.""" from pybitmessage import state -from pybitmessage.bitmessagekivy.mpybit import NavigateApp +from mpybit import NavigateApp from class_addressGenerator import FakeAddressGenerator diff --git a/src/mock/kv b/src/mock/kv new file mode 120000 index 00000000..35580041 --- /dev/null +++ b/src/mock/kv @@ -0,0 +1 @@ +../bitmessagekivy/kv \ No newline at end of file diff --git a/src/mock/main.kv b/src/mock/main.kv new file mode 120000 index 00000000..1a214d2f --- /dev/null +++ b/src/mock/main.kv @@ -0,0 +1 @@ +../bitmessagekivy/main.kv \ No newline at end of file diff --git a/src/mock/mockbitmessagekivy/bmconfigparser.py b/src/mock/mockbitmessagekivy/bmconfigparser.py deleted file mode 100644 index 618b5792..00000000 --- a/src/mock/mockbitmessagekivy/bmconfigparser.py +++ /dev/null @@ -1,280 +0,0 @@ -# pylint: disable=too-many-lines,import-error,no-name-in-module,unused-argument, no-else-return, unused-variable -# pylint: disable=too-many-ancestors,too-many-locals,useless-super-delegation, attribute-defined-outside-init -# pylint: disable=protected-access -# pylint: disable=import-outside-toplevel,ungrouped-imports,wrong-import-order,unused-import,arguments-differ -# pylint: disable=invalid-name,unnecessary-comprehension,broad-except,simplifiable-if-expression,no-member -# pylint: disable=too-many-return-statements - -""" -BMConfigParser class definition and default configuration settings -""" - -import os -import shutil -import sys # FIXME: bad style! write more generally -from datetime import datetime - -from six import string_types -from six.moves import configparser - -try: - import state - from singleton import Singleton -except ImportError: - from pybitmessage import state - from pybitmessage.singleton import Singleton - -SafeConfigParser = configparser.SafeConfigParser - - -BMConfigDefaults = { - "bitmessagesettings": { - "maxaddrperstreamsend": 500, - "maxbootstrapconnections": 20, - "maxdownloadrate": 0, - "maxoutboundconnections": 8, - "maxtotalconnections": 200, - "maxuploadrate": 0, - "apiinterface": "127.0.0.1", - "apiport": 8442, - "udp": "True" - }, - "threads": { - "receive": 3, - }, - "network": { - "bind": "", - "dandelion": 90, - }, - "inventory": { - "storage": "sqlite", - "acceptmismatch": "False", - }, - "knownnodes": { - "maxnodes": 20000, - }, - "zlib": { - "maxsize": 1048576 - } -} - - -@Singleton -class BMConfigParser(SafeConfigParser): - """ - Singleton class inherited from :class:`ConfigParser.SafeConfigParser` - with additional methods specific to bitmessage config. - """ - # pylint: disable=too-many-ancestors - _temp = {} - - def set(self, section, option, value=None): - if self._optcre is self.OPTCRE or value: - if not isinstance(value, string_types): - raise TypeError("option values must be strings") - if not self.validate(section, option, value): - raise ValueError("Invalid value %s" % value) - return SafeConfigParser.set(self, section, option, value) - - # pylint: disable=redefined-builtinm, too-many-return-statements - def get(self, section, option, raw=False, vars=None): - if sys.version_info[0] == 3: - # pylint: disable=arguments-differ - try: - if section == "bitmessagesettings" and option == "timeformat": - return SafeConfigParser.get( - self, section, option, raw=True, vars=vars) - try: - return self._temp[section][option] - except KeyError: - pass - return SafeConfigParser.get( - self, section, option, raw=True, vars=vars) - except configparser.InterpolationError: - return SafeConfigParser.get( - self, section, option, raw=True, vars=vars) - except (configparser.NoSectionError, configparser.NoOptionError) as e: - try: - return BMConfigDefaults[section][option] - except (KeyError, ValueError, AttributeError): - raise e - else: - # pylint: disable=arguments-differ - try: - if section == "bitmessagesettings" and option == "timeformat": - return SafeConfigParser.get( - self, section, option, raw, vars) - try: - return self._temp[section][option] - except KeyError: - pass - return SafeConfigParser.get( - self, section, option, True, vars) - except configparser.InterpolationError: - return SafeConfigParser.get( - self, section, option, True, vars) - except (configparser.NoSectionError, configparser.NoOptionError) as e: - try: - return BMConfigDefaults[section][option] - except (KeyError, ValueError, AttributeError): - raise e - - def setTemp(self, section, option, value=None): - """Temporary set option to value, not saving.""" - try: - self._temp[section][option] = value - except KeyError: - self._temp[section] = {option: value} - - def safeGetBoolean(self, section, field): - """Return value as boolean, False on exceptions""" - try: - # Used in the python2.7 - # return self.getboolean(section, field) - # Used in the python3.5.2 - # print(config, section, field) - return self.getboolean(section, field) - except (configparser.NoSectionError, configparser.NoOptionError, - ValueError, AttributeError): - return False - - def safeGetInt(self, section, field, default=0): - """Return value as integer, default on exceptions, - 0 if default missing""" - try: - # Used in the python2.7 - # return self.getint(section, field) - # Used in the python3.7.0 - return int(self.get(section, field)) - except (configparser.NoSectionError, configparser.NoOptionError, - ValueError, AttributeError): - return default - - def safeGetFloat(self, section, field, default=0.0): - """Return value as float, default on exceptions, - 0.0 if default missing""" - try: - return self.getfloat(section, field) - except (configparser.NoSectionError, configparser.NoOptionError, - ValueError, AttributeError): - return default - - def safeGet(self, section, option, default=None): - """Return value as is, default on exceptions, None if default missing""" - try: - return self.get(section, option) - except (configparser.NoSectionError, configparser.NoOptionError, - ValueError, AttributeError): - return default - - def items(self, section, raw=False, variables=None): - # pylint: disable=signature-differs - """Return section variables as parent, - but override the "raw" argument to always True""" - return SafeConfigParser.items(self, section, True, variables) - - def _reset(self): - """Reset current config. There doesn't appear to be a built in - method for this""" - sections = self.sections() - for x in sections: - self.remove_section(x) - - if sys.version_info[0] == 3: - @staticmethod - def addresses(hidden=False): - """Return a list of local bitmessage addresses (from section labels)""" - return [x for x in BMConfigParser().sections() if x.startswith('BM-') and ( - hidden or not BMConfigParser().safeGetBoolean(x, 'hidden'))] - - def read(self, filenames): - self._reset() - SafeConfigParser.read(self, filenames) - for section in self.sections(): - for option in self.options(section): - try: - # pylint: disable=unsubscriptable-object - if not self.validate( - section, option, - self[section][option] - ): - try: - newVal = BMConfigDefaults[section][option] - except configparser.NoSectionError: - continue - except KeyError: - continue - SafeConfigParser.set( - self, section, option, newVal) - except configparser.InterpolationError: - continue - - def readfp(self, fp, filename=None): - # pylint: disable=no-member - SafeConfigParser.read_file(self, fp) - else: - @staticmethod - def addresses(): - """Return a list of local bitmessage addresses (from section labels)""" - return [ - x for x in BMConfigParser().sections() if x.startswith('BM-')] - - def read(self, filenames): - """Read config and populate defaults""" - self._reset() - SafeConfigParser.read(self, filenames) - for section in self.sections(): - for option in self.options(section): - try: - if not self.validate( - section, option, - SafeConfigParser.get(self, section, option) - ): - try: - newVal = BMConfigDefaults[section][option] - except KeyError: - continue - SafeConfigParser.set( - self, section, option, newVal) - except configparser.InterpolationError: - continue - - def save(self): - """Save the runtime config onto the filesystem""" - fileName = os.path.join(state.appdata, 'keys.dat') - fileNameBak = '.'.join([ - fileName, datetime.now().strftime("%Y%j%H%M%S%f"), 'bak']) - # create a backup copy to prevent the accidental loss due to - # the disk write failure - try: - shutil.copyfile(fileName, fileNameBak) - # The backup succeeded. - fileNameExisted = True - except (IOError, Exception): - # The backup failed. This can happen if the file - # didn't exist before. - fileNameExisted = False - - with open(fileName, 'w') as configfile: - self.write(configfile) - # delete the backup - if fileNameExisted: - os.remove(fileNameBak) - - def validate(self, section, option, value): - """Input validator interface (using factory pattern)""" - try: - return getattr(self, 'validate_%s_%s' % (section, option))(value) - except AttributeError: - return True - - @staticmethod - def validate_bitmessagesettings_maxoutboundconnections(value): - """Reject maxoutboundconnections that are too high or too low""" - try: - value = int(value) - except ValueError: - return False - if value < 0 or value > 8: - return False - return True diff --git a/src/mock/mockbitmessagekivy/kv b/src/mock/mockbitmessagekivy/kv deleted file mode 120000 index 6276c558..00000000 --- a/src/mock/mockbitmessagekivy/kv +++ /dev/null @@ -1 +0,0 @@ -../../../../../PyBitmessage/src/bitmessagekivy/kv \ No newline at end of file diff --git a/src/mock/mockbitmessagekivy/network/threads.py b/src/mock/mockbitmessagekivy/network/threads.py deleted file mode 120000 index c95b4c36..00000000 --- a/src/mock/mockbitmessagekivy/network/threads.py +++ /dev/null @@ -1 +0,0 @@ -../../../../network/threads.py \ No newline at end of file diff --git a/src/mock/mpybit.py b/src/mock/mpybit.py new file mode 120000 index 00000000..39d3466d --- /dev/null +++ b/src/mock/mpybit.py @@ -0,0 +1 @@ +../bitmessagekivy/mpybit.py \ No newline at end of file diff --git a/src/mock/mockbitmessagekivy/__init__.py b/src/mock/pybitmessage/__init__.py similarity index 100% rename from src/mock/mockbitmessagekivy/__init__.py rename to src/mock/pybitmessage/__init__.py diff --git a/src/mock/pybitmessage/addresses.py b/src/mock/pybitmessage/addresses.py new file mode 120000 index 00000000..072ae8b4 --- /dev/null +++ b/src/mock/pybitmessage/addresses.py @@ -0,0 +1 @@ +../../addresses.py \ No newline at end of file diff --git a/src/mock/mockbitmessagekivy/addresses.py b/src/mock/pybitmessage/addresses1.py similarity index 100% rename from src/mock/mockbitmessagekivy/addresses.py rename to src/mock/pybitmessage/addresses1.py diff --git a/src/mock/pybitmessage/bmconfigparser.py b/src/mock/pybitmessage/bmconfigparser.py new file mode 120000 index 00000000..7a33e186 --- /dev/null +++ b/src/mock/pybitmessage/bmconfigparser.py @@ -0,0 +1 @@ +../../bmconfigparser.py \ No newline at end of file diff --git a/src/mock/mockbitmessagekivy/class_addressGenerator.py b/src/mock/pybitmessage/class_addressGenerator1.py similarity index 100% rename from src/mock/mockbitmessagekivy/class_addressGenerator.py rename to src/mock/pybitmessage/class_addressGenerator1.py diff --git a/src/mock/mockbitmessagekivy/get_platform.py b/src/mock/pybitmessage/get_platform.py similarity index 100% rename from src/mock/mockbitmessagekivy/get_platform.py rename to src/mock/pybitmessage/get_platform.py diff --git a/src/mock/mockbitmessagekivy/inventory.py b/src/mock/pybitmessage/inventory.py similarity index 100% rename from src/mock/mockbitmessagekivy/inventory.py rename to src/mock/pybitmessage/inventory.py diff --git a/src/mock/mockbitmessagekivy/kivy_state.py b/src/mock/pybitmessage/kivy_state.py similarity index 100% rename from src/mock/mockbitmessagekivy/kivy_state.py rename to src/mock/pybitmessage/kivy_state.py diff --git a/src/mock/mockbitmessagekivy/main.kv b/src/mock/pybitmessage/main.kv similarity index 100% rename from src/mock/mockbitmessagekivy/main.kv rename to src/mock/pybitmessage/main.kv diff --git a/src/mock/mockbitmessagekivy/network/__init__.py b/src/mock/pybitmessage/network/__init__.py similarity index 100% rename from src/mock/mockbitmessagekivy/network/__init__.py rename to src/mock/pybitmessage/network/__init__.py diff --git a/src/mock/pybitmessage/network/threads.py b/src/mock/pybitmessage/network/threads.py new file mode 120000 index 00000000..e4b780b1 --- /dev/null +++ b/src/mock/pybitmessage/network/threads.py @@ -0,0 +1 @@ +../../../network/threads.py \ No newline at end of file diff --git a/src/mock/mockbitmessagekivy/queues.py b/src/mock/pybitmessage/queues.py similarity index 100% rename from src/mock/mockbitmessagekivy/queues.py rename to src/mock/pybitmessage/queues.py diff --git a/src/mock/mockbitmessagekivy/shutdown.py b/src/mock/pybitmessage/shutdown.py similarity index 100% rename from src/mock/mockbitmessagekivy/shutdown.py rename to src/mock/pybitmessage/shutdown.py diff --git a/src/mock/pybitmessage/singleton.py b/src/mock/pybitmessage/singleton.py new file mode 120000 index 00000000..d1688ec7 --- /dev/null +++ b/src/mock/pybitmessage/singleton.py @@ -0,0 +1 @@ +../../singleton.py \ No newline at end of file diff --git a/src/mock/mockbitmessagekivy/singleton.py b/src/mock/pybitmessage/singleton1.py similarity index 100% rename from src/mock/mockbitmessagekivy/singleton.py rename to src/mock/pybitmessage/singleton1.py diff --git a/src/mock/mockbitmessagekivy/state.py b/src/mock/pybitmessage/state.py similarity index 100% rename from src/mock/mockbitmessagekivy/state.py rename to src/mock/pybitmessage/state.py diff --git a/src/mock/mockbitmessagekivy/screens_data.json b/src/mock/screens_data.json similarity index 100% rename from src/mock/mockbitmessagekivy/screens_data.json rename to src/mock/screens_data.json