|
7 | 7 | import re
|
8 | 8 | import sys
|
9 | 9 | from json import loads
|
| 10 | +from logging.handlers import TimedRotatingFileHandler |
10 | 11 |
|
11 |
| -from PyQt5.QtCore import QDir, QSettings, QSize, Qt, QTimer, QUrl, pyqtSlot |
| 12 | +from PyQt5.QtCore import QDir, QFileInfo, QSettings, QSize, Qt, QTimer, QUrl, pyqtSlot |
12 | 13 | from PyQt5.QtGui import QDesktopServices, QFont, QIcon
|
13 | 14 | from PyQt5.QtWidgets import (
|
14 | 15 | QAction,
|
|
42 | 43 | )
|
43 | 44 | from Util.mqtt import MqttClient
|
44 | 45 |
|
45 |
| -# TODO: rework device export |
46 |
| - |
47 | 46 | __version__ = "0.3&quo
10000
t;
|
48 | 47 | __tasmota_minimum__ = "6.6.0.17"
|
49 | 48 |
|
@@ -73,12 +72,13 @@ def __init__(
|
73 | 72 |
|
74 | 73 | # configure logging
|
75 | 74 | logging.basicConfig(
|
76 |
| - filename=log_path, |
77 | 75 | level="DEBUG" if debug else "INFO",
|
78 | 76 | datefmt="%Y-%m-%d %H:%M:%S",
|
79 | 77 | format="%(asctime)s [%(levelname)s] %(message)s",
|
80 | 78 | )
|
81 |
| - logging.getLogger().addHandler(logging.StreamHandler(sys.stdout)) |
| 79 | + logging.getLogger().addHandler( |
| 80 | + TimedRotatingFileHandler(filename=log_path, when="d", interval=1) |
| 81 | + ) |
82 | 82 | logging.info("### TDM START ###")
|
83 | 83 |
|
84 | 84 | # load devices from the devices file, create TasmotaDevices and add the to the environment
|
@@ -185,9 +185,9 @@ def build_mainmenu(self):
|
185 | 185 | mSettings.addAction(QIcon(), "BSSId aliases", self.bssid)
|
186 | 186 | mSettings.addSeparator()
|
187 | 187 | mSettings.addAction(QIcon(), "Preferences", self.prefs)
|
188 |
| - |
189 |
| - # mExport = self.menuBar().addMenu("Export") |
190 |
| - # mExport.addAction(QIcon(), "OpenHAB", self.openhab) |
| 188 | + mSettings.addSeparator() |
| 189 | + mSettings.addAction(QIcon(), "Open config file", self.open_config_file) |
| 190 | + mSettings.addAction(QIcon(), "Open log file location", self.open_log_location) |
191 | 191 |
|
192 | 192 | def build_toolbars(self):
|
193 | 193 | main_toolbar = Toolbar(
|
@@ -522,6 +522,14 @@ def prefs(self):
|
522 | 522 |
|
523 | 523 | self.settings.sync()
|
524 | 524 |
|
| 525 | + def open_config_file(self): |
| 526 | + QDesktopServices.openUrl(QUrl.fromLocalFile(self.settings.fileName())) |
| 527 | + |
| 528 | + @staticmethod |
| 529 | + def open_log_location(): |
| 530 | + fi = QFileInfo(logging.getLogger().handlers[1].baseFilename) |
| 531 | + QDesktopServices.openUrl(QUrl.fromLocalFile(fi.absolutePath())) |
| 532 | + |
525 | 533 | def auto_telemetry_period(self):
|
526 | 534 | curr_val = self.settings.value("autotelemetry", 5000, int)
|
527 | 535 | period, ok = QInputDialog.getInt(
|
|
0 commit comments