mirror of
https://github.com/pdxlocations/contact.git
synced 2026-03-28 17:12:35 +01:00
import cleanup
This commit is contained in:
@@ -3,9 +3,9 @@ import time
|
||||
from datetime import datetime
|
||||
import logging
|
||||
|
||||
import globals
|
||||
import default_config as config
|
||||
from utilities.utils import get_name_from_number
|
||||
import default_config as config
|
||||
import globals
|
||||
|
||||
def get_table_name(channel):
|
||||
# Construct the table name
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import os
|
||||
import json
|
||||
import logging
|
||||
import json
|
||||
import os
|
||||
|
||||
def format_json_single_line_arrays(data, indent=4):
|
||||
"""
|
||||
|
||||
2
main.py
2
main.py
@@ -18,8 +18,8 @@ from message_handlers.rx_handler import on_receive
|
||||
from ui.curses_ui import main_ui, draw_splash
|
||||
from utilities.utils import get_channels, get_node_list, get_nodeNum
|
||||
from db_handler import init_nodedb, load_messages_from_db
|
||||
import globals
|
||||
import default_config as config
|
||||
import globals
|
||||
|
||||
# Set environment variables for ncurses compatibility
|
||||
os.environ["NCURSES_NO_UTF8_ACS"] = "1"
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import logging
|
||||
import time
|
||||
from meshtastic import BROADCAST_NUM
|
||||
from utilities.utils import get_node_list, decimal_to_hex, get_name_from_number
|
||||
import globals
|
||||
from utilities.utils import get_node_list, get_name_from_number
|
||||
from ui.curses_ui import draw_packetlog_win, draw_node_list, draw_messages_window, draw_channel_list, add_notification
|
||||
from db_handler import save_message_to_db, maybe_store_nodeinfo_in_db
|
||||
import default_config as config
|
||||
import globals
|
||||
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
from datetime import datetime
|
||||
from meshtastic import BROADCAST_NUM
|
||||
from db_handler import save_message_to_db, update_ack_nak
|
||||
from meshtastic.protobuf import mesh_pb2, portnums_pb2
|
||||
from utilities.utils import get_name_from_number
|
||||
import globals
|
||||
import google.protobuf.json_format
|
||||
from meshtastic import BROADCAST_NUM
|
||||
from meshtastic.protobuf import mesh_pb2, portnums_pb2
|
||||
|
||||
from db_handler import save_message_to_db, update_ack_nak
|
||||
from utilities.utils import get_name_from_number
|
||||
import default_config as config
|
||||
import globals
|
||||
|
||||
ack_naks = {}
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@ import curses
|
||||
import logging
|
||||
|
||||
from save_to_radio import settings_factory_reset, settings_reboot, settings_reset_nodedb, settings_shutdown, save_changes
|
||||
from ui.menus import generate_menu_from_protobuf
|
||||
from input_handlers import get_bool_selection, get_repeated_input, get_user_input, get_enum_input, get_fixed32_input
|
||||
from ui.menus import generate_menu_from_protobuf
|
||||
from ui.colors import setup_colors, get_color
|
||||
from utilities.arg_parser import setup_parser
|
||||
from utilities.interfaces import initialize_interface
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import curses
|
||||
import textwrap
|
||||
import globals
|
||||
from utilities.utils import get_name_from_number, get_channels, get_time_ago
|
||||
from settings import settings_menu
|
||||
from message_handlers.tx_handler import send_message, send_traceroute
|
||||
import ui.dialog
|
||||
from ui.colors import setup_colors, get_color
|
||||
import default_config as config
|
||||
import ui.dialog
|
||||
import globals
|
||||
|
||||
def refresh_all():
|
||||
for i, box in enumerate([channel_box, messages_box, nodes_box]):
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import curses
|
||||
import json
|
||||
import os
|
||||
import json
|
||||
import curses
|
||||
from ui.colors import get_color, setup_colors
|
||||
from default_config import format_json_single_line_arrays, loaded_config
|
||||
|
||||
|
||||
@@ -3,14 +3,21 @@ import meshtastic.serial_interface, meshtastic.tcp_interface, meshtastic.ble_int
|
||||
import globals
|
||||
|
||||
def initialize_interface(args):
|
||||
if args.ble:
|
||||
return meshtastic.ble_interface.BLEInterface(args.ble if args.ble != "any" else None)
|
||||
elif args.host:
|
||||
return meshtastic.tcp_interface.TCPInterface(args.host)
|
||||
else:
|
||||
try:
|
||||
return meshtastic.serial_interface.SerialInterface(args.port)
|
||||
except PermissionError as ex:
|
||||
logging.error("You probably need to add yourself to the `dialout` group to use a serial connection.")
|
||||
if globals.interface.devPath is None:
|
||||
return meshtastic.tcp_interface.TCPInterface("meshtastic.local")
|
||||
try:
|
||||
if args.ble:
|
||||
return meshtastic.ble_interface.BLEInterface(args.ble if args.ble != "any" else None)
|
||||
elif args.host:
|
||||
return meshtastic.tcp_interface.TCPInterface(args.host)
|
||||
else:
|
||||
try:
|
||||
return meshtastic.serial_interface.SerialInterface(args.port)
|
||||
except PermissionError as ex:
|
||||
logging.error(f"You probably need to add yourself to the `dialout` group to use a serial connection. {ex}")
|
||||
except Exception as ex:
|
||||
logging.error(f"Unexpected error initializing interface: {ex}")
|
||||
if globals.interface.devPath is None:
|
||||
return meshtastic.tcp_interface.TCPInterface("meshtastic.local")
|
||||
|
||||
except Exception as ex:
|
||||
logging.critical(f"Fatal error initializing interface: {ex}")
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import globals
|
||||
from datetime import datetime
|
||||
from meshtastic.protobuf import config_pb2
|
||||
import re
|
||||
|
||||
def get_channels():
|
||||
"""Retrieve channels from the node and update globals.channel_list and globals.all_messages."""
|
||||
|
||||
Reference in New Issue
Block a user