mirror of
https://github.com/markqvist/LXMF-Tools.git
synced 2025-07-29 09:48:36 -04:00
Layout adjustments
This commit is contained in:
parent
7f167666ed
commit
56b3c50ab9
12 changed files with 43 additions and 367 deletions
|
@ -82,8 +82,6 @@ PATH = os.path.expanduser("~") + "/." + os.path.splitext(os.path.basename(__file
|
|||
PATH_RNS = None
|
||||
|
||||
|
||||
|
||||
|
||||
#### Global Variables - System (Not changeable) ####
|
||||
CONFIG = None
|
||||
RNS_CONNECTION = None
|
||||
|
@ -447,7 +445,7 @@ class lxmf_connection:
|
|||
def sync_now(self, limit=None):
|
||||
if self.message_router.get_outbound_propagation_node() is not None:
|
||||
if self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_IDLE or self.message_router.propagation_transfer_state == LXMF.LXMRouter.PR_COMPLETE:
|
||||
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity))
|
||||
log("LXMF - Message sync requested from propagation node " + RNS.prettyhexrep(self.message_router.get_outbound_propagation_node()) + " for " + str(self.identity), LOG_DEBUG)
|
||||
self.message_router.request_messages_from_propagation_node(self.identity, max_messages = limit)
|
||||
return True
|
||||
else:
|
||||
|
@ -587,8 +585,6 @@ class lxmf_connection:
|
|||
log("- App Data: " + message.app_data, LOG_DEBUG)
|
||||
|
||||
|
||||
|
||||
|
||||
class lxmf_connection_propagation():
|
||||
def __init__(self, owner, aspect_filter=None):
|
||||
self.owner = owner
|
||||
|
@ -672,8 +668,6 @@ class lxmf_announce_callback:
|
|||
return
|
||||
|
||||
|
||||
|
||||
|
||||
#### LXMF - Message ####
|
||||
def lxmf_message_received_callback(message):
|
||||
if not CONFIG["main"].getboolean("power") or not CONFIG["router"].getboolean("lxmf_to_mqtt"):
|
||||
|
@ -781,8 +775,6 @@ def mqtt_log_message(message, message_tag="MQTT - Message log"):
|
|||
log("- QOS: " + str(message.qos), LOG_DEBUG)
|
||||
|
||||
|
||||
|
||||
|
||||
#### MQTT - State ####
|
||||
def mqtt_state():
|
||||
t = threading.Timer(int(CONFIG["mqtt"]["state_interval"])*60, mqtt_state_now)
|
||||
|
@ -790,8 +782,6 @@ def mqtt_state():
|
|||
t.start()
|
||||
|
||||
|
||||
|
||||
|
||||
#### MQTT - State ####
|
||||
def mqtt_state_now():
|
||||
if not CONFIG["router"].getboolean("state_to_mqtt"):
|
||||
|
@ -826,8 +816,6 @@ def mqtt_state_now():
|
|||
MQTT_CONNECTION.publish(CONFIG["mqtt"]["topic_rm_state"], message_out)
|
||||
|
||||
|
||||
|
||||
|
||||
#### MQTT - Connected ####
|
||||
def mqtt_connected_callback(client, userdata, flags, rc):
|
||||
MQTT_CONNECTION.subscribe(CONFIG["mqtt"]["topic_power"])
|
||||
|
@ -843,8 +831,6 @@ def mqtt_connected_callback(client, userdata, flags, rc):
|
|||
log("MQTT - Connected", LOG_DEBUG)
|
||||
|
||||
|
||||
|
||||
|
||||
#### MQTT - Message ####
|
||||
def mqtt_message_received_callback_power(client, userdata, message):
|
||||
global CONFIG
|
||||
|
@ -859,8 +845,6 @@ def mqtt_message_received_callback_power(client, userdata, message):
|
|||
MQTT_CONNECTION.publish(CONFIG["mqtt"]["topic_rm_power"], "off")
|
||||
|
||||
|
||||
|
||||
|
||||
#### MQTT - Message ####
|
||||
def mqtt_message_received_callback_state(client, userdata, message):
|
||||
global CONFIG
|
||||
|
@ -870,8 +854,6 @@ def mqtt_message_received_callback_state(client, userdata, message):
|
|||
mqtt_state_now()
|
||||
|
||||
|
||||
|
||||
|
||||
#### MQTT - Message ####
|
||||
def mqtt_message_received_callback_send(client, userdata, message):
|
||||
mqtt_log_message(message)
|
||||
|
@ -985,8 +967,6 @@ def config_getoption(config, section, key, default=False, lng_key=""):
|
|||
return default
|
||||
|
||||
|
||||
|
||||
|
||||
#### Config - Set #####
|
||||
def config_set(key=None, value=""):
|
||||
global PATH
|
||||
|
@ -1015,8 +995,6 @@ def config_set(key=None, value=""):
|
|||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
#### Config - Read #####
|
||||
def config_read(file=None, file_override=None):
|
||||
global CONFIG
|
||||
|
@ -1042,8 +1020,6 @@ def config_read(file=None, file_override=None):
|
|||
return True
|
||||
|
||||
|
||||
|
||||
|
||||
#### Config - Save #####
|
||||
def config_save(file=None):
|
||||
global CONFIG
|
||||
|
@ -1062,8 +1038,6 @@ def config_save(file=None):
|
|||
return True
|
||||
|
||||
|
||||
|
||||
|
||||
#### Config - Default #####
|
||||
def config_default(file=None, file_override=None):
|
||||
global CONFIG
|
||||
|
@ -1157,8 +1131,6 @@ LOG_SUFFIX = ""
|
|||
LOG_FILE = ""
|
||||
|
||||
|
||||
|
||||
|
||||
def log(text, level=3, file=None):
|
||||
if not LOG_LEVEL:
|
||||
return
|
||||
|
@ -1353,8 +1325,6 @@ def setup(path=None, path_rns=None, path_log=None, loglevel=None, service=False)
|
|||
time.sleep(1)
|
||||
|
||||
|
||||
|
||||
|
||||
#### Start ####
|
||||
def main():
|
||||
try:
|
||||
|
@ -1407,8 +1377,6 @@ DEFAULT_CONFIG = '''# This is the default config file.
|
|||
# You should probably edit it to suit your needs and use-case.
|
||||
|
||||
|
||||
|
||||
|
||||
#### Main program settings ####
|
||||
[main]
|
||||
|
||||
|
@ -1422,8 +1390,6 @@ name =
|
|||
power = Yes
|
||||
|
||||
|
||||
|
||||
|
||||
#### LXMF connection settings ####
|
||||
[lxmf]
|
||||
|
||||
|
@ -1490,8 +1456,6 @@ sync_limit = 8
|
|||
signature_validated = Yes
|
||||
|
||||
|
||||
|
||||
|
||||
#### MQTT connection settings ####
|
||||
[mqtt]
|
||||
|
||||
|
@ -1551,8 +1515,6 @@ state_periodic = Yes
|
|||
state_interval = 30 #Minutes
|
||||
|
||||
|
||||
|
||||
|
||||
#### Message router settings ####
|
||||
[router]
|
||||
|
||||
|
@ -1569,8 +1531,6 @@ lxmf_announce_to_mqtt = False
|
|||
state_to_mqtt = True
|
||||
|
||||
|
||||
|
||||
|
||||
#### Message settings ####
|
||||
[message]
|
||||
|
||||
|
@ -1622,8 +1582,6 @@ mqtt_to_lxmf_length_min = 0 #0=any length
|
|||
mqtt_to_lxmf_length_max = 0 #0=any length
|
||||
|
||||
|
||||
|
||||
|
||||
#### Right settings ####
|
||||
# Allow only specific source addresses/hashs or any.
|
||||
[allowed]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue