Overview
| Comment: | [lo] lexicon editor as non modal dialog | 
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive | 
| Timelines: | family | ancestors | descendants | both | trunk | lo | 
| Files: | files | file ages | folders | 
| SHA3-256: | 2239a762bd1d9e7980894605c44d1f60 | 
| User & Date: | olr on 2020-02-04 14:06:49 | 
| Other Links: | manifest | tags | 
Context
| 2020-02-06 | ||
| 06:51 | [core][fr] suggestions: remove empty suggestions check-in: 86199c55ea user: olr tags: trunk, fr, core | |
| 2020-02-04 | ||
| 14:06 | [lo] lexicon editor as non modal dialog check-in: 2239a762bd user: olr tags: trunk, lo | |
| 13:58 | [lo] conjugueur as non modal dialog check-in: fabbc4bc0c user: olr tags: trunk, lo | |
Changes
Modified gc_lang/fr/oxt/DictOptions/LexiconEditor.py from [6367f7ed95] to [9068830b8a].
| ︙ | ︙ | |||
| 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import grammalecte.fr.conj_generator as conjgen import SearchWords import TagsInfo from com.sun.star.task import XJobExecutor from com.sun.star.awt import XActionListener from com.sun.star.awt import XKeyListener from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK # BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY # DEFAULT_BUTTON_OK, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_RETRY, DEFAULT_BUTTON_YES, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_IGNORE from com.sun.star.awt.MessageBoxType import INFOBOX, ERRORBOX # MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX | > | 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | import grammalecte.fr.conj_generator as conjgen import SearchWords import TagsInfo from com.sun.star.task import XJobExecutor from com.sun.star.awt import XActionListener from com.sun.star.awt import XTopWindowListener from com.sun.star.awt import XKeyListener from com.sun.star.awt.MessageBoxButtons import BUTTONS_OK # BUTTONS_OK, BUTTONS_OK_CANCEL, BUTTONS_YES_NO, BUTTONS_YES_NO_CANCEL, BUTTONS_RETRY_CANCEL, BUTTONS_ABORT_IGNORE_RETRY # DEFAULT_BUTTON_OK, DEFAULT_BUTTON_CANCEL, DEFAULT_BUTTON_RETRY, DEFAULT_BUTTON_YES, DEFAULT_BUTTON_NO, DEFAULT_BUTTON_IGNORE from com.sun.star.awt.MessageBoxType import INFOBOX, ERRORBOX # MESSAGEBOX, INFOBOX, WARNINGBOX, ERRORBOX, QUERYBOX | 
| ︙ | ︙ | |||
| 57 58 59 60 61 62 63 | 
            x.setPointer(xPointer)
        self.xContainer.setVisible(True) # seems necessary to refresh the dialog box and text widgets (why?)
        # return
        return result
    return wrapper
 | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 
            x.setPointer(xPointer)
        self.xContainer.setVisible(True) # seems necessary to refresh the dialog box and text widgets (why?)
        # return
        return result
    return wrapper
class LexiconEditor (unohelper.Base, XActionListener, XTopWindowListener, XKeyListener, XJobExecutor):
    def __init__ (self, ctx):
        self.ctx = ctx
        self.xSvMgr = self.ctx.ServiceManager
        self.xDesktop = self.xSvMgr.createInstanceWithContext("com.sun.star.frame.Desktop", self.ctx)
        self.xDocument = self.xDesktop.getCurrentComponent()
        self.xContainer = None
 | 
| ︙ | ︙ | |||
| 280 281 282 283 284 285 286 | 
        self.xContainer.getControl('save_button').setActionCommand('Save')
        self.xContainer.getControl('import_button').addActionListener(self)
        self.xContainer.getControl('import_button').setActionCommand('Import')
        self.xContainer.getControl('export_button').addActionListener(self)
        self.xContainer.getControl('export_button').setActionCommand('Export')
        self.xContainer.getControl('close_button').addActionListener(self)
        self.xContainer.getControl('close_button').setActionCommand('Close')
 | > | | | 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 | 
        self.xContainer.getControl('save_button').setActionCommand('Save')
        self.xContainer.getControl('import_button').addActionListener(self)
        self.xContainer.getControl('import_button').setActionCommand('Import')
        self.xContainer.getControl('export_button').addActionListener(self)
        self.xContainer.getControl('export_button').setActionCommand('Export')
        self.xContainer.getControl('close_button').addActionListener(self)
        self.xContainer.getControl('close_button').setActionCommand('Close')
        self.xContainer.addTopWindowListener(self) # listener with XTopWindowListener methods
        self.xContainer.setVisible(True)  # True for non modal dialog
        xToolkit = self.xSvMgr.createInstanceWithContext('com.sun.star.awt.ExtToolkit', self.ctx)
        self.xContainer.createPeer(xToolkit, None)
        #self.xContainer.execute()        # For modal dialog
    def _createKeyListeners (self, lNames, sAction):
        for sName in lNames:
            self.xContainer.getControl(sName).addKeyListener(self)
    def _createActionListeners (self, lNames, sAction):
        for sName in lNames:
 | 
| ︙ | ︙ | |||
| 316 317 318 319 320 321 322 | 
            elif xActionEvent.ActionCommand == "Import":
                self.importDictionary()
            elif xActionEvent.ActionCommand == "Export":
                self.exportDictionary()
            elif xActionEvent.ActionCommand == 'Info':
                pass
            elif xActionEvent.ActionCommand == "Close":
 | > | > > > > > > > > > > > > > > > > > > > > > > | 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | 
            elif xActionEvent.ActionCommand == "Import":
                self.importDictionary()
            elif xActionEvent.ActionCommand == "Export":
                self.exportDictionary()
            elif xActionEvent.ActionCommand == 'Info':
                pass
            elif xActionEvent.ActionCommand == "Close":
                self.xContainer.dispose()           # Non modal dialog
                #self.xContainer.endExecute()       # Modal dialog
        except:
            traceback.print_exc()
    # XTopWindowListener (useful for non modal dialog only)
    def windowOpened (self, xEvent):
        return
    def windowClosing (self, xEvent):
        self.xContainer.dispose()           # Non modal dialog
    def windowClosed (self, xEvent):
        return
    def windowMinimized (self, xEvent):
        return
    def windowNormalized (self, xEvent):
        return
    def windowActivated (self, xEvent):
        return
    def windowDeactivated (self, xEvent):
        return
    # XKeyListener
    def keyPressed (self, xKeyEvent):
        pass
    def keyReleased (self, xKeyEvent):
        self.updateGenWords()
 | 
| ︙ | ︙ |