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