135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
self.xNewName = self._addWidget('newname', 'Edit', nX, nY1+20, 60, 10, FontDescriptor = xFDMono)
self.xNewPattern = self._addWidget('newreplace', 'Edit', nX+65, nY1+20, 130, 10, FontDescriptor = xFDMono)
self.xNewRepl = self._addWidget('newby', 'Edit', nX+200, nY1+20, 100, 10, FontDescriptor = xFDMono)
self.xNewRegex = self._addWidget('newregex', 'CheckBox', nX+305, nY1+22, 35, nHeight, Label = ui.get("regex"), HelpText=ui.get("regex_help"))
self.xNewCaseSens = self._addWidget('newcasesens', 'CheckBox', nX+340, nY1+22, 40, nHeight, Label = ui.get("casesens"), HelpText=ui.get("casesens_help"), State=True)
self._addWidget('add', 'Button', self.xDialog.Width-50, nY1+31, 40, 11, Label = ui.get('add'))
lColumns = [
{"Title": ui.get("name"), "ColumnWidth": 80},
{"Title": ui.get("pattern"), "ColumnWidth": 160},
{"Title": ui.get("repl"), "ColumnWidth": 120},
{"Title": ui.get("regex"), "ColumnWidth": 60},
|
>
|
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
self.xNewName = self._addWidget('newname', 'Edit', nX, nY1+20, 60, 10, FontDescriptor = xFDMono)
self.xNewPattern = self._addWidget('newreplace', 'Edit', nX+65, nY1+20, 130, 10, FontDescriptor = xFDMono)
self.xNewRepl = self._addWidget('newby', 'Edit', nX+200, nY1+20, 100, 10, FontDescriptor = xFDMono)
self.xNewRegex = self._addWidget('newregex', 'CheckBox', nX+305, nY1+22, 35, nHeight, Label = ui.get("regex"), HelpText=ui.get("regex_help"))
self.xNewCaseSens = self._addWidget('newcasesens', 'CheckBox', nX+340, nY1+22, 40, nHeight, Label = ui.get("casesens"), HelpText=ui.get("casesens_help"), State=True)
self._addWidget('order_info', 'FixedText', nX, nY1+32, 300, nHeight, Label = ui.get("order_info"))
self._addWidget('add', 'Button', self.xDialog.Width-50, nY1+31, 40, 11, Label = ui.get('add'))
lColumns = [
{"Title": ui.get("name"), "ColumnWidth": 80},
{"Title": ui.get("pattern"), "ColumnWidth": 160},
{"Title": ui.get("repl"), "ColumnWidth": 120},
{"Title": ui.get("regex"), "ColumnWidth": 60},
|
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
|
}
xGridDataModel = self.xGridModel.GridDataModel
xGridDataModel.addRow(xGridDataModel.RowCount + 1, self._getValuesForRow(sRuleName))
xGridDataModel.sortByColumn(0, True)
self._clearAddFields()
def _getValuesForRow (self, sRuleName):
return (sRuleName, self.dRules[sRuleName]["sPattern"], self.dRules[sRuleName]["sRepl"], str(self.dRules[sRuleName]["bRegex"]), str(self.dRules[sRuleName]["bCaseSens"]))
def _checkRuleName (self, sRuleName):
return re.search(r"^\w[\w_#.,;!?-]{,14}$", sRuleName)
def modifyRule (self):
if not self._checkRuleName(self.xEditName.Text):
MessageBox(self.xDocument, ui.get("name_error"), ui.get("name_error_title"), ERRORBOX)
|
|
>
>
>
|
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
}
xGridDataModel = self.xGridModel.GridDataModel
xGridDataModel.addRow(xGridDataModel.RowCount + 1, self._getValuesForRow(sRuleName))
xGridDataModel.sortByColumn(0, True)
self._clearAddFields()
def _getValuesForRow (self, sRuleName):
return (sRuleName, self.dRules[sRuleName]["sPattern"],
self.dRules[sRuleName]["sRepl"],
"✓" if self.dRules[sRuleName]["bRegex"] else "",
"✓" if self.dRules[sRuleName]["bCaseSens"] else "")
def _checkRuleName (self, sRuleName):
return re.search(r"^\w[\w_#.,;!?-]{,14}$", sRuleName)
def modifyRule (self):
if not self._checkRuleName(self.xEditName.Text):
MessageBox(self.xDocument, ui.get("name_error"), ui.get("name_error_title"), ERRORBOX)
|