_miamG.py 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. # import
  2. # ------------------------------------------------------------------------------------------
  3. import easygui, sys
  4. from multiprocessing import freeze_support
  5. # miam import
  6. import miamQT
  7. import WF_test_
  8. import myapp
  9. import miamResults4PublicationLIGHT
  10. import miamResults4PublicationPALETTE
  11. # ------------------------------------------------------------------------------------------
  12. # MIAM project 2020
  13. # ------------------------------------------------------------------------------------------
  14. # author: remi.cozot@univ-littoral.fr
  15. # ------------------------------------------------------------------------------------------
  16. def main():
  17. # MIAM MAIN CHOICE
  18. msg ="MIAM: main menu select action"
  19. title = "MIAM - Remi Cozot (c) 2020"
  20. choices = [ "load image (SDR): display image, Lightness Histogram, Palette.", # [0] load image (SDR): display image, Lightness Histogogram, Palette
  21. "launch QT interafce."] # [1] launch QT interafce
  22. # take into account command line arguments
  23. if len(sys.argv[1:])>=1:
  24. # sys.argv[0]) == name of module
  25. if (sys.argv[1]).isnumeric() :
  26. choice = choices[int(sys.argv[1])]
  27. # according to choice
  28. print("MIAM:"+choice)
  29. if choice == choices[0]: myapp.guiImage()
  30. elif choice == choices[1]: miamQT.startGUI()
  31. else:
  32. if choice: print("MIAM:" + choice + " unknown !")
  33. else: sys.exit(0)
  34. elif 'help' in sys.argv[1]:
  35. print("------ MIAM - Remi Cozot (c) 2020 ------")
  36. print("----------------------------------------------------------------")
  37. print("possible choices:")
  38. for i, c in enumerate(choices):
  39. print("python __miam.py ",i, ">",choices[i])
  40. print("----------------------------------------------------------------")
  41. sys.exit(0)
  42. else:
  43. choice = "error command line parameter: "+ sys.argv[1]
  44. else: # no parameter in command line (interactive mode)
  45. cont = True
  46. while cont:
  47. choice = easygui.choicebox(msg, title, choices)
  48. if choice:
  49. print("MIAM:"+choice)
  50. else: sys.exit(0)
  51. # according to choice
  52. if choice == choices[0]: myapp.guiImage()
  53. elif choice == choices[1]: miamQT.startGUI()
  54. # continue or stop
  55. msgRedo = "Do you want to continue?"
  56. titleRedo = "Please Confirm"
  57. cont = easygui.ccbox(msgRedo, titleRedo)
  58. # miamResults4PublicationPALETTE.clusterPalette()
  59. # miamResults4PublicationLIGHT.clusterLightnessHist()
  60. # myapp.guiSDR()
  61. # ------------------------------------------------------------------------------------------
  62. if __name__ == '__main__':
  63. freeze_support()
  64. main()
  65. # ------------------------------------------------------------------------------------------