def install(self, filePath): """Install dictionary""" extention = os.path.splitext(filePath)[1][1:] succeeded = False try: if extention.lower() in dicttype.PLUGIN.getFileExtentions(): try: directory, dtype = installPlugin(filePath) if directory: if dtype.lower() == 'plugin': dictionary = newplugin._loadDictionaryPlugin( directory) else: dictionary = plaindict._loadPlainDictionary( directory) self.mainWin.addDictionary(dictionary) succeeded = True except Exception as e: errorwin.showErrorMessage(_("Installation failed"), e.args[0] or '') self.mainWin.SetStatusText(_("Installation failed")) return else: try: directory = installPlainDictionary(filePath) if directory: dictionary = plaindict._loadPlainDictionary(directory) self.mainWin.addDictionary(dictionary) succeeded = True except Exception as e: traceback.print_exc() errorwin.showErrorMessage(_("Installation Error"), e.args[0] or '') self.mainWin.SetStatusText(_("Error: Installation failed")) return except: # Can this happen? self.mainWin.SetStatusText(_("Error: Installation failed")) traceback.print_exc() if succeeded: title = _("Dictionary installed") msg = _("Dictionary successfully installed. You can choose it " \ "from \"Dictionaries\" menu now.") errorwin.showInfoMessage(title, msg)
def install(self, filePath): """Install dictionary""" extention = os.path.splitext(filePath)[1][1:] succeeded = False try: if extention.lower() in dicttype.PLUGIN.getFileExtentions(): try: directory, dtype = installPlugin(filePath) if directory: if dtype.lower() == 'plugin': dictionary = newplugin._loadDictionaryPlugin( directory) else: dictionary = plaindict._loadPlainDictionary( directory) self.mainWin.addDictionary(dictionary) succeeded = True except Exception, e: errorwin.showErrorMessage(_("Installation failed"), e.args[0] or '') self.mainWin.SetStatusText(_("Installation failed")) return else:
def install(self, filePath): """Install dictionary""" extention = os.path.splitext(filePath)[1][1:] succeeded = False try: if extention.lower() in dicttype.PLUGIN.getFileExtentions(): try: directory, dtype = installPlugin(filePath) if directory: if dtype.lower() == 'plugin': dictionary = newplugin._loadDictionaryPlugin(directory) else: dictionary = plaindict._loadPlainDictionary(directory) self.mainWin.addDictionary(dictionary) succeeded = True except Exception, e: errorwin.showErrorMessage(_("Installation failed"), e.args[0] or '') self.mainWin.SetStatusText(_("Installation failed")) return else:
dictionary = plaindict._loadPlainDictionary( directory) self.mainWin.addDictionary(dictionary) succeeded = True except Exception, e: errorwin.showErrorMessage(_("Installation failed"), e.args[0] or '') self.mainWin.SetStatusText(_("Installation failed")) return else: try: directory = installPlainDictionary(filePath) if directory: dictionary = plaindict._loadPlainDictionary(directory) self.mainWin.addDictionary(dictionary) succeeded = True except Exception, e: traceback.print_exc() errorwin.showErrorMessage(_("Installation Error"), e.args[0] or '') self.mainWin.SetStatusText(_("Error: Installation failed")) return except: # Can this happen? self.mainWin.SetStatusText(_("Error: Installation failed")) traceback.print_exc() if succeeded: title = _("Dictionary installed")
else: dictionary = plaindict._loadPlainDictionary(directory) self.mainWin.addDictionary(dictionary) succeeded = True except Exception, e: errorwin.showErrorMessage(_("Installation failed"), e.args[0] or '') self.mainWin.SetStatusText(_("Installation failed")) return else: try: directory = installPlainDictionary(filePath) if directory: dictionary = plaindict._loadPlainDictionary(directory) self.mainWin.addDictionary(dictionary) succeeded = True except Exception, e: traceback.print_exc() errorwin.showErrorMessage(_("Installation Error"), e.args[0] or '') self.mainWin.SetStatusText(_("Error: Installation failed")) return except: # Can this happen? self.mainWin.SetStatusText(_("Error: Installation failed")) traceback.print_exc() if succeeded: title = _("Dictionary installed")