def installFromFile(self, install):
     mname = generateModuleName(install.plugin.name)
     index = plugin(install.plugin.name, mname, install.plugin.version, install.plugin.eps)
     install.addSelf(const.PLUGIN_CONF_INSTALL_OPT)
     install.install.mname = mname
     self.__checkIntegrity(install, index)
     self.__install(install)
 def getConfOfPluginArchive(self, fileName):
     try:
         rmtree(path.join(const.PLUGIN_DOWNLOAD_PATH, path.basename(fileName)))
     except:
         pass
     try:
         tar = tarfile.open(fileName)
         tar.extractall(path.join(const.PLUGIN_DOWNLOAD_PATH, path.basename(fileName)))
         tar.close()
     except:
         raise( piException(e_piPluginExtractFail, fileName) )
     try:
         install = loadConfig(path.join(const.PLUGIN_DOWNLOAD_PATH, path.basename(fileName), const.PLUGIN_INSTALL_CONFIG_FILE))
         mname = generateModuleName(install.plugin.name)
     except Exception as e:
         raise( piException(e_piPluginConfCorrupt, fileName) )
     try:
         rmtree(path.join(const.PLUGIN_DOWNLOAD_PATH, mname))           
     except:
         pass
     try:
         move(path.join(const.PLUGIN_DOWNLOAD_PATH, path.basename(fileName)), path.join(const.PLUGIN_DOWNLOAD_PATH, mname))
         return(install)        
     except:
         raise( piException(e_piPluginExtractFail, path.join(const.PLUGIN_DOWNLOAD_PATH, mname)) )
 def on_installFromFileButton_clicked(self):
     fileName = QtGui.QFileDialog.getOpenFileName(self, self.msg["m_openFileTitle"],const.USER_HOME_PATH, "Archive (*.tar.gz)")
     if fileName:
         cursorShape = self.cursor()
         self.setCursor(QtGui.QCursor(QtCore.Qt.WaitCursor))
         try:
             install = self.index.getConfOfPluginArchive(unicode(fileName))
             mname = generateModuleName(install.plugin.name)
             reply = QtGui.QMessageBox.Yes
             if mname in self.plugins.getMNames():
                 if parseVersion(install.plugin.version) < parseVersion(self.plugins.getPluginByMName(mname).mconf.plugin.version):
                     reply = QMessage(self.msg["m_newerPluginIsInstalled"], QtGui.QMessageBox.Warning, install.plugin.name +" "+ str(install.plugin.version), \
                             QtGui.QMessageBox.Yes | QtGui.QMessageBox.No, False, QtGui.QMessageBox.No) 
             if reply == QtGui.QMessageBox.Yes:
                 self.index.installFromFile(install)
         except piException as e:
             self.setCursor(cursorShape)
             QMessage(self.msg[e.code], QtGui.QMessageBox.Critical, False, False, e.data)
         self.setCursor(cursorShape)