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/src/bitmessagemain.py b/src/bitmessagemain.py index dc7426ac..79228f14 100755 --- a/src/bitmessagemain.py +++ b/src/bitmessagemain.py @@ -30,6 +30,7 @@ import time import traceback import defaults +import helper_sql import shared import shutdown import state @@ -85,6 +86,7 @@ def signal_handler(signum, frame): class Main(object): """Main PyBitmessage class""" def start(self): + import pdb;pdb.set_trace() """Start main application""" # pylint: disable=too-many-statements,too-many-branches,too-many-locals fixSocket() @@ -197,8 +199,12 @@ class Main(object): # The closeEvent should command this thread to exit gracefully. sqlLookup.daemon = False sqlLookup.start() + print("Thread Started........................................... 200 in bitmessagemain.py") + helper_sql.sql_ready.wait() Inventory() # init + print("thread after inventory 204..................................",helper_sql.sql_available) + # init, needs to be early because other thread may access it early Dandelion() diff --git a/src/class_sqlThread.py b/src/class_sqlThread.py index d22ffadb..a7dd3048 100644 --- a/src/class_sqlThread.py +++ b/src/class_sqlThread.py @@ -35,7 +35,9 @@ class sqlThread(threading.Thread): def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements """Process SQL queries from `.helper_sql.sqlSubmitQueue`""" + print("line no 38 in class_Sqlthread......................................",helper_sql.sql_available) helper_sql.sql_available = True + print("run call in class_Sqlthread.py..................................",helper_sql.sql_available) self.conn = sqlite3.connect(state.appdata + 'messages.dat') self.conn.text_factory = str self.cur = self.conn.cursor() diff --git a/src/helper_sql.py b/src/helper_sql.py index cba98884..be665812 100644 --- a/src/helper_sql.py +++ b/src/helper_sql.py @@ -28,7 +28,9 @@ sqlReturnQueue = queue.Queue() sql_lock = threading.Lock() """ lock to prevent queueing a new request until the previous response is available """ +print("31...............................................................................before sql_available") sql_available = False +print("33................................................................................sql_available",sql_available) """set to True by `.threads.sqlThread` immediately upon start""" sql_ready = threading.Event() """set by `.threads.sqlThread` when ready for processing (after @@ -43,7 +45,11 @@ def sqlQuery(sql_statement, *args): :param list args: SQL query parameters :rtype: list """ + print('before asser throw............................................................................',sql_available) + print("sql_statementsql_statementsql_statementsql_statement before",sql_statement) assert sql_available + print('after asser throw............................................................................',sql_available) + print("sql_statementsql_statementsql_statementsql_statementsql_statementsql_statement after",sql_statement) sql_lock.acquire() sqlSubmitQueue.put(sql_statement) diff --git a/src/inventory.py b/src/inventory.py index fc06e455..4630e364 100644 --- a/src/inventory.py +++ b/src/inventory.py @@ -1,8 +1,8 @@ """The Inventory singleton""" # TODO make this dynamic, and watch out for frozen, like with messagetypes -import storage.filesystem -import storage.sqlite +import pybitmessage.storage.filesystem +import pybitmessage.storage.sqlite from bmconfigparser import BMConfigParser from singleton import Singleton @@ -16,7 +16,7 @@ class Inventory(): def __init__(self): self._moduleName = BMConfigParser().safeGet("inventory", "storage") self._inventoryClass = getattr( - getattr(storage, self._moduleName), + getattr(pybitmessage.storage, self._moduleName), "{}Inventory".format(self._moduleName.title()) ) self._realInventory = self._inventoryClass() diff --git a/src/main.py b/src/main.py index e1644436..40c314e7 100644 --- a/src/main.py +++ b/src/main.py @@ -1,6 +1,7 @@ """This module is for thread start.""" import state import sys +import pdb;pdb.set_trace() from bitmessagemain import main from termcolor import colored print(colored('kivy is not supported at the moment for this version..', 'red')) diff --git a/src/network/__init__.py b/src/network/__init__.py index 70613539..877fbece 100644 --- a/src/network/__init__.py +++ b/src/network/__init__.py @@ -1,7 +1,7 @@ """ Network subsystem packages """ -from addrthread import AddrThread +from pybitmessage.network.addrthread import AddrThread from announcethread import AnnounceThread from connectionpool import BMConnectionPool from dandelion import Dandelion diff --git a/src/storage/filesystem.py b/src/storage/filesystem.py index 150e8d9e..3425c00a 100644 --- a/src/storage/filesystem.py +++ b/src/storage/filesystem.py @@ -8,8 +8,8 @@ from binascii import hexlify, unhexlify from os import listdir, makedirs, path, remove, rmdir from threading import RLock -from paths import lookupAppdataFolder -from storage import InventoryItem, InventoryStorage +from pybitmessage.paths import lookupAppdataFolder +from pybitmessage.storage.storage import InventoryItem, InventoryStorage logger = logging.getLogger('default') @@ -239,7 +239,7 @@ class FilesystemInventory(InventoryStorage): def hashes_by_stream(self, stream): """Return inventory vectors (hashes) for a stream""" - try: + try: return self._inventory[stream].keys() except KeyError: return [] @@ -264,6 +264,7 @@ class FilesystemInventory(InventoryStorage): for streamDict in self._inventory.values(): for hashId, item in streamDict.items(): if item.expires < minTime: - deletes.append(hashId) + deletes.append(hashId) for hashId in deletes: self.delHashId(hashId) + \ No newline at end of file diff --git a/src/storage/sqlite.py b/src/storage/sqlite.py index 50a2034e..a5ae6a81 100644 --- a/src/storage/sqlite.py +++ b/src/storage/sqlite.py @@ -5,8 +5,8 @@ import sqlite3 import time from threading import RLock -from helper_sql import SqlBulkExecute, sqlExecute, sqlQuery -from storage import InventoryItem, InventoryStorage +from pybitmessage.helper_sql import SqlBulkExecute, sqlExecute, sqlQuery, sql_ready +from pybitmessage.storage.storage import InventoryItem, InventoryStorage class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors @@ -90,6 +90,11 @@ class SqliteInventory(InventoryStorage): # pylint: disable=too-many-ancestors return values def unexpired_hashes_by_stream(self, stream): + # sql_ready.wait() + from threading import current_thread + print(current_thread().name,"Thread running....................................................") + + """Return unexpired inventory vectors filtered by stream""" with self.lock: t = int(time.time())