Project/NewPythonPackageDialog.py

changeset 0
de9c2efb9d02
child 12
1d8dd9706f46
equal deleted inserted replaced
-1:000000000000 0:de9c2efb9d02
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2007 - 2009 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to add a new Python package.
8 """
9
10 from PyQt4.QtGui import QDialog, QDialogButtonBox
11 from PyQt4.QtCore import pyqtSlot
12
13 from Ui_NewPythonPackageDialog import Ui_NewPythonPackageDialog
14
15 class NewPythonPackageDialog(QDialog, Ui_NewPythonPackageDialog):
16 """
17 Class implementing a dialog to add a new Python package.
18 """
19 def __init__(self, relPath, parent = None):
20 """
21 Constructor
22
23 @param relPath initial package path relative to the project root (string)
24 """
25 QDialog.__init__(self, parent)
26 self.setupUi(self)
27
28 self.okButton = self.buttonBox.button(QDialogButtonBox.Ok)
29 self.okButton.setEnabled(False)
30
31 rp = relPath.replace("/", ".").replace("\\", ".")
32 self.packageEdit.setText(rp)
33
34 @pyqtSlot(str)
35 def on_packageEdit_textChanged(self, txt):
36 """
37 Private slot called, when the package name is changed.
38
39 @param txt new text of the package name edit (string)
40 """
41 self.okButton.setEnabled(txt != "")
42
43 def getData(self):
44 """
45 Public method to retrieve the data entered into the dialog.
46
47 @return package name (string)
48 """
49 return self.packageEdit.text()

eric ide

mercurial