/usr/share/pyshared/pymecavideo/preferences.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 | # -*- coding: utf-8 -*-
licence="""
preferences is a a file of the project 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 PyQt4.QtCore import *
from PyQt4.QtGui import *
#from Ui_preferences import Ui_Dialog
from dbg import Dbg
import vecteur, commands
import pickle, os, os.path
class Preferences:
def __init__(self, parent):
self.app=parent
self.app.dbg.p(3,"In : Preferences, preferences.py")
self.conffile=os.path.join(self.app._dir("conf"),"pymecavideo.conf")
# ajuste les valeurs par défaut
self.proximite=False
self.lastVideo=""
self.videoDir=os.getcwd()
self.niveauDbg=0 # niveau d'importance des messages de débogage
# récupère les valeurs enregistrées
self.load()
def __str__(self):
"""
Renvoie une chaîne représentant les préférences, lisible par un humain
"""
result=self.app.tr("Proximite de la souris %1").arg(self.proximite)
result +=self.app.tr("; derniere video %1").arg(self.lastVideo)
result +=self.app.tr("; videoDir %1").arg(self.videoDir)
return "%s" %result
def save(self):
"""
Sauvegarde des préférences dans le fichier de configuration.
"""
f=open(self.conffile,"w")
self.app.dbg.p(6,"sauvegarde des preferences dans %s" %self.conffile)
self.app.dbg.p(6, "%s" %self)
try :
self.lastVideo = unicode(self.lastVideo,'utf8')
except TypeError:
pass
pickle.dump((self.proximite,self.lastVideo,self.videoDir),f)
f.close()
def load(self):
if os.path.exists(self.conffile):
try:
f=open(self.conffile,"r")
(self.proximite,self.lastVideo,self.videoDir) = pickle.load(f)
f.close()
except:
self.app.dbg.p(2,"erreur en lisant %s" %self.conffile)
self.app.dbg.p(2,"effacement du répertoire temporaire de pymecavideo")
pass
|