1. # -*- coding: windows-1252 -*-
  2.  
  3. # sys.stdout.encoding
  4. # --> 'cp850'
  5. # sys.getdefaultencoding()
  6. # --> 'latin1'
  7. # locale.getdefaultlocale()
  8. # --> 'cp1252'
  9. # Apparemment sous win 2000 --> cp1252
  10. # -----------------------------------------------------------
  11. # Voir http://pythonfacile.free.fr/python/unicode.html
  12. # --> Terminal de sortie --> La fenetre DOS
  13. # Encodage de la fenetre DOS --> 'cp850'
  14. # -----------------------------------------------------------
  15.  
  16. import os
  17. import sys
  18. import time
  19. import glob
  20. import _winreg
  21. import subprocess
  22. import locale
  23. import string
  24. import webbrowser
  25.  
  26. import tarfile
  27.  
  28. #import Tkinter
  29. from Tkinter import *
  30. from SimpleDialog import SimpleDialog
  31. import tkMessageBox
  32.  
  33. "#! "+sys.executable
  34.  
  35.  
  36. class DetectionRegistreApplis(object):
  37.  
  38. def __init__(self):
  39.  
  40. # Initialisation de la fonction contenant les
  41. # textes (version française et anglaise)
  42. self.txt = self.textes()
  43.  
  44. self.root = Tk()
  45. self.root.geometry("666x234+160+50")
  46. self.root.maxsize(666, 234)
  47. self.root.minsize(666, 234)
  48. self.root.config(relief=GROOVE)
  49. self.root.title(self.titre_fenetre)
  50.  
  51. frame_parent = Frame(self.root, height=300, width=700, relief=GROOVE)
  52. frame_parent.pack()
  53.  
  54. framePresentation = Frame(frame_parent, height=126, width=660, bd=0, relief=GROOVE)
  55. framePresentation.pack()
  56.  
  57. frameCheck = Frame(frame_parent, height=200, width=400, bd=0, relief=GROOVE)
  58. frameCheck.pack()
  59.  
  60. frameVide = Frame(frame_parent, height=20, width=500, bd=0, relief=GROOVE)
  61. frameVide.pack()
  62.  
  63. frameBoutonCapture = Frame(frame_parent, height=66, width=500, bd=2, relief=GROOVE)
  64. frameBoutonCapture.pack()
  65.  
  66. image_logo = PhotoImage(file = "logo_ekd.gif")
  67. Label(framePresentation, image = image_logo).place(x=6, y=8)
  68.  
  69. texteCheck = Message(framePresentation, text=self.presentation, width=570)
  70. texteCheck.place(x=110, y=2)
  71.  
  72. # Definition de chaque variable pour les lecteurs
  73. v = (IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False), IntVar(value=False))
  74. # ...
  75. (self.varC, self.varD, self.varE, self.varF, self.varG, self.varH, self.varI, self.varJ, self.varK, self.varL, self.varM, self.varN, self.varO, self.varP, self.varQ, self.varR, self.varS, self.varT, self.varU, self.varV, self.varW, self.varX, self.varY, self.varZ) = v
  76. #
  77. # Liste des donnees pour les cases a cocher
  78. listeCheck = [["C:", self.varC, self.capture, 0, 0], ["D:", self.varD, self.capture, 0, 1], ["E:", self.varE, self.capture, 0, 2], ["F:", self.varF, self.capture, 0, 3], ["G:", self.varG, self.capture, 0, 4], ["H:", self.varH, self.capture, 0, 5], ["I:", self.varI, self.capture, 0, 6], ["J:", self.varJ, self.capture, 0, 7], ["K:", self.varK, self.capture, 0, 8], ["L:", self.varL, self.capture, 0, 9], ["M:", self.varM, self.capture, 0, 10], ["N:", self.varN, self.capture, 0, 11],["O:", self.varO, self.capture, 0, 12], ["P:", self.varP, self.capture, 0, 13], ["Q:", self.varQ, self.capture, 1, 0], ["R:", self.varR, self.capture, 1, 1], ["S:", self.varS, self.capture, 1, 2], ["T:", self.varT, self.capture, 1, 3], ["U:", self.varU, self.capture, 1, 4], ["V:", self.varV, self.capture, 1, 5], ["W:", self.varW, self.capture, 1, 6], ["X:", self.varX, self.capture, 1, 7], ["Y:", self.varY, self.capture, 1, 8], ["Z:", self.varZ, self.capture, 1, 9]]
  79. #
  80. # Boucle d'assignation des cases a cocher
  81. for parcCheck in listeCheck:
  82. Checkbutton(frameCheck, text=parcCheck[0], variable=parcCheck[1], command=parcCheck[2]).grid(row = parcCheck[3], column = parcCheck[4])
  83. #
  84. button_quitter = Button(frameBoutonCapture, text = self.bouton_quitter, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = self.root.quit)
  85. button_quitter.place(x = 8, y = 8)
  86. #
  87. button_aide = Button(frameBoutonCapture, text = self.bouton_aide, bg = 'blue', fg = 'white', activebackground = 'blue', activeforeground = 'white', command = self.aide)
  88. button_aide.place(x = 161, y = 8)
  89. #
  90. button_install = Button(frameBoutonCapture, text = self.demarr_install, bg = 'blue', fg = 'white', activebackground = 'blue', activeforeground = 'white', command = self.action)
  91. button_install.place(x = 300, y = 8)
  92. #
  93. self.root.mainloop()
  94.  
  95.  
  96. def capture(self, event=None):
  97.  
  98. # Liste contenant la capture de tous les lecteurs [[capture_lecteur, nom_lecteur], ...]
  99. listeCapt = [[self.varC.get(), "C:"], [self.varD.get(), "D:"], [self.varE.get(), "E:"], [self.varF.get(), "F:"], [self.varG.get(), "G:"], [self.varH.get(), "H:"], [self.varI.get(), "I:"], [self.varJ.get(), "J:"], [self.varK.get(), "K:"], [self.varL.get(), "L:"], [self.varM.get(), "M:"], [self.varN.get(), "N:"], [self.varO.get(), "O:"], [self.varP.get(), "P:"], [self.varQ.get(), "Q:"], [self.varR.get(), "R:"], [self.varS.get(), "S:"], [self.varT.get(), "T:"], [self.varU.get(), "U:"], [self.varV.get(), "V:"], [self.varW.get(), "W:"], [self.varX.get(), "X:"], [self.varY.get(), "Y:"], [self.varZ.get(), "Z:"]]
  100.  
  101. # Liste contenant les lecteurs selectionnes par l'utilisateur
  102. self.liste_capt_lecteur = [parcCaptLect[1] for parcCaptLect in listeCapt if parcCaptLect[0] == 1]
  103. #
  104. print self.liste_retenue, self.liste_capt_lecteur
  105.  
  106.  
  107. def aide(self):
  108. "Fenetre supplementaire pour afficher l'aide en ligne"
  109.  
  110. # Initialisation de la fonction contenant les
  111. # textes (version francaise et anglaise)
  112. self.txt = self.textes()
  113.  
  114. top = Toplevel()
  115. top.geometry("500x220+242+70")
  116. top.maxsize(500, 200)
  117. top.minsize(500, 200)
  118. top.config(relief=GROOVE)
  119. top.title(self.titre_fen)
  120.  
  121. frame_lien_aide = Frame(top, height=250, width=500, bd=0, relief=GROOVE)
  122. frame_lien_aide.pack()
  123.  
  124. texte_lien_1_aide = Message(frame_lien_aide, text=self.txt_lien_1_aide, width=500)
  125. texte_lien_1_aide.pack(side=TOP)
  126.  
  127. bouton_lien_1_aide = Button(frame_lien_aide, text = self.bouton_lien_1_aide, bg = 'yellow', fg = 'black', activebackground = 'yellow', activeforeground = 'black', command = self.lien_1_aide)
  128. bouton_lien_1_aide.pack()
  129.  
  130. texte_lien_2_aide = Message(frame_lien_aide, text=self.txt_lien_2_aide, width=500)
  131. texte_lien_2_aide.pack(side=TOP)
  132.  
  133. bouton_lien_2_aide = Button(frame_lien_aide, text = self.bouton_lien_2_aide, bg = 'yellow', fg = 'black', activebackground = 'yellow', activeforeground = 'black', command = self.lien_2_aide)
  134. bouton_lien_2_aide.pack()
  135.  
  136. texte_lien_3_aide = Message(frame_lien_aide, text=self.txt_lien_3_aide, width=500)
  137. texte_lien_3_aide.pack(side=TOP)
  138.  
  139. bouton_lien_3_aide = Button(frame_lien_aide, text = self.bouton_lien_3_aide, bg = 'yellow', fg = 'black', activebackground = 'yellow', activeforeground = 'black', command = self.lien_3_aide)
  140. bouton_lien_3_aide.pack()
  141.  
  142. frame_bout_fermer = Frame(top, height=200, width=300, bd=2, relief=GROOVE)
  143. frame_bout_fermer.place(x = 210, y = 170)
  144.  
  145. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  146. bouton_fermer_top.pack()
  147.  
  148.  
  149. def lien_1_aide(self):
  150.  
  151. webbrowser.open('http://ekd.tuxfamily.org/index.php/Telechargement/Windows#toc3')
  152.  
  153.  
  154. def lien_2_aide(self):
  155.  
  156. webbrowser.open('http://ekd.tuxfamily.org/index.php/Telechargement/Windows#toc5')
  157.  
  158.  
  159. def lien_3_aide(self):
  160.  
  161. webbrowser.open('http://ekd.tuxfamily.org/index.php/Telechargement/Windows#toc4')
  162.  
  163.  
  164. def erreurDepMencoder(self):
  165. "Fenetre supplementaire pour afficher l'erreur si Mplayer-Mencoder absent"
  166.  
  167. # Initialisation de la fonction contenant les
  168. # textes (version francaise et anglaise)
  169. self.txt = self.textes()
  170.  
  171. top = Toplevel()
  172. top.geometry("500x86+242+100")
  173. top.maxsize(500, 86)
  174. top.minsize(500, 86)
  175. top.config(relief=GROOVE)
  176. top.title(self.titre_dep_manq)
  177.  
  178. frame_err_menc = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  179. frame_err_menc.pack()
  180.  
  181. texte_err_menc = Message(frame_err_menc, text=self.txt_mencoder_manq, width=500)
  182. texte_err_menc.pack()
  183.  
  184. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  185. frame_bout_fermer.place(x = 210, y = 42)
  186.  
  187. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  188. bouton_fermer_top.pack()
  189.  
  190.  
  191. def erreurDepFFmpeg(self):
  192. "Fenetre supplementaire pour afficher l'erreur si FFmpeg absent"
  193.  
  194. # Initialisation de la fonction contenant les
  195. # textes (version francaise et anglaise)
  196. self.txt = self.textes()
  197.  
  198. top = Toplevel()
  199. top.geometry("500x86+242+100")
  200. top.maxsize(500, 86)
  201. top.minsize(500, 86)
  202. top.config(relief=GROOVE)
  203. top.title(self.titre_dep_manq)
  204.  
  205. frame_err_ffmpeg = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  206. frame_err_ffmpeg.pack()
  207.  
  208. texte_err_ffmpeg = Message(frame_err_ffmpeg, text=self.txt_ffmpeg_manq, width=500)
  209. texte_err_ffmpeg.pack()
  210.  
  211. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  212. frame_bout_fermer.place(x = 210, y = 42)
  213.  
  214. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  215. bouton_fermer_top.pack()
  216.  
  217.  
  218. def erreurDepFFmpeg2theora(self):
  219. "Fenetre supplementaire pour afficher l'erreur si FFmpeg2theora absent"
  220.  
  221. # Initialisation de la fonction contenant les
  222. # textes (version francaise et anglaise)
  223. self.txt = self.textes()
  224.  
  225. top = Toplevel()
  226. top.geometry("500x86+242+100")
  227. top.maxsize(500, 86)
  228. top.minsize(500, 86)
  229. top.config(relief=GROOVE)
  230. top.title(self.titre_dep_manq)
  231.  
  232. frame_err_ffmpeg2theora = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  233. frame_err_ffmpeg2theora.pack()
  234.  
  235. texte_err_ffmpeg2theora = Message(frame_err_ffmpeg2theora, text=self.txt_ffmpeg2theora_manq, width=500)
  236. texte_err_ffmpeg2theora.pack()
  237.  
  238. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  239. frame_bout_fermer.place(x = 210, y = 42)
  240.  
  241. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  242. bouton_fermer_top.pack()
  243.  
  244.  
  245. def erreurDepImageMagick(self):
  246. "Fenetre supplementaire pour afficher l'erreur si ImageMagick absent"
  247.  
  248. # Initialisation de la fonction contenant les
  249. # textes (version francaise et anglaise)
  250. self.txt = self.textes()
  251.  
  252. top = Toplevel()
  253. top.geometry("500x86+242+100")
  254. top.maxsize(500, 86)
  255. top.minsize(500, 86)
  256. top.config(relief=GROOVE)
  257. top.title(self.titre_dep_manq)
  258.  
  259. frame_err_imageMagick = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  260. frame_err_imageMagick.pack()
  261.  
  262. texte_err_imageMagick = Message(frame_err_imageMagick, text=self.txt_imageMagick_manq, width=500)
  263. texte_err_imageMagick.pack()
  264.  
  265. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  266. frame_bout_fermer.place(x = 210, y = 42)
  267.  
  268. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  269. bouton_fermer_top.pack()
  270.  
  271.  
  272. def erreurDepImagePIL(self):
  273. "Fenetre supplementaire pour afficher l'erreur si Python Imaging Library absent"
  274.  
  275. # Initialisation de la fonction contenant les
  276. # textes (version francaise et anglaise)
  277. self.txt = self.textes()
  278.  
  279. top = Toplevel()
  280. top.geometry("500x86+242+100")
  281. top.maxsize(500, 86)
  282. top.minsize(500, 86)
  283. top.config(relief=GROOVE)
  284. top.title(self.titre_dep_manq)
  285.  
  286. frame_err_pil = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  287. frame_err_pil.pack()
  288.  
  289. texte_err_pil = Message(frame_err_pil, text=self.txt_pil_manq, width=500)
  290. texte_err_pil.pack()
  291.  
  292. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  293. frame_bout_fermer.place(x = 210, y = 42)
  294.  
  295. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  296. bouton_fermer_top.pack()
  297.  
  298.  
  299. def erreurDepImagePyQt4(self):
  300. "Fenetre supplementaire pour afficher l'erreur si PyQt4 absent"
  301.  
  302. # Initialisation de la fonction contenant les
  303. # textes (version francaise et anglaise)
  304. self.txt = self.textes()
  305.  
  306. top = Toplevel()
  307. top.geometry("500x86+242+100")
  308. top.maxsize(500, 86)
  309. top.minsize(500, 86)
  310. top.config(relief=GROOVE)
  311. top.title(self.titre_dep_manq)
  312.  
  313. frame_err_pyqt4 = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  314. frame_err_pyqt4.pack()
  315.  
  316. texte_err_pyqt4 = Message(frame_err_pyqt4, text=self.txt_pyqt4_manq, width=500)
  317. texte_err_pyqt4.pack()
  318.  
  319. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  320. frame_bout_fermer.place(x = 210, y = 42)
  321.  
  322. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  323. bouton_fermer_top.pack()
  324.  
  325.  
  326. def erreurDepImageNumpy(self):
  327. "Fenetre supplementaire pour afficher l'erreur si Numpy absent"
  328.  
  329. # Initialisation de la fonction contenant les
  330. # textes (version francaise et anglaise)
  331. self.txt = self.textes()
  332.  
  333. top = Toplevel()
  334. top.geometry("500x86+242+100")
  335. top.maxsize(500, 86)
  336. top.minsize(500, 86)
  337. top.config(relief=GROOVE)
  338. top.title(self.titre_dep_manq)
  339.  
  340. frame_err_numpy = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  341. frame_err_numpy.pack()
  342.  
  343. texte_err_numpy = Message(frame_err_numpy, text=self.txt_numpy_manq, width=500)
  344. texte_err_numpy.pack()
  345.  
  346. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  347. frame_bout_fermer.place(x = 210, y = 42)
  348.  
  349. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  350. bouton_fermer_top.pack()
  351.  
  352.  
  353. def erreurDepImageLame(self):
  354. "Fenetre supplementaire pour afficher l'erreur si Lame absent"
  355.  
  356. # Initialisation de la fonction contenant les
  357. # textes (version francaise et anglaise)
  358. self.txt = self.textes()
  359.  
  360. top = Toplevel()
  361. top.geometry("500x86+242+100")
  362. top.maxsize(500, 86)
  363. top.minsize(500, 86)
  364. top.config(relief=GROOVE)
  365. top.title(self.titre_dep_manq)
  366.  
  367. frame_err_lame = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  368. frame_err_lame.pack()
  369.  
  370. texte_err_lame = Message(frame_err_lame, text=self.txt_lame_manq, width=500)
  371. texte_err_lame.pack()
  372.  
  373. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  374. frame_bout_fermer.place(x = 210, y = 42)
  375.  
  376. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  377. bouton_fermer_top.pack()
  378.  
  379.  
  380. def erreurDepImageMjpegtools(self):
  381. "Fenetre supplementaire pour afficher l'erreur si Mjpegtools absent"
  382.  
  383. # Initialisation de la fonction contenant les
  384. # textes (version francaise et anglaise)
  385. self.txt = self.textes()
  386.  
  387. top = Toplevel()
  388. top.geometry("500x86+242+100")
  389. top.maxsize(500, 86)
  390. top.minsize(500, 86)
  391. top.config(relief=GROOVE)
  392. top.title(self.titre_dep_manq)
  393.  
  394. frame_err_mjpegtools = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  395. frame_err_mjpegtools.pack()
  396.  
  397. texte_err_mjpegtools = Message(frame_err_mjpegtools, text=self.txt_mjpegtools_manq, width=500)
  398. texte_err_mjpegtools.pack()
  399.  
  400. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  401. frame_bout_fermer.place(x = 210, y = 42)
  402.  
  403. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  404. bouton_fermer_top.pack()
  405.  
  406.  
  407. def erreurDepImageSox(self):
  408. "Fenetre supplementaire pour afficher l'erreur si Sox absent"
  409.  
  410. # Initialisation de la fonction contenant les
  411. # textes (version francaise et anglaise)
  412. self.txt = self.textes()
  413.  
  414. top = Toplevel()
  415. top.geometry("500x86+242+100")
  416. top.maxsize(500, 86)
  417. top.minsize(500, 86)
  418. top.config(relief=GROOVE)
  419. top.title(self.titre_dep_manq)
  420.  
  421. frame_err_sox = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  422. frame_err_sox.pack()
  423.  
  424. texte_err_sox = Message(frame_err_sox, text=self.txt_sox_manq, width=500)
  425. texte_err_sox.pack()
  426.  
  427. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  428. frame_bout_fermer.place(x = 210, y = 42)
  429.  
  430. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  431. bouton_fermer_top.pack()
  432.  
  433.  
  434. def erreurDepImageGMIC(self):
  435. "Fenetre supplementaire pour afficher l'erreur si GMIC absent"
  436.  
  437. # Initialisation de la fonction contenant les
  438. # textes (version francaise et anglaise)
  439. self.txt = self.textes()
  440.  
  441. top = Toplevel()
  442. top.geometry("500x86+242+100")
  443. top.maxsize(500, 86)
  444. top.minsize(500, 86)
  445. top.config(relief=GROOVE)
  446. top.title(self.titre_dep_manq)
  447.  
  448. frame_err_gmic = Frame(top, height=86, width=500, bd=0, relief=GROOVE)
  449. frame_err_gmic.pack()
  450.  
  451. texte_err_gmic = Message(frame_err_gmic, text=self.txt_gmic_manq, width=500)
  452. texte_err_gmic.pack()
  453.  
  454. frame_bout_fermer = Frame(top, height=86, width=300, bd=2, relief=GROOVE)
  455. frame_bout_fermer.place(x = 210, y = 42)
  456.  
  457. bouton_fermer_top = Button(frame_bout_fermer, text = self.bouton_fermer, bg = 'red', fg = 'white', activebackground = 'red', activeforeground = 'white', command = top.destroy)
  458. bouton_fermer_top.pack()
  459.  
  460.  
  461. def textes(self):
  462.  
  463. # Version de la locale (fr pour langue francaise)
  464. langue = locale.getdefaultlocale()[0][:2]
  465.  
  466. # Date et heure courante
  467. from time import strftime
  468. #self.date = strftime("%Y-%m-%d %H:%M:%S")
  469.  
  470. if langue == 'fr': # francais
  471. self.titre_fenetre = "Installation graphique d'EKD sous Windows"
  472. self.bouton_quitter = "Quitter"
  473. self.bouton_fermer = "Fermer"
  474. self.bouton_aide = "Aide"
  475. self.demarr_install = "Cliquez ici pour d�marrer l'installation"
  476. self.presentation = "EKD est une application de post-production pour vid�o, image et fichier audio. Voici la fen�tre d'installation pour Windows (XP, Vista et Seven).\n\nDans un premier temps il vous est demand� de renseigner dans quel(s) lecteur(s) est/sont install�(es) les d�pendances utiles au fonctionnement du logiciel (les d�pendances en question sont le pack codec Satsuki, ImageMagick, Python, Python Imaging Library, Numpy et PyQt4). Cochez (ou d�cochez) les cases ci-dessous:"
  477. self.liste_retenue = "Liste des disques retenus: "
  478. self.titreInfoQuest = "Informations/Question"
  479. self.TitreErrNonSelectLect = "Erreur"
  480. self.errNonSelectLect = "Premier cas d'erreur ; vous devez s�lectionner au moins un lecteur ! Retournez dans la fen�tre principale et cochez les bonnes cases.\nDeuxi�me cas d'erreur ; vous essayez d'installer EKD mais votre nom d'utilisateur comporte un accent EKD ne peut pas s'installer si votre nom d'utilisateur comporte un accent)."
  481. self.date = strftime("%d/%m/%Y � %H:%M:%S")
  482. self.renseignements_collectes = "Installation faite le %s\n" % self.date
  483.  
  484. # Aide
  485. self.titre_fen = "Aide � l'installation d'EKD"
  486. self.txt_lien_1_aide = "1) Tout d'abord, vous devez installer les d�pendances d'EKD (indispensable pour son fonctionnement !):"
  487. self.bouton_lien_1_aide = "Installation des d�pendances"
  488. self.txt_lien_2_aide = "2) Ensuite, installez l'ex�cutable d'EKD (suivez bien les indications si vous installez sous windows Vista ou windows Seven !):"
  489. self.bouton_lien_2_aide = "Installation de l'ex�cutable d'EKD"
  490. self.txt_lien_3_aide = "3) Pour finir proc�dez � l'�tape finale de l'installation (celle que vous �tes en train d'effectuer en ce moment):"
  491. self.bouton_lien_3_aide = "Rep�rage des d�pendances d'EKD"
  492.  
  493. # Titre fenetre erreur installation depeandance
  494. self.titre_dep_manq = "Erreur, d�pendance manquante !"
  495. # Erreur install dependance --> Mplayer-Mencoder
  496. self.txt_mencoder_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� Mplayer-Mencoder. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de Mplayer-Mencoder."
  497. # Erreur install dependance --> FFmpeg
  498. self.txt_ffmpeg_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� FFmpeg. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de FFmpeg."
  499. # Erreur install dependance --> FFmpeg2theora
  500. self.txt_ffmpeg2theora_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� FFmpeg2theora. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de FFmpeg2theora."
  501. # Erreur install dependance --> ImageMagick
  502. self.txt_imageMagick_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� ImageMagick. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de ImageMagick."
  503. # Erreur install dependance --> Python Imaging Library
  504. self.txt_pil_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� Python Imaging Library. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de Python Imaging Library."
  505. # Erreur install dependance --> PyQt4
  506. self.txt_pyqt4_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� PyQt4. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de PyQt4."
  507. # Erreur install dependance --> Numpy
  508. self.txt_numpy_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� Numpy. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de Numpy."
  509. # Erreur install dependance --> Lame
  510. self.txt_lame_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� Lame. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de Lame."
  511. # Erreur install dependance --> Mjpegtools
  512. self.txt_mjpegtools_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� Mjpegtools. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de Mjpegtools."
  513. # Erreur install dependance --> Sox
  514. self.txt_sox_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� Sox. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de Sox."
  515. # Erreur install dependance --> GMIC
  516. self.txt_gmic_manq = "EKD ne d�marrera pas tant que vous n'aurez pas install� G'MIC. Cliquez sur le bouton Aide pour plus d'informations sur l'installation de G'MIC."
  517.  
  518.  
  519. def action(self):
  520.  
  521. # Initialisation de la fonction contenant les
  522. # textes (version francaise et anglaise)
  523. self.txt = self.textes()
  524.  
  525. # Version de la locale (fr pour langue francaise)
  526. langue = locale.getdefaultlocale()[0][:2]
  527.  
  528. separ = "# ----------------------------------------------------- #"
  529.  
  530. # Liste qui devra contenir toutes les informations collectées lors de l'installation
  531. liste_ecr_fichier = []
  532.  
  533. liste_ecr_fichier.append(separ+"\n"+self.renseignements_collectes+separ+"\n"+"Utilisateur courant: "+os.path.expanduser('~')+'\n')
  534.  
  535. # Ecriture prealable du fichier sauv_txt_install_ekd.txt si erreur quelconque
  536. chemSauvInstall_1 = open(os.path.expanduser('~')+os.sep+'sauv_txt_install_ekd.txt', 'w')
  537. #chemSauvInstall_1.write("".join(liste_ecr_fichier)+'\n'+self.erreur_ecr_fich_install)
  538. chemSauvInstall_1.write("".join(liste_ecr_fichier)+'\n')
  539. chemSauvInstall_1.close()
  540.  
  541. # ---------------------------------------------------------- #
  542. # Exception principale (du moteur)
  543. # ---------------------------------------------------------- #
  544. try:
  545.  
  546. # Lecteurs sélectionnes sous forme de chaine de caractere
  547. choixLect = ", ".join(self.liste_capt_lecteur)
  548. #
  549. if langue == 'fr': # francais
  550. texteInfo = "Recherche des d�pendances pour le bon fonctionnement du logiciel, sur le(s) lecteur(s): %s.\nA la fin de cette proc�dure votre ordinateur va red�marrer (n'oubliez pas de fermer toutes les applications en cours de fonctionnement).\n\nEtes-vous d'accord pour continuer ?" % choixLect
  551.  
  552.  
  553. liste_ecr_fichier.append(self.liste_retenue+choixLect+'\n')
  554.  
  555. tkMessageBox.askyesno(self.titreInfoQuest, texteInfo)
  556.  
  557. # --------------------- DEBUT MOTEUR ----------------------- #
  558.  
  559. "Detection des applications utiles pour le bon fonctionnement d'EKD sous Windows Xp"
  560.  
  561. # Temps debut pour calcul
  562. self.debut = time.clock()
  563.  
  564. ### Debut decompactage de l'archibve .tar.gz ################################
  565.  
  566. # Chemin du script courant en eliminant dependances_windows
  567. chemin = os.getcwd()
  568.  
  569. # Recherche du chemin de l'archive .tar.gz
  570. recherche_tar_gz = glob.glob(chemin + os.sep + 'windows' + os.sep + '*.tar.gz')
  571. recherche_tar_gz = recherche_tar_gz[0]
  572.  
  573. # Repertoire ds lequel sera decompacte l'archive
  574. rep_tar_gz = os.path.dirname(recherche_tar_gz)
  575.  
  576. # Repertoire Mplayer
  577. rep_mplayer = recherche_tar_gz.split('.')
  578. rep_mplayer = rep_mplayer[0]
  579.  
  580. if os.path.exists(recherche_tar_gz) is True:
  581. # Si le repertoire Mplayer existe deja pas la peine de decompacter l'archive
  582. if os.path.exists(rep_mplayer) is False:
  583. # Decompactage de trunk.tar.gz dans le repertoire courant
  584. t = tarfile.open(name=recherche_tar_gz, mode='r', fileobj=None, bufsize=10240)
  585. t.extractall(path=rep_tar_gz, members=None)
  586. print separ
  587. if langue == 'fr': # francais
  588. extract_tar_gz_fr = "Extraction de l'archive: %s --> OK" % os.path.basename(recherche_tar_gz)
  589. liste_ecr_fichier.append(extract_tar_gz_fr+'\n')
  590. print extract_tar_gz_fr
  591. else: # autre que fr
  592. extract_tar_gz_en = 'Extracting the archive: %s --> OK' % os.path.basename(recherche_tar_gz)
  593. liste_ecr_fichier.append(extract_tar_gz_fr+'\n')
  594. print extract_tar_gz_en
  595. print separ
  596. else: pass
  597.  
  598. # Elimination de l'archive elle-meme
  599. # N'est pas elimine pour l'instant
  600. #os.remove(recherche_tar_gz)
  601.  
  602. ### Fin decompactage de l'archibve .tar.gz ##################################
  603.  
  604. # Si il manque un fichier dans le repertoire 'windows\chemin_install_applis'
  605. # dans l'arborescence d'EKD (il doit y en avoir 11):
  606. # --> install_de_mencoder.txt
  607. # --> install_de_ffmpeg.txt
  608. # --> install_de_pil.txt
  609. # --> install_de_numpy.txt
  610. # --> install_de_pyqt4.txt
  611. # --> install_de_imagemagick.txt
  612. # --> install_de_ffmpeg2theora.txt
  613. # --> install_de_lame.txt
  614. # --> install_de_mjpegtools.txt
  615. # --> install_de_sox.txt
  616. # --> install_de_gmic.txt
  617. # ... les fichiers presents sont elimines ... et tout recommencera
  618. # a fonctionner normalement quand l'utilisateur aura bien installe
  619. # toutes les dependances
  620.  
  621. # Si il y a 11 elements, il faut mettre --> < 11
  622. if len(glob.glob('windows/chemin_install_applis/*')) < 11:
  623. for fichManq in glob.glob('windows/chemin_install_applis/*'):
  624. os.remove(fichManq)
  625.  
  626. listeAppliWin = [('install_de_mencoder.txt','mplayer,mencoder'),('install_de_ffmpeg.txt','ffmpeg'),('install_de_pil.txt','pil'),('install_de_numpy.txt','numpy'),('install_de_pyqt4.txt','pyqt4'),('install_de_imagemagick.txt','imagemagick'),('install_de_ffmpeg2theora.txt','ffmpeg2theora'),('install_de_lame.txt','lame'),('install_de_mjpegtools.txt','mjpegtools'),('install_de_sox.txt','sox'),('install_de_gmic.txt','gmic')]
  627.  
  628. # Boucle de parcours de la listeAppliWin pour verifier la presence des fichiers de config et qu'ils sont non nuls.
  629. z = 0
  630. for depWin in listeAppliWin:
  631. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\'+depWin[0]):
  632. if os.path.getsize(os.getcwd()+'\\windows\\chemin_install_applis\\'+depWin[0])>0:
  633. ouv1 = open(os.getcwd()+'\\windows\\chemin_install_applis\\'+depWin[0], 'r')
  634. self.repOuSeTrouveMplayMenc = ouv1.read()
  635. # print '* '+depWin[1]+' --> OK'
  636. ouv1.close()
  637. else:
  638. os.remove(os.getcwd()+'\\windows\\chemin_install_applis\\'+depWin[0])
  639. z = 1
  640. else :
  641. z = 1
  642.  
  643. if z == 1:
  644.  
  645. # Si le repertoire n'existe pas, il est cree
  646. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis') is False:
  647. os.mkdir(os.getcwd()+os.sep+'windows'+os.sep+'chemin_install_applis')
  648.  
  649. mencoder = 'mencoder.exe'
  650. ffmpeg = 'ffmpeg.exe'
  651. ffmpeg2theora = 'ffmpeg2theora.exe'
  652. imgMagick = 'composite.exe'
  653. pil = 'Image.py'
  654. pyQt4 = 'QtGui.pyd'
  655. numpy = 'fftpack.py'
  656. lame = 'lame.exe'
  657. mjpegtools_ppmtoy4m = 'ppmtoy4m.exe'
  658. sox = 'sox.exe'
  659. gmic = 'gmic.exe'
  660. # site.py pour pour changer l'encodage
  661. sitePointPy = 'site.py'
  662.  
  663. listeChemMencoder = []
  664. listeChemFfmpeg = []
  665. listeChemFfmpeg2Theora = []
  666. listeChemImageMagick = []
  667. listeChemPil = []
  668. listeChemPyQt4 = []
  669. listeChemNumpy = []
  670. listeChemLame = []
  671. listeChemMjpegtools = []
  672. listeChemSox = []
  673. listeChemGMIC = []
  674. # Pour fichier site.py
  675. listeChemSitePointPy = []
  676.  
  677. # Liste des applications a chercher
  678. liste_applis = [[mencoder,listeChemMencoder,0], [ffmpeg,listeChemFfmpeg,0], [ffmpeg2theora,listeChemFfmpeg2Theora,0], [imgMagick,listeChemImageMagick,0], [pil,listeChemPil,0], [pyQt4,listeChemPyQt4,0], [numpy,listeChemNumpy,0], [lame,listeChemLame,0], [mjpegtools_ppmtoy4m,listeChemMjpegtools,0], [sox,listeChemSox,0], [gmic,listeChemGMIC,0], [sitePointPy,listeChemSitePointPy,0]]
  679.  
  680. # Temps debut pour calcul
  681. debut = time.clock()
  682.  
  683. # Appel de la fonction find. Ajoute par Mireaux pour augmenter la rapidite de
  684. # detection du chemin vers les dependances d'EKD (donc la 2eme partie de
  685. # l'install d'EKD). Discussion visible ici:
  686. # http://ekd.tuxfamily.org/forum/showthread.php?tid=210&page=1
  687. remaining = len(liste_applis)
  688. for parc_dd in self.liste_capt_lecteur:
  689. remaining = self.find(parc_dd, liste_applis, remaining)
  690. if remaining == 0:
  691. break
  692.  
  693. # Si la recherche echoue (logs non installes par exemple)
  694. # elle donne lieu a une liste vide (ne contenant rien -->
  695. # meme par a une chaine vide). Le code ci-dessous insere
  696. # (dans ce cas) une chaine vide dans les listes concernees
  697. if listeChemMencoder == []: listeChemMencoder.append('')
  698. if listeChemFfmpeg == []: listeChemFfmpeg.append('')
  699. if listeChemFfmpeg2Theora == []: listeChemFfmpeg2Theora.append('')
  700. if listeChemImageMagick == []: listeChemImageMagick.append('')
  701. if listeChemPil == []: listeChemPil.append('')
  702. if listeChemPyQt4 == []: listeChemPyQt4.append('')
  703. if listeChemNumpy == []: listeChemNumpy.append('')
  704. if listeChemLame == []: listeChemLame.append('')
  705. if listeChemMjpegtools == []: listeChemMjpegtools.append('')
  706. if listeChemSox == []: listeChemSox.append('')
  707. if listeChemGMIC == []: listeChemGMIC.append('')
  708.  
  709. # Repertoire ou se trouve mplayer.exe et mencoder.exe
  710. self.repOuSeTrouveMplayMenc = listeChemMencoder[0]
  711. # Si Mplayer-Mencoder n'est pas installe, la fenetre d'erreur s'affiche
  712. if self.repOuSeTrouveMplayMenc == '': self.erreurDepMencoder()
  713.  
  714. # Repertoire ou se trouve ffmpeg.exe
  715. self.repOuSeTrouveFfmpeg = listeChemFfmpeg[0]
  716. # Si FFmpeg n'est pas installe, la fenetre d'erreur s'affiche
  717. if self.repOuSeTrouveFfmpeg == '': self.erreurDepFFmpeg()
  718.  
  719. # Repertoire ou se trouve ffmeg2theora
  720. self.repOuSeTrouveFfmpeg2theora = listeChemFfmpeg2Theora[0]
  721. # Si FFmpeg2theora n'est pas installe, la fenetre d'erreur s'affiche
  722. if self.repOuSeTrouveFfmpeg2theora == '': self.erreurDepFFmpeg2theora()
  723.  
  724. # Repertoire ou se trouve composite.exe d'ImageMagick
  725. self.repOuSeTrouveImgMagick = listeChemImageMagick[0]
  726. # Si ImageMagick n'est pas installe, la fenetre d'erreur s'affiche
  727. if self.repOuSeTrouveImgMagick == '': self.erreurDepImageMagick()
  728.  
  729. # Repertoire ou se trouve Python Imaging Library
  730. self.repOuSeTrouvePIL = listeChemPil[0]
  731. # Si Python Imaging Library n'est pas installe, la fenetre d'erreur s'affiche
  732. if self.repOuSeTrouvePIL == '': self.erreurDepImagePIL()
  733.  
  734. # Repertoire ou se trouve PyQt4
  735. self.repOuSeTrouvePyQt4 = listeChemPyQt4[0]
  736. # Si PyQt4 n'est pas installe, la fenetre d'erreur s'affiche
  737. if self.repOuSeTrouvePyQt4 == '': self.erreurDepImagePyQt4()
  738.  
  739. # Repertoire ou se trouve Numpy
  740. self.repOuSeTrouveNumpy = listeChemNumpy[0]
  741. # Si Numpy n'est pas installe, la fenetre d'erreur s'affiche
  742. if self.repOuSeTrouveNumpy == '': self.erreurDepImageNumpy()
  743.  
  744. # Repertoire ou se trouve Lame
  745. self.repOuSeTrouveLame = listeChemLame[0]
  746. # Si Lame n'est pas installe, la fenetre d'erreur s'affiche
  747. if self.repOuSeTrouveLame == '': self.erreurDepImageLame()
  748.  
  749. # Repertoire ou se trouve Mjpegtools
  750. self.repOuSeTrouveMjpegtools = listeChemMjpegtools[0]
  751. # Si Mjpegtools n'est pas installe, la fenetre d'erreur s'affiche
  752. if self.repOuSeTrouveMjpegtools == '': self.erreurDepImageMjpegtools()
  753.  
  754. # Repertoire ou se trouve Sox
  755. self.repOuSeTrouveSox = listeChemSox[0]
  756. # Si Sox n'est pas installe, la fenetre d'erreur s'affiche
  757. if self.repOuSeTrouveSox == '': self.erreurDepImageSox()
  758.  
  759. # Repertoire ou se trouve G'MIC
  760. self.repOuSeTrouveGMIC = listeChemGMIC[0]
  761. # Si G'MIC n'est pas installe, la fenetre d'erreur s'affiche
  762. if self.repOuSeTrouveGMIC == '': self.erreurDepImageGMIC()
  763.  
  764. # Repertoire ou se trouve site.py (pour chang encodage ascii vers latin1)
  765. self.repOuSeTrouveSitePointPy = listeChemSitePointPy[0]
  766.  
  767. """
  768. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_mencoder.txt') is False:
  769. # Ecriture dans le fichier 'install_de_mencoder.txt' du chemin d'installation de mencoder (et mplayer)
  770. chemInstallMencoder=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_mencoder.txt', 'w')
  771. chemInstallMencoder.write(self.repOuSeTrouveMplayMenc)
  772. chemInstallMencoder.close()
  773. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_ffmpeg.txt') is False:
  774. # Ecriture dans le fichier 'install_de_ffmpeg.txt' du chemin d'installation de ffmpeg
  775. chemInstallFfmpeg=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_ffmpeg.txt', 'w')
  776. chemInstallFfmpeg.write(self.repOuSeTrouveFfmpeg)
  777. chemInstallFfmpeg.close()
  778. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_imagemagick.txt') is False:
  779. # Ecriture dans le fichier 'install_de_imagemagick.txt' du chemin d'installation d'ImageMagick
  780. chemInstallImgMagick=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_imagemagick.txt', 'w')
  781. chemInstallImgMagick.write(self.repOuSeTrouveImgMagick)
  782. chemInstallImgMagick.close()
  783. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_pil.txt') is False:
  784. # Ecriture dans le fichier 'install_de_pil.txt' du chemin d'installation de Python Imaging Library
  785. chemInstallPIL=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_pil.txt', 'w')
  786. chemInstallPIL.write(self.repOuSeTrouvePIL)
  787. chemInstallPIL.close()
  788. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_pyqt4.txt') is False:
  789. # Ecriture dans le fichier 'install_de_pyqt4.txt' du chemin de PyQt4
  790. chemInstallPyQt4=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_pyqt4.txt', 'w')
  791. chemInstallPyQt4.write(self.repOuSeTrouvePyQt4)
  792. chemInstallPyQt4.close()
  793. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_numpy.txt') is False:
  794. # Ecriture dans le fichier 'install_de_numpy.txt' du chemin d'installation de Numpy
  795. chemInstallNumpy=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_numpy.txt', 'w')
  796. chemInstallNumpy.write(self.repOuSeTrouveNumpy)
  797. chemInstallNumpy.close()
  798. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_ffmpeg2theora.txt') is False:
  799. # Ecriture dans le fichier 'install_de_ffmpeg2theora.txt' du chemin de ffmpeg2theora
  800. chemInstallFfmpeg2theora=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_ffmpeg2theora.txt', 'w')
  801. chemInstallFfmpeg2theora.write(self.repOuSeTrouveFfmpeg2theora)
  802. chemInstallFfmpeg2theora.close()
  803. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_lame.txt') is False:
  804. # Ecriture dans le fichier 'install_de_lame.txt' du chemin de Lame
  805. chemInstallLame=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_lame.txt', 'w')
  806. chemInstallLame.write(self.repOuSeTrouveLame)
  807. chemInstallLame.close()
  808. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_mjpegtools.txt') is False:
  809. # Ecriture dans le fichier 'install_de_mjpegtools.txt' du chemin de Mjpegtools
  810. chemInstallMjpegtools=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_mjpegtools.txt', 'w')
  811. chemInstallMjpegtools.write(self.repOuSeTrouveMjpegtools)
  812. chemInstallMjpegtools.close()
  813. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_sox.txt') is False:
  814. # Ecriture dans le fichier 'install_de_sox.txt' du chemin de Sox
  815. chemInstallSox=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_sox.txt', 'w')
  816. chemInstallSox.write(self.repOuSeTrouveSox)
  817. chemInstallSox.close()
  818. if os.path.exists(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_gmic.txt') is False:
  819. # Ecriture dans le fichier 'install_de_gmic.txt' du chemin de G'MIC
  820. chemInstallGMIC=open(os.getcwd()+'\\windows\\chemin_install_applis\\install_de_gmic.txt', 'w')
  821. chemInstallGMIC.write(self.repOuSeTrouveGMIC)
  822. chemInstallGMIC.close()
  823. """
  824.  
  825. # Pour windows
  826. liste_chem_app = [[os.getcwd()+'\\windows\\chemin_install_applis\\install_de_mencoder.txt', self.repOuSeTrouveMplayMenc, 'Mplayer-Mencoder'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_ffmpeg.txt', self.repOuSeTrouveFfmpeg, 'FFmpeg'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_imagemagick.txt', self.repOuSeTrouveImgMagick, 'ImageMagick'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_pil.txt', self.repOuSeTrouvePIL, 'Python Imaging Library'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_pyqt4.txt', self.repOuSeTrouvePyQt4, 'PyQt4'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_numpy.txt', self.repOuSeTrouveNumpy, 'Numpy'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_ffmpeg2theora.txt', self.repOuSeTrouveFfmpeg2theora, 'FFmpeg2theora'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_lame.txt', self.repOuSeTrouveLame, 'Lame'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_mjpegtools.txt', self.repOuSeTrouveMjpegtools, 'Mjpegtools'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_sox.txt', self.repOuSeTrouveSox, 'Sox'], [os.getcwd()+'\\windows\\chemin_install_applis\\install_de_gmic.txt', self.repOuSeTrouveGMIC, "G'MIC"]]
  827.  
  828. for parc_l_chem_app in liste_chem_app:
  829. if os.path.exists(parc_l_chem_app[0]) is False:
  830. #
  831. if langue == 'fr': # francais
  832. txt_install_app = "Chemin d'installation de %s: " % (parc_l_chem_app[2])
  833. liste_ecr_fichier.append(txt_install_app+parc_l_chem_app[1]+'\n')
  834. else: # autres langues
  835. txt_install_app = "Installation path of %s: " % (parc_l_chem_app[2])
  836. liste_ecr_fichier.append(txt_install_app+parc_l_chem_app[1]+'\n')
  837. #
  838. # Ecriture dans les differents fichiers d'install
  839. chemInstall = open(parc_l_chem_app[0], 'w')
  840. chemInstall.write(parc_l_chem_app[1])
  841. chemInstall.close()
  842.  
  843. # Suite de l'ecriture dans le fichier sauv_txt_install_ekd.txt si ok
  844. chemSauvInstall_3 = open(os.path.expanduser('~')+os.sep+'sauv_txt_install_ekd.txt', 'w')
  845. chemSauvInstall_3.write("".join(liste_ecr_fichier))
  846. chemSauvInstall_3.close()
  847.  
  848. # Si le francais est detecte pour un pays (ou region) a langage francophone ...
  849. # C'est la seule solution qui fonctionne sous windows (pour la gestion des
  850. # chemins et/ou fichiers) avec accents. Il s'agit de modifier la variable
  851. # encoding dans le fichier site.py situee dans le repertoire (si Python 2.6
  852. # par exemple): ...\Python26\Lib. L'encodage par defaut ascii est transforme
  853. # en latin1
  854. loc = locale.getdefaultlocale()[0]
  855. if loc in ['fr_BE', 'fr_CA', 'fr_CH', 'fr_FR', 'fr_LU']:
  856. ouvSPPy = open(self.repOuSeTrouveSitePointPy+"\\site.py", "rb")
  857. enrSPPy = open("windows\\chemin_install_applis\\site.py", "wb")
  858. # Ecriture dans le fichier
  859. lEncSite = ouvSPPy.readlines()
  860. for parcEncSite in lEncSite:
  861. if parcEncSite == ' encoding = "ascii" # Default value set by _PyUnicode_Init()\r\n':
  862. parcEncSite = ' encoding = "latin1" # Default value set by _PyUnicode_Init()\r\n'
  863. enrSPPy.write(parcEncSite)
  864. else:
  865. enrSPPy.write(parcEncSite)
  866.  
  867. # Fermeture
  868. ouvSPPy.close()
  869. enrSPPy.close()
  870.  
  871. # Copie/ecrasement de site.py contenu dans ...\Python26\Lib (si Python 2.6)
  872. import shutil
  873. shutil.copy(os.getcwd()+'\\windows\\chemin_install_applis\\site.py', self.repOuSeTrouveSitePointPy+'\\site.py')
  874. # Elimination du fichier (car cela pourrait poser des problemes lors
  875. # d'une nouvelle recherche de site.py)
  876. os.remove(os.getcwd()+'\\windows\\chemin_install_applis\\site.py')
  877.  
  878. self.fin = time.clock()
  879. tempsDeTraitement = self.fin - self.debut
  880. if langue == 'fr': # francais
  881. tmps_rech = 'Temps de la recherche: %d secondes' % tempsDeTraitement
  882. print tmps_rech
  883. liste_ecr_fichier.append(tmps_rech)
  884. # Suite de l'ecriture dans le fichier sauv_txt_install_ekd.txt si ok
  885. chemSauvInstall_4 = open(os.path.expanduser('~')+os.sep+'sauv_txt_install_ekd.txt', 'w')
  886. chemSauvInstall_4.write("".join(liste_ecr_fichier))
  887. chemSauvInstall_4.close()
  888.  
  889. # Application des variables d'environnement et redemarrage
  890. # de la machine uniquement si les dependances n'avaient
  891. # prealablement pas ete installees.
  892. self.variableEnv()
  893.  
  894. except:
  895. tkMessageBox.showerror(self.TitreErrNonSelectLect, self.errNonSelectLect)
  896.  
  897.  
  898. def quitter(self):
  899. self.root.destroy
  900. sys.exit(0)
  901.  
  902.  
  903. # Fonction ajoutee par Mireaux pour augmenter la rapidite de
  904. # detection du chemin vers les dependances d'EKD (donc la
  905. # 2eme partie de l'install d'EKD). Discussion visible ici:
  906. # http://ekd.tuxfamily.org/forum/showthread.php?tid=210&page=1
  907. def find(self,dir,liste,remaining):
  908. try:
  909. xdir = dir
  910. if len(xdir) == 2:
  911. xdir += os.sep
  912. files = os.listdir(xdir)
  913. except:
  914. return remaining
  915.  
  916. # Recherche des fichiers
  917. for item in files :
  918. if os.path.isdir(dir + os.sep + item):
  919. continue
  920. for litem in liste :
  921. if litem[2] :
  922. continue
  923. if (litem[0] == item):
  924. litem[1].append(dir)
  925. litem[2] = True
  926. remaining -= 1
  927. if remaining == 0:
  928. return 0
  929. # Exploration des sous-repertoires
  930. for item in files:
  931. dir2 = dir + os.sep + item
  932. if os.path.isfile(dir2) :
  933. continue
  934. remaining = self.find(dir2,liste,remaining)
  935. if remaining == 0 :
  936. return 0
  937. return remaining
  938.  
  939.  
  940. def variableEnv(self):
  941. "Application des variables d'environnement dans la base de registre. Adapte de l'excellent script: http://mail.python.org/pipermail/python-list/2003-December/240977.html"
  942.  
  943. self.item='path'
  944. self.keypath = r'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'
  945.  
  946. if self.repOuSeTrouveMplayMenc!='' and self.repOuSeTrouveFfmpeg!='' and self.repOuSeTrouveFfmpeg2theora!='' and self.repOuSeTrouveLame!='' and self.repOuSeTrouveMjpegtools!='' and self.repOuSeTrouveSox!='' and self.repOuSeTrouveGMIC!='':
  947. # Boucle pour inserer les chemins (detectes ds la fonction detect_1) dans la base de registre
  948. for self.newPart in [self.repOuSeTrouveMplayMenc, self.repOuSeTrouveFfmpeg, self.repOuSeTrouveFfmpeg2theora, self.repOuSeTrouveLame, self.repOuSeTrouveMjpegtools, self.repOuSeTrouveSox, self.repOuSeTrouveGMIC]:
  949.  
  950. self.key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.keypath)
  951. self.path, self.dataType = _winreg.QueryValueEx(self.key, self.item)
  952. self.key.Close()
  953. #print
  954. #print "Le chemin actuel des variables d'environnement est:\n\n%s" % self.path
  955. #print
  956.  
  957. if self.path.lower().find(self.newPart.lower()) == -1:
  958. #print
  959. #print 'Il ne contient pas', self.newPart
  960. #print
  961. self.path = os.pathsep.join(self.path.split(os.pathsep) + [self.newPart])
  962. self.key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, self.keypath, 0, _winreg.KEY_SET_VALUE)
  963. _winreg.SetValueEx(self.key, self.item, 0, self.dataType, self.path)
  964. self.key.Close()
  965. #print
  966. #print "Nouveau chemin des variables d'environnement:\n\n%s" % self.path
  967. #print
  968. #else:
  969. #print "Rien a faire -- tout est deja ok pour les variables d'environnement"
  970.  
  971. if (len(self.repOuSeTrouveMplayMenc) > 0) and (len(self.repOuSeTrouveFfmpeg) > 0) and (len(self.repOuSeTrouveFfmpeg2theora) > 0) and (len(self.repOuSeTrouveImgMagick) > 0) and (len(self.repOuSeTrouvePIL) > 0) and (len(self.repOuSeTrouvePyQt4) > 0) and (len(self.repOuSeTrouveNumpy) > 0) and (len(self.repOuSeTrouveLame) > 0) and (len(self.repOuSeTrouveMjpegtools) > 0) and (len(self.repOuSeTrouveSox) > 0) and (len(self.repOuSeTrouveGMIC) > 0):
  972. # Redemarrage de la machine afin que les variables d'environnement soient actives
  973. os.system('shutdown -r -t 0 -f')
  974.