Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes undo stack and clears stack on project creation #37

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

StephenNneji
Copy link
Contributor

The undo stack was not setup properly this fixes it. Also setup logging for exceptions in qt slots

Copy link
Collaborator

@alexhroom alexhroom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can't tell if this is the expected behaviour - i tried to test by adding an action to the toolbar that crashes it:

    def create_toolbar(self):
        """Creates the toolbar"""

        def fall_over():
            raise ValueError

        self.error = QtGui.QAction("&Crash", self)
        self.error.setStatusTip("Crash!")
        self.error.setIcon(QtGui.QIcon(path_for("help.png")))
        self.error.triggered.connect(fall_over)

        self.toolbar = self.addToolBar("ToolBar")
        self.toolbar.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.PreventContextMenu)
        self.toolbar.setMovable(False)
        self.toolbar.setEnabled(False)

        self.toolbar.addAction(self.new_project_action)
        self.toolbar.addAction(self.open_project_action)
        self.toolbar.addAction(self.save_project_action)
        self.toolbar.addAction(self.undo_action)
        self.toolbar.addAction(self.redo_action)
        self.toolbar.addAction(self.export_plots_action)
        self.toolbar.addAction(self.open_help_action)
        self.toolbar.addAction(self.error)

and when I click this action I get the following in my terminal:

CRITICAL:root:An unhandled exception occurred!
Traceback (most recent call last):
  File "/home/rec93639/Code/RasCAL-2/rascal2/ui/view.py", line 158, in fall_over
    raise ValueError
ValueError

but the log file is empty.
so it's logging as expected, but it's logging to the terminal and not to the log file? is this what you intended or should it be logging to the file?

@StephenNneji
Copy link
Contributor Author

It should now write to local log file and I have added a backup if a crash happens before local log is setup

Copy link
Collaborator

@alexhroom alexhroom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks all good now!

@StephenNneji StephenNneji merged commit 02e9a17 into RascalSoftware:main Oct 3, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants