PluginManager/PluginInstallDialog.py

changeset 45
9a18f4dbb493
parent 13
1af94a91f439
child 48
f4274afeba82
equal deleted inserted replaced
44:fe5cd20cb0eb 45:9a18f4dbb493
285 self.trUtf8("""<p>The file <b>{0}</b> is not a valid plugin """ 285 self.trUtf8("""<p>The file <b>{0}</b> is not a valid plugin """
286 """ZIP-archive. Aborting...</p>""").format(archive), \ 286 """ZIP-archive. Aborting...</p>""").format(archive), \
287 False 287 False
288 288
289 # parse the plugin module's plugin header 289 # parse the plugin module's plugin header
290 pluginSource = zip.read(pluginFileName) 290 pluginSource = zip.read(pluginFileName).decode("utf-8")
291 packageName = "" 291 packageName = ""
292 internalPackages = [] 292 internalPackages = []
293 needsRestart = False 293 needsRestart = False
294 pyqtApi = 0 294 pyqtApi = 0
295 for line in pluginSource.splitlines(): 295 for line in pluginSource.splitlines():
395 else: 395 else:
396 # it is a file 396 # it is a file
397 d = os.path.dirname(outname) 397 d = os.path.dirname(outname)
398 if not os.path.exists(d): 398 if not os.path.exists(d):
399 self.__makedirs(d) 399 self.__makedirs(d)
400 f = open(outname, "w") 400 f = open(outname, "wb")
401 f.write(zip.read(name)) 401 f.write(zip.read(name))
402 f.close() 402 f.close()
403 self.__installedFiles.append(outname) 403 self.__installedFiles.append(outname)
404 self.progress.setValue(tot) 404 self.progress.setValue(tot)
405 # now compile user interface files 405 # now compile user interface files
406 compileUiFiles(os.path.join(destination, packageName), True) 406 compileUiFiles(os.path.join(destination, packageName), True)
407 else: 407 else:
408 outname = os.path.join(destination, pluginFileName) 408 outname = os.path.join(destination, pluginFileName)
409 f = open(outname, "w") 409 f = open(outname, "w", encoding = "utf-8")
410 f.write(pluginSource) 410 f.write(pluginSource)
411 f.close() 411 f.close()
412 self.__installedFiles.append(outname) 412 self.__installedFiles.append(outname)
413 except os.error as why: 413 except os.error as why:
414 self.__rollback() 414 self.__rollback()

eric ide

mercurial