1.0.1
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
from PyQt5 import QtWidgets, QtCore, QtGui
|
||||
import logging
|
||||
from logging_config import get_logger
|
||||
import subprocess
|
||||
import os
|
||||
from logging_config import get_logger, get_log_directory_path
|
||||
from launch_agent import get_launch_agent_manager
|
||||
|
||||
|
||||
@@ -28,7 +30,7 @@ class OptionsDialog(QtWidgets.QDialog):
|
||||
"""Setup the dialog UI"""
|
||||
self.setWindowTitle("HereIAm Options")
|
||||
self.setModal(True)
|
||||
self.setFixedSize(400, 220) # Increased height to accommodate new option
|
||||
self.setFixedSize(400, 260) # Increased height to accommodate new button
|
||||
|
||||
# Ensure dialog appears on top and is properly managed
|
||||
self.setWindowFlags(QtCore.Qt.Dialog | QtCore.Qt.WindowStaysOnTopHint)
|
||||
@@ -81,6 +83,12 @@ class OptionsDialog(QtWidgets.QDialog):
|
||||
|
||||
layout.addLayout(form_layout)
|
||||
|
||||
# Open Logs button
|
||||
logs_button = QtWidgets.QPushButton("Open Logs Directory")
|
||||
logs_button.setToolTip("Open the directory containing HereIAm log files")
|
||||
logs_button.clicked.connect(self.open_logs_directory)
|
||||
layout.addWidget(logs_button)
|
||||
|
||||
# Button box
|
||||
button_box = QtWidgets.QDialogButtonBox(
|
||||
QtWidgets.QDialogButtonBox.Save | QtWidgets.QDialogButtonBox.Cancel
|
||||
@@ -144,6 +152,41 @@ class OptionsDialog(QtWidgets.QDialog):
|
||||
self.logger.error(f"Error getting dialog values: {e}")
|
||||
return None
|
||||
|
||||
def open_logs_directory(self):
|
||||
"""Open the logs directory in Finder (macOS)"""
|
||||
try:
|
||||
log_dir = get_log_directory_path()
|
||||
self.logger.debug(f"Opening logs directory: {log_dir}")
|
||||
|
||||
# Ensure the directory exists
|
||||
if not os.path.exists(log_dir):
|
||||
self.logger.warning(f"Logs directory does not exist: {log_dir}")
|
||||
QtWidgets.QMessageBox.warning(
|
||||
self,
|
||||
"Directory Not Found",
|
||||
f"The logs directory does not exist yet:\n{log_dir}\n\nLogs will be created when the application runs."
|
||||
)
|
||||
return
|
||||
|
||||
# Open directory in Finder on macOS
|
||||
subprocess.run(['open', log_dir], check=True)
|
||||
self.logger.info(f"Successfully opened logs directory: {log_dir}")
|
||||
|
||||
except subprocess.CalledProcessError as e:
|
||||
self.logger.error(f"Failed to open logs directory: {e}")
|
||||
QtWidgets.QMessageBox.critical(
|
||||
self,
|
||||
"Error Opening Directory",
|
||||
f"Failed to open logs directory:\n{str(e)}"
|
||||
)
|
||||
except Exception as e:
|
||||
self.logger.error(f"Unexpected error opening logs directory: {e}")
|
||||
QtWidgets.QMessageBox.critical(
|
||||
self,
|
||||
"Error",
|
||||
f"An unexpected error occurred:\n{str(e)}"
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def get_options(current_wait_time=240, current_start_enabled=True, current_log_level="INFO", current_move_px=10, current_launch_at_startup=False, parent=None):
|
||||
"""Static method to show the dialog and return values"""
|
||||
|
||||
Reference in New Issue
Block a user