Example #1
0
    def revert_changes(self):
        """
        Revert the state of the table to that of the last save-point
        """
        self.LOGGER << "Reverting all user edits"

        m = self.model()

        m.beginResetModel()

        # block signals from the model while we undo all so that we
        # don't overwhelm the user's processor with full-auto-fire signals
        with blocked_signals(m):
            while self._undo_stack.canUndo() \
                    and not self._undo_stack.isClean():
                self._undo_stack.undo()

        # selection is likely worthless now
        self.clearSelection()

        # we have no selection, so disable the movement buttons
        self.enableModActions.emit(False)

        # now, with signals reenabled, reanalyse the error-types;
        m.check_mod_errors()

        # and finish the model reset
        m.endResetModel()
Example #2
0
    def revert_changes(self):
        """
        Revert the state of the table to that of the last save-point
        """
        self.LOGGER << "Reverting all user edits"

        m = self.model()

        m.beginResetModel()

        # block signals from the model while we undo all so that we
        # don't overwhelm the user's processor with full-auto-fire signals
        with blocked_signals(m):
            while self._undo_stack.canUndo() \
                    and not self._undo_stack.isClean():
                self._undo_stack.undo()

        # selection is likely worthless now
        self.clearSelection()

        # we have no selection, so disable the movement buttons
        self.enableModActions.emit(False)

        # now, with signals reenabled, reanalyse the error-types;
        m.check_mod_errors()

        # and finish the model reset
        m.endResetModel()
Example #3
0
 def check_default(self):
     """
     If the active profile is marked as default, check the
     "is_default" checkbox. Otherwise, uncheck it.
     """
     # make sure we have a valid profile
     if self._selected_profile:
         # don't want unchecking this to trigger changing the default profile
         with ui_utils.blocked_signals(self.cbox_default):
             self.cbox_default.setChecked(self._selected_profile.name == Config.default_profile)
Example #4
0
    def check_default(self):
        """
        If the active profile is marked as default, check the
        "is_default" checkbox. Otherwise, uncheck it.
        """
        # make sure we have a valid profile
        if self._selected_profile:
            # don't want unchecking this to trigger changing the default profile
            with ui_utils.blocked_signals(self.cbox_default):
                self.cbox_default.setChecked(
                    self._selected_profile.name == MManager.default_profile)

        # if there is only 1 profile, disable the checkbox
        self.cbox_default.setEnabled(self._num_profiles > 1)