1
# -*- coding: utf-8 -*-
3
# This file is part of Videoporama
4
# Videoporama is a program to make diaporama export in video file
5
# Copyright (C) 2007-2010 Olivier Ponchaut <opvg@numericable.be> - Dominique Levray
7
# This program is free software; you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 2 of the License, or
10
# (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
17
# You should have received a copy of the GNU General Public License along
18
# with this program; if not, write to the Free Software Foundation, Inc.,
19
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22
from xml.dom import minidom
23
from xml.dom.minidom import Document
24
from PyQt4.QtCore import *
25
from PyQt4.QtGui import *
27
#Specific Windows version : Load Windows Registry module
33
#Modules from Videoporama project
34
from interface import *
35
from main_win import *
36
from statusconf import *
38
from ConfigurationDlg import *
39
from GlobalDefines import *
40
from DocHelpDlg import *
41
from RenderDlg import *
42
from DefMoviePointDlg import *
43
from SoundDlg import *
44
from SoundProcess import *
47
class Gui_Main(QMainWindow,Ui_MainWindow) : #OK QT4
48
def __init__(self, parent=None):
49
super(Gui_Main, self).__init__(parent)
52
#domledom : Add resizeEvent signal
53
def resizeEvent (self, event):
54
self.emit(SIGNAL("resizeEvent(QResizeEvent)"),event)
57
def __init__(self,args,IsPortable):
58
# Define if application start in portable application mode
59
self.IsPortable=IsPortable
61
# First thing to do : ask if it's a windows operating system !
62
if isWindows()==False:
63
if self.IsPortable==True :
64
print "This PortableVersion can only be use on Windows System"
67
self.AEROCOMPATIBILITY = False #True pour prendre en charge AERO (Vista/Windows 7)
68
self.Windows = "" #It's not a Windows OS
71
WinVersion=QtCore.QSysInfo().WindowsVersion
72
if WinVersion==0x0010 : self.Windows="Windows NT (operating system version 4.0)"
73
elif WinVersion==0x0020 : self.Windows="Windows 2000 (operating system version 5.0)"
74
elif WinVersion==0x0030 : self.Windows="Windows XP (operating system version 5.1)"
75
elif WinVersion==0x0040 : self.Windows="Windows Server 2003, Windows Server 2003 R2, Windows Home Server, Windows XP Professional x64 Edition (operating system version 5.2)"
76
elif WinVersion==0x0080 : self.Windows="Windows Vista, Windows Server 2008 (operating system version 6.0)"
77
elif WinVersion==0x0090 : self.Windows="Windows 7, Windows Server 2008 R2 (operating system version 6.1)"
78
else : self.Windows="Unknown version"
80
#AERO Flag for MPlayer
81
if WinVersion>=0x0080:
82
self.AEROCOMPATIBILITY = True #True pour prendre en charge AERO (Vista/Windows 7)
84
self.AEROCOMPATIBILITY = False #False pour ne pas prendre en charge AERO (Vista/Windows 7)
86
#Load registry value for specific Windows Folder
87
key = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders',0,_winreg.KEY_READ)
88
(WINDOWS_APPDATA,typevaleur) = _winreg.QueryValueEx(key,'AppData')
89
(WINDOWS_MUSIC,typevaleur) = _winreg.QueryValueEx(key,'My Music')
90
(WINDOWS_PICTURES,typevaleur) = _winreg.QueryValueEx(key,'My Pictures')
91
(WINDOWS_VIDEO,typevaleur) = _winreg.QueryValueEx(key,'My Video')
92
(WINDOWS_DOCUMENTS,typevaleur)= _winreg.QueryValueEx(key,'Personal')
95
print "Windows = "+self.Windows
97
#local variables definition
99
self.AACMode = "" #adts if ffmpeg 0.6 and libfaac for ffmpeg 0.5
100
self.StopMAJOFD = False #Flag to stop modification of OFD configuration for project
101
self.StopMAJSpinbox = False #Flag to stop multiple update during spinbox update
102
self.BLOCKDefZoomPointDlg = False #Flag for allow only one DefZoomPointDlg at a time
103
self.BLOCKCloseApp = False #Flag to block multiple ask for save project when close app
104
self.StopUpdatePixDuringNewSelect = False #Variable to stop multiple updatepix when an image is selected
105
self.StopUpdatePixDuringEmpty = False #Variable to stop updatepix when empty timeline
106
self.StopSetupInterface = False #Variable to stop multiple SetupInterface
107
self.OutputOFDXMLObject = None #Output format definition XML Object
108
self.homeDir = "" #Home directory
109
self.lastDirImage = "" #Last directory use for Image
110
self.lastDirMovies = "" #Last directory use for Movie
111
self.lastDirProject = "" #Last directory use for Project
112
self.lastDirSound = "" #Last directory use for Sound
113
self.lastDirRender = "" #Last directory use for Render
114
self.lastDirBackground = "" #Last directory use for Background Image
115
self.NewSEQPosition = 0 #if Add sequence after current sequence else Add sequence at the project end
118
self.ProjectFilePathName = "" #PathName of the project file
119
self.ProjectXMLObject = None #Document object of the project file
120
self.IsProjectModified = False #Flag for known if project file need to be save
121
self.imgformat = 0 #Project image format
122
#self.soundfile = "" #Project sound file
123
self.outputFile = "" #Project output file
124
self.XMLText = None #Overlaid text
127
self.ConfigFilePathName = "" #PathName of the configuration file
128
self.ConfigXMLObject = None #Document object of the configuration file
130
#Directory Configuration (default value are calculate during the init process)
131
self.T = "" #Temporary directory
132
self.I = "" #FFMPEG directory
133
self.MP = "" #MPlayer directory
134
self.S = "" #SOX directory
135
self.MJ = "" #MPJEPTools directory
136
self.ImageEditor = "" #ImageEditor filename
137
IsGIMPOk = False #True if image editor is found
139
#Standard Project Options (default value are set here !)
140
self.ConfVideoF = 0 #Default output format
141
self.ConfImgFormat = 0 #Default output format
142
self.ConfTime = 7 #project options : image duration of the 1st static shot
143
self.ConfStaticTimeNext = 2 #project options : image duration of next static shot
144
self.ConfAnimTimeNext = 3 #project options : image duration of animated shot
145
self.ConfTime = 7 #project options : image duration
146
self.ConfSpeedT = 3 #project options : transition duration
147
self.ConfTypeT = 8 #project options : default transition : Random
148
self.ConfTransiOpt = 0 #project options : default transition option (0 for Random)
149
self.ConfBgFile = "" #project options : default background file
150
self.ConfBgColor = 0 #project options : default background color
151
self.ConfDisplayUnit = 0 #Display configuration - "0"=as %, "1"= as Pixel
152
self.ConfAutoRotate = 1 #Display configuration - Automatic Rotation of rotaded image
155
self.TOverlaidFontName = "Arial Black" # font name
157
self.TOverlaidFontName = "Impact" # font name
158
self.TOverlaidFontSize = 12 # font size
159
self.TOverlaidFontColor = "ffffff" # font color
160
self.TOverlaidFontShadowColor = "000000" # font shadow color
161
self.TOverlaidIsBold = False # if bold mode
162
self.TOverlaidIsItalic = False # if Italic mode
163
self.TOverlaidIsUnderline = False # if Underline mode
164
self.TOverlaidHAlign = 1 # Horizontal alignement : 0=left, 1=center, 2=right, 3=justif
165
self.TOverlaidVAlign = 1 # Vertical alignement : 0=up, 1=center, 2=bottom
166
self.TOverlaidStyleText = 1 # Style : 0=normal, 1=outerline, 2=shadow up-left, 3=shadow up-right, 4=shadow bt-left, 5=shadow bt-right
167
self.TOverlaidBackgroundForm = 0 # Type of the form : 0=None, 1=Rectangle, 2=Ellipse
168
self.TOverlaidBackgroundStyle = 0 # Type of the background color : 0=Solid, 1=Transparent 90% 2=Transparent 80%..., 10=Transparent
169
self.TOverlaidBackgroundColor = "afafaf" # Color of the background of the form
170
self.TOverlaidPenSize = 1 # Width of the pen of the form
171
self.TOverlaidPenColor = "ffffff" # Color of the pen of the form
174
self.TBackGFontName = "Comic Sans MS" # font name
176
self.TBackGFontName = "DejaVu Sans" # font name
177
self.TBackGFontSize = 28 # font size
178
self.TBackGFontColor = "ffffff" # font color
179
self.TBackGFontShadowColor = "5f5f5f" # font shadow color
180
self.TBackGIsBold = True # if bold mode
181
self.TBackGIsItalic = False # if Italic mode
182
self.TBackGIsUnderline = False # if Underline mode
183
self.TBackGHAlign = 1 # Horizontal alignement : 0=left, 1=center, 2=right, 3=justif
184
self.TBackGVAlign = 1 # Vertical alignement : 0=up, 1=center, 2=bottom
185
self.TBackGStyleText = 1 # Style : 0=normal, 1=outerline, 2=shadow up-left, 3=shadow up-right, 4=shadow bt-left, 5=shadow bt-right
186
self.TBackGBackgroundForm = 0 # Type of the form : 0=None, 1=Rectangle, 2=Ellipse
187
self.TBackGBackgroundStyle = 0 # Type of the background color : 0=Solid, 1=Transparent 90% 2=Transparent 80%..., 10=Transparent
188
self.TBackGBackgroundColor = "afafaf" # Color of the background of the form
189
self.TBackGPenSize = 1 # Width of the pen of the form
190
self.TBackGPenColor = "ffffff" # Color of the pen of the form
193
self.TShotFontName = "Comic Sans MS" # font name
195
self.TShotFontName = "DejaVu Sans" # font name
196
self.TShotFontSize = 20 # font size
197
self.TShotFontColor = "ffffff" # font color
198
self.TShotFontShadowColor = "5f5f5f" # font shadow color
199
self.TShotIsBold = False # if bold mode
200
self.TShotIsItalic = False # if Italic mode
201
self.TShotIsUnderline = False # if Underline mode
202
self.TShotHAlign = 1 # Horizontal alignement : 0=left, 1=center, 2=right, 3=justif
203
self.TShotVAlign = 1 # Vertical alignement : 0=up, 1=center, 2=bottom
204
self.TShotStyleText = 5 # Style : 0=normal, 1=outerline, 2=shadow up-left, 3=shadow up-right, 4=shadow bt-left, 5=shadow bt-right
205
self.TShotBackgroundForm = 2 # Type of the form : 0=None, 1=Rectangle, 2=Ellipse
206
self.TShotBackgroundStyle = 2 # Type of the Background color : 0=Solid, 1=Transparent 90% 2=Transparent 80%..., 10=Transparent
207
self.TShotBackgroundColor = "550000" # Color of the Background of the form
208
self.TShotPenSize = 2 # Width of the pen of the form
209
self.TShotPenColor = "ffffff" # Color of the pen of the form
212
self.CheckCodecAtStartup = 0 #if 0 then Check Codec at Startup
213
self.ThumbnailsSize = 1 #size of the thumbnails in the timeline
215
self.RestoreWindowState = 1 #if 1 restore window size/position at startup
216
self.MainWinRx = 0 #Saved position for Main Windows
217
self.MainWinRy = 0 #Saved position for Main Windows
218
self.MainWinRw = 600 #Saved position for Main Windows
219
self.MainWinRh = 400 #Saved position for Main Windows
220
self.ZoomBoxIsMaximized = 0 #Saved position for Zoombox DLG
221
self.ZoomBoxWinRx = -1 #Saved position for Zoombox DLG
222
self.ZoomBoxWinRy = -1 #Saved position for Zoombox DLG
223
self.ZoomBoxWinRw = -1 #Saved position for Zoombox DLG
224
self.ZoomBoxWinRh = -1 #Saved position for Zoombox DLG
225
self.TextBoxIsMaximized = 0 #Saved position for Textbox DLG
226
self.TextBoxWinRx = -1 #Saved position for Textbox DLG
227
self.TextBoxWinRy = -1 #Saved position for Textbox DLG
228
self.TextBoxWinRw = -1 #Saved position for Textbox DLG
229
self.TextBoxWinRh = -1 #Saved position for Textbox DLG
232
self.SEQClipboard = None #Internal clipboard for Sequence
234
# To optimise DisplayLength
235
self.TimeChanged = True # True if a time as change
236
# To not redraw ruller if no change
237
self.PrevStart =QTime(0,0,0)
238
self.PrevEnd =QTime(0,0,0)
239
self.PrevDuration=QTime(0,0,0)
241
#-------------------------------------------------------------------------------------------------------------
243
# Init Qt application and locale
244
self.qtapp=QApplication(args)
245
self.qtapp.setAttribute(Qt.AA_NativeWindows,True)
246
locale = QLocale.system().name()
247
print "locale : ", locale
250
qtTrans = QTranslator()
251
if qtTrans.load(u"/usr/share/qt4/translations/qt_"+unicode(locale[0:2])+u".qm") :
252
self.qtapp.installTranslator(qtTrans)
254
#Init videoporama translation
255
qtTranslator = QTranslator()
256
if qtTranslator.load(u"./locale/videoporama_"+unicode(locale[0:2])+u".qm") :
257
self.qtapp.installTranslator(qtTranslator)
259
# Loading Output Format Definition from xml file
260
self.OutputOFDXMLObject=VideoporamaOFD("VideoporamaOFD.xml",self)
262
#check if the .videoporama directory exist in the home-user. If not : create it
263
#and Init default directory
266
#-----------------------
268
#-----------------------
270
#Configuration directory & file
272
self.homeDir=WINDOWS_APPDATA
273
if self.homeDir[len(self.homeDir)-1]!='/' : self.homeDir=self.homeDir+'/'
274
self.ConfigFilePathName=self.homeDir+u'videoporama/'
275
#self.ConfigFilePathName=QDir().toNativeSeparators(self.ConfigFilePathName)
276
if self.IsPortable==False:
277
if QDir(self.ConfigFilePathName).exists()==False :
278
#print self.qtapp.translate("main","Configuration directory doesn't exist")
279
#print self.qtapp.translate("main","Create configuration directory")
281
QDir().mkpath(self.ConfigFilePathName)
283
#print self.qtapp.translate("main","Error creating driectory directory")
285
self.ConfigFilePathName=self.ConfigFilePathName+u'idv_config.xml'
287
cwd=QDir().current().absolutePath()
288
if cwd.endsWith(Sep)!=True: cwd=unicode(cwd)+Sep
289
self.ConfigFilePathName=cwd+u'idv_config.xml' # In portable version, file is save in the current directory
291
#Default directory for ressources
292
self.lastDirImage = WINDOWS_PICTURES
293
self.lastDirMovies = WINDOWS_VIDEO
294
self.lastDirProject = WINDOWS_DOCUMENTS
295
self.lastDirSound = WINDOWS_MUSIC
296
self.lastDirRender = WINDOWS_VIDEO
297
self.lastDirBackground = WINDOWS_PICTURES
299
#External softwares directory
300
cwd=QDir().current().absolutePath()
301
if cwd.endsWith(Sep)!=True: cwd=unicode(cwd)+Sep
302
self.I = cwd+u"extern_bin/ffmpeg/bin/" #FFMPEG directory
303
self.MP = cwd+u"extern_bin/mplayer/" #MPlayer directory
304
self.S = cwd+u"extern_bin/sox/" #SOX directory
305
self.MJ = cwd+u"extern_bin/mjpegtools/bin/" #MPJEPTools directory
309
if self.IsPortable==False:
310
if IsBinaryFileExist("C:\\Program Files\\GIMP-2.0\\bin\\gimp-2.6.exe"):
311
self.ImageEditor = "C:\\Program Files\\GIMP-2.0\\bin\\gimp-2.6.exe"
313
self.ImageEditor = ""
315
if IsBinaryFileExist("C:\\Program Files\\GIMP-2.0\\bin\\gimp-2.6.exe"):
316
self.ImageEditor = "C:\\Program Files\\GIMP-2.0\\bin\\gimp-2.6.exe"
317
elif IsBinaryFileExist("..\\..\\GIMPPortable\\GIMPPortable.exe"):
318
self.ImageEditor = "..\\..\\GIMPPortable\\GIMPPortable.exe"
320
self.ImageEditor = ""
323
#-----------------------
325
#-----------------------
326
self.homeDir=QDir().homePath()
327
if self.homeDir[len(self.homeDir)-1]!='/' : self.homeDir=self.homeDir+'/'
328
self.homeDir=QDir().toNativeSeparators(self.homeDir)
330
#Default directory for ressources
331
self.lastDirImage = self.homeDir #Last directory use for Image
332
self.lastDirMovies = self.homeDir #Last directory use for Movie
333
self.lastDirProject = self.homeDir #Last directory use for Project
334
self.lastDirSound = self.homeDir #Last directory use for Sound
335
self.lastDirRender = self.homeDir #Last directory use for Render
336
self.lastDirBackground = self.homeDir #Last directory use for Background Image
338
#External softwares directory
339
self.I = "/usr/bin/" #FFMPEG directory
340
self.MP = "/usr/bin/" #MPlayer directory
341
self.S = "/usr/bin/" #SOX directory
342
self.MJ = "/usr/bin/" #MPJEPTools directory
344
if IsBinaryFileExist("/usr/bin/gimp"):
345
self.ImageEditor = "/usr/bin/gimp"
347
self.ImageEditor = ""
349
#Configuration directory
350
self.ConfigFilePathName=self.homeDir+".videoporama/"
351
self.ConfigFilePathName=QDir().toNativeSeparators(self.ConfigFilePathName)
352
if QDir(self.ConfigFilePathName).exists()==False :
353
print self.qtapp.translate("main","Configuration directory doesn't exist")
354
print self.qtapp.translate("main","Create configuration directory")
356
QDir().mkpath(self.ConfigFilePathName)
358
print self.qtapp.translate("main","Error creating driectory directory")
360
self.ConfigFilePathName=self.ConfigFilePathName+u'idv_config.xml'
363
self.T=QDir().toNativeSeparators(QDir.temp().absolutePath())
364
if self.T[len(self.T)-1]!=QDir().separator().toAscii() : self.T=self.T+QDir().separator().toAscii()
366
# Loading configuration data from xml file
367
ConfigFile=QFile(self.ConfigFilePathName)
368
if ConfigFile.open(QIODevice.ReadOnly | QIODevice.Text) :
369
print self.qtapp.translate("main",u"Loading configuration data")
370
self.ConfigXMLObject=minidom.parse(ConfigFile)
374
print self.qtapp.translate("main","Create configuration data file")
375
self.ConfigXMLObject= Document()
376
xmltag = self.ConfigXMLObject.createElement(u"configuration")
377
self.ConfigXMLObject.appendChild(xmltag)
380
#Loading configuration from configuration file
381
# ... force loading all data to create them with default value if not exist
383
#Configuration TAB Directory configuration
384
if self.IsPortable==False :
385
self.T = LoadValueFromXMLFile(self.ConfigXMLObject,'tmpdir',self.T) #Temporary directory
386
self.I = LoadValueFromXMLFile(self.ConfigXMLObject,'imgmgkdir',self.I) #FFMPEG directory
387
self.MP = LoadValueFromXMLFile(self.ConfigXMLObject,'mplayerdir',self.MP) #MPlayer directory
388
self.S = LoadValueFromXMLFile(self.ConfigXMLObject,'soxdir',self.S) #SOX directory
389
self.MJ = LoadValueFromXMLFile(self.ConfigXMLObject,'mjpegtoolsdir',self.MJ) #MPJEPTools directory
390
self.ImageEditor = LoadValueFromXMLFile(self.ConfigXMLObject,'ImageEditor',self.ImageEditor) #ImageEditor filename
392
self.lastDirImage = LoadValueFromXMLFile(self.ConfigXMLObject,'lastDirImage',self.lastDirImage) #Last directory use for Image
393
self.lastDirMovies = LoadValueFromXMLFile(self.ConfigXMLObject,'lastDirMovies',self.lastDirMovies) #Last directory use for Movie
394
self.lastDirProject = LoadValueFromXMLFile(self.ConfigXMLObject,'lastDirProject',self.lastDirProject) #Last directory use for Project
395
self.lastDirSound = LoadValueFromXMLFile(self.ConfigXMLObject,'lastDirSound',self.lastDirSound) #Last directory use for Sound
396
self.lastDirRender = LoadValueFromXMLFile(self.ConfigXMLObject,'lastDirRender',self.lastDirRender) #Last directory use for Render
397
self.lastDirBackground = LoadValueFromXMLFile(self.ConfigXMLObject,'lastDirBackground',self.lastDirBackground) #Last directory use for Background Image
399
#Configuration TAB Display configuration
400
self.ConfDisplayUnit = LoadValueFromXMLFile(self.ConfigXMLObject,'zoomVal',self.ConfDisplayUnit)
401
self.RestoreWindowState = LoadValueFromXMLFile(self.ConfigXMLObject,'WindowsSettings-RestoreWindowState',self.RestoreWindowState)
402
self.ThumbnailsSize = int(LoadValueFromXMLFile(self.ConfigXMLObject,'ThumbnailsSize',self.ThumbnailsSize))
403
self.ConfAutoRotate = LoadValueFromXMLFile(self.ConfigXMLObject,'ConfAutoRotate',self.ConfAutoRotate)
404
self.NewSEQPosition = int(LoadValueFromXMLFile(self.ConfigXMLObject,'NewSEQPosition',self.NewSEQPosition))
406
#Configuration TAB Default output format
407
self.ConfVideoF = LoadValueFromXMLFile(self.ConfigXMLObject,'videof',self.ConfVideoF)
408
self.ConfImgFormat = LoadValueFromXMLFile(self.ConfigXMLObject,'imgformat',self.ConfImgFormat)
410
self.ConfOFDDeviceType = LoadValueFromXMLFile(self.ConfigXMLObject,'OFDDeviceType',"Computer")
411
self.ConfOFDDeviceModel = LoadValueFromXMLFile(self.ConfigXMLObject,'OFDDeviceModel',"Generic PC")
412
self.ConfOFDOutputCodec = LoadValueFromXMLFile(self.ConfigXMLObject,'OFDOutputCodec',"AVI (XVid/MP3)")
413
self.ConfOFDOutputFormat= LoadValueFromXMLFile(self.ConfigXMLObject,'OFDOutputFormat',"VGA 640x480-25 fps")
415
#Configuration TAB Standards project options
416
self.ConfTime = LoadValueFromXMLFile(self.ConfigXMLObject,'time',self.ConfTime)
417
self.ConfStaticTimeNext = LoadValueFromXMLFile(self.ConfigXMLObject,'StaticTimeNext',self.ConfStaticTimeNext)
418
self.ConfAnimTimeNext = LoadValueFromXMLFile(self.ConfigXMLObject,'AnimTimeNext',self.ConfAnimTimeNext)
419
self.ConfSpeedT = LoadValueFromXMLFile(self.ConfigXMLObject,'speedt',self.ConfSpeedT)
420
self.ConfTypeT = LoadValueFromXMLFile(self.ConfigXMLObject,'typet',self.ConfTypeT)
421
self.ConfTransiOpt = LoadValueFromXMLFile(self.ConfigXMLObject,'transiopt',self.ConfTransiOpt)
422
self.ConfBgFile = LoadValueFromXMLFile(self.ConfigXMLObject,'bgfile',self.ConfBgFile)
423
self.ConfBgColor = LoadValueFromXMLFile(self.ConfigXMLObject,'bgcolor',self.ConfBgColor)
425
#Configuration Default texts options for dialog box
427
self.TOverlaidFontName = LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidFontName',self.TOverlaidFontName)
428
self.TOverlaidFontSize = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidFontSize',str(self.TOverlaidFontSize)))
429
self.TOverlaidFontColor = LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidFontColor',self.TOverlaidFontColor)
430
self.TOverlaidFontShadowColor= LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidFontShadowColor',self.TOverlaidFontShadowColor)
431
self.TOverlaidIsBold = (LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidIsBold',"1" if self.TOverlaidIsBold==True else "0")=="1")
432
self.TOverlaidIsItalic = (LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidIsItalic',"1" if self.TOverlaidIsItalic==True else "0")=="1")
433
self.TOverlaidIsUnderline = (LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidIsUnderline',"1" if self.TOverlaidIsUnderline==True else "0")=="1")
434
self.TOverlaidHAlign = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidHAlign',str(self.TOverlaidHAlign)))
435
self.TOverlaidVAlign = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidVAlign',str(self.TOverlaidVAlign)))
436
self.TOverlaidStyleText = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidStyleText',str(self.TOverlaidStyleText)))
437
self.TOverlaidBackgroundForm = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidBackgroundForm',str(self.TOverlaidBackgroundForm)))
438
self.TOverlaidBackgroundStyle= int(LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidBackgroundStyle',str(self.TOverlaidBackgroundStyle)))
439
self.TOverlaidBackgroundColor= LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidBackgroundColor',self.TOverlaidBackgroundColor)
440
self.TOverlaidPenSize = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidPenSize',str(self.TOverlaidPenSize)))
441
self.TOverlaidPenColor = LoadValueFromXMLFile(self.ConfigXMLObject,'TOverlaidPenColor',self.TOverlaidPenColor)
443
self.TBackGFontName = LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGFontName',self.TBackGFontName)
444
self.TBackGFontSize = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGFontSize',str(self.TBackGFontSize)))
445
self.TBackGFontColor = LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGFontColor',self.TBackGFontColor)
446
self.TBackGFontShadowColor= LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGFontShadowColor',self.TBackGFontShadowColor)
447
self.TBackGIsBold = (LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGIsBold',"1" if self.TBackGIsBold==True else "0")=="1")
448
self.TBackGIsItalic = (LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGIsItalic',"1" if self.TBackGIsItalic==True else "0")=="1")
449
self.TBackGIsUnderline = (LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGIsUnderline',"1" if self.TBackGIsUnderline==True else "0")=="1")
450
self.TBackGHAlign = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGHAlign',str(self.TBackGHAlign)))
451
self.TBackGVAlign = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGVAlign',str(self.TBackGVAlign)))
452
self.TBackGStyleText = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGStyleText',str(self.TBackGStyleText)))
453
self.TBackGBackgroundForm = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGBackgroundForm',str(self.TBackGBackgroundForm)))
454
self.TBackGBackgroundStyle= int(LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGBackgroundStyle',str(self.TBackGBackgroundStyle)))
455
self.TBackGBackgroundColor= LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGBackgroundColor',self.TBackGBackgroundColor)
456
self.TBackGPenSize = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGPenSize',str(self.TBackGPenSize)))
457
self.TBackGPenColor = LoadValueFromXMLFile(self.ConfigXMLObject,'TBackGPenColor',self.TBackGPenColor)
459
self.TShotFontName = LoadValueFromXMLFile(self.ConfigXMLObject,'TShotFontName',self.TShotFontName)
460
self.TShotFontSize = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TShotFontSize',str(self.TShotFontSize)))
461
self.TShotFontColor = LoadValueFromXMLFile(self.ConfigXMLObject,'TShotFontColor',self.TShotFontColor)
462
self.TShotFontShadowColor= LoadValueFromXMLFile(self.ConfigXMLObject,'TShotFontShadowColor',self.TShotFontShadowColor)
463
self.TShotIsBold = (LoadValueFromXMLFile(self.ConfigXMLObject,'TShotIsBold',"1" if self.TShotIsBold==True else "0")=="1")
464
self.TShotIsItalic = (LoadValueFromXMLFile(self.ConfigXMLObject,'TShotIsItalic',"1" if self.TShotIsItalic==True else "0")=="1")
465
self.TShotIsUnderline = (LoadValueFromXMLFile(self.ConfigXMLObject,'TShotIsUnderline',"1" if self.TShotIsUnderline==True else "0")=="1")
466
self.TShotHAlign = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TShotHAlign',str(self.TShotHAlign)))
467
self.TShotVAlign = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TShotVAlign',str(self.TShotVAlign)))
468
self.TShotStyleText = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TShotStyleText',str(self.TShotStyleText)))
469
self.TShotBackgroundForm = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TShotBackgroundForm',str(self.TShotBackgroundForm)))
470
self.TShotBackgroundStyle= int(LoadValueFromXMLFile(self.ConfigXMLObject,'TShotBackgroundStyle',str(self.TShotBackgroundStyle)))
471
self.TShotBackgroundColor= LoadValueFromXMLFile(self.ConfigXMLObject,'TShotBackgroundColor',self.TShotBackgroundColor)
472
self.TShotPenSize = int(LoadValueFromXMLFile(self.ConfigXMLObject,'TShotPenSize',str(self.TShotPenSize)))
473
self.TShotPenColor = LoadValueFromXMLFile(self.ConfigXMLObject,'TShotPenColor',self.TShotPenColor)
475
#Others Configuration options
476
self.CheckCodecAtStartup= LoadValueFromXMLFile(self.ConfigXMLObject,'CheckCodecAtStartup',self.CheckCodecAtStartup)
480
self.win.TABOptions.setCurrentIndex(0) # Force 1st TAB
483
self.win.timeline.horizontalHeader().hide()
484
self.win.timeline.verticalHeader().hide()
485
self.win.timeline.setRowCount(1)
486
self.win.timeline.setHorizontalScrollBarPolicy(QtCore.Qt.ScrollBarAlwaysOn)
487
self.win.timeline.setShowGrid(False)
488
self.SelectionEnCours=None
491
self.win.TableZoomPoint.horizontalHeader().hide()
492
self.win.TableZoomPoint.verticalHeader().hide()
493
self.win.TableZoomPoint.setColumnCount(1)
494
self.win.TableZoomPoint.setShowGrid(False)
499
self.win.imgformat.setCurrentIndex(self.imgformat)
502
# Create transition list
503
self.lstT=LstTransi(self)
504
self.win.typet.addItems(self.lstT)
505
self.RANDOMTRANSITIONTYPE=self.win.typet.count()
506
self.win.transiopt.addItem(QIcon("iconstr/tr-00-00.png"),self.qtapp.translate("main","No Option"))
508
# Restore Windows Settings (size/position/state) if needed
510
if self.RestoreWindowState=="1":
511
ForceMaximized=int(LoadValueFromXMLFile(self.ConfigXMLObject,'WindowsSettings-ismaximized',0))
512
self.MainWinRx=int(LoadValueFromXMLFile(self.ConfigXMLObject,'WindowsSettings-x',0))
513
self.MainWinRy=int(LoadValueFromXMLFile(self.ConfigXMLObject,'WindowsSettings-y',0))
514
self.MainWinRw=int(LoadValueFromXMLFile(self.ConfigXMLObject,'WindowsSettings-width',0))
515
self.MainWinRh=int(LoadValueFromXMLFile(self.ConfigXMLObject,'WindowsSettings-height',0))
517
self.win.move(self.MainWinRx,self.MainWinRy)
518
self.win.resize(self.MainWinRw,self.MainWinRh)
519
if ForceMaximized!=0: self.win.showMaximized()
521
self.ZoomBoxIsMaximized=int(LoadValueFromXMLFile(self.ConfigXMLObject,'ZoomBoxSettings-ismaximized',0))
522
self.ZoomBoxWinRx =int(LoadValueFromXMLFile(self.ConfigXMLObject,'ZoomBoxSettings-x',0))
523
self.ZoomBoxWinRy =int(LoadValueFromXMLFile(self.ConfigXMLObject,'ZoomBoxSettings-y',0))
524
self.ZoomBoxWinRw =int(LoadValueFromXMLFile(self.ConfigXMLObject,'ZoomBoxSettings-width',0))
525
self.ZoomBoxWinRh =int(LoadValueFromXMLFile(self.ConfigXMLObject,'ZoomBoxSettings-height',0))
526
self.TextBoxIsMaximized=int(LoadValueFromXMLFile(self.ConfigXMLObject,'TextBoxSettings-ismaximized',0))
527
self.TextBoxWinRx =int(LoadValueFromXMLFile(self.ConfigXMLObject,'TextBoxSettings-x',0))
528
self.TextBoxWinRy =int(LoadValueFromXMLFile(self.ConfigXMLObject,'TextBoxSettings-y',0))
529
self.TextBoxWinRw =int(LoadValueFromXMLFile(self.ConfigXMLObject,'TextBoxSettings-width',0))
530
self.TextBoxWinRh =int(LoadValueFromXMLFile(self.ConfigXMLObject,'TextBoxSettings-height',0))
535
self.montageLenght = 0.0
536
self.SoundDef = None # Sound definition data of sound montage part
538
#setup Timeline heigh depend on self.ThumbnailsSize
539
self.Timeline_ChTThumbnailSize()
541
# Difference between Posix and Nt plateforme
543
actionButton="triggered()"
545
actionButton="activated()"
547
#---------------------------------------------
548
# Qt SLOT/SIGNAL connection
549
#---------------------------------------------
552
self.qtapp.connect(self.win.action_Exit,SIGNAL(actionButton),self.App_CloseApp)
553
self.qtapp.connect(self.qtapp, SIGNAL("lastWindowClosed()"),self.App_CloseApp)
554
self.qtapp.connect(self.win,SIGNAL("resizeEvent(QResizeEvent)"),self.App_ResizeEvent)
555
self.qtapp.connect(self.win.TABOptions,SIGNAL("currentChanged(int)"),self.App_DisplayPixMainWin)
557
#file manipulation function
558
self.qtapp.connect(self.win.action_New,SIGNAL(actionButton),self.File_NewProject)
559
self.qtapp.connect(self.win.action_Open,SIGNAL(actionButton),self.File_OpenProject)
560
self.qtapp.connect(self.win.action_Save,SIGNAL(actionButton),self.File_SaveProject)
561
self.qtapp.connect(self.win.actionSave_as,SIGNAL(actionButton),self.File_SaveAsProject)
562
self.qtapp.connect(self.win.actionAddProject,SIGNAL(actionButton),self.File_AddProject)
565
#self.qtapp.connect(self.win.soundfile,SIGNAL("lostFocus()"),self.TAB_Montage_ChgSndFile)
566
#self.qtapp.connect(self.win.soundfilea,SIGNAL("clicked()"),self.TAB_Montage_BrowseSndFile)
567
self.qtapp.connect(self.win.imgformat,SIGNAL("activated(int)"),self.TAB_Montage_SetImgFormat)
568
self.qtapp.connect(self.win.DefTextBtMontage,SIGNAL("pressed()"),self.TAB_Montage_DefText)
571
self.qtapp.connect(self.win.actionCut,SIGNAL(actionButton),self.SEQ_Cut)
572
self.qtapp.connect(self.win.actionCopy,SIGNAL(actionButton),self.SEQ_Copy)
573
self.qtapp.connect(self.win.actionPaste,SIGNAL(actionButton),self.SEQ_Paste)
575
self.qtapp.connect(self.win.typet,SIGNAL("currentIndexChanged(int)"),self.SEQ_ChgTrOption)
576
self.qtapp.connect(self.win.transiopt,SIGNAL("currentIndexChanged(int)"),self.SEQ_ChgOptTr)
577
self.qtapp.connect(self.win.speedt,SIGNAL("activated(int)"),self.SEQ_ChoixSpeedT)
578
self.qtapp.connect(self.win.bgfile,SIGNAL("lostFocus()"),self.SEQ_ChgBgFile)
579
self.qtapp.connect(self.win.bgfilea,SIGNAL("clicked()"),self.SEQ_BrowseBgFile)
580
self.qtapp.connect(self.win.bgcolor,SIGNAL("lostFocus()"),self.SEQ_ChgBgColor)
581
self.qtapp.connect(self.win.bgcolora,SIGNAL("clicked()"),self.SEQ_BrowseBgColor)
582
self.qtapp.connect(self.win.DefTextBtImage,SIGNAL("pressed()"),self.SEQ_DefText)
585
self.qtapp.connect(self.win.ImageFileBt,SIGNAL("pressed()"),self.TAB_Image_ChgImageFile)
586
self.qtapp.connect(self.win.RotateLeftBT,SIGNAL("pressed()"),self.TAB_Image_RotateLeft)
587
self.qtapp.connect(self.win.RotateRightBT,SIGNAL("pressed()"),self.TAB_Image_RotateRight)
588
self.qtapp.connect(self.win.CallGimpBT,SIGNAL("pressed()"),self.TAB_Image_CallGimp)
589
self.qtapp.connect(self.win.RefreshImgBT,SIGNAL("pressed()"),self.TAB_Image_RefreshImg)
592
self.qtapp.connect(self.win.MovieFileBt,SIGNAL("pressed()"),self.TAB_Movie_ChgMovieFile)
593
self.qtapp.connect(self.win.RotateLeftMovieBT,SIGNAL("pressed()"),self.TAB_Movie_RotateLeft)
594
self.qtapp.connect(self.win.RotateRightMovieBT,SIGNAL("pressed()"),self.TAB_Movie_RotateRight)
595
self.qtapp.connect(self.win.RefreshMovieBT,SIGNAL("pressed()"),self.TAB_Movie_RefreshMovie)
596
self.qtapp.connect(self.win.DefMoviePointBt,SIGNAL("pressed()"),self.TAB_Movie_DefMoviePoint)
597
self.qtapp.connect(self.win.MovieStartEd,SIGNAL("timeChanged(QTime)"),self.TAB_Movie_OnDefStartPosEd)
598
self.qtapp.connect(self.win.MovieEndEd,SIGNAL("timeChanged(QTime)"),self.TAB_Movie_OnDefEndPosEd)
601
self.qtapp.connect(self.win.actionAddtitle,SIGNAL(actionButton),self.Timeline_AddTitle)
602
self.qtapp.connect(self.win.actionAdd,SIGNAL(actionButton),self.Timeline_BrowseAddImage)
603
self.qtapp.connect(self.win.actionAddMovie,SIGNAL(actionButton),self.Timeline_BrowseAddMovie)
604
self.qtapp.connect(self.win.actionMove_right,SIGNAL(actionButton),self.Timeline_MoveItemToRight)
605
self.qtapp.connect(self.win.actionMove_left,SIGNAL(actionButton),self.Timeline_MoveItemToLeft)
606
self.qtapp.connect(self.win.actionRemove,SIGNAL(actionButton),self.Timeline_DeleteItem)
607
self.qtapp.connect(self.win.timeline,SIGNAL("itemSelectionChanged()"),self.Timeline_ChgSelectedItem)
608
self.qtapp.connect(self.win.ZoomDownBt,SIGNAL("pressed()"),self.Timeline_ZoomDown)
609
self.qtapp.connect(self.win.ZoomUpBt,SIGNAL("pressed()"),self.Timeline_ZoomUp)
611
#TableZoomPoint and TAB Zoom action
612
self.qtapp.connect(self.win.addZoomPoint,SIGNAL("pressed()"),self.TableZoomPoint_AddPoint)
613
self.qtapp.connect(self.win.moveZoomPointToLeft,SIGNAL("pressed()"),self.TableZoomPoint_MoveItemToUp)
614
self.qtapp.connect(self.win.moveZoomPointToRight,SIGNAL("pressed()"),self.TableZoomPoint_MoveItemToDown)
615
self.qtapp.connect(self.win.removeZoomPoint,SIGNAL("pressed()"),self.TableZoomPoint_DeleteItem)
616
self.qtapp.connect(self.win.ZoomPointTimeFixe,SIGNAL("valueChanged(int)"),self.TableZoomPoint_ChgTimeFixe)
617
self.qtapp.connect(self.win.ZoomPointTimeTravel,SIGNAL("valueChanged(int)"),self.TableZoomPoint_ChgTimeToTravel)
618
self.qtapp.connect(self.win.TableZoomPoint,SIGNAL("itemSelectionChanged()"),self.TableZoomPoint_ChgSelectedItem)
619
self.qtapp.connect(self.win.ZoomPointXValue,SIGNAL("valueChanged(double)"),self.TableZoomPoint_ChgZoomPointXValue)
620
self.qtapp.connect(self.win.ZoomPointYValue,SIGNAL("valueChanged(double)"),self.TableZoomPoint_ChgZoomPointYValue)
621
self.qtapp.connect(self.win.ZoomPointZoomValue,SIGNAL("valueChanged(double)"),self.TableZoomPoint_ChgZoomPointZoomValue)
622
self.qtapp.connect(self.win.DefZoomPointBt,SIGNAL("pressed()"),self.TableZoomPoint_DefZoomPoint)
623
self.qtapp.connect(self.win.DefTextBtZoomPoint,SIGNAL("pressed()"),self.TableZoomPoint_DefZoomPointText)
624
#Other toolbar action
625
self.qtapp.connect(self.win.actionConfiguration,SIGNAL(actionButton),self.App_Configuration)
626
self.qtapp.connect(self.win.action_About,SIGNAL(actionButton),self.App_About)
627
self.qtapp.connect(self.win.actionDocumentation,SIGNAL(actionButton),self.App_Documentation)
628
self.qtapp.connect(self.win.actionNewFunctions,SIGNAL(actionButton),self.App_NewFunctions)
629
self.qtapp.connect(self.win.serie,SIGNAL(actionButton),self.App_ProcessSerieDialog)
630
self.qtapp.connect(self.win.actionPreview,SIGNAL(actionButton),self.App_Preview)
631
self.qtapp.connect(self.win.actionPreviewBt,SIGNAL("pressed()"),self.App_Preview)
632
self.qtapp.connect(self.win.actionPreviewFrom,SIGNAL(actionButton),self.App_PreviewFrom)
633
self.qtapp.connect(self.win.actionPreviewFromBt,SIGNAL("pressed()"),self.App_PreviewFrom)
634
self.qtapp.connect(self.win.actionRender,SIGNAL(actionButton),self.App_DoRender)
635
self.qtapp.connect(self.win.actionRenderBt,SIGNAL("pressed()"),self.App_DoRender)
636
self.qtapp.connect(self.win.actionVideo_player,SIGNAL(actionButton),self.App_MplayerView)
637
self.qtapp.connect(self.win.actionVideo_player,SIGNAL(actionButton),self.App_MplayerView)
639
# Sound montage button
640
self.qtapp.connect(self.win.SoundButton,SIGNAL("pressed()"),self.SND_test)
642
# Display main window
645
self.check_CheckConfig(False,ForceConfig)
646
#if firsttime : open the configuration dialogbox
647
if ForceConfig==True: self.App_Configuration(True)
649
self.StopMAJOFD = False
652
self.IsProjectModified=False
653
self.File_NewProject()
655
# If option -idv + idv file -> Open file
657
if args[2] == "-idv" :
658
self.ProjectFilePathName=args[3]
659
#Import configurations data from xml file
661
fo2=open(self.ProjectFilePathName,'r')
662
self.ProjectXMLObject=minidom.parse(fo2)
664
#Make object from XML data
665
self.File_MakeFromXML()
667
print self.qtapp.translate("main","Opening ")+self.ProjectFilePathName
669
# Display lenght time.
670
self.App_DisplayLenght()
671
self.App_DisplayPixMainWin(0)
677
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
678
self.soundDlg = SoundDlg(self.montageLenght, self, self.win)
680
#self.WaitEvents() #Pour laisser le temps à la fenêtre de se fermer !
681
self.soundDlg.setTimeline(self.win.timeline, 25)
683
xmlSound = self.ProjectXMLObject.getElementsByTagName('sound')[0]
686
self.soundDlg.setSoundFromXml(xmlSound)
687
self.qtapp.restoreOverrideCursor()
689
self.qtapp.connect(self.soundDlg.buttonBox,SIGNAL("rejected()"),self.soundDlg,SLOT("close()"))
690
self.qtapp.connect(self.soundDlg.buttonBox,SIGNAL("accepted()"), self.getSoundDef)
692
def getXMLSound(self) :
693
"""Function to get XML for sound montage part"""
694
XMLSound = self.soundDlg.getXMLSound(self.ProjectXMLObject)
696
oldSound = self.ProjectXMLObject.getElementsByTagName('Videoporama')[0].removeChild(self.ProjectXMLObject.getElementsByTagName('sound')[0])
699
self.ProjectXMLObject.getElementsByTagName('Videoporama')[0].appendChild(XMLSound)
700
self.soundDlg.close()
702
def getSoundDef(self) :
703
"""Function to get definition of sound montage part"""
705
self.SoundDef = self.soundDlg.getPropSound()
706
self.soundDlg.close()
708
#----------------------------------------------------------------------------------------
709
# Petite fonction pour forcer les réaffichages en vidant l'EventLoop !
710
#----------------------------------------------------------------------------------------
711
def WaitEvents(self):
714
QCoreApplication.processEvents()
717
#----------------------------------------------------------------------------------------
718
# closeApp : when videoporama stop
719
#----------------------------------------------------------------------------------------
720
def App_CloseApp(self):
721
if self.BLOCKCloseApp: return
722
#Ask to save project before continuing if current project not save
723
if self.IsProjectModified:
724
self.BLOCKCloseApp=True
725
reply = QtGui.QMessageBox.question(self.win, self.qtapp.translate("main","New project"),
726
self.qtapp.translate("main","Current project was modified.\nSave it now before continuing ?"),
727
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
728
if reply==QtGui.QMessageBox.Yes: self.File_SaveProject()
730
self.App_SaveConfig()
733
def App_SaveConfig(self):
734
# Update xml document
735
if self.IsPortable==False :
736
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"imgmgkdir",unicode(self.I))
737
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"mjpegtoolsdir",unicode(self.MJ))
738
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"soxdir",unicode(self.S))
739
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"tmpdir",unicode(self.T))
740
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"mplayerdir",unicode(self.MP))
741
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"ImageEditor",unicode(self.ImageEditor))
743
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"time",str(self.ConfTime))
744
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"StaticTimeNext",str(self.ConfStaticTimeNext))
745
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"AnimTimeNext",str(self.ConfAnimTimeNext))
746
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"speedt",str(self.ConfSpeedT))
747
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"typet",str(self.ConfTypeT))
748
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"transiopt",str(self.ConfTransiOpt))
749
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"bgcolor",str(self.ConfBgColor))
750
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"bgfile",unicode(self.ConfBgFile))
751
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"imgformat",str(self.ConfImgFormat))
752
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"zoomVal",str(self.ConfDisplayUnit))
753
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"ThumbnailsSize",str(self.ThumbnailsSize))
754
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"NewSEQPosition",str(self.NewSEQPosition))
756
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"WindowsSettings-RestoreWindowState",str(self.RestoreWindowState))
757
UpdateConfigurationXMLFile(self.ConfigXMLObject,'OFDDeviceType',unicode(self.ConfOFDDeviceType))
758
UpdateConfigurationXMLFile(self.ConfigXMLObject,'OFDDeviceModel',unicode(self.ConfOFDDeviceModel))
759
UpdateConfigurationXMLFile(self.ConfigXMLObject,'OFDOutputCodec',unicode(self.ConfOFDOutputCodec))
760
UpdateConfigurationXMLFile(self.ConfigXMLObject,'OFDOutputFormat',unicode(self.ConfOFDOutputFormat))
762
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidFontName', str(self.TOverlaidFontName))
763
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidFontSize', str(self.TOverlaidFontSize))
764
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidFontColor', str(self.TOverlaidFontColor))
765
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidFontShadowColor', str(self.TOverlaidFontShadowColor))
766
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidIsBold', str("1" if self.TOverlaidIsBold==True else "0"))
767
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidIsItalic', str("1" if self.TOverlaidIsItalic==True else "0"))
768
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidIsUnderline', str("1" if self.TOverlaidIsUnderline==True else "0"))
769
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidHAlign', str(self.TOverlaidHAlign))
770
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidVAlign', str(self.TOverlaidVAlign))
771
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidStyleText', str(self.TOverlaidStyleText))
772
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidBackgroundForm', str(self.TOverlaidBackgroundForm))
773
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidBackgroundStyle', str(self.TOverlaidBackgroundStyle))
774
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidBackgroundColor', str(self.TOverlaidBackgroundColor))
775
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidPenSize', str(self.TOverlaidPenSize))
776
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TOverlaidPenColor', str(self.TOverlaidPenColor))
778
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGFontName', str(self.TBackGFontName))
779
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGFontSize', str(self.TBackGFontSize))
780
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGFontColor', str(self.TBackGFontColor))
781
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGFontShadowColor', str(self.TBackGFontShadowColor))
782
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGIsBold', str("1" if self.TBackGIsBold==True else "0"))
783
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGIsItalic', str("1" if self.TBackGIsItalic==True else "0"))
784
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGIsUnderline', str("1" if self.TBackGIsUnderline==True else "0"))
785
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGHAlign', str(self.TBackGHAlign))
786
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGVAlign', str(self.TBackGVAlign))
787
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGStyleText', str(self.TBackGStyleText))
788
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGBackgroundForm', str(self.TBackGBackgroundForm))
789
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGBackgroundStyle', str(self.TBackGBackgroundStyle))
790
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGBackgroundColor', str(self.TBackGBackgroundColor))
791
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGPenSize', str(self.TBackGPenSize))
792
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TBackGPenColor', str(self.TBackGPenColor))
794
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotFontName', str(self.TShotFontName))
795
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotFontSize', str(self.TShotFontSize))
796
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotFontColor', str(self.TShotFontColor))
797
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotFontShadowColor', str(self.TShotFontShadowColor))
798
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotIsBold', str("1" if self.TShotIsBold==True else "0"))
799
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotIsItalic', str("1" if self.TShotIsItalic==True else "0"))
800
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotIsUnderline', str("1" if self.TShotIsUnderline==True else "0"))
801
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotHAlign', str(self.TShotHAlign))
802
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotVAlign', str(self.TShotVAlign))
803
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotStyleText', str(self.TShotStyleText))
804
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotBackgroundForm', str(self.TShotBackgroundForm))
805
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotBackgroundStyle', str(self.TShotBackgroundStyle))
806
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotBackgroundColor', str(self.TShotBackgroundColor))
807
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotPenSize', str(self.TShotPenSize))
808
UpdateConfigurationXMLFile(self.ConfigXMLObject,'TShotPenColor', str(self.TShotPenColor))
810
# Save Windows size/position on exit
811
if self.win.isMaximized():
816
size=self.win.frameGeometry()
817
self.MainWinRx = size.x()
818
self.MainWinRy = size.y()
819
size=self.win.geometry()
821
size=self.win.geometry()
822
self.MainWinRx = size.x()-1 #It's not good but X11 don't give the real information !
823
self.MainWinRy = size.y()-self.win.menuBar().height()-5 #It's not good but X11 don't give the real information !
824
self.MainWinRw = size.width()
825
self.MainWinRh = size.height()
826
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"WindowsSettings-ismaximized",str(state))
827
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"WindowsSettings-x",str(self.MainWinRx))
828
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"WindowsSettings-y",str(self.MainWinRy))
829
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"WindowsSettings-width",str(self.MainWinRw))
830
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"WindowsSettings-height",str(self.MainWinRh))
832
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"ZoomBoxSettings-ismaximized",str(self.ZoomBoxIsMaximized))
833
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"ZoomBoxSettings-x",str(self.ZoomBoxWinRx))
834
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"ZoomBoxSettings-y",str(self.ZoomBoxWinRy))
835
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"ZoomBoxSettings-width",str(self.ZoomBoxWinRw))
836
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"ZoomBoxSettings-height",str(self.ZoomBoxWinRh))
838
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"TextBoxSettings-ismaximized",str(self.TextBoxIsMaximized))
839
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"TextBoxSettings-x",str(self.TextBoxWinRx))
840
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"TextBoxSettings-y",str(self.TextBoxWinRy))
841
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"TextBoxSettings-width",str(self.TextBoxWinRw))
842
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"TextBoxSettings-height",str(self.TextBoxWinRh))
845
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"lastDirImage",unicode(self.lastDirImage))
846
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"lastDirMovies",unicode(self.lastDirMovies))
847
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"lastDirProject",unicode(self.lastDirProject))
848
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"lastDirSound",unicode(self.lastDirSound))
849
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"lastDirRender",unicode(self.lastDirRender))
850
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"lastDirBackground",unicode(self.lastDirBackground))
851
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"CheckCodecAtStartup",str(self.CheckCodecAtStartup))
854
ConfigFile=QFile(self.ConfigFilePathName)
855
if ConfigFile.open(QIODevice.WriteOnly | QIODevice.Text) :
856
ConfigFile.write(self.ConfigXMLObject.toxml('utf-8'))
859
#-------------------------------------------------------------------------------------------------
860
# App_DisplayPixMainWin : function call each time the preview zone (main window) need to be update
861
#-------------------------------------------------------------------------------------------------
862
def App_DisplayPixMainWin(self,TabToDisplay) :
863
if self.StopUpdatePixDuringNewSelect==True : return
864
#Aspect ratio rendering
865
OuputWidth=float(self.win.preview.width())
866
if self.imgformat==1 : OutputHeight=float((OuputWidth/16)*9)
867
else : OutputHeight=float((OuputWidth/4)*3)
868
if OutputHeight>self.win.preview.height():
869
#Retry for OuputWidth if image is not landscape
870
OutputHeight=float(self.win.preview.height())
871
if self.imgformat==1 : OuputWidth=float((OutputHeight/9)*16)
872
else : OuputWidth=float((OutputHeight/3)*4)
874
DecalX=float(self.win.preview.width()-OuputWidth)/2
875
DecalY=float(self.win.preview.height()-OutputHeight)/2
876
#Create Background QImage
877
bkgpix = QImage(QSize(self.win.preview.width(),self.win.preview.height()),QImage.Format_ARGB32_Premultiplied)
879
p.fillRect(QRect(0,0,self.win.preview.width(),self.win.preview.height()),toqcolor(QString("afafaf").toInt(16)[0]))
881
if (self.index != -1) :
882
image=self.win.timeline.cellWidget(0,self.index)
884
# Zoom and travel TAB
885
i = self.win.TableZoomPoint.currentRow()
886
if i > -1 : Dessin,Unused=image.ToRenderImageForDisplay(i,OuputWidth,OutputHeight)
887
else : Dessin,Unused=image.ToRenderImageForDisplay(0,OuputWidth,OutputHeight)
888
if self.XMLText!=None: Dessin=ApplyTextToQImage(Dessin,self.XMLText.getElementsByTagName(u"SaveXML")[0])
890
p.drawImage(DecalX,DecalY,Dessin)
892
self.win.preview.setPixmap(QPixmap.fromImage(bkgpix))
894
#----------------------------------------------------------------------------------------
895
# App_ResizeEvent : when main videoporama window is resize
896
#----------------------------------------------------------------------------------------
897
def App_ResizeEvent(self, event) :
899
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
900
# Reset variables to force a refresh of the ruller
901
self.TimeChanged=True
902
self.PrevStart =QTime(0,0,0)
903
self.PrevEnd =QTime(0,0,0)
904
self.PrevDuration=QTime(0,0,0)
905
self.App_DisplayLenght()
909
#----------------------------------------------------------------------------------------
910
# Function for set all elements in the main windows
911
#----------------------------------------------------------------------------------------
912
def App_SetupInterface(self):
913
self.StopSetupInterface = True
914
NbrImageItem = self.win.timeline.columnCount()
916
self.index = self.win.timeline.currentColumn()
918
#if none is selected, force select the first
919
self.win.timeline.setCurrentCell(0,0)
920
self.index = self.win.timeline.currentColumn()
921
image=self.win.timeline.cellWidget(0,self.index)
922
if image.ObjectType!=2 :
923
row=self.win.TableZoomPoint.currentRow()
924
if row!=-1 : ZoomPointItem=self.win.TableZoomPoint.cellWidget(row,0)
925
else : ZoomPointItem=None
926
else : ZoomPointItem=None
932
self.App_WindowTitleAndFlag()
933
CurTab=self.win.TABOptions.currentIndex()
935
if CurTab!=0: self.win.TABOptions.setCurrentIndex(0)
936
self.win.TABOptions.setTabEnabled(1,False)
937
self.win.TABOptions.setTabEnabled(2,False)
938
self.win.TABOptions.setTabEnabled(3,False)
940
self.win.TABOptions.setTabEnabled(1,True)
942
#----------------------------------------
944
#----------------------------------------
945
self.win.imgformat.setCurrentIndex(self.imgformat)
946
#self.win.soundfile.setText(self.soundfile)
948
#----------------------------------------
950
#----------------------------------------
951
self.win.bgcolor.setDisabled(image==None)
952
self.win.bgcolora.setDisabled(image==None)
953
self.win.bgfile.setDisabled(image==None)
954
self.win.bgfilea.setDisabled(image==None)
955
self.win.ZoomPointTimeFixe.setDisabled(image==None)
956
self.win.ZoomPointTimeTravel.setDisabled(image==None)
957
self.win.speedt.setDisabled(image==None)
958
self.win.typet.setDisabled(image==None)
959
self.win.transiopt.setDisabled(image==None)
960
self.win.DefTextBtImage.setDisabled(image==None)
963
self.win.bgcolor.setText(str(image.bgcolor))
964
color=toqcolor(QString(image.bgcolor).toInt(16)[0])
966
qp.setColor(QPalette.Base,color)
967
self.win.bgcolor.setPalette(qp)
968
self.win.bgfile.setText(image.bgfile)
969
self.win.speedt.setCurrentIndex(int(image.speedt))
970
self.win.typet.setCurrentIndex(int(image.typet))
971
self.win.transiopt.setCurrentIndex(int(image.opttransi))
973
self.win.bgcolor.setText(str(self.ConfBgColor))
974
color=toqcolor(QString(self.ConfBgColor).toInt(16)[0])
976
qp.setColor(QPalette.Base,color)
977
self.win.bgcolor.setPalette(qp)
978
self.win.bgfile.setText(self.ConfBgFile)
979
self.win.speedt.setCurrentIndex(int(self.ConfSpeedT))
980
self.win.typet.setCurrentIndex(int(self.ConfTypeT))
981
self.win.transiopt.setCurrentIndex(int(self.ConfTransiOpt))
983
#----------------------------------------
985
#----------------------------------------
986
self.win.actionMove_left.setDisabled(image==None or NbrImageItem<2 or self.index==0)
987
self.win.actionMove_right.setDisabled(image==None or NbrImageItem<2 or self.index==NbrImageItem-1)
988
self.win.actionRemove.setDisabled(self.index==-1)
989
self.win.actionPreview.setDisabled(NbrImageItem==0)
990
self.win.actionPreviewFrom.setDisabled(NbrImageItem==0)
991
self.win.actionPreviewBt.setDisabled(NbrImageItem==0)
992
self.win.actionPreviewFromBt.setDisabled(NbrImageItem==0)
993
self.win.actionRender.setDisabled(NbrImageItem==0)
994
self.win.actionRenderBt.setDisabled(NbrImageItem==0)
995
self.win.actionCut.setDisabled(image==None)
996
self.win.actionCopy.setDisabled(image==None)
997
self.win.actionPaste.setDisabled(self.SEQClipboard==None)
998
self.win.actionSave_as.setDisabled(NbrImageItem==0)
999
self.win.ZoomDownBt.setDisabled(self.ThumbnailsSize==0)
1000
self.win.ZoomUpBt.setDisabled(self.ThumbnailsSize==2)
1002
#----------------------------------------
1004
#----------------------------------------
1005
if image!=None : DisableFlag=image.ObjectType==2
1006
else: DisableFlag=True
1008
self.win.addZoomPoint.setDisabled(DisableFlag)
1009
self.win.ZoomPointXValue.setDisabled(ZoomPointItem==None)
1010
self.win.ZoomPointYValue.setDisabled(ZoomPointItem==None)
1011
self.win.ZoomPointZoomValue.setDisabled(ZoomPointItem==None)
1012
self.win.DefZoomPointBt.setDisabled(ZoomPointItem==None)
1013
self.win.DefTextBtZoomPoint.setDisabled(ZoomPointItem==None)
1014
self.win.ZoomPointTimeFixe.setDisabled(ZoomPointItem==None)
1016
if DisableFlag==False:
1017
self.win.moveZoomPointToLeft.setDisabled(self.win.TableZoomPoint.rowCount()<2 or self.win.TableZoomPoint.currentRow()==0)
1018
self.win.moveZoomPointToRight.setDisabled(self.win.TableZoomPoint.rowCount()<2 or self.win.TableZoomPoint.currentRow()==self.win.TableZoomPoint.rowCount()-1)
1019
self.win.removeZoomPoint.setDisabled(self.win.TableZoomPoint.rowCount()<2)
1020
self.win.EXIFTable.setDisabled(image.urlim=="")
1021
self.win.ImageFile.setDisabled(image.urlim=="")
1022
self.win.ImageFileBt.setDisabled(image.urlim=="")
1023
self.win.RotateLeftBT.setDisabled(image.urlim=="")
1024
self.win.RotateRightBT.setDisabled(image.urlim=="")
1025
self.win.CallGimpBT.setDisabled(image.urlim=="" or self.IsGIMPOk==False)
1026
self.win.RefreshImgBT.setDisabled(image.urlim=="")
1028
self.win.moveZoomPointToLeft.setDisabled(True)
1029
self.win.moveZoomPointToRight.setDisabled(True)
1030
self.win.removeZoomPoint.setDisabled(True)
1031
self.win.ImageFile.setText("")
1032
self.win.EXIFTable.setDisabled(True)
1033
self.win.ImageFile.setDisabled(True)
1034
self.win.ImageFileBt.setDisabled(True)
1035
self.win.RotateLeftBT.setDisabled(True)
1036
self.win.RotateRightBT.setDisabled(True)
1037
self.win.CallGimpBT.setDisabled(True)
1038
self.win.RefreshImgBT.setDisabled(True)
1040
if ZoomPointItem!=None :
1041
#if an item is selected in TableZoomPoint
1042
ZoomPointItem.SetupInterface()
1043
self.win.ZoomPointTimeTravel.setDisabled(self.win.TableZoomPoint.currentRow()<=0)
1044
if self.win.TableZoomPoint.currentRow()<=0: self.win.ZoomPointTimeTravel.setValue(0)
1046
#if no item in TableZoomPoint
1047
self.win.ZoomPointTimeTravel.setDisabled(True)
1048
self.win.ZoomPointZoomValue.setValue(100)
1049
self.win.ZoomPointYValue.setValue(0)
1050
self.win.ZoomPointXValue.setValue(0)
1051
self.win.ZoomPointXLabel.setText("")
1052
self.win.ZoomPointYLabel.setText("")
1053
self.win.ZoomPointZoomLabel.setText("")
1054
self.win.ZoomPointTimeFixe.setValue(0)
1055
self.win.ZoomPointTimeTravel.setValue(0)
1057
if self.ConfDisplayUnit=="0":
1059
self.win.ZoomPointXValue.setDecimals(2)
1060
self.win.ZoomPointYValue.setDecimals(2)
1061
self.win.ZoomPointZoomValue.setDecimals(2)
1063
#Display unit in pixel
1064
self.win.ZoomPointXValue.setDecimals(0)
1065
self.win.ZoomPointYValue.setDecimals(0)
1066
self.win.ZoomPointZoomValue.setDecimals(0)
1068
#----------------------------------------
1070
#----------------------------------------
1072
DisableFlag=image.ObjectType!=2
1076
self.win.MovieFile.setDisabled(DisableFlag)
1077
self.win.MovieFileBt.setDisabled(DisableFlag)
1078
self.win.RotateLeftMovieBT.setDisabled(DisableFlag)
1079
self.win.RotateRightMovieBT.setDisabled(DisableFlag)
1080
self.win.RefreshMovieBT.setDisabled(DisableFlag)
1082
#----------------------------------------
1083
#Other toolbar action
1084
#----------------------------------------
1085
#self.win.actionVideo_player.setDisabled(NbrImageItem==0)
1086
self.win.serie.setDisabled(NbrImageItem==0)
1087
self.App_DisplayLenght()
1088
self.StopSetupInterface = False
1090
#----------------------------------------------------------------------------------------
1091
# Function to calcul project duration and set it
1092
#----------------------------------------------------------------------------------------
1093
def App_DisplayLenght(self) :
1094
if self.TimeChanged==True:
1096
imgpsec=self.OutputOFDXMLObject.GetAllProperties(self.OFDDeviceType,self.OFDDeviceModel,self.OFDOutputCodec,self.imgformat,self.OFDOutputFormat)[1]
1100
imgpsec=int(imgpsec)
1101
if imgpsec==30 : ips=float(30000/1001)
1105
self.montageLenght = 0.0
1108
DurationSequence = 0
1110
while k<self.win.timeline.columnCount() :
1111
Image=self.win.timeline.cellWidget(0,k)
1113
if Image.ObjectType!=2 : StopShot=self.win.TableZoomPoint.currentRow()
1115
# Calc curimage position for current shot
1116
if k<self.win.timeline.currentColumn() :
1117
self.curimage = self.totimage+Image.CalcImageTime(imgpsec,StopShot)[1]
1118
if k<=self.win.timeline.currentColumn() :
1119
StartSequence = self.totimage+Image.CalcImageTime(imgpsec,0)[1] # For ruller
1120
DurationSequence = Image.CalcImageTime(imgpsec)[1] # For ruller
1121
if k==(self.win.timeline.columnCount()-1): self.totimage += Image.CalcImageTime(imgpsec)[1]
1122
else : self.totimage += Image.CalcImageTime(imgpsec)[1]-Image.CalcImageTime(imgpsec)[5]
1124
self.montageLenght = float(self.totimage)/ips
1125
self.win.duration.setText(frameToTime(self.curimage, ips)+"/"+frameToTime(self.totimage, ips))
1128
Duration=QTime(0,0,0,0).fromString(frameToTime(self.totimage,ips),"HH:mm:ss.zzz")
1129
Start =QTime(0,0,0,0).fromString(frameToTime(StartSequence,ips),"HH:mm:ss.zzz")
1130
End =QTime(0,0,0,0).fromString(frameToTime(StartSequence+DurationSequence,ips),"HH:mm:ss.zzz")
1131
if Start<>self.PrevStart or End<>self.PrevEnd or Duration<>self.PrevDuration:
1132
DrawMovieRuller(self.win.CustomWidget,Start,End,Duration) # Draw zone
1133
self.PrevStart =Start
1135
self.PrevDuration=Duration
1136
self.TimeChanged = False
1138
#----------------------------------------------------------------------------------------
1139
# Function for set Window Title and Flag
1140
#----------------------------------------------------------------------------------------
1141
def App_WindowTitleAndFlag(self):
1142
if self.IsPortable :
1143
Title="Portable Videoporama (0.8.1) - "
1145
Title="Videoporama (0.8.1) - "
1147
if self.ProjectFilePathName=="":
1148
Title=Title+"<"+self.qtapp.translate("main","new file")+">"
1150
Title=Title+validatePath(self.ProjectFilePathName,False)
1152
#if self.IsProjectModified: Title=Title+"*"
1153
self.win.setWindowTitle(Title)
1154
self.win.action_Save.setDisabled(self.IsProjectModified==False)
1155
self.win.setWindowModified(self.IsProjectModified)
1157
#----------------------------------------------------------------------------------------
1158
# Function for set Window Title and Flag
1159
#----------------------------------------------------------------------------------------
1160
def App_SetModifiedFlag(self):
1161
if self.IsProjectModified==False and self.StopUpdatePixDuringNewSelect==False:
1162
self.IsProjectModified=True
1163
self.App_WindowTitleAndFlag()
1165
#-----------------------------------------------------------------------------------------------------------------------------------------------
1166
# Other toolbar action
1167
#-----------------------------------------------------------------------------------------------------------------------------------------------
1168
#----------------------------------------------------------------------------------------
1170
#----------------------------------------------------------------------------------------
1171
def App_Preview(self) :
1172
self.File_CreateXMLObject() # ensure ProjectXMLObject is created and up to date
1173
showprog=RenderDlg(self,True,self.win) # open dialog box
1174
showprog.show() # display dialog box
1175
self.WaitEvents() # be sure dialog box is display
1176
showprog.ProgressProcess() # start process
1178
def App_PreviewFrom(self) :
1179
self.File_CreateXMLObject() # ensure ProjectXMLObject is created and up to date
1180
showprog=RenderDlg(self,True,self.win) # open dialog box
1181
showprog.show() # display dialog box
1182
self.WaitEvents() # be sure dialog box is display
1183
# Define a start sequence for preview
1184
showprog.StartRenderSequence = self.win.timeline.currentColumn()
1185
showprog.ProgressProcess() # start process
1187
#----------------------------------------------------------------------------------------
1189
#----------------------------------------------------------------------------------------
1190
def App_DoRender(self) :
1191
self.File_CreateXMLObject() # ensure ProjectXMLObject is created and up to date
1192
showprog=RenderDlg(self,False,self.win) # open dialog box
1193
showprog.show() # display dialog box
1195
#----------------------------------------------------------------------------------------
1196
# start mplayer to view a file
1197
#----------------------------------------------------------------------------------------
1198
def App_MplayerView(self) :
1199
#--------------------------------------------- à faire : vérifier en anglais !
1200
self.mpview = Mplayer(self,taille=(400,300), choixWidget=(Mplayer.PAS_PRECEDENT_SUIVANT,Mplayer.CURSEUR_A_PART,Mplayer.PARCOURIR), cheminMPlayer=self.MP)
1201
self.mpview.setWindowTitle(self.qtapp.translate("main","Video Player"))
1204
#----------------------------------------------------------------------------------------
1206
#----------------------------------------------------------------------------------------
1207
def App_About(self) :
1208
aboutw=About(self.win)
1210
self.qtapp.connect(aboutw.closeabout,SIGNAL("clicked()"),aboutw,SLOT("close()"))
1212
#----------------------------------------------------------------------------------------
1213
# Documentation Dialog box
1214
#----------------------------------------------------------------------------------------
1215
def App_Documentation(self) :
1216
docw=DocHelp(self,self.qtapp.translate("Documentation","en-main.html"),self.win)
1219
def App_NewFunctions(self) :
1220
docw=DocHelp(self,self.qtapp.translate("Documentation","en-new.html"),self.win)
1223
#----------------------------------------------------------------------------------------
1224
# Serie dialog box and process
1225
#----------------------------------------------------------------------------------------
1226
def App_ProcessSerieDialog(self) :
1227
self.winserie=Lot(self.lstT,self,self.win)
1228
self.winserie.fromc.setMaximum(self.win.timeline.columnCount())
1229
self.winserie.toc.setMaximum(self.win.timeline.columnCount())
1230
self.winserie.show()
1231
self.qtapp.connect(self.winserie.buttonBox,SIGNAL("accepted()"),self.App_ProcessSerieDo)
1233
def App_ProcessSerieDo(self) :
1234
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1235
#if user forget to add line : add current selection
1236
if self.winserie.tableImage.rowCount() == 0 : self.winserie.validLineA()
1239
while Cur < self.winserie.tableImage.rowCount() :
1240
option=self.winserie.tableImage.item(Cur,2).text().split(":")
1241
imF =self.winserie.tableImage.item(Cur,0).text()
1242
imL =self.winserie.tableImage.item(Cur,1).text()
1244
while i <= (int(imL)-1) :
1245
if str(option[0].split("=")[0])=="1" :
1246
UpdateAttributXMLFile(self.win.timeline.cellWidget(0,i).ZoomPointList,u"Point-0",u"timeFixe",str(option[0].split("=")[1]),u"ZoomPointTable")
1247
if i==self.win.timeline.currentColumn(): self.win.TableZoomPoint.cellWidget(0,0).timeFixe=int(str(option[0].split("=")[1]))
1248
if str(option[1].split("=")[0])=="1" : self.win.timeline.cellWidget(0,i).bgfile =str(option[1].split("=")[1])
1249
if str(option[2].split("=")[0])=="1" : self.win.timeline.cellWidget(0,i).bgcolor =str(option[2].split("=")[1])
1250
if str(option[3].split("=")[0])=="1" : self.win.timeline.cellWidget(0,i).speedt =unicode(option[3].split("=")[1])
1251
if str(option[4].split("=")[0])=="1" :
1252
if int(option[4].split("=")[1])==self.winserie.RANDOMTRANSITIONTYPE:
1253
transi, optTransi = randomTransi()
1254
self.win.timeline.cellWidget(0,i).typet =int(transi)
1255
self.win.timeline.cellWidget(0,i).opttransi=int(optTransi)
1257
self.win.timeline.cellWidget(0,i).typet =int(option[4].split("=")[1])
1258
self.win.timeline.cellWidget(0,i).opttransi=int(option[5])
1259
#refresh image and timeline thumbnail
1260
self.win.timeline.cellWidget(0,i).ResetThumb()
1263
self.App_SetupInterface()
1264
self.App_DisplayLenght()
1265
self.App_SetModifiedFlag()
1266
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
1267
self.qtapp.restoreOverrideCursor()
1269
#-----------------------------------------------------------------------------------------------------------------------------------------------
1270
# Status_conf dialog box : Check configuration and display report
1271
#-----------------------------------------------------------------------------------------------------------------------------------------------
1273
def check_CheckConfig(self,ConfigWindow=True,ForceHide=False):
1274
# init dialog box if need or if self.CheckCodecAtStartup not check
1275
if (ConfigWindow==True) or (ForceHide==False and self.CheckCodecAtStartup!="2"):
1276
ok=QIcon(QPixmap("icons/ok.png"))
1277
nok=QIcon(QPixmap("icons/nok.png"))
1278
self.statconf=StatusConf(self.win)
1279
else : self.statconf=None
1281
#Check Image Editor configuration
1282
if QFileInfo(QDir().toNativeSeparators(self.ImageEditor)).exists():
1283
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(ok,self.qtapp.translate("main","An Image Editor is correctly configured")))
1286
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,self.qtapp.translate("main","The Image Editor is not found, check the configuration")))
1289
#Check FFMpeg directory configuration
1290
if QDir(self.I).exists():
1291
if isWindows(): ToCheck=QDir().toNativeSeparators(self.I)+"ffmpeg.exe"
1292
else : ToCheck=QDir().toNativeSeparators(self.I)+"ffmpeg"
1293
if QFileInfo(ToCheck).exists():
1294
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(ok,"FFmpeg"+self.qtapp.translate("main"," is correctly configured")))
1296
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,"FFmpeg : "+self.qtapp.translate("main","not found, check the configuration")))
1298
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,"FFmpeg "+self.qtapp.translate("main",": The configuration directory is not define, check the configuration")))
1300
#Check ffmpeg abilities
1302
self.msgffmpeg = QStringList()
1303
self.listformats = QStringList()
1304
self.convertformat = []
1307
commande = u"\""+unicode(self.I)+u"ffmpeg.exe\" -formats"
1308
f = subprocess.Popen(commande.encode('iso-8859-1'), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
1310
f = subprocess.Popen(validateCommande(self.I+"ffmpeg")+' -formats', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
1313
["RAW DV (dv)","dv"],
1314
["MPEG1","mpeg1video"],
1315
["MPEG2","mpeg2video"],
1317
["Theora","libtheora"],
1321
["WebM (VP8)","libvpx"],
1323
["libfaac AAC (Advanced Audio Codec)","libfaac"],
1324
["ADTS AAC (Advanced Audio Codec)","adts"],
1325
["libmp3lame MP3 (MPEG audio layer 3)","libmp3lame"],
1326
["libvorbis Vorbis","libvorbis"],
1327
["Dolby Digital (AC-3)","ac3"],
1328
["PCM signed 16-bit little-endian","s16le"],
1331
["MPEG file format","mpeg"],
1332
["MOV file format","mov"],
1333
["DV file format","dv"],
1334
["AVI file format","avi"],
1335
["FLV file format","flv"],
1336
["MKV file format","matroska"],
1337
["3GP file format","3gp"],
1338
["WEBM file format","webm"],
1339
["MP4 file format","mp4"]
1344
verffmpeg = f.communicate()[0]
1345
for ff in FormatToTest :
1346
if verffmpeg.find(ff[1]) == -1 : #if format is not found
1348
#add-it to the projet combobox
1349
if ff[1]!="libfaac" and ff[1]!="adts" and self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,self.qtapp.translate("main","The ffmpeg package installed don't include %1 and isn't able to encode in %2. This format will be disable in the user interface.").arg(QString(ff[1])).arg(QString(ff[0]))))
1351
else : #if format is found
1352
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(ok,self.qtapp.translate("main","The ffmpeg package is able to encode in %1.").arg(QString(ff[0]))))
1353
if ff[1]=="libfaac" : self.AACMode="libfaac"
1354
self.listformats.append(ff[1])
1357
if QDir(self.S).exists():
1358
if isWindows(): ToCheck=QDir().toNativeSeparators(self.S)+"sox.exe"
1359
else : ToCheck=QDir().toNativeSeparators(self.S)+"sox"
1360
if QFileInfo(ToCheck).exists():
1361
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(ok,"SoX"+self.qtapp.translate("main"," is correctly configured")))
1362
#Check sox abilities
1365
commande = u"\""+unicode(self.S)+u"sox.exe\" -h"
1366
s = subprocess.Popen(commande.encode('iso-8859-1'), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
1368
s = subprocess.Popen(validateCommande(unicode(self.S+"sox"))+u" -h", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()[0]
1369
self.msgsox = [u"",u"",u""]
1370
if s.find("wav") == -1 :
1371
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,self.qtapp.translate("main","Wav Format is not supported by your version of Sox. Add required package from your distribution unless you won't be able to make video.")))
1372
if s.find("ogg") == -1 :
1373
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,self.qtapp.translate("main","Ogg Format is not supported by your version of Sox. Add required package from your distribution unless you won't be able to use ogg sound file.")))
1374
if s.find("mp3") == -1 :
1375
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,self.qtapp.translate("main","Mp3 Format is not supported by your version of Sox. Add required package from your distribution unless you won't be able to use mp3 sound file.")))
1379
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,"SoX : "+self.qtapp.translate("main","not found, check the configuration")))
1381
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,"SoX "+self.qtapp.translate("main",": The configuration directory is not define, check the configuration")))
1384
if QDir(self.MJ).exists():
1385
if isWindows(): ToCheck=QDir().toNativeSeparators(self.MJ)+"ppmtoy4m.exe"
1386
else : ToCheck=QDir().toNativeSeparators(self.MJ)+"ppmtoy4m"
1387
if QFileInfo(ToCheck).exists():
1388
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(ok,"MJpegTools"+self.qtapp.translate("main"," is correctly configured")))
1390
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,"MJpegTools : "+self.qtapp.translate("main","not found, check the configuration")))
1392
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,"MJpegTools "+self.qtapp.translate("main",": The configuration directory is not define, check the configuration")))
1395
if QDir(self.MP).exists():
1396
if isWindows(): ToCheck=QDir().toNativeSeparators(self.MP)+"mplayer.exe"
1397
else : ToCheck=QDir().toNativeSeparators(self.MP)+"mplayer"
1398
if QFileInfo(ToCheck).exists():
1399
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(ok,"MPlayer"+self.qtapp.translate("main"," is correctly configured")))
1401
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,"MPlayer : "+self.qtapp.translate("main","not found, check the configuration")))
1403
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,"MPlayer "+self.qtapp.translate("main",": The configuration directory is not define, check the configuration")))
1406
if QDir(self.T).exists():
1407
if IsPathWritable(self.T) :
1408
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(ok,self.qtapp.translate("main","The temporary directory is writable")))
1410
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,self.qtapp.translate("main","The temporary directory is not writable")))
1412
if self.statconf!=None: self.statconf.status.addItem(QListWidgetItem(nok,self.qtapp.translate("main","The temporary directory is not define, check the configuration")))
1414
if self.statconf!=None:
1415
c=int(self.CheckCodecAtStartup)
1416
self.statconf.chk.setChecked(bool(c))
1417
self.qtapp.connect(self.statconf.closew,SIGNAL("clicked()"),self.statconf,SLOT("close()"))
1418
self.statconf.connect(self.statconf.chk,SIGNAL("stateChanged(int)"),self.check_ChgDisplayAtStartup)
1419
self.statconf.show()
1421
#Handler for the checkbox "Don't display at startup"
1422
def check_ChgDisplayAtStartup(self,state):
1423
self.CheckCodecAtStartup=str(state)
1424
UpdateConfigurationXMLFile(self.ConfigXMLObject,u"CheckCodecAtStartup",str(state))
1426
#-----------------------------------------------------------------------------------------------------------------------------------------------
1427
# File manipulation functions
1428
#-----------------------------------------------------------------------------------------------------------------------------------------------
1430
#----------------------------------------------------------------------------------------
1431
# Create a new Project (to xml file) function
1432
#----------------------------------------------------------------------------------------
1433
def File_NewProject(self):
1434
#Ask to save project before continuing if current project not save
1435
if self.IsProjectModified:
1436
reply = QtGui.QMessageBox.question(self.win, self.qtapp.translate("main","New project"),
1437
self.qtapp.translate("main","Current project was modified.\nSave it now before continuing ?"),
1438
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
1439
if reply==QtGui.QMessageBox.Yes: self.File_SaveProject()
1442
self.Timeline_Empty()
1444
#Setup default value
1445
self.imgformat = int(self.ConfImgFormat) #Project image format
1446
self.OFDDeviceType = self.ConfOFDDeviceType #
1447
self.OFDDeviceModel = self.ConfOFDDeviceModel #
1448
self.OFDOutputCodec = self.ConfOFDOutputCodec #
1449
self.OFDOutputFormat = self.ConfOFDOutputFormat #
1450
self.ProjectFilePathName = "" #PathName of the project file
1451
self.ProjectXMLObject = None #Document object of the project file
1452
self.IsProjectModified = False #Flag for known if project file need to be save
1453
#self.soundfile = "" #Project sound file
1454
self.outputFile = "" #Project output file
1455
self.XMLText = None #Overlaid text
1456
self.File_CreateXMLObject()
1457
self.App_DisplayLenght()
1458
self.App_SetupInterface()
1460
#----------------------------------------------------------------------------------------
1461
# open an existing project (from xml file) function
1462
#----------------------------------------------------------------------------------------
1463
def File_OpenProject(self):
1464
#Ask to save project before continuing if current project not save
1465
if self.IsProjectModified:
1466
reply = QtGui.QMessageBox.question(self.win, self.qtapp.translate("main","Open project"),
1467
self.qtapp.translate("main","Current project was modified.\nSave it now before continuing ?"),
1468
QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
1469
if reply==QtGui.QMessageBox.Yes: self.File_SaveProject()
1473
FileName=QFileDialog.getOpenFileName(self.win, self.qtapp.translate("main","Open project"),self.lastDirProject, QString("*.idv (*.idv)"))
1474
self.WaitEvents() #Pour laisser le temps à la fenêtre de se fermer !
1476
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1477
self.lastDirProject=QFileInfo(unicode(FileName)).dir().absolutePath()
1480
self.Timeline_Empty()
1482
self.ProjectFilePathName=validatePath(FileName,False)
1483
#Import configurations data from xml file
1485
File=QFile(self.ProjectFilePathName)
1486
if File.open(QIODevice.ReadOnly | QIODevice.Text) :
1488
self.ProjectXMLObject=minidom.parse(File)
1490
#Make object from XML data
1491
self.File_MakeFromXML()
1494
if Err==1 : QtGui.QMessageBox.critical(self.win,self.qtapp.translate("main","Open project"),self.qtapp.translate("main","Error loading file"),QtGui.QMessageBox.Ok)
1495
self.App_SetupInterface()
1496
self.qtapp.restoreOverrideCursor()
1500
#----------------------------------------------------------------------------------------
1501
# Add an existing project (from xml file) add the end of this project function
1502
#----------------------------------------------------------------------------------------
1503
def File_AddProject(self):
1506
FileName=QFileDialog.getOpenFileName(self.win, self.qtapp.translate("main","Add an existing project"),self.lastDirProject, QString("*.idv (*.idv)"))
1507
self.WaitEvents() #Pour laisser le temps à la fenêtre de se fermer !
1509
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1510
self.lastDirProject=QFileInfo(unicode(FileName)).dir().absolutePath()
1512
self.ProjectFilePathName=validatePath(FileName,False)
1513
#Import configurations data from xml file
1515
File=QFile(self.ProjectFilePathName)
1516
if File.open(QIODevice.ReadOnly | QIODevice.Text) :
1518
AddXMLObject=minidom.parse(File)
1520
#Make object from XML data
1521
self.File_MakeFromXMLObject(AddXMLObject)
1524
if Err==1 : QtGui.QMessageBox.critical(self.win,self.qtapp.translate("main","Add an existing project"),self.qtapp.translate("main","Error loading file"),QtGui.QMessageBox.Ok)
1525
self.TimeChanged =True
1526
self.App_SetupInterface()
1527
self.IsProjectModified=True
1528
self.App_WindowTitleAndFlag()
1529
self.qtapp.restoreOverrideCursor()
1533
#----------------------------------------------------------------------------------------
1534
# Save project to file asking for filename (to xml file) function
1535
#----------------------------------------------------------------------------------------
1536
def File_SaveAsProject(self):
1538
FileName=QFileDialog.getSaveFileName(self.win,self.qtapp.translate("main","Save project"),self.lastDirProject, QString("*.idv (*.idv)"))
1540
self.lastDirProject=QFileInfo(FileName).dir().absolutePath()
1541
self.ProjectFilePathName=self.lastDirProject
1542
if self.ProjectFilePathName.endsWith(QDir().separator().toAscii())!=True : self.ProjectFilePathName=self.ProjectFilePathName+QDir().separator().toAscii()
1543
self.ProjectFilePathName=self.ProjectFilePathName+QFileInfo(FileName).baseName()+u".idv"
1544
#ensure ProjectXMLObject is created
1545
self.File_CreateXMLObject()
1548
File=QFile(self.ProjectFilePathName)
1549
if File.open(QIODevice.WriteOnly | QIODevice.Text) :
1551
File.write(self.ProjectXMLObject.toxml('utf-8'))
1553
self.IsProjectModified=False
1554
self.App_WindowTitleAndFlag()
1557
if Err==1 : QtGui.QMessageBox.critical(self.win,self.qtapp.translate("main","Save project"),self.qtapp.translate("main","Error writing file"),QtGui.QMessageBox.Ok)
1559
#----------------------------------------------------------------------------------------
1560
# saveProject (to xml file) function
1561
#----------------------------------------------------------------------------------------
1562
def File_SaveProject(self):
1563
#if no filename transfert to Save As function
1564
if self.ProjectFilePathName=="":
1565
self.File_SaveAsProject()
1567
#ensure ProjectXMLObject is created
1568
self.File_CreateXMLObject()
1571
File=QFile(self.ProjectFilePathName)
1572
if File.open(QIODevice.WriteOnly | QIODevice.Text) :
1574
File.write(self.ProjectXMLObject.toprettyxml(encoding='utf-8'))
1575
# File.write(self.ProjectXMLObject.toxml('utf-8'))
1577
self.IsProjectModified=False
1578
self.App_WindowTitleAndFlag()
1581
if Err==1 : QtGui.QMessageBox.critical(self.win,self.qtapp.translate("main","Save project"),self.qtapp.translate("main","Error writing file"),QtGui.QMessageBox.Ok)
1583
#----------------------------------------------------------------------------------------
1584
# Create XMLObject from objects
1585
#----------------------------------------------------------------------------------------
1586
def File_CreateXMLObject(self):
1587
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1589
if self.SoundDef == None :
1591
xmlPoint=self.ProjectXMLObject.getElementsByTagName(u"Videoporama")[0]
1592
TheSound = xmlPoint.getElementsByTagName(u"sound")
1593
if TheSound.length>0:
1594
soundTag=self.ProjectXMLObject.importNode(TheSound[0],True)
1597
self.ProjectXMLObject = Document()
1598
xmltag = self.ProjectXMLObject.createElement(u"Videoporama")
1599
self.ProjectXMLObject.appendChild(xmltag)
1601
UpdateConfigurationXMLFile(self.ProjectXMLObject,u"outputfile",MakeRelatif(self.ProjectFilePathName,self.outputFile),u"Videoporama")
1602
#UpdateConfigurationXMLFile(self.ProjectXMLObject,u"sndfile",MakeRelatif(self.ProjectFilePathName,self.soundfile),u"Videoporama")
1603
UpdateConfigurationXMLFile(self.ProjectXMLObject,u"imgformat",str(self.imgformat),u"Videoporama")
1604
UpdateConfigurationXMLFile(self.ProjectXMLObject,'OFDDeviceType',str(self.OFDDeviceType),u"Videoporama")
1605
UpdateConfigurationXMLFile(self.ProjectXMLObject,'OFDDeviceModel',str(self.OFDDeviceModel),u"Videoporama")
1606
UpdateConfigurationXMLFile(self.ProjectXMLObject,'OFDOutputCodec',str(self.OFDOutputCodec),u"Videoporama")
1607
UpdateConfigurationXMLFile(self.ProjectXMLObject,'OFDOutputFormat',str(self.OFDOutputFormat),u"Videoporama")
1609
if self.SoundDef == None :
1610
if soundTag!=None : xmltag.appendChild(soundTag)
1612
soundTag = self.ProjectXMLObject.createElement(u"sound")
1613
mainTag = self.ProjectXMLObject.createElement(u"mainTrack")
1614
commentTag = self.ProjectXMLObject.createElement(u"commentTrack")
1615
for sound in self.SoundDef[0] :
1616
sndTag = self.ProjectXMLObject.createElement(u"soundObject")
1617
sndTag.setAttribute(u'track',unicode(sound[0]))
1618
sndTag.setAttribute(u'urlFile',MakeRelatif(self.ProjectFilePathName, unicode(sound[1])))
1619
sndTag.setAttribute(u'TstartV',unicode(sound[2]))
1620
sndTag.setAttribute(u'TendV',unicode(sound[3]))
1621
sndTag.setAttribute(u'silence',unicode(sound[4]))
1622
sndTag.setAttribute(u'silenceD',unicode(sound[5]))
1623
sndTag.setAttribute(u'gain',unicode(sound[6]))
1624
sndTag.setAttribute(u'fadein',unicode(sound[7]))
1625
sndTag.setAttribute(u'fadeout',unicode(sound[8]))
1626
mainTag.appendChild(sndTag)
1628
for sound in self.SoundDef[1] :
1629
sndTag = self.ProjectXMLObject.createElement(u"soundObject")
1630
sndTag.setAttribute(u'track',unicode(sound[0]))
1631
sndTag.setAttribute(u'urlFile',MakeRelatif(self.ProjectFilePathName, unicode(sound[1])))
1632
sndTag.setAttribute(u'TstartV',unicode(sound[2]))
1633
sndTag.setAttribute(u'TendV',unicode(sound[3]))
1634
sndTag.setAttribute(u'silence',unicode(sound[4]))
1635
sndTag.setAttribute(u'silenceD',unicode(sound[5]))
1636
sndTag.setAttribute(u'gain',unicode(sound[6]))
1637
sndTag.setAttribute(u'fadein',unicode(sound[7]))
1638
sndTag.setAttribute(u'fadeout',unicode(sound[8]))
1639
commentTag.appendChild(sndTag)
1641
soundTag.appendChild(mainTag)
1642
soundTag.appendChild(commentTag)
1643
xmltag.appendChild(soundTag)
1645
#Transfert overlaid text to XMLFile
1646
if self.XMLText!=None:
1647
xmlText=self.XMLText.getElementsByTagName(u"Text")
1648
if xmlText.length>0 :
1650
TextToAdd=self.XMLText.importNode(xmlText,True)
1651
xmltag.appendChild(TextToAdd)
1653
nitem=self.win.timeline.columnCount()
1656
QCoreApplication.processEvents()
1658
Image=self.win.timeline.cellWidget(0,i)
1660
xmlchild=doc.createElement("IMG-"+str(i))
1661
xmlchild.setAttribute('ObjectType',str(Image.ObjectType))
1662
xmlchild.setAttribute('transition',str(Image.typet))
1663
xmlchild.setAttribute('tr_option',str(Image.opttransi))
1664
xmlchild.setAttribute('speedt',str(Image.speedt))
1665
xmlchild.setAttribute('bgcolor',str(Image.bgcolor))
1666
xmlchild.setAttribute('bgfile',MakeRelatif(self.ProjectFilePathName,Image.bgfile))
1667
xmlchild.setAttribute('urlimage',MakeRelatif(self.ProjectFilePathName,Image.urlim))
1668
xmlchild.setAttribute('EXIF_Orientation',str(Image.EXIF_Orientation))
1669
xmlchild.setAttribute('EndVideo',unicode(Image.EndVideo.toString("HH:mm:ss.zzz")))
1670
xmlchild.setAttribute('StartVideo',unicode(Image.StartVideo.toString("HH:mm:ss.zzz")))
1672
item=self.win.timeline.cellWidget(0,i)
1674
#Transfert image text to XMLFile
1675
if item.XMLText!=None:
1676
xmlText=item.XMLText.getElementsByTagName(u"Text")
1677
if xmlText.length>0 :
1679
TextToAdd=item.XMLText.importNode(xmlText,True)
1680
xmlchild.appendChild(TextToAdd)
1682
#Transfert XML ZoomPointList of each item to XMLFile
1684
x=LoadAttributFromXMLFile(item.ZoomPointList,u"Point-"+str(j),u"x",u"ZoomPointTable")
1686
QCoreApplication.processEvents()
1687
y=LoadAttributFromXMLFile(item.ZoomPointList,u"Point-"+str(j),u"y",u"ZoomPointTable")
1688
zoom=LoadAttributFromXMLFile(item.ZoomPointList,u"Point-"+str(j),u"zoom",u"ZoomPointTable")
1689
timeFixe=LoadAttributFromXMLFile(item.ZoomPointList,u"Point-"+str(j),u"timeFixe",u"ZoomPointTable")
1690
timeToTravel=LoadAttributFromXMLFile(item.ZoomPointList,u"Point-"+str(j),u"timeToTravel",u"ZoomPointTable")
1692
#add zoompoint to xml
1694
xmlSubChild=doc.createElement('Point-'+str(j))
1695
xmlSubChild.setAttribute('x',str(x))
1696
xmlSubChild.setAttribute('y',str(y))
1697
xmlSubChild.setAttribute('zoom',str(zoom))
1698
xmlSubChild.setAttribute('timeFixe',str(timeFixe))
1699
xmlSubChild.setAttribute('timeToTravel',str(timeToTravel))
1701
# Transfert ZoompointText item(s)
1702
xmlDocItem=item.ZoomPointList.getElementsByTagName(u"Point-"+str(j))[0]
1703
xmlDoc=xmlDocItem.getElementsByTagName(u"Text")
1704
if xmlDoc.length>0 : # If text exist
1706
xmlText=xmlDocItem.getElementsByTagName(u"Text")
1707
if xmlText.length>0 :
1709
TextToAdd=item.ZoomPointList.importNode(xmlDoc,True)
1710
xmlSubChild.appendChild(TextToAdd)
1712
xmlchild.appendChild(xmlSubChild)
1715
x=LoadAttributFromXMLFile(item.ZoomPointList,u"Point-"+str(j),u"x",u"ZoomPointTable")
1716
#==> End of ZoomPointList table
1717
xmltag.appendChild(xmlchild)
1719
#==> End of img table
1720
self.qtapp.restoreOverrideCursor()
1722
#----------------------------------------------------------------------------------------
1723
# Read data from ProjectXMLObject and create all object
1724
#----------------------------------------------------------------------------------------
1725
def File_MakeFromXML(self,ForceNewImageFormat=False,ForceNewVideoFormat=False): #OK QT4
1726
#init new project with XML file
1727
if ForceNewImageFormat==False: self.imgformat = int(LoadValueFromXMLFile(self.ProjectXMLObject,'imgformat',self.ConfImgFormat,u"Videoporama"))
1728
self.outputFile = MakeAbsolut(self.ProjectFilePathName,LoadValueFromXMLFile(self.ProjectXMLObject,'outputfile',"",u"Videoporama"))
1729
#self.soundfile = MakeAbsolut(self.ProjectFilePathName,LoadValueFromXMLFile(self.ProjectXMLObject,'sndfile',"",u"Videoporama"))
1730
self.OFDDeviceType = LoadValueFromXMLFile(self.ProjectXMLObject,'OFDDeviceType',"",u"Videoporama")
1731
self.OFDDeviceModel = LoadValueFromXMLFile(self.ProjectXMLObject,'OFDDeviceModel',"",u"Videoporama")
1732
self.OFDOutputCodec = LoadValueFromXMLFile(self.ProjectXMLObject,'OFDOutputCodec',"",u"Videoporama")
1733
self.OFDOutputFormat= LoadValueFromXMLFile(self.ProjectXMLObject,'OFDOutputFormat',"",u"Videoporama")
1735
#Search if the project have overlaid text
1736
xmlPoint=self.ProjectXMLObject.getElementsByTagName(u"Videoporama")[0]
1737
xmlText =xmlPoint.getElementsByTagName(u"Text")
1738
if xmlText.length>0 :
1740
# Be sure this child is type Overlaid (and not type image or Zoompoint)
1741
if xmlText.getAttribute(u"Type")=="Overlaid":
1742
self.XMLText=Document()
1743
xmlRoot=self.XMLText.createElement(u"SaveXML")
1744
self.XMLText.appendChild(xmlRoot)
1745
xmlRoot.appendChild(self.ProjectXMLObject.importNode(xmlText,True))
1749
self.File_MakeFromXMLObject(self.ProjectXMLObject)
1750
self.App_DisplayLenght()
1751
self.App_SetupInterface()
1753
def File_MakeFromXMLObject(self,BufXMLObject):
1756
NameItem="IMG-"+str(k)
1757
transition=LoadAttributFromXMLFile(BufXMLObject,NameItem,'transition',u"Videoporama")
1758
while transition!="":
1759
QCoreApplication.processEvents()
1760
#stop update during this process
1761
self.StopUpdatePixDuringNewSelect=True
1763
#create the thumb/image
1765
ObjectType=int(LoadAttributFromXMLFile(BufXMLObject,NameItem,'ObjectType',u"Videoporama"))
1769
col=self.win.timeline.columnCount()
1771
MakeAbsolut(self.ProjectFilePathName,LoadAttributFromXMLFile(BufXMLObject,NameItem,'urlimage',u"Videoporama")),#urlim = Filename
1772
MakeAbsolut(self.ProjectFilePathName,LoadAttributFromXMLFile(BufXMLObject,NameItem,'bgfile',u"Videoporama")), #background file
1773
LoadAttributFromXMLFile(BufXMLObject,NameItem,'bgcolor',u"Videoporama"), #background color
1774
LoadAttributFromXMLFile(BufXMLObject,NameItem,'transition',u"Videoporama"), #transition type
1775
LoadAttributFromXMLFile(BufXMLObject,NameItem,'tr_option',u"Videoporama"), #transition option
1776
LoadAttributFromXMLFile(BufXMLObject,NameItem,'speedt',u"Videoporama"), #transition duration
1777
LoadAttributFromXMLFile(BufXMLObject,NameItem,'EXIF_Orientation',u"Videoporama"), #image orientation
1778
self, #Videoporama class instance
1779
ObjectType #ObjectType
1781
QCoreApplication.processEvents()
1782
Image.EndVideo =QTime(0,0,0).fromString(LoadAttributFromXMLFile(BufXMLObject,NameItem,'EndVideo',u"Videoporama"),"HH:mm:ss.zzz")
1783
Image.StartVideo=QTime(0,0,0).fromString(LoadAttributFromXMLFile(BufXMLObject,NameItem,'StartVideo',u"Videoporama"),"HH:mm:ss.zzz")
1784
Image.DurationVideo=QTime(0,0,0).addMSecs(Image.StartVideo.msecsTo(Image.EndVideo))
1785
#if ObjectType==2: Image.LoadMovieInfo()
1787
#Search if the image have text
1788
xmlPoint=BufXMLObject.getElementsByTagName(NameItem)[0]
1789
xmlText =xmlPoint.getElementsByTagName(u"Text")
1790
if xmlText.length>0 :
1792
# Be sure this child is type image (and not type Zoompoint)
1793
if xmlText.getAttribute(u"Type")=="Image":
1794
Image.XMLText=Document()
1795
xmlRoot=Image.XMLText.createElement(u"SaveXML")
1796
Image.XMLText.appendChild(xmlRoot)
1797
xmlRoot.appendChild(BufXMLObject.importNode(xmlText,True))
1799
self.win.timeline.insertColumn(col)
1800
hpix=self.win.timeline.height()-18
1801
if self.imgformat == 1 : wpix=(hpix-4)*16/9+34
1802
else : wpix=(hpix-4)*4/3+34
1803
self.win.timeline.setColumnWidth(col,wpix)
1804
self.win.timeline.setCellWidget(0,col,Image)
1808
x=LoadAttributSubFromXMLFile(BufXMLObject,NameItem,'Point-'+str(i),'x')
1810
QCoreApplication.processEvents()
1811
y=LoadAttributSubFromXMLFile(BufXMLObject,NameItem,'Point-'+str(i),'y')
1812
zoom=LoadAttributSubFromXMLFile(BufXMLObject,NameItem,'Point-'+str(i),'zoom')
1813
timeFixe=LoadAttributSubFromXMLFile(BufXMLObject,NameItem,'Point-'+str(i),'timeFixe')
1814
timeToTravel=LoadAttributSubFromXMLFile(BufXMLObject,NameItem,'Point-'+str(i),'timeToTravel')
1815
xmlSourceImage=BufXMLObject.getElementsByTagName(NameItem)[0]
1816
xmlSourcePoint=xmlSourceImage.getElementsByTagName('Point-'+str(i))[0]
1817
xmlText=xmlSourcePoint.getElementsByTagName(u"Text")
1818
if xmlText.length>0 :
1820
TextToAdd=BufXMLObject.importNode(xmlText,True)
1824
#Temp : Compatibility with old file
1826
timeFixe=LoadAttributFromXMLFile(BufXMLObject,NameItem,'time',u"Videoporama")
1829
Image.AddZoomPointItem(float(x),float(y),float(timeFixe),float(zoom),float(timeToTravel),False,False,TextToAdd)
1831
x=LoadAttributSubFromXMLFile(BufXMLObject,NameItem,'Point-'+str(i),'x')
1833
#Generate thumbail for this image
1835
QCoreApplication.processEvents()
1836
#Force Display new thumbnail
1837
self.win.timeline.repaint()
1838
#update now available
1839
self.StopUpdatePixDuringNewSelect=False
1841
NameItem=u"IMG-"+str(k)
1842
transition=LoadAttributFromXMLFile(BufXMLObject,NameItem,'transition',u"Videoporama")
1844
#-----------------------------------------------------------------------------------------------------------------------------------------------
1845
# Configuration dialog box
1846
#-----------------------------------------------------------------------------------------------------------------------------------------------
1848
def App_Configuration(self,ForceOnglet=False) : #OK QT4
1849
self.winconfig=ConfigurationDlg(self,self.win)
1850
if ForceOnglet==True:
1851
self.winconfig.tabWidget.setCurrentIndex(2)
1852
self.winconfig.show()
1854
#-----------------------------------------------------------------------------------------------------------------------------------------------
1856
#-----------------------------------------------------------------------------------------------------------------------------------------------
1858
#Function call each time a user enter a new value for background color
1859
def SEQ_ChgBgColor(self):
1860
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
1861
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1862
BgColor=self.win.bgcolor.text()
1863
color=toqcolor(QString(BgColor).toInt(16)[0])
1865
qp.setColor(QPalette.Base,color)
1866
self.win.bgcolor.setPalette(qp)
1870
xcolor=colortohex(red*65536+green*256+blue)
1871
self.win.timeline.cellWidget(0,self.index).bgcolor=xcolor
1872
self.win.BgColor=xcolor
1873
self.win.timeline.cellWidget(0,self.index).ResetThumb()
1874
self.App_SetupInterface()
1875
self.App_SetModifiedFlag()
1876
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
1877
self.qtapp.restoreOverrideCursor()
1879
#Functions for Cut/Copy and Paste
1881
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
1882
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1883
CurrentSEQ=self.win.timeline.cellWidget(0,self.index)
1884
self.SEQClipboard=CurrentSEQ.ExportSequenceToXML()
1885
self.Timeline_DeleteItem()
1886
self.qtapp.restoreOverrideCursor()
1889
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
1890
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1891
CurrentSEQ=self.win.timeline.cellWidget(0,self.index)
1892
self.SEQClipboard=CurrentSEQ.ExportSequenceToXML()
1893
self.App_SetupInterface()
1894
self.qtapp.restoreOverrideCursor()
1896
def SEQ_Paste(self):
1897
if self.SEQClipboard ==None : return
1898
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1902
#stop update during this process
1903
self.StopUpdatePixDuringNewSelect=True
1905
#create the thumb/image
1906
#col=self.win.timeline.columnCount() ## For the paste function, col is always after the current item
1907
col=self.win.timeline.currentColumn()+1
1909
ObjectType=int(LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'ObjectType',u"SaveXML"))
1914
LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'urlimage',u"SaveXML"), #urlim = Filename
1915
LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'bgfile',u"SaveXML"), #background file
1916
LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'bgcolor',u"SaveXML"), #background color
1917
LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'transition',u"SaveXML"), #transition type
1918
LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'tr_option',u"SaveXML"), #transition option
1919
LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'speedt',u"SaveXML"), #transition duration
1920
LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'EXIF_Orientation',u"SaveXML"), #image orientation
1921
self, #Videoporama class instance
1924
Image.EndVideo =QTime(0,0,0).fromString(LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'EndVideo',u"SaveXML"),"HH:mm:ss.zzz")
1925
Image.StartVideo=QTime(0,0,0).fromString(LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'StartVideo',u"SaveXML"),"HH:mm:ss.zzz")
1926
Image.DurationVideo=QTime(0,0,0).addMSecs(Image.StartVideo.msecsTo(Image.EndVideo))
1928
#Search if the image have text
1929
xmlPoint=self.SEQClipboard.getElementsByTagName(NameItem)[0]
1930
xmlText =xmlPoint.getElementsByTagName(u"Text")
1931
if xmlText.length>0 :
1933
# Be sure this child is type image (and not type Zoompoint)
1934
if xmlText.getAttribute(u"Type")=="Image":
1935
Image.XMLText=Document()
1936
xmlRoot=Image.XMLText.createElement(u"SaveXML")
1937
Image.XMLText.appendChild(xmlRoot)
1938
xmlRoot.appendChild(self.SEQClipboard.importNode(xmlText,True))
1940
self.win.timeline.insertColumn(col)
1941
hpix=self.win.timeline.height()-18
1942
if self.imgformat == 1 : wpix=(hpix-4)*16/9+34
1943
else : wpix=(hpix-4)*4/3+34
1944
self.win.timeline.setColumnWidth(col,wpix)
1945
self.win.timeline.setCellWidget(0,col,Image)
1949
x=LoadAttributSubFromXMLFile(self.SEQClipboard,NameItem,'Point-'+str(i),'x',u"SaveXML")
1951
y=LoadAttributSubFromXMLFile(self.SEQClipboard,NameItem,'Point-'+str(i),'y',u"SaveXML")
1952
zoom=LoadAttributSubFromXMLFile(self.SEQClipboard,NameItem,'Point-'+str(i),'zoom',u"SaveXML")
1953
timeFixe=LoadAttributSubFromXMLFile(self.SEQClipboard,NameItem,'Point-'+str(i),'timeFixe',u"SaveXML")
1954
timeToTravel=LoadAttributSubFromXMLFile(self.SEQClipboard,NameItem,'Point-'+str(i),'timeToTravel',u"SaveXML")
1955
xmlSourceImage=self.SEQClipboard.getElementsByTagName(NameItem)[0]
1956
xmlSourcePoint=xmlSourceImage.getElementsByTagName('Point-'+str(i))[0]
1957
xmlText=xmlSourcePoint.getElementsByTagName(u"Text")
1958
if xmlText.length>0 :
1960
TextToAdd=self.SEQClipboard.importNode(xmlText,True)
1964
#Temp : Compatibility with old file
1966
timeFixe=LoadAttributFromXMLFile(self.SEQClipboard,NameItem,'time',u"SaveXML")
1969
Image.AddZoomPointItem(float(x),float(y),float(timeFixe),float(zoom),float(timeToTravel),False,False,TextToAdd)
1971
x=LoadAttributSubFromXMLFile(self.SEQClipboard,NameItem,'Point-'+str(i),'x',u"SaveXML")
1973
#Generate thumbail for this image
1975
#Force Display new thumbnail
1976
self.win.timeline.repaint()
1977
#update now available
1978
self.StopUpdatePixDuringNewSelect=False
1979
#display the thumb/image
1982
self.App_DisplayLenght()
1983
self.App_SetModifiedFlag()
1984
self.win.timeline.setCurrentCell(0,col)
1985
self.qtapp.restoreOverrideCursor()
1987
#Function call each time browse palette to select a background color
1988
def SEQ_BrowseBgColor(self):
1989
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
1990
color=QColorDialog.getColor(toqcolor(QString(self.win.timeline.cellWidget(0,self.index).bgcolor).toInt(16)[0]),self.win)
1994
xcolor=colortohex(red*65536+green*256+blue)
1995
self.win.timeline.cellWidget(0,self.index).bgcolor=xcolor
1996
if (self.StopUpdatePixDuringNewSelect!=True):
1997
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
1998
self.win.timeline.cellWidget(0,self.index).ResetThumb()
1999
self.App_SetupInterface()
2000
self.App_SetModifiedFlag()
2001
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2002
self.qtapp.restoreOverrideCursor()
2004
#Function call each time a user enter a new value for background file
2005
def SEQ_ChgBgFile(self):
2006
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2007
self.win.timeline.cellWidget(0,self.index).bgfile=unicode(self.win.bgfile.text())
2008
if (self.StopUpdatePixDuringNewSelect!=True):
2009
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2010
self.win.timeline.cellWidget(0,self.index).ResetThumb()
2011
self.App_SetupInterface()
2012
self.App_SetModifiedFlag()
2013
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2014
self.qtapp.restoreOverrideCursor()
2016
#Function call each time browse file to select a background file
2017
def SEQ_BrowseBgFile(self):
2018
file=QFileDialog.getOpenFileName(self.win, self.qtapp.translate("main","File Dialog"),self.lastDirBackground, "Images(*.jpg *.JPG *.png *.PNG *.gif *.GIF *.xpm *.XPM)")
2020
self.win.bgfile.setText(file)
2021
self.lastDirBackground=QFileInfo(file).dir().absolutePath()
2022
self.SEQ_ChgBgFile()
2023
if (self.StopUpdatePixDuringNewSelect!=True):
2024
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2025
self.win.timeline.cellWidget(0,self.index).ResetThumb()
2026
self.App_SetupInterface()
2027
self.App_SetModifiedFlag()
2028
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2029
self.qtapp.restoreOverrideCursor()
2031
#Function call each time option-transition choice is change
2032
def SEQ_ChgOptTr(self,newopttransi):
2033
if self.index!=-1 and self.index==self.win.timeline.currentColumn() and newopttransi!=-1 :
2034
if (self.StopUpdatePixDuringNewSelect!=True):
2035
image=self.win.timeline.cellWidget(0,self.index)
2037
image.opttransi=newopttransi
2039
#self.App_SetupInterface()
2040
self.App_SetModifiedFlag()
2042
#Function call each time image duration change
2043
def SEQ_ChgTime(self,val):
2044
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2045
self.win.timeline.cellWidget(0,self.index).time=val
2046
if (self.StopUpdatePixDuringNewSelect!=True):
2047
self.win.timeline.cellWidget(0,self.index).updatePix()
2048
self.App_SetupInterface()
2049
self.App_SetModifiedFlag()
2050
self.App_DisplayLenght()
2052
#Function call each time transition choice is change
2053
def SEQ_ChgTrOption(self,NewTransi) :
2054
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2055
z=getTrOptionLst(self,NewTransi)
2056
self.win.transiopt.clear()
2061
FNameTr=u"iconstr/"+z[i]+u".png"
2063
FNameTr=u"iconstr/tr-0"+unicode(NewTransi)+u"-0"+unicode(i)+u".png"
2065
self.win.transiopt.addItem(QIcon(FNameTr),z[i])
2067
self.win.transiopt.addItem(z[i])
2070
if (self.StopUpdatePixDuringNewSelect!=True):
2071
self.win.timeline.cellWidget(0,self.index).typet=NewTransi
2072
self.win.timeline.cellWidget(0,self.index).optTransi=0
2073
self.win.timeline.cellWidget(0,self.index).updatePix()
2074
self.App_SetModifiedFlag()
2075
self.App_SetupInterface()
2076
self.App_DisplayLenght()
2080
#Function call each time transition duration change
2081
def SEQ_ChoixSpeedT(self,txt):
2082
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2083
self.win.timeline.cellWidget(0,self.index).speedt=txt
2084
if (self.StopUpdatePixDuringNewSelect!=True):
2085
self.win.timeline.cellWidget(0,self.index).updatePix()
2086
self.App_SetModifiedFlag()
2087
self.App_SetupInterface()
2088
self.App_DisplayLenght()
2090
def SEQ_DefText(self):
2091
self.index = self.win.timeline.currentColumn()
2092
image=self.win.timeline.cellWidget(0,self.index)
2094
self.DefTextDlg=DefTextDlg(image,0,self,"Image",self.win)
2095
self.DefTextDlg.show()
2096
self.DefTextDlg.FirstInit()
2097
if image.XMLText!=None :
2098
xmlPoint=image.XMLText.getElementsByTagName(u"SaveXML")[0]
2099
self.DefTextDlg.ImportXML(xmlPoint)
2100
self.DefTextDlg.ForcePaint()
2102
def SEQ_DefTextOk(self):
2103
# Save Windows size/position on exit
2104
self.DefTextDlg.SaveWindowPosition()
2106
self.index = self.win.timeline.currentColumn()
2107
image=self.win.timeline.cellWidget(0,self.index)
2109
image.XMLText=self.DefTextDlg.ExportToXML()
2111
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2112
self.App_SetModifiedFlag()
2113
self.DefTextDlg.close()
2115
#-----------------------------------------------------------------------------------------------------------------------------------------------
2116
# TAB Montage Option
2117
#-----------------------------------------------------------------------------------------------------------------------------------------------
2118
#Function call each time user enter a soundfile
2119
#def TAB_Montage_ChgSndFile(self):
2120
#file=self.win.soundfile.text()
2122
#file=QDir().toNativeSeparators(file)
2123
#self.lastDirSound=QFileInfo(file).dir().absolutePath()
2124
#self.soundfile=unicode(QFileInfo(self.win.soundfile.text()).absoluteFilePath())
2127
#UpdateConfigurationXMLFile(self.ProjectXMLObject,u"sndfile",self.soundfile,u"Videoporama")
2128
#self.App_SetModifiedFlag()
2130
#Function for browse to select soundfile
2131
#def TAB_Montage_BrowseSndFile(self):
2132
#file=QFileInfo(QFileDialog.getOpenFileName(self.win, self.qtapp.translate("main","File Dialog"),self.lastDirSound, "Sound(*.wav *.WAV *.mp3 *.MP3 *.ogg *.OGG)")).absoluteFilePath()
2134
#self.lastDirSound=QFileInfo(file).dir().absolutePath()
2135
#file=QDir().toNativeSeparators(file)
2138
#self.win.soundfile.setText(file)
2139
#self.soundfile=unicode(file)
2140
#UpdateConfigurationXMLFile(self.ProjectXMLObject,u"sndfile",self.soundfile,u"Videoporama")
2141
#self.App_SetModifiedFlag()
2143
#Function call to change image format 16/9 - 4/3
2144
def TAB_Montage_SetImgFormat(self,imgF) :
2145
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2146
SaveSelect = self.win.timeline.currentColumn()
2148
#apply new image format
2152
hpix=self.win.timeline.height()-18
2153
if self.imgformat == 1 : wpix=(hpix-4)*16/9+34
2154
else : wpix=(hpix-4)*4/3+34
2156
while i<self.win.timeline.columnCount():
2157
self.win.timeline.setColumnWidth(i,wpix)
2158
Sequence=self.win.timeline.cellWidget(0,i)
2159
Sequence.ResetThumb()
2162
self.win.timeline.setCurrentCell(0,SaveSelect)
2163
self.App_SetModifiedFlag()
2164
self.App_DisplayPixMainWin(0)
2165
self.qtapp.restoreOverrideCursor()
2167
def TAB_Montage_DefText(self):
2168
self.DefTextDlg=DefTextDlg(None,0,self,"Overlaid",self.win)
2169
self.DefTextDlg.show()
2170
self.DefTextDlg.FirstInit()
2171
if self.XMLText!=None :
2172
xmlPoint=self.XMLText.getElementsByTagName(u"SaveXML")[0]
2173
self.DefTextDlg.ImportXML(xmlPoint)
2174
self.DefTextDlg.ForcePaint()
2176
def TAB_Montage_DefTextOk(self):
2177
# Save Windows size/position on exit
2178
self.DefTextDlg.SaveWindowPosition()
2180
self.XMLText=self.DefTextDlg.ExportToXML()
2181
self.DefTextDlg.close()
2182
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2183
self.App_SetModifiedFlag()
2185
#-----------------------------------------------------------------------------------------------------------------------------------------------
2187
#-----------------------------------------------------------------------------------------------------------------------------------------------
2188
def TAB_Movie_DefMoviePoint(self):
2189
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2190
Image = self.win.timeline.cellWidget(0,self.index)
2191
if Image.ObjectType==2:
2192
self.DefMoviePointDlg=DefMoviePointDlg(Image,self,self.win)
2193
self.DefMoviePointDlg.show()
2195
def TAB_Movie_DefMoviePointOk(self):
2196
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2197
Image = self.win.timeline.cellWidget(0,self.index)
2198
if Image.ObjectType==2:
2199
self.TimeChanged =True
2200
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2201
Image.StartVideo = self.DefMoviePointDlg.StartVideo
2202
Image.EndVideo = self.DefMoviePointDlg.EndVideo
2203
Image.DurationVideo = self.DefMoviePointDlg.DurationVideo
2204
self.win.ActualDurationEd.setTime(Image.DurationVideo)
2205
self.win.MovieStartEd.setMinimumTime(QTime(0,0,0))
2206
self.win.MovieStartEd.setMaximumTime(Image.EndVideo)
2207
self.win.MovieStartEd.setTime(Image.StartVideo)
2208
self.win.MovieEndEd.setMinimumTime(Image.StartVideo)
2209
self.win.MovieEndEd.setMaximumTime(Image.InitialDurationVideo)
2210
self.win.MovieEndEd.setTime(Image.EndVideo)
2211
self.DefMoviePointDlg.close()
2212
Image.CacheThumb=None
2213
Image.MakeXMLZoomPointList()
2214
self.TAB_Movie_RefreshMovie()
2215
self.qtapp.restoreOverrideCursor()
2217
def TAB_Movie_RotateLeft(self):
2218
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2219
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2220
Image = self.win.timeline.cellWidget(0,self.index)
2221
if Image.EXIF_Orientation==1 : Image.EXIF_Orientation=8
2222
elif Image.EXIF_Orientation==8 : Image.EXIF_Orientation=3
2223
elif Image.EXIF_Orientation==3 : Image.EXIF_Orientation=6
2224
elif Image.EXIF_Orientation==6 : Image.EXIF_Orientation=1
2225
self.TAB_Movie_RefreshMovie()
2226
self.qtapp.restoreOverrideCursor()
2228
def TAB_Movie_RotateRight(self):
2229
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2230
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2231
Image = self.win.timeline.cellWidget(0,self.index)
2232
if Image.EXIF_Orientation==1 : Image.EXIF_Orientation=6
2233
elif Image.EXIF_Orientation==6 : Image.EXIF_Orientation=3
2234
elif Image.EXIF_Orientation==3 : Image.EXIF_Orientation=8
2235
elif Image.EXIF_Orientation==8 : Image.EXIF_Orientation=1
2236
self.TAB_Movie_RefreshMovie()
2237
self.qtapp.restoreOverrideCursor()
2239
def TAB_Movie_RefreshMovie(self):
2240
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2241
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2242
Image = self.win.timeline.cellWidget(0,self.index)
2245
self.App_SetModifiedFlag()
2246
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2247
self.App_DisplayLenght()
2248
self.qtapp.restoreOverrideCursor()
2250
def TAB_Movie_ChgMovieFile(self):
2251
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2252
Image = self.win.timeline.cellWidget(0,self.index)
2254
NewFile=QFileDialog.getOpenFileNames(self.win,self.qtapp.translate("main","Change movie files"),self.lastDirMovies, "Movies(*.avi *.AVI *.mpg *.MPG *.mov *.MOV *dv *DV *mp4 *MP4 *.mkv *.MKV)")
2256
self.TimeChanged =True
2257
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2258
self.lastDirMovies=QFileInfo(NewFile[0]).dir().absolutePath()
2259
Image.urlim=unicode(NewFile[0])
2260
self.TAB_Movie_RefreshMovie()
2261
self.Timeline_ChgSelectedItem()
2262
self.qtapp.restoreOverrideCursor()
2264
def TAB_Movie_OnDefStartPosEd(self,NewTime):
2265
if self.StopMAJSpinbox==True: return
2266
self.StopMAJSpinbox=True
2267
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2268
Image = self.win.timeline.cellWidget(0,self.index)
2269
if Image.ObjectType==2:
2270
self.TimeChanged =True
2271
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2272
Image.StartVideo=NewTime
2273
Image.DurationVideo=QTime(0,0,0).addMSecs(Image.StartVideo.msecsTo(Image.EndVideo))
2274
self.win.MovieStartEd.setTime(Image.StartVideo)
2275
self.win.MovieEndEd.setMinimumTime(Image.StartVideo)
2276
self.win.ActualDurationEd.setTime(Image.DurationVideo)
2277
Image.CacheThumb=None
2278
Image.MakeXMLZoomPointList()
2280
self.App_SetModifiedFlag()
2281
self.App_DisplayLenght()
2282
self.qtapp.restoreOverrideCursor()
2283
self.StopMAJSpinbox=False
2285
def TAB_Movie_OnDefEndPosEd(self,NewTime):
2286
if self.StopMAJSpinbox==True: return
2287
self.StopMAJSpinbox=True
2288
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2289
Image = self.win.timeline.cellWidget(0,self.index)
2290
if Image.ObjectType==2:
2291
self.TimeChanged =True
2292
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2293
Image.EndVideo=NewTime
2294
Image.DurationVideo=QTime(0,0,0).addMSecs(Image.StartVideo.msecsTo(Image.EndVideo))
2295
self.win.MovieEndEd.setTime(Image.EndVideo)
2296
self.win.MovieStartEd.setMaximumTime(Image.EndVideo)
2297
self.win.ActualDurationEd.setTime(Image.DurationVideo)
2298
Image.CacheThumb=None
2299
Image.MakeXMLZoomPointList()
2301
self.App_SetModifiedFlag()
2302
self.App_DisplayLenght()
2303
self.qtapp.restoreOverrideCursor()
2304
self.StopMAJSpinbox=False
2306
#-----------------------------------------------------------------------------------------------------------------------------------------------
2308
#-----------------------------------------------------------------------------------------------------------------------------------------------
2309
def TAB_Image_ChgImageFile(self):
2310
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2311
Image = self.win.timeline.cellWidget(0,self.index)
2314
NewFile=unicode(QFileDialog.getOpenFileName(self.win,self.qtapp.translate("main","Change image file"),self.lastDirImage, "Images(*.jpg *.JPG *.png *.PNG *.gif *.GIF *ppm *PPM *tiff *TIFF *.xpm *.XPM)"))
2316
fdialog = CFileDialogIMG(self.win,self.qtapp.translate("main","Change image file"),self.lastDirImage, "Images(*.jpg *.JPG *.png *.PNG *.gif *.GIF *.xpm *.XPM)")
2317
fdialog.addPreview()
2318
fdialog.setOption(QFileDialog.DontConfirmOverwrite, False)
2319
fdialog.setFileMode(QFileDialog.ExistingFile) # Only one file
2321
NewFile=unicode(fdialog.selectedFiles()[0])
2323
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2324
self.lastDirImage=QFileInfo(unicode(NewFile)).dir().absolutePath()
2326
self.TAB_Image_RefreshImg()
2327
self.Timeline_ChgSelectedItem()
2328
self.qtapp.restoreOverrideCursor()
2330
def TAB_Image_RotateRight(self):
2331
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2332
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2333
Image = self.win.timeline.cellWidget(0,self.index)
2334
if Image.EXIF_Orientation==1 : Image.EXIF_Orientation=6
2335
elif Image.EXIF_Orientation==6 : Image.EXIF_Orientation=3
2336
elif Image.EXIF_Orientation==3 : Image.EXIF_Orientation=8
2337
elif Image.EXIF_Orientation==8 : Image.EXIF_Orientation=1
2338
self.TAB_Image_RefreshImg()
2339
self.qtapp.restoreOverrideCursor()
2341
def TAB_Image_RotateLeft(self):
2342
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2343
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2344
Image = self.win.timeline.cellWidget(0,self.index)
2345
if Image.EXIF_Orientation==1 : Image.EXIF_Orientation=8
2346
elif Image.EXIF_Orientation==8 : Image.EXIF_Orientation=3
2347
elif Image.EXIF_Orientation==3 : Image.EXIF_Orientation=6
2348
elif Image.EXIF_Orientation==6 : Image.EXIF_Orientation=1
2349
self.TAB_Image_RefreshImg()
2350
self.qtapp.restoreOverrideCursor()
2352
def TAB_Image_CallGimp(self):
2353
if self.IsGIMPOk==True and self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2354
Image = self.win.timeline.cellWidget(0,self.index)
2356
cmd=u' \"'+unicode(QDir().toNativeSeparators(self.ImageEditor))+u'\" \"'+unicode(QDir().toNativeSeparators(Image.urlim))+u'\"'
2359
subprocess.Popen(cmd.encode('iso-8859-1'),shell=True,stdin=subprocess.PIPE,stderr=file('nul','a'),stdout=file('nul','a'))
2361
subprocess.Popen(cmd.encode('utf-8'),shell=True,stdin=subprocess.PIPE)
2363
def TAB_Image_RefreshImg(self):
2364
if self.index!=-1 and self.index==self.win.timeline.currentColumn() :
2365
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2366
Image = self.win.timeline.cellWidget(0,self.index)
2368
self.App_SetModifiedFlag()
2369
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2370
self.qtapp.restoreOverrideCursor()
2372
def TAB_Image_SetDisplayData(self,EXIFDesc,EXIFValue):
2373
Row=self.win.EXIFTable.rowCount()
2374
self.win.EXIFTable.insertRow(Row)
2375
self.win.EXIFTable.setItem(Row,0,QTableWidgetItem(QString(EXIFDesc)))
2377
self.win.EXIFTable.setItem(Row,1,QTableWidgetItem(QString(EXIFValue)))
2380
self.win.EXIFTable.setRowHeight(Row,18)
2382
#-----------------------------------------------------------------------------------------------------------------------------------------------
2384
#-----------------------------------------------------------------------------------------------------------------------------------------------
2385
def Timeline_BrowseAddImage(self):
2387
files=QFileDialog.getOpenFileNames(self.win,self.qtapp.translate("main","Select input files"),self.lastDirImage, "Images(*.jpg *.JPG *.png *.PNG *.gif *.GIF *ppm *PPM *tiff *TIFF *.xpm *.XPM)")
2388
self.Timeline_BrowseAddImage2(files)
2390
fdialog = CFileDialogIMG(self.win,self.qtapp.translate("main","Select input files"),self.lastDirImage, "Images(*.jpg *.JPG *.png *.PNG *.gif *.GIF *.xpm *.XPM)")
2391
fdialog.addPreview()
2392
fdialog.setOption(QFileDialog.DontConfirmOverwrite, False)
2393
fdialog.setFileMode(QFileDialog.ExistingFiles)
2395
self.qtapp.connect(fdialog, SIGNAL("filesSelected(QStringList)"), self.Timeline_BrowseAddImage2)
2397
def Timeline_BrowseAddImage2(self, files) :
2398
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2400
self.lastDirImage=QFileInfo(files[0]).dir().absolutePath()
2401
#Create new item in the timeline at current position if self.NewSEQPosition==0 or at the end
2402
if self.NewSEQPosition==0: col=self.win.timeline.currentColumn()+1
2403
else : col=self.win.timeline.columnCount()
2404
NextSelectedItem=col
2406
# Check if the transition choice is "Random"-> Then define random transition
2407
if int(self.ConfTypeT) == self.RANDOMTRANSITIONTYPE :
2408
transi, optTransi = randomTransi()
2410
# If not random -> Transi define by config
2411
transi = self.ConfTypeT
2412
optTransi = self.ConfTransiOpt
2415
unicode(file), #urlim = Filename
2416
unicode(self.ConfBgFile), #background file
2417
self.ConfBgColor, #background color
2418
str(transi), #transition type
2419
str(optTransi), #transition option
2420
self.ConfSpeedT, #transition duration
2421
-1, #default orientation (read from exif data)
2422
self, #Videoporama class instance
2423
1 #Object Type=Image
2425
Image.AddZoomPointItem(0,0,self.ConfTime,100,0.0,False,False)
2426
self.win.timeline.insertColumn(col)
2427
hpix=self.win.timeline.height()-18
2428
if self.imgformat == 1 : wpix=(hpix-4)*16/9+34
2429
else : wpix=(hpix-4)*4/3+34
2430
self.win.timeline.setColumnWidth(col,wpix)
2431
self.win.timeline.setCellWidget(0,col,Image)
2432
Image.updatePix() #Generate thumbail for this image
2433
self.win.timeline.repaint() #Force Display new thumbnail
2436
self.TimeChanged =True
2437
self.App_SetModifiedFlag()
2438
self.index=NextSelectedItem
2439
self.win.timeline.setCurrentCell(0,NextSelectedItem)
2442
self.qtapp.restoreOverrideCursor()
2444
def Timeline_BrowseAddMovie(self):
2445
files=QFileDialog.getOpenFileNames(self.win,self.qtapp.translate("main","Select movie files"),self.lastDirMovies, "Movies(*.avi *.AVI *.mpg *.MPG *.mov *.MOV *dv *DV *mp4 *MP4 *.mkv *.MKV)")
2446
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2448
self.lastDirMovies=QFileInfo(files[0]).dir().absolutePath()
2449
#Create new item in the timeline at current position if self.NewSEQPosition==0 or at the end
2450
if self.NewSEQPosition==0: col=self.win.timeline.currentColumn()+1
2451
else : col=self.win.timeline.columnCount()
2452
NextSelectedItem=col
2454
# Check if the transition choice is "Random"-> Then define random transition
2455
if int(self.ConfTypeT) == self.RANDOMTRANSITIONTYPE :
2456
transi, optTransi = randomTransi()
2458
# If not random -> Transi define by config
2459
transi = self.ConfTypeT
2460
optTransi = self.ConfTransiOpt
2462
unicode(file), #urlim = Filename
2463
unicode(self.ConfBgFile), #background file
2464
self.ConfBgColor, #background color
2465
str(transi), #transition type
2466
str(optTransi), #transition option
2467
self.ConfSpeedT, #transition duration
2468
-1, #default orientation (read from exif data)
2469
self, #Videoporama class instance
2470
2 #Object Type=Movie
2472
self.win.timeline.insertColumn(col)
2473
hpix=self.win.timeline.height()-18
2474
if self.imgformat == 1 : wpix=(hpix-4)*16/9+34
2475
else : wpix=(hpix-4)*4/3+34
2476
self.win.timeline.setColumnWidth(col,wpix)
2477
self.win.timeline.setCellWidget(0,col,Image)
2478
Image.updatePix() #Generate thumbail for this image
2479
self.win.timeline.repaint() #Force Display new thumbnail
2482
self.App_SetModifiedFlag()
2483
self.index=NextSelectedItem
2484
self.win.timeline.setCurrentCell(0,NextSelectedItem)
2485
self.TimeChanged =True
2486
self.App_SetupInterface()
2489
self.qtapp.restoreOverrideCursor()
2491
def Timeline_AddTitle(self):
2492
# Check if the transition choice is "Random"-> Then define random transition
2493
if int(self.ConfTypeT) == self.RANDOMTRANSITIONTYPE :
2494
transi, optTransi = randomTransi()
2496
# If not random -> Transi define by config
2497
transi = self.ConfTypeT
2498
optTransi = self.ConfTransiOpt
2500
#Create new item in the timeline at current position if self.NewSEQPosition==0 or at the end
2501
if self.NewSEQPosition==0: col=self.win.timeline.currentColumn()+1
2502
else : col=self.win.timeline.columnCount()
2505
"", #urlim = Filename
2506
unicode(self.ConfBgFile), #background file
2507
self.ConfBgColor, #background color
2508
str(transi), #transition type
2509
str(optTransi), #transition option
2510
self.ConfSpeedT, #transition duration
2511
-1, #default orientation (not use in this case)
2512
self, #Videoporama class instance
2513
0 #Object Type=Title
2515
Image.AddZoomPointItem(0,0,self.ConfTime,100,0.0,False,False)
2516
self.win.timeline.insertColumn(col)
2517
hpix=self.win.timeline.height()-18
2518
if self.imgformat == 1 : wpix=(hpix-4)*16/9+34
2519
else : wpix=(hpix-4)*4/3+34
2520
self.win.timeline.setColumnWidth(col,wpix)
2521
self.win.timeline.setCellWidget(0,col,Image)
2523
Image.updatePix() #Generate thumbail for this image
2524
self.win.timeline.repaint() #Force Display new thumbnail
2526
self.TimeChanged =True
2527
self.App_SetModifiedFlag()
2529
self.win.timeline.setCurrentCell(0,col)
2531
def Timeline_Empty(self):
2532
self.StopUpdatePixDuringEmpty=True
2533
self.TimeChanged =True
2535
#Clear current selection
2536
self.SelectionEnCours=None
2539
while i<self.win.timeline.columnCount() : self.win.timeline.removeColumn(i)
2540
#Clean TableZoomPoint
2542
while i<self.win.TableZoomPoint.rowCount() : self.win.TableZoomPoint.removeRow(i)
2543
#Init new project data with default option from configuration XML object
2545
ProjectFilePathName=""
2546
self.ProjectXMLObject= Document()
2547
xmltag = self.ProjectXMLObject.createElement(u"Videoporama")
2548
self.ProjectXMLObject.appendChild(xmltag)
2549
self.imgformat = int(LoadValueFromXMLFile(self.ProjectXMLObject,'imgformat',self.ConfImgFormat,u"Videoporama"))
2550
#self.soundfile = LoadValueFromXMLFile(self.ProjectXMLObject,'sndfile',"",u"Videoporama")
2551
self.outputFile = ""
2552
self.StopMAJSpinbox = True
2553
self.win.imgformat.setCurrentIndex(self.imgformat)
2554
self.StopMAJSpinbox = False
2555
self.IsProjectModified=False
2556
self.StopUpdatePixDuringEmpty=False
2558
def Timeline_MoveItemToRight(self):
2559
if self.index!=(self.win.timeline.columnCount()-1) :
2561
wcol = self.win.timeline.columnWidth(i)
2562
pict=self.win.timeline.cellWidget(0,i).copy()
2564
self.win.timeline.insertColumn(nc)
2565
self.win.timeline.setColumnWidth(nc, wcol)
2566
self.win.timeline.setCellWidget(0,nc,pict)
2567
self.win.timeline.removeColumn(i)
2568
self.win.timeline.setCurrentCell(0,i+1)
2569
self.TimeChanged =True
2570
self.App_SetModifiedFlag()
2571
self.App_SetupInterface()
2573
def Timeline_MoveItemToLeft(self):
2576
wcol = self.win.timeline.columnWidth(i)
2577
pict=self.win.timeline.cellWidget(0,i).copy()
2578
self.TimeChanged=True
2581
self.win.timeline.insertColumn(nc)
2582
self.win.timeline.setColumnWidth(nc, wcol)
2583
self.win.timeline.setCellWidget(0,nc,pict)
2584
self.win.timeline.removeColumn(b)
2585
self.win.timeline.setCurrentCell(0,nc)
2586
self.TimeChanged =True
2587
self.App_SetModifiedFlag()
2588
self.App_SetupInterface()
2590
def Timeline_DeleteItem(self):
2591
self.SelectionEnCours=None
2594
self.win.timeline.removeColumn(i)
2595
j = self.win.timeline.columnCount()
2598
self.win.timeline.setCurrentCell(0,0)
2600
self.win.timeline.setCurrentCell(0,i-1)
2602
self.win.timeline.setCurrentCell(0,i)
2603
self.TimeChanged =True
2604
self.App_SetModifiedFlag()
2606
self.App_SetupInterface()
2608
# Function call each time an image is selected
2609
def Timeline_ChgSelectedItem(self):
2610
if self.StopUpdatePixDuringEmpty==True: return
2611
#Stop all updatepix during this process
2612
self.StopUpdatePixDuringNewSelect=True
2614
self.index = self.win.timeline.currentColumn()
2615
image=self.win.timeline.cellWidget(0,self.index)
2619
self.win.typet.setCurrentIndex(int(image.typet))
2620
self.win.bgcolor.setText(image.bgcolor)
2621
color=toqcolor(QString(image.bgcolor).toInt(16)[0])
2623
qp.setColor(QPalette.Base,color)
2624
self.win.bgcolor.setPalette(qp)
2625
self.win.bgfile.setText(image.bgfile)
2626
self.win.speedt.setCurrentIndex(int(image.speedt))
2627
optt=int(image.opttransi)
2628
self.win.transiopt.setCurrentIndex(optt)
2631
while i<self.win.EXIFTable.rowCount() : self.win.EXIFTable.removeRow(i)
2632
CurTab=self.win.TABOptions.currentIndex()
2633
if image.ObjectType!=2:
2635
if CurTab==3: self.win.TABOptions.setCurrentIndex(2)
2636
self.win.TABOptions.setTabEnabled(2,True)
2637
self.win.TABOptions.setTabEnabled(3,False)
2638
self.win.ImageFile.setText(image.urlim)
2639
if image.ObjectType==1:
2640
image.EXIF_Size=str(int(image.RealImageSizeWidth))+" x "+str(int(image.RealImageSizeHeight))
2641
self.TAB_Image_SetDisplayData("Original date/time",image.EXIF_OrigDatetime) # Date/time of the image taken (EXIF)
2642
self.TAB_Image_SetDisplayData("Description",image.EXIF_Description) # Image description (EXIF)
2643
self.TAB_Image_SetDisplayData("Camera",image.EXIF_Camera) # Camera (EXIF)
2644
self.TAB_Image_SetDisplayData("Artist - Copyright",image.EXIF_Artist) # Artist/Copyright (EXIF)
2645
self.TAB_Image_SetDisplayData("Image size",image.EXIF_Size) # Size (x*y) (EXIF)
2646
self.TAB_Image_SetDisplayData("ISO Speed",image.EXIF_ISO) # ISO (EXIF)
2647
self.TAB_Image_SetDisplayData("Focal aperture",image.EXIF_Focal) # Focal (EXIF)
2648
self.TAB_Image_SetDisplayData("Exposure Time",image.EXIF_ExposureTime) # ExposureTime (EXIF)
2650
self.win.VideoTrackInfo.setText("")
2651
self.win.AudioTrackInfo.setText("")
2652
self.win.MovieFile.setText("")
2655
if CurTab==2: self.win.TABOptions.setCurrentIndex(3)
2656
self.StopMAJSpinbox=True
2657
self.win.TABOptions.setTabEnabled(2,False)
2658
self.win.TABOptions.setTabEnabled(3,True)
2659
self.win.MovieFile.setText(image.urlim)
2660
self.win.VideoTrackInfo.setText(image.InfoVideo)
2661
self.win.AudioTrackInfo.setText(image.InfoAudio)
2662
self.win.ActualDurationEd.setTime(image.DurationVideo)
2663
self.win.MovieStartEd.setMinimumTime(QTime(0,0,0))
2664
self.win.MovieStartEd.setMaximumTime(image.EndVideo)
2665
self.win.MovieStartEd.setTime(image.StartVideo)
2666
self.win.MovieEndEd.setMinimumTime(image.StartVideo)
2667
self.win.MovieEndEd.setMaximumTime(image.InitialDurationVideo)
2668
self.win.MovieEndEd.setTime(image.EndVideo)
2669
self.StopMAJSpinbox=False
2670
self.App_DisplayLenght()
2672
image.StateSelected=True
2674
if (image!=self.SelectionEnCours):
2675
if (self.SelectionEnCours!=None):
2677
self.SelectionEnCours.StateSelected=False
2678
self.SelectionEnCours.updatePix()
2679
#self.SelectionEnCours.SetupInterface()
2682
self.SelectionEnCours=image
2683
self.SelectionEnCours.MakeTableZoomPointFromXML()
2684
self.win.TableZoomPoint.setCurrentCell(0,0)
2685
self.StopUpdatePixDuringNewSelect=False #Allow updatepix now
2686
image.updatePix() #Then force an updatepix
2689
self.StopUpdatePixDuringNewSelect=False
2690
self.TimeChanged = True
2691
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2692
if self.StopSetupInterface!=True: self.App_SetupInterface()
2694
#----------------------------------------------------------------------------------------
2695
# App_ResizeEvent : when main videoporama window is resize
2696
#----------------------------------------------------------------------------------------
2697
def Timeline_ChTThumbnailSize(self) :
2698
self.qtapp.setOverrideCursor(QCursor(Qt.WaitCursor))
2699
if self.ThumbnailsSize==0:
2700
self.win.timeline.setMinimumSize(QtCore.QSize(0, 80))
2701
self.win.timeline.setMaximumSize(QtCore.QSize(16777215, 80))
2702
elif self.ThumbnailsSize==1:
2703
self.win.timeline.setMinimumSize(QtCore.QSize(0, 120))
2704
self.win.timeline.setMaximumSize(QtCore.QSize(16777215, 120))
2706
self.win.timeline.setMinimumSize(QtCore.QSize(0, 150))
2707
self.win.timeline.setMaximumSize(QtCore.QSize(16777215, 150))
2710
hpix=self.win.timeline.height()-18
2711
if self.imgformat == 1 : wpix=(hpix-4)*16/9+34
2712
else : wpix=(hpix-4)*4/3+34
2714
self.win.timeline.setRowHeight(0,hpix)
2716
while i<self.win.timeline.columnCount():
2717
self.win.timeline.setColumnWidth(i,wpix)
2718
Sequence=self.win.timeline.cellWidget(0,i)
2719
Sequence.CacheThumb=None
2720
Sequence.updatePix()
2722
self.qtapp.restoreOverrideCursor()
2724
def Timeline_ZoomUp(self):
2725
if self.ThumbnailsSize<2:
2726
self.ThumbnailsSize+=1
2727
self.Timeline_ChTThumbnailSize()
2728
self.App_SetupInterface()
2730
def Timeline_ZoomDown(self):
2731
if self.ThumbnailsSize>0:
2732
self.ThumbnailsSize-=1
2733
self.Timeline_ChTThumbnailSize()
2734
self.App_SetupInterface()
2736
#-----------------------------------------------------------------------------------------------------------------------------------------------
2737
#TableZoomPoint action
2738
#-----------------------------------------------------------------------------------------------------------------------------------------------
2739
def TableZoomPoint_AddPoint(self):
2740
self.index = self.win.timeline.currentColumn()
2741
image=self.win.timeline.cellWidget(0,self.index)
2743
self.TimeChanged =True
2744
image.AddZoomPointItem(0.1,0.1,self.ConfStaticTimeNext,50,self.ConfAnimTimeNext)
2746
# Update Thumbnail image
2749
self.App_SetModifiedFlag()
2750
self.App_SetupInterface()
2752
def TableZoomPoint_MoveItemToUp(self):
2753
self.index = self.win.timeline.currentColumn()
2754
image=self.win.timeline.cellWidget(0,self.index)
2756
i = self.win.TableZoomPoint.currentRow()
2758
self.TimeChanged =True
2759
pict=self.win.TableZoomPoint.cellWidget(i,0).copy()
2762
self.win.TableZoomPoint.insertRow(nc)
2763
self.win.TableZoomPoint.setRowHeight(nc,pict.h)
2764
self.win.TableZoomPoint.setCellWidget(nc,0,pict)
2765
self.win.TableZoomPoint.removeRow(b)
2766
self.win.TableZoomPoint.setCurrentCell(nc,0)
2767
image.MakeXMLZoomPointList()
2768
# Set number of all zoom point
2770
while (i<self.win.TableZoomPoint.rowCount()):
2771
self.win.TableZoomPoint.cellWidget(i,0).NumZoomPoint=i
2773
image.CacheThumb=None
2775
self.App_SetModifiedFlag()
2776
self.App_SetupInterface()
2778
def TableZoomPoint_MoveItemToDown(self):
2779
self.index = self.win.timeline.currentColumn()
2780
image=self.win.timeline.cellWidget(0,self.index)
2782
i = self.win.TableZoomPoint.currentRow()
2783
if i!=(self.win.TableZoomPoint.rowCount()-1) :
2784
self.TimeChanged =True
2785
pict=self.win.TableZoomPoint.cellWidget(i,0).copy()
2787
self.win.TableZoomPoint.insertRow(nc)
2788
self.win.TableZoomPoint.setRowHeight(nc,pict.h)
2789
self.win.TableZoomPoint.setCellWidget(nc,0,pict)
2790
self.win.TableZoomPoint.removeRow(i)
2791
self.win.TableZoomPoint.setCurrentCell(i+1,0)
2792
image.MakeXMLZoomPointList()
2793
# Set number of all zoom point
2795
while (i<self.win.TableZoomPoint.rowCount()):
2796
self.win.TableZoomPoint.cellWidget(i,0).NumZoomPoint=i
2798
image.CacheThumb=None
2800
self.App_SetModifiedFlag()
2801
self.App_SetupInterface()
2803
def TableZoomPoint_DeleteItem(self):
2804
self.index = self.win.timeline.currentColumn()
2805
image=self.win.timeline.cellWidget(0,self.index)
2807
self.TimeChanged =True
2808
i = self.win.TableZoomPoint.currentRow()
2810
self.win.TableZoomPoint.removeRow(i)
2811
image.NbrZoomPoint-=1
2812
j = self.win.TableZoomPoint.rowCount()
2815
self.win.TableZoomPoint.setCurrentCell(0,0)
2817
self.win.TableZoomPoint.setCurrentCell(i-1,0)
2819
self.win.TableZoomPoint.setCurrentCell(i,0)
2820
# Set number of all zoom point
2822
while (i<self.win.TableZoomPoint.rowCount()):
2823
self.win.TableZoomPoint.cellWidget(i,0).NumZoomPoint=i
2825
image.MakeXMLZoomPointList()
2826
# Update Thumbnail image
2828
self.App_SetModifiedFlag()
2829
self.App_SetupInterface()
2831
#Function call each time image duration change
2832
def TableZoomPoint_ChgTimeFixe(self,val):
2833
if self.StopSetupInterface : return
2834
self.index = self.win.timeline.currentColumn()
2835
image=self.win.timeline.cellWidget(0,self.index)
2837
self.TimeChanged =True
2838
i = self.win.TableZoomPoint.currentRow()
2840
item=self.win.TableZoomPoint.cellWidget(i,0)
2843
image.MakeXMLZoomPointList()
2846
self.App_SetModifiedFlag()
2847
self.App_DisplayLenght()
2849
#Function call each time image duration change
2850
def TableZoomPoint_ChgTimeToTravel(self,val):
2851
if self.StopSetupInterface : return
2852
self.index = self.win.timeline.currentColumn()
2853
image=self.win.timeline.cellWidget(0,self.index)
2855
self.TimeChanged =True
2856
i = self.win.TableZoomPoint.currentRow()
2858
item=self.win.TableZoomPoint.cellWidget(i,0)
2860
item.timeToTravel = val
2861
image.MakeXMLZoomPointList()
2864
self.App_SetModifiedFlag()
2865
self.App_DisplayLenght()
2867
def TableZoomPoint_ChgSelectedItem(self):
2868
# Draw each item to remove selection or add selection to the new selected item
2870
while (i<self.win.TableZoomPoint.rowCount()) :
2871
item=self.win.TableZoomPoint.cellWidget(i,0)
2872
if item!=None : item.updatePix()
2874
# Repaint preview zone
2875
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2876
self.App_SetupInterface()
2878
def TableZoomPoint_ChgZoomPointXValue(self,Value):
2879
if self.StopMAJSpinbox: return
2880
self.index = self.win.timeline.currentColumn()
2881
image=self.win.timeline.cellWidget(0,self.index)
2883
i = self.win.TableZoomPoint.currentRow()
2885
item=self.win.TableZoomPoint.cellWidget(i,0)
2887
if self.ConfDisplayUnit=="0" :
2892
Value=Value/image.xmax
2894
item.CacheThumb=None
2895
image.CacheThumb=None
2896
image.MakeXMLZoomPointList()
2899
item.SetupInterface()
2900
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2901
self.App_SetModifiedFlag()
2903
def TableZoomPoint_ChgZoomPointYValue(self,Value):
2904
if self.StopMAJSpinbox: return
2905
self.index = self.win.timeline.currentColumn()
2906
image=self.win.timeline.cellWidget(0,self.index)
2908
i = self.win.TableZoomPoint.currentRow()
2910
item=self.win.TableZoomPoint.cellWidget(i,0)
2912
if self.ConfDisplayUnit=="0" :
2917
Value=Value/image.ymax
2919
image.CacheThumb=None
2920
item.CacheThumb=None
2921
image.MakeXMLZoomPointList()
2924
item.SetupInterface()
2925
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2926
self.App_SetModifiedFlag()
2928
def TableZoomPoint_ChgZoomPointZoomValue(self,Value):
2929
if self.StopMAJSpinbox: return
2930
self.index = self.win.timeline.currentColumn()
2931
image=self.win.timeline.cellWidget(0,self.index)
2933
i = self.win.TableZoomPoint.currentRow()
2935
item=self.win.TableZoomPoint.cellWidget(i,0)
2937
if self.ConfDisplayUnit=="0" :
2942
Value=(Value/image.xmax)*100
2944
item.CacheThumb=None
2945
image.CacheThumb=None
2946
image.MakeXMLZoomPointList()
2949
item.SetupInterface()
2950
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2951
self.App_SetModifiedFlag()
2953
def TableZoomPoint_DefZoomPointText(self):
2954
self.index = self.win.timeline.currentColumn()
2955
image=self.win.timeline.cellWidget(0,self.index)
2957
ZoomPointNum = self.win.TableZoomPoint.currentRow()
2958
if ZoomPointNum > -1 :
2959
item=self.win.TableZoomPoint.cellWidget(ZoomPointNum,0)
2961
self.DefTextDlg=DefTextDlg(image,ZoomPointNum,self,"ZoomPoint",self.win)
2962
xmlPoint=image.ZoomPointList.getElementsByTagName(u"Point-"+str(ZoomPointNum))[0]
2963
self.DefTextDlg.show()
2964
self.DefTextDlg.FirstInit()
2965
self.DefTextDlg.ImportXML(xmlPoint)
2966
self.DefTextDlg.ForcePaint()
2968
def TableZoomPoint_DefZoomPointTextOk(self):
2969
# Save Windows size/position on exit
2970
self.DefTextDlg.SaveWindowPosition()
2972
self.index = self.win.timeline.currentColumn()
2973
image=self.win.timeline.cellWidget(0,self.index)
2975
ZoomPointNum = self.win.TableZoomPoint.currentRow()
2976
if ZoomPointNum > -1 :
2977
ZoomPointItem=self.win.TableZoomPoint.cellWidget(ZoomPointNum,0)
2978
if ZoomPointItem!=None :
2979
ZoomPointItem.CacheThumb=None
2980
image.CacheThumb=None
2981
ZoomPointItem.XMLText=self.DefTextDlg.ExportToXML()
2982
self.DefTextDlg.close()
2983
image.MakeXMLZoomPointList()
2985
ZoomPointItem.updatePix()
2986
ZoomPointItem.SetupInterface()
2987
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
2988
self.App_SetModifiedFlag()
2990
def TableZoomPoint_DefZoomPoint(self):
2991
self.index = self.win.timeline.currentColumn()
2992
image=self.win.timeline.cellWidget(0,self.index)
2994
i = self.win.TableZoomPoint.currentRow()
2996
item=self.win.TableZoomPoint.cellWidget(i,0)
2998
self.DefZoomPointDlg=DefZoomPointDlg(image,item,self,self.win)
2999
self.DefZoomPointDlg.show()
3000
self.DefZoomPointDlg.FirstInit()
3002
def TableZoomPoint_DefZoomPointOk(self):
3003
# Save Windows size/position on exit
3004
self.DefZoomPointDlg.SaveWindowPosition()
3006
self.index = self.win.timeline.currentColumn()
3007
image=self.win.timeline.cellWidget(0,self.index)
3009
i = self.win.TableZoomPoint.currentRow()
3011
item=self.win.TableZoomPoint.cellWidget(i,0)
3013
item.CacheThumb=None
3014
item.x = self.DefZoomPointDlg.cadre.x
3015
item.y = self.DefZoomPointDlg.cadre.y
3016
item.zoom = self.DefZoomPointDlg.cadre.zoom
3017
ZoomPointItem.CacheThumb=None
3018
image.CacheThumb=None
3019
self.DefZoomPointDlg.close()
3020
image.MakeXMLZoomPointList()
3023
item.SetupInterface()
3024
self.App_DisplayPixMainWin(self.win.TABOptions.currentIndex())
3025
image.MakeXMLZoomPointList()
3026
self.App_SetModifiedFlag()