Sat, 12 Apr 2014 19:47:46 +0200
Fixed a window sizing issue.
# -*- coding: utf-8 -*- # Copyright (c) 2010 - 2014 Detlev Offenbach <detlev@die-offenbachs.de> # """ Module implementing the Change Occurrences dialog. """ from PyQt4.QtCore import pyqtSlot from PyQt4.QtGui import QDialogButtonBox, QAbstractButton from Ui_ChangeOccurrencesDialog import Ui_ChangeOccurrencesDialog from RefactoringDialogBase import RefactoringDialogBase class ChangeOccurrencesDialog(RefactoringDialogBase, Ui_ChangeOccurrencesDialog): """ Class implementing the Change Occurrences dialog. """ def __init__(self, refactoring, title, renamer, parent=None): """ Constructor @param refactoring reference to the main refactoring object (Refactoring) @param title title of the dialog (string) @param renamer reference to the renamer object (rope.refactor.rename.Rename) @param parent reference to the parent widget (QWidget) """ RefactoringDialogBase.__init__(self, refactoring, title, parent) self.setupUi(self) self.__renamer = renamer self.__okButton = self.buttonBox.button(QDialogButtonBox.Ok) self.__okButton.setEnabled(False) self.__previewButton = self.buttonBox.addButton( self.trUtf8("Preview"), QDialogButtonBox.ActionRole) self.__previewButton.setDefault(True) msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) @pyqtSlot(str) def on_replaceEdit_textChanged(self, text): """ Private slot to react to changes of the new name. @param text text entered into the edit (string) """ self.__okButton.setEnabled(text != "") @pyqtSlot(QAbstractButton) def on_buttonBox_clicked(self, button): """ Private slot to act on the button pressed. @param button reference to the button pressed (QAbstractButton) """ if button == self.__previewButton: self.previewChanges() elif button == self.__okButton: self.applyChanges() def _calculateChanges(self, handle): """ Protected method to calculate the changes. @param handle reference to the task handle (rope.base.taskhandle.TaskHandle) @return reference to the Changes object (rope.base.change.ChangeSet) """ try: changes = self.__renamer.get_changes( self.replaceEdit.text(), only_calls=self.onlyCallsCheckBox.isChecked(), reads=self.readsCheckBox.isChecked(), writes=self.writesCheckBox.isChecked()) return changes except Exception as err: self._refactoring.handleRopeError(err, self._title, handle) return None