-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #41 from dougollerenshaw/clean_up_inheritance
Clean up inheritance
- Loading branch information
Showing
7 changed files
with
203 additions
and
145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
from PyQt5.QtWidgets import QMessageBox, QTextEdit | ||
from PyQt5.QtGui import QFont | ||
from PyQt5.QtCore import Qt | ||
import logging | ||
|
||
|
||
def get_logger(): | ||
logger = logging.getLogger(__name__) | ||
logger.setLevel(logging.INFO) | ||
return logger | ||
|
||
|
||
class TracebackDialog(QMessageBox): | ||
def __init__(self, parent, traceback_text): | ||
super().__init__(parent) | ||
self.logger = get_logger() | ||
self.logger.info( | ||
f"TracebackDialog: Initializing with text: {traceback_text[:50]}..." | ||
) | ||
self.setWindowTitle("Error Detected") | ||
self.setText("An error was detected in the running script:") | ||
self.setInformativeText(traceback_text) | ||
self.setIcon(QMessageBox.Warning) | ||
|
||
self.setFixedWidth(600) | ||
self.setSizeGripEnabled(True) | ||
|
||
self.send_button = self.addButton("Request a fix", QMessageBox.ActionRole) | ||
self.ignore_button = self.addButton("Ignore", QMessageBox.RejectRole) | ||
|
||
text_browser = self.findChild(QTextEdit) | ||
if text_browser: | ||
font = QFont("Courier") | ||
font.setStyleHint(QFont.Monospace) | ||
font.setFixedPitch(True) | ||
font.setPointSize(10) | ||
text_browser.setFont(font) | ||
|
||
def exec_(self): | ||
self.logger.info("TracebackDialog: Executing dialog") | ||
result = super().exec_() | ||
user_choice = "fix" if self.clickedButton() == self.send_button else "ignore" | ||
self.logger.info(f"TracebackDialog: User chose to {user_choice} the traceback") | ||
return self.clickedButton() == self.send_button |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.