432 def __pyinstaller(self): |
432 def __pyinstaller(self): |
433 """ |
433 """ |
434 Private slot to execute the pyinstaller command for the current |
434 Private slot to execute the pyinstaller command for the current |
435 project. |
435 project. |
436 """ |
436 """ |
|
437 from PyInstallerInterface.PyInstallerConfigDialog import PyInstallerConfigDialog |
|
438 from PyInstallerInterface.PyInstallerExecDialog import PyInstallerExecDialog |
|
439 |
437 project = ericApp().getObject("Project") |
440 project = ericApp().getObject("Project") |
438 majorVersionStr = project.getProjectLanguage() |
441 majorVersionStr = project.getProjectLanguage() |
439 if majorVersionStr == "Python3": |
442 if majorVersionStr == "Python3": |
440 executables = [ |
443 executables = [ |
441 f for f in exePy3 if f.endswith(("pyinstaller", "pyinstaller.exe")) |
444 f for f in exePy3 if f.endswith(("pyinstaller", "pyinstaller.exe")) |
442 ] |
445 ] |
443 if not executables: |
446 if not executables: |
444 EricMessageBox.critical( |
447 EricMessageBox.critical( |
445 self.__ui, |
448 self.__ui, |
446 self.tr("pyinstaller"), |
449 self.tr("pyinstaller"), |
447 self.tr( |
450 self.tr("""The pyinstaller executable could not be found."""), |
448 """The pyinstaller executable could not be""" """ found.""" |
|
449 ), |
|
450 ) |
451 ) |
451 return |
452 return |
452 |
453 |
453 # check if all files saved and errorfree before continue |
454 # check if all files saved and errorfree before continue |
454 if not project.checkAllScriptsDirty(reportSyntaxErrors=True): |
455 if not project.checkAllScriptsDirty(reportSyntaxErrors=True): |
455 return |
456 return |
456 |
457 |
457 from PyInstallerInterface.PyInstallerConfigDialog import ( |
|
458 PyInstallerConfigDialog, |
|
459 ) |
|
460 |
|
461 params = project.getData("PACKAGERSPARMS", "PYINSTALLER") |
458 params = project.getData("PACKAGERSPARMS", "PYINSTALLER") |
462 dlg = PyInstallerConfigDialog( |
459 dlg = PyInstallerConfigDialog( |
463 project, executables, params, mode="installer" |
460 project, executables, params, mode="installer" |
464 ) |
461 ) |
465 if dlg.exec() == QDialog.DialogCode.Accepted: |
462 if dlg.exec() == QDialog.DialogCode.Accepted: |
466 args, params, script = dlg.generateParameters() |
463 args, params, script = dlg.generateParameters() |
467 project.setData("PACKAGERSPARMS", "PYINSTALLER", params) |
464 project.setData("PACKAGERSPARMS", "PYINSTALLER", params) |
468 |
465 |
469 # now do the call |
466 # now do the call |
470 from PyInstallerInterface.PyInstallerExecDialog import ( |
|
471 PyInstallerExecDialog, |
|
472 ) |
|
473 |
|
474 dia = PyInstallerExecDialog("pyinstaller") |
467 dia = PyInstallerExecDialog("pyinstaller") |
475 dia.show() |
468 dia.show() |
476 res = dia.start(args, params, project, script) |
469 res = dia.start(args, project, script) |
477 if res: |
470 if res: |
478 dia.exec() |
471 dia.exec() |
479 |
472 |
480 @pyqtSlot() |
473 @pyqtSlot() |
481 def __pyiMakeSpec(self): |
474 def __pyiMakeSpec(self): |
482 """ |
475 """ |
483 Private slot to execute the pyi-makespec command for the current |
476 Private slot to execute the pyi-makespec command for the current |
484 project to generate a spec file to be used by pyinstaller. |
477 project to generate a spec file to be used by pyinstaller. |
485 """ |
478 """ |
|
479 from PyInstallerInterface.PyInstallerConfigDialog import PyInstallerConfigDialog |
|
480 from PyInstallerInterface.PyInstallerExecDialog import PyInstallerExecDialog |
|
481 |
486 project = ericApp().getObject("Project") |
482 project = ericApp().getObject("Project") |
487 majorVersionStr = project.getProjectLanguage() |
483 majorVersionStr = project.getProjectLanguage() |
488 if majorVersionStr == "Python3": |
484 if majorVersionStr == "Python3": |
489 executables = [ |
485 executables = [ |
490 f for f in exePy3 if f.endswith(("pyi-makespec", "pyi-makespec.exe")) |
486 f for f in exePy3 if f.endswith(("pyi-makespec", "pyi-makespec.exe")) |
491 ] |
487 ] |
492 if not executables: |
488 if not executables: |
493 EricMessageBox.critical( |
489 EricMessageBox.critical( |
494 self.__ui, |
490 self.__ui, |
495 self.tr("pyi-makespec"), |
491 self.tr("pyi-makespec"), |
496 self.tr( |
492 self.tr("""The pyi-makespec executable could not be found."""), |
497 """The pyi-makespec executable could not be""" """ found.""" |
|
498 ), |
|
499 ) |
493 ) |
500 return |
494 return |
501 |
495 |
502 # check if all files saved and errorfree before continue |
496 # check if all files saved and errorfree before continue |
503 if not project.checkAllScriptsDirty(reportSyntaxErrors=True): |
497 if not project.checkAllScriptsDirty(reportSyntaxErrors=True): |
504 return |
498 return |
505 |
|
506 from PyInstallerInterface.PyInstallerConfigDialog import ( |
|
507 PyInstallerConfigDialog, |
|
508 ) |
|
509 |
499 |
510 params = project.getData("PACKAGERSPARMS", "PYINSTALLER") |
500 params = project.getData("PACKAGERSPARMS", "PYINSTALLER") |
511 dlg = PyInstallerConfigDialog(project, executables, params, mode="spec") |
501 dlg = PyInstallerConfigDialog(project, executables, params, mode="spec") |
512 if dlg.exec() == QDialog.DialogCode.Accepted: |
502 if dlg.exec() == QDialog.DialogCode.Accepted: |
513 args, params, script = dlg.generateParameters() |
503 args, params, script = dlg.generateParameters() |
514 project.setData("PACKAGERSPARMS", "PYINSTALLER", params) |
504 project.setData("PACKAGERSPARMS", "PYINSTALLER", params) |
515 |
505 |
516 # now do the call |
506 # now do the call |
517 from PyInstallerInterface.PyInstallerExecDialog import ( |
|
518 PyInstallerExecDialog, |
|
519 ) |
|
520 |
|
521 dia = PyInstallerExecDialog("pyinstaller") |
507 dia = PyInstallerExecDialog("pyinstaller") |
522 dia.show() |
508 dia.show() |
523 res = dia.start(args, params, project, script) |
509 res = dia.start(args, project, script) |
524 if res: |
510 if res: |
525 dia.exec() |
511 dia.exec() |
526 |
512 |
527 @pyqtSlot() |
513 @pyqtSlot() |
528 def __pyinstallerCleanup(self): |
514 def __pyinstallerCleanup(self): |
529 """ |
515 """ |
530 Private slot to remove the directories created by pyinstaller. |
516 Private slot to remove the directories created by pyinstaller. |
531 """ |
517 """ |
532 project = ericApp().getObject("Project") |
|
533 |
|
534 from PyInstallerInterface.PyInstallerCleanupDialog import ( |
518 from PyInstallerInterface.PyInstallerCleanupDialog import ( |
535 PyInstallerCleanupDialog, |
519 PyInstallerCleanupDialog, |
536 ) |
520 ) |
|
521 |
|
522 project = ericApp().getObject("Project") |
537 |
523 |
538 dlg = PyInstallerCleanupDialog() |
524 dlg = PyInstallerCleanupDialog() |
539 if dlg.exec() == QDialog.DialogCode.Accepted: |
525 if dlg.exec() == QDialog.DialogCode.Accepted: |
540 removeDirs = dlg.getDirectories() |
526 removeDirs = dlg.getDirectories() |
541 for directory in removeDirs: |
527 for directory in removeDirs: |