17 from E5Gui.E5Completers import E5DirCompleter |
17 from E5Gui.E5Completers import E5DirCompleter |
18 from E5Gui import E5FileDialog |
18 from E5Gui import E5FileDialog |
19 |
19 |
20 from .Ui_NewDialogClassDialog import Ui_NewDialogClassDialog |
20 from .Ui_NewDialogClassDialog import Ui_NewDialogClassDialog |
21 |
21 |
|
22 import UI.PixmapCache |
|
23 |
22 |
24 |
23 class NewDialogClassDialog(QDialog, Ui_NewDialogClassDialog): |
25 class NewDialogClassDialog(QDialog, Ui_NewDialogClassDialog): |
24 """ |
26 """ |
25 Class implementing a dialog to ente the data for a new dialog class file. |
27 Class implementing a dialog to ente the data for a new dialog class file. |
26 """ |
28 """ |
35 @param parent parent widget if the dialog (QWidget) |
37 @param parent parent widget if the dialog (QWidget) |
36 """ |
38 """ |
37 super(NewDialogClassDialog, self).__init__(parent) |
39 super(NewDialogClassDialog, self).__init__(parent) |
38 self.setupUi(self) |
40 self.setupUi(self) |
39 |
41 |
|
42 self.pathButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
|
43 |
40 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
44 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok) |
41 self.okButton.setEnabled(False) |
45 self.okButton.setEnabled(False) |
42 |
46 |
43 self.pathnameCompleter = E5DirCompleter(self.pathnameEdit) |
47 self.pathnameCompleter = E5DirCompleter(self.pathnameEdit) |
44 |
48 |
45 self.classnameEdit.setText(defaultClassName) |
49 self.classnameEdit.setText(defaultClassName) |
46 self.filenameEdit.setText(defaultFile) |
50 self.filenameEdit.setText(defaultFile) |
47 self.pathnameEdit.setText(QDir.toNativeSeparators(defaultPath)) |
51 self.pathnameEdit.setText(QDir.toNativeSeparators(defaultPath)) |
48 |
52 |
|
53 msh = self.minimumSizeHint() |
|
54 self.resize(max(self.width(), msh.width()), msh.height()) |
|
55 |
49 @pyqtSlot() |
56 @pyqtSlot() |
50 def on_pathButton_clicked(self): |
57 def on_pathButton_clicked(self): |
51 """ |
58 """ |
52 Private slot called to open a directory selection dialog. |
59 Private slot called to open a directory selection dialog. |
53 """ |
60 """ |
54 path = E5FileDialog.getExistingDirectory( |
61 path = E5FileDialog.getExistingDirectory( |
55 self, |
62 self, |
56 self.trUtf8("Select source directory"), |
63 self.tr("Select source directory"), |
57 QDir.fromNativeSeparators(self.pathnameEdit.text())) |
64 QDir.fromNativeSeparators(self.pathnameEdit.text())) |
58 if path: |
65 if path: |
59 self.pathnameEdit.setText(QDir.toNativeSeparators(path)) |
66 self.pathnameEdit.setText(QDir.toNativeSeparators(path)) |
60 |
67 |
61 def __enableOkButton(self): |
68 def __enableOkButton(self): |