Plugins/WizardPlugins/QRegExpWizard/QRegExpWizardDialog.py

changeset 564
b3d966393ba9
parent 553
5af61623ae3c
child 791
9ec2ac20e54e
equal deleted inserted replaced
563:e35d2cda9a74 564:b3d966393ba9
66 self.buttonBox.addButton(self.trUtf8("Execute"), QDialogButtonBox.ActionRole) 66 self.buttonBox.addButton(self.trUtf8("Execute"), QDialogButtonBox.ActionRole)
67 self.executeButton.setToolTip(self.trUtf8("Execute the regular expression")) 67 self.executeButton.setToolTip(self.trUtf8("Execute the regular expression"))
68 self.nextButton = \ 68 self.nextButton = \
69 self.buttonBox.addButton(self.trUtf8("Next match"), 69 self.buttonBox.addButton(self.trUtf8("Next match"),
70 QDialogButtonBox.ActionRole) 70 QDialogButtonBox.ActionRole)
71 self.nextButton.setToolTip(\ 71 self.nextButton.setToolTip(
72 self.trUtf8("Show the next match of the regular expression")) 72 self.trUtf8("Show the next match of the regular expression"))
73 self.nextButton.setEnabled(False) 73 self.nextButton.setEnabled(False)
74 74
75 if fromEric: 75 if fromEric:
76 self.buttonBox.button(QDialogButtonBox.Close).hide() 76 self.buttonBox.button(QDialogButtonBox.Close).hide()
77 self.copyButton = None 77 self.copyButton = None
78 else: 78 else:
79 self.copyButton = \ 79 self.copyButton = \
80 self.buttonBox.addButton(self.trUtf8("Copy"), QDialogButtonBox.ActionRole) 80 self.buttonBox.addButton(self.trUtf8("Copy"), QDialogButtonBox.ActionRole)
81 self.copyButton.setToolTip(\ 81 self.copyButton.setToolTip(
82 self.trUtf8("Copy the regular expression to the clipboard")) 82 self.trUtf8("Copy the regular expression to the clipboard"))
83 self.buttonBox.button(QDialogButtonBox.Ok).hide() 83 self.buttonBox.button(QDialogButtonBox.Ok).hide()
84 self.buttonBox.button(QDialogButtonBox.Cancel).hide() 84 self.buttonBox.button(QDialogButtonBox.Cancel).hide()
85 self.variableLabel.hide() 85 self.variableLabel.hide()
86 self.variableLineEdit.hide() 86 self.variableLineEdit.hide()
209 @pyqtSlot() 209 @pyqtSlot()
210 def on_saveButton_clicked(self): 210 def on_saveButton_clicked(self):
211 """ 211 """
212 Private slot to save the regexp to a file. 212 Private slot to save the regexp to a file.
213 """ 213 """
214 fname, selectedFilter = QFileDialog.getSaveFileNameAndFilter(\ 214 fname, selectedFilter = QFileDialog.getSaveFileNameAndFilter(
215 self, 215 self,
216 self.trUtf8("Save regular expression"), 216 self.trUtf8("Save regular expression"),
217 "", 217 "",
218 self.trUtf8("RegExp Files (*.rx);;All Files (*)"), 218 self.trUtf8("RegExp Files (*.rx);;All Files (*)"),
219 None, 219 None,
246 @pyqtSlot() 246 @pyqtSlot()
247 def on_loadButton_clicked(self): 247 def on_loadButton_clicked(self):
248 """ 248 """
249 Private slot to load a regexp from a file. 249 Private slot to load a regexp from a file.
250 """ 250 """
251 fname = QFileDialog.getOpenFileName(\ 251 fname = QFileDialog.getOpenFileName(
252 self, 252 self,
253 self.trUtf8("Load regular expression"), 253 self.trUtf8("Load regular expression"),
254 "", 254 "",
255 self.trUtf8("RegExp Files (*.rx);;All Files (*)")) 255 self.trUtf8("RegExp Files (*.rx);;All Files (*)"))
256 if fname: 256 if fname:
297 re.setPatternSyntax(QRegExp.Wildcard) 297 re.setPatternSyntax(QRegExp.Wildcard)
298 else: 298 else:
299 re.setPatternSyntax(QRegExp.RegExp) 299 re.setPatternSyntax(QRegExp.RegExp)
300 if re.isValid(): 300 if re.isValid():
301 E5MessageBox.information(self, 301 E5MessageBox.information(self,
302 self.trUtf8(""), 302 self.trUtf8("Validation"),
303 self.trUtf8("""The regular expression is valid.""")) 303 self.trUtf8("""The regular expression is valid."""))
304 else: 304 else:
305 E5MessageBox.critical(self, 305 E5MessageBox.critical(self,
306 self.trUtf8("Error"), 306 self.trUtf8("Error"),
307 self.trUtf8("""Invalid regular expression: {0}""") 307 self.trUtf8("""Invalid regular expression: {0}""")

eric ide

mercurial