282
283
284
285
286
287
288
289
290
291
292
293
294
295
|
self.updateGenWords()
elif xActionEvent.ActionCommand == "Add":
self.addToLexicon()
elif xActionEvent.ActionCommand == "Delete":
self.deleteSelectedEntries()
elif xActionEvent.ActionCommand == "Save":
self.saveLexicon()
elif xActionEvent.ActionCommand == "Export":
self.exportDictionary()
elif xActionEvent.ActionCommand == "Close":
self.xContainer.endExecute()
except:
traceback.print_exc()
|
>
>
|
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
|
self.updateGenWords()
elif xActionEvent.ActionCommand == "Add":
self.addToLexicon()
elif xActionEvent.ActionCommand == "Delete":
self.deleteSelectedEntries()
elif xActionEvent.ActionCommand == "Save":
self.saveLexicon()
elif xActionEvent.ActionCommand == "Import":
self.importDictionary()
elif xActionEvent.ActionCommand == "Export":
self.exportDictionary()
elif xActionEvent.ActionCommand == "Close":
self.xContainer.endExecute()
except:
traceback.print_exc()
|
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
|
self.xSave.Enabled = True
self.xNumAdded.Label = str(int(self.xNumAdded.Label) + xGridDataModelNew.RowCount)
self.xNumLex.Label = str(int(self.xNumLex.Label) + xGridDataModelNew.RowCount)
self._resetWidgets()
@_waitPointer
def deleteSelectedEntries (self):
xGridDataModel = self.xGridModelNew.GridDataModel
for i in self.xGridControlNew.getSelectedRows():
xGridDataModel.removeRow(i)
xGridDataModel = self.xGridModelLex.GridDataModel
nSelectedEntries = len(self.xGridControlLex.getSelectedRows())
for i in self.xGridControlLex.getSelectedRows():
xGridDataModel.removeRow(i)
self.xNumDeleted.Label = str(int(self.xNumDeleted.Label) + nSelectedEntries)
self.xNumLex.Label = str(xGridDataModel.RowCount)
#g_ImplementationHelper = unohelper.ImplementationHelper()
#g_ImplementationHelper.addImplementation(LexiconEditor, 'net.grammalecte.LexiconEditor', ('com.sun.star.task.Job',))
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
|
self.xSave.Enabled = True
self.xNumAdded.Label = str(int(self.xNumAdded.Label) + xGridDataModelNew.RowCount)
self.xNumLex.Label = str(int(self.xNumLex.Label) + xGridDataModelNew.RowCount)
self._resetWidgets()
@_waitPointer
def deleteSelectedEntries (self):
# generated entries
xGridDataModel = self.xGridModelNew.GridDataModel
for i in self.xGridControlNew.getSelectedRows():
xGridDataModel.removeRow(i)
self.xGridControlNew.deselectAllRows()
# lexicon
xGridDataModel = self.xGridModelLex.GridDataModel
nSelectedEntries = len(self.xGridControlLex.getSelectedRows())
for i in self.xGridControlLex.getSelectedRows():
xGridDataModel.removeRow(i)
self.xGridControlLex.deselectAllRows()
self.xNumDeleted.Label = str(int(self.xNumDeleted.Label) + nSelectedEntries)
self.xNumLex.Label = str(xGridDataModel.RowCount)
@_waitPointer
def importDictionary (self):
pass
@_waitPointer
def exportDictionary (self):
xFilePicker = self.xSvMgr.createInstanceWithContext('com.sun.star.ui.dialogs.SystemFilePicker', self.ctx)
xFilePicker.appendFilter("Supported files", "*.json; *.bdic")
#xFilePicker.setDisplayDirectory("")
#xFilePicker.setMultiSelectionMode(True)
nResult = xFilePicker.execute()
if nResult == 1:
pass
#lFile = xFilePicker.getSelectedFiles()
#lFile = xFilePicker.getFiles()
#g_ImplementationHelper = unohelper.ImplementationHelper()
#g_ImplementationHelper.addImplementation(LexiconEditor, 'net.grammalecte.LexiconEditor', ('com.sun.star.task.Job',))
|