Index: gc_lang/fr/oxt/DictOptions/LexiconEditor.py ================================================================== --- gc_lang/fr/oxt/DictOptions/LexiconEditor.py +++ gc_lang/fr/oxt/DictOptions/LexiconEditor.py @@ -20,10 +20,11 @@ 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 @@ -59,11 +60,11 @@ # return return result return wrapper -class LexiconEditor (unohelper.Base, XActionListener, XKeyListener, XJobExecutor): +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) @@ -282,14 +283,15 @@ 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.setVisible(False) + 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() + #self.xContainer.execute() # For modal dialog def _createKeyListeners (self, lNames, sAction): for sName in lNames: self.xContainer.getControl(sName).addKeyListener(self) @@ -318,13 +320,36 @@ elif xActionEvent.ActionCommand == "Export": self.exportDictionary() elif xActionEvent.ActionCommand == 'Info': pass elif xActionEvent.ActionCommand == "Close": - self.xContainer.endExecute() + 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