Templates/TemplatePropertiesDialog.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1002
1151d1ea562a
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
14 14
15 from .Ui_TemplatePropertiesDialog import Ui_TemplatePropertiesDialog 15 from .Ui_TemplatePropertiesDialog import Ui_TemplatePropertiesDialog
16 16
17 from E5Gui import E5MessageBox 17 from E5Gui import E5MessageBox
18 18
19
19 class TemplatePropertiesDialog(QDialog, Ui_TemplatePropertiesDialog): 20 class TemplatePropertiesDialog(QDialog, Ui_TemplatePropertiesDialog):
20 """ 21 """
21 Class implementing the templates properties dialog. 22 Class implementing the templates properties dialog.
22 """ 23 """
23 def __init__(self, parent, groupMode = False, itm = None): 24 def __init__(self, parent, groupMode=False, itm=None):
24 """ 25 """
25 Constructor 26 Constructor
26 27
27 @param parent the parent widget (QWidget) 28 @param parent the parent widget (QWidget)
28 @param groupMode flag indicating group mode (boolean) 29 @param groupMode flag indicating group mode (boolean)
38 """ Templates may be autocompleted upon this name.""" 39 """ Templates may be autocompleted upon this name."""
39 """ In order to support autocompletion. the template name""" 40 """ In order to support autocompletion. the template name"""
40 """ must only consist of letters (a-z and A-Z),""" 41 """ must only consist of letters (a-z and A-Z),"""
41 """ digits (0-9) and underscores (_).</p>""" 42 """ digits (0-9) and underscores (_).</p>"""
42 )) 43 ))
43 self.__nameValidator = QRegExpValidator(QRegExp("[a-zA-Z0-9_]+"), 44 self.__nameValidator = QRegExpValidator(QRegExp("[a-zA-Z0-9_]+"),
44 self.nameEdit) 45 self.nameEdit)
45 self.nameEdit.setValidator(self.__nameValidator) 46 self.nameEdit.setValidator(self.__nameValidator)
46 47
47 self.languages = [("All", self.trUtf8("All"))] 48 self.languages = [("All", self.trUtf8("All"))]
48 supportedLanguages = QScintilla.Lexers.getSupportedLanguages() 49 supportedLanguages = QScintilla.Lexers.getSupportedLanguages()
180 def getData(self): 181 def getData(self):
181 """ 182 """
182 Public method to get the data entered into the dialog. 183 Public method to get the data entered into the dialog.
183 184
184 @return a tuple of two strings (name, language), if the dialog is in group mode, 185 @return a tuple of two strings (name, language), if the dialog is in group mode,
185 and a tuple of four strings (name, description, group name, template) 186 and a tuple of four strings (name, description, group name, template)
186 otherwise. 187 otherwise.
187 """ 188 """
188 if self.groupMode: 189 if self.groupMode:
189 return (self.nameEdit.text(), 190 return (self.nameEdit.text(),
190 self.languages[self.groupCombo.currentIndex()][0] 191 self.languages[self.groupCombo.currentIndex()][0]
191 ) 192 )
192 else: 193 else:
193 return (self.nameEdit.text(), 194 return (self.nameEdit.text(),
194 self.descriptionEdit.text(), 195 self.descriptionEdit.text(),
195 self.groupCombo.currentText(), 196 self.groupCombo.currentText(),
196 self.templateEdit.toPlainText() 197 self.templateEdit.toPlainText()
197 ) 198 )

eric ide

mercurial