/usr/share/pyshared/pymecavideo/qtiplotexport.py is in python-mecavideo 6.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #-*- coding: utf-8 -*-
"""
qtiplotexport.py, a module for pymecavideo:
a program to track moving points in a video frameset
Copyright (C) 2007 Jean-Baptiste Butet <ashashiwa@gmail.com>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from string import Template
import time
qtiFileTemplate=Template("""\
QtiPlot 0.9.0 project file
<scripting-lang> muParser
<windows> 1
$table
<open>1</open>
""")
tableTemplate=Template("""\
<table>
Table1 $ligs $cols $date
geometry 0 0 664 258 active
header$headers
ColWidth$colWidths
<com>
</com>
ColType$colTypes
ReadOnlyColumn$colRo
HiddenColumn$colHidden
Comments$comments
WindowLabel 2
<data>
$data
</data>
</table>
""")
class Qtiplot:
"""
Une classe pour exporter des fichiers de type Qtiplot
"""
def __init__(self, app):
"""
Crée l'objet
@param app l'application de pymecavideo
"""
self.app=app
dic={}
dic['date']=time.strftime("%d/%m/%y %H:%M")
n=len(app.points.keys())
if n <30: n=30
dic['ligs']=str(n)
dic['cols']=str(1+2*app.nb_de_points)
dic['headers']='\tt-s[X]'
dic['colWidths']='\t100'
dic['colTypes']='\t0;0/13'
dic['colRo']='\t0'
dic['colHidden']='\t0'
dic['comments']='\t'
for i in range(app.nb_de_points):
dic['headers']+='\tX%s-m[Y]\tY%s-m[Y]' %(i+1,i+1)
dic['colWidths']+="\t100\t100"
dic['colTypes']+="\t0;0/13\t0;0/13"
dic['colRo']+='\t0\t0'
dic['colHidden']+='\t0\t0'
dic['comments']+='\t\t'
# deux bizarreries : tabulations supplémentaires
dic['colWidths']+='\t'; dic['comments']+='\t'
dic['data']=''
ligne=0
dt=app.deltaT
for k in app.points.keys():
data=app.points[k]
dic['data']+='%i\t%f' %(ligne, dt*ligne)
for vect in data[1:]:
vect=app.pointEnMetre(vect)
dic['data']+='\t%f\t%f' %(vect.x(), vect.y())
dic['data']+='\n'
ligne +=1
dic['data']= dic['data'][:-1] # suppression du dernier retour à la ligne
self.table=tableTemplate.substitute(dic)
self.qtifile=qtiFileTemplate.substitute({'table': self.table})
def saveToFile(self,f):
"""
Enregistre les données dans un fichier
@param f le fichier ouver déjà en écriture
"""
f.write(self.qtifile)
|