Load the fonts, scaled for the current display size.
(self)
| 1579 | On the Pager, action modules can't be imported (missing pandas/rich), |
| 1580 | so we read the pre-deployed actions.json instead of regenerating it.""" |
| 1581 | try: |
| 1582 | if os.path.exists(self.actions_file): |
| 1583 | with open(self.actions_file, 'r') as f: |
| 1584 | actions = json.load(f) |
| 1585 | for action in actions: |
| 1586 | b_class = action.get('b_class') |
| 1587 | if b_class and b_class not in self.status_list: |
| 1588 | self.status_list.append(b_class) |
| 1589 | logger.info(f"Loaded {len(self.status_list)} action statuses from actions.json") |
| 1590 | else: |
| 1591 | logger.warning("actions.json not found - status animations will be unavailable") |
| 1592 | except Exception as e: |
| 1593 | logger.error(f"Error loading actions.json: {e}") |
| 1594 | |
| 1595 | def initialize_csv(self): |
| 1596 | """Initialize the network knowledge base CSV file with headers.""" |
| 1597 | logger.info("Initializing the network knowledge base CSV file with headers") |
| 1598 | try: |
| 1599 | if not os.path.exists(self.netkbfile): |
| 1600 | try: |
| 1601 | with open(self.actions_file, 'r') as file: |
| 1602 | actions = json.load(file) |
| 1603 | action_names = [action["b_class"] for action in actions if "b_class" in action] |
| 1604 | except FileNotFoundError as e: |
| 1605 | logger.error(f"Actions file not found: {e}") |
| 1606 | return |
| 1607 | except json.JSONDecodeError as e: |
| 1608 | logger.error(f"Error decoding JSON from actions file: {e}") |
| 1609 | return |
| 1610 | except Exception as e: |
| 1611 | logger.error(f"Unexpected error reading actions file: {e}") |
| 1612 | return |
no test coverage detected