/ src / state.py
state.py
 1  """
 2  Global runtime variables.
 3  """
 4  
 5  neededPubkeys = {}
 6  
 7  extPort = None
 8  """For UPnP"""
 9  
10  socksIP = None
11  """for Tor hidden service"""
12  
13  appdata = ""
14  """holds the location of the application data storage directory"""
15  
16  shutdown = 0
17  """
18  Set to 1 by the `.shutdown.doCleanShutdown` function.
19  Used to tell the threads to exit.
20  """
21  
22  # Component control flags - set on startup, do not change during runtime
23  #     The defaults are for standalone GUI (default operating mode)
24  enableNetwork = True
25  """enable network threads"""
26  enableObjProc = True
27  """enable object processing thread"""
28  enableAPI = True
29  """enable API (if configured)"""
30  enableGUI = True
31  """enable GUI (QT or ncurses)"""
32  enableSTDIO = False
33  """enable STDIO threads"""
34  enableKivy = False
35  """enable kivy app and test cases"""
36  curses = False
37  
38  maximumNumberOfHalfOpenConnections = 0
39  
40  maximumLengthOfTimeToBotherResendingMessages = 0
41  
42  ownAddresses = {}
43  
44  discoveredPeers = {}
45  
46  kivy = False
47  
48  kivyapp = None
49  
50  testmode = False
51  
52  clientHasReceivedIncomingConnections = False
53  """used by API command clientStatus"""
54  
55  numberOfMessagesProcessed = 0
56  numberOfBroadcastsProcessed = 0
57  numberOfPubkeysProcessed = 0
58  
59  statusIconColor = "red"
60  """
61  GUI status icon color
62  .. note:: bad style, refactor it
63  """
64  
65  ackdataForWhichImWatching = {}
66  
67  thisapp = None
68  """Singleton instance"""
69  
70  backend_py3_compatible = False
71  
72  
73  class Placeholder(object):  # pylint:disable=too-few-public-methods
74      """Placeholder class"""
75  
76      def __init__(self, className):
77          self.className = className
78  
79      def __getattr__(self, name):
80          self._raise()
81  
82      def __setitem__(self, key, value):
83          self._raise()
84  
85      def __getitem__(self, key):
86          self._raise()
87  
88      def _raise(self):
89          raise NotImplementedError(
90              "Probabaly you forgot to initialize state variable for {}".format(
91                  self.className
92              )
93          )
94  
95  
96  Inventory = Placeholder("Inventory")