rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
properties[propname] = (getterValue, setterValue, propType, propIndex)
properties[propname] = { "GetterValue" : getterValue, "SetterValue" : setterValue, "PropertyType" : propType, "IndexParamType" : propIndex, "IndexParamName" : propIndexName, "Category" : (getter or setter)["Category"], "GetterName" : getterName, "SetterName" : setterName, "GetterComment" : gette...
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
constants.append( ("SCI_" + string.upper(getterName), getterValue) ) del(functions[getterName])
constants.append( ("SCI_" + string.upper(getterName), getter))
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
constants.append( ("SCI_" + string.upper(setterName), setterValue) ) del(functions[setterName])
constants.append( ("SCI_" + string.upper(setterName), setter))
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
constants.sort()
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
for name, value in constants:
for name, features in constants:
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
out.write('\n\t{"%s",%s}' % (name, value))
out.write('\n\t{"%s",%s}' % (name, features["Value"]))
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
funclist = functions.items() funclist.sort()
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
for name, features in funclist:
for name, features in functions:
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
out.write('{""}};\n')
out.write('{"",0,iface_void,{iface_void,iface_void}} };\n')
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
proplist = properties.items() proplist.sort()
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
for propname, (getter, setter, valueType, paramType) in proplist:
for propname, property in properties:
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
propname, getter, setter, valueType, paramType
propname, property["GetterValue"], property["SetterValue"], property["PropertyType"], property["IndexParamType"]
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
out.write('{""}};\n')
out.write('{"", 0, iface_void, iface_void} };\n')
def printIFaceTableCXXFile(f,out): constants = [] functions = {} properties = {} for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not StartsWith(name, "SCLEX_"): constants.append( (name, features["Value"]) ) elif features["FeatureType"] i...
if Contains(line, "//++Autogenerated"):
if Contains(line, "//++Autogenerated") or Contains(line, "<!-- <Autogenerated> -->"):
def CopyWithInsertion(input, output, genfn, definition): copying = 1 for line in input.readlines(): if copying: output.write(line) if Contains(line, "//++Autogenerated"): copying = 0 genfn(definition, output) if Contains(line, "//--Autogenerated"): copying = 1 output.write(line)
if Contains(line, "//--Autogenerated"):
if Contains(line, "//--Autogenerated") or Contains(line, "<!-- </Autogenerated> -->"):
def CopyWithInsertion(input, output, genfn, definition): copying = 1 for line in input.readlines(): if copying: output.write(line) if Contains(line, "//++Autogenerated"): copying = 0 genfn(definition, output) if Contains(line, "//--Autogenerated"): copying = 1 output.write(line)
functions = []
functions = {} properties = {}
def printIFaceTableCXXFile(f,out): constants = [] functions = [] for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): constants.append( (name, features["Value"]) ) elif features["Featu...
functions.append((name, features))
functions[name] = features if features["FeatureType"] == "get": propname = string.replace(name, "Get", "", 1) properties[propname] = (name, properties.get(propname,(None,None))[1]) elif features["FeatureType"] == "set": propname = string.replace(name, "Set", "", 1) properties[propname] = (properties.get(propname,(Non...
def printIFaceTableCXXFile(f,out): constants = [] functions = [] for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): constants.append( (name, features["Value"]) ) elif features["Featu...
functions.sort()
funclist = functions.items() funclist.sort()
def printIFaceTableCXXFile(f,out): constants = [] functions = [] for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): constants.append( (name, features["Value"]) ) elif features["Featu...
for name, features in functions:
for name, features in funclist:
def printIFaceTableCXXFile(f,out): constants = [] functions = [] for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): constants.append( (name, features["Value"]) ) elif features["Featu...
name, features["Value"], features["ReturnType"] or "void", paramTypes[0], paramTypes[1]
name, features["Value"], returnType, paramTypes[0], paramTypes[1]
def printIFaceTableCXXFile(f,out): constants = [] functions = [] for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): constants.append( (name, features["Value"]) ) elif features["Featu...
else: out.write('{""}};\n') out.write("\nstatic IFaceProperty ifaceProperties[] = {") if properties: proplist = properties.items() proplist.sort() first = 1 for propname, (getter, setter, valueType, paramType) in proplist: if first: first = 0 else: out.write(",") out.write('\n\t{"%s", %s, %s, iface_%s, iface_%s}' % ...
def printIFaceTableCXXFile(f,out): constants = [] functions = [] for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): constants.append( (name, features["Value"]) ) elif features["Featu...
out.write("\tifaceConstantCount = %d\n" % len(constants))
out.write("\tifaceConstantCount = %d,\n" % len(constants)) out.write("\tifacePropertyCount = %d\n" % len(properties))
def printIFaceTableCXXFile(f,out): constants = [] functions = [] for name in f.order: features = f.features[name] if features["Category"] != "Deprecated": if features["FeatureType"] == "val": if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): constants.append( (name, features["Value"]) ) elif features["Featu...
'from MGI_Synonym_MusMarker_View s ' + \ 'where s.synonymType in ("similar", "broad", "narrow") '
'from MGI_SynonymType st, MGI_Synonym s ' + \ 'where st._MGIType_key = 2 ' + \ 'and st._Organism_key = 1 ' + \ 'and st.synonymType in ("similar", "broad", "narrow") ' + \ 'and st._SynonymType_key = s._SynonymType_key '
def priority10(): # mouse synonyms (similar, broad, narrow) print 'processing priority 10...%s' % mgi_utils.date() cmd = 'select _Marker_key = s._Object_key, s._Organism_key, _OrthologOrganism_key = NULL, label = s.synonym ' + \ 'from MGI_Synonym_MusMarker_View s ' + \ 'where s.synonymType in ("similar", "broad", "n...
server = os.environ['DBSERVER'] database = os.environ['DBNAME'] user = os.environ['DBUSER'] passwordFile = os.environ['DBPASSWORDFILE']
user = os.environ['MGD_DBUSER'] passwordFile = os.environ['MGD_DBPASSWORDFILE']
def createBCPfile(): ''' # # Create bcp file # ''' print 'Creating %s.bcp...' % (table) bcpFile = open(outDir + '/%s.bcp' % (table), 'w') # delete existing entries db.sql('delete from %s where _Refs_key = %s' % (table, refsKey), None) # exclude all problem Molecular Segments # (those with at least one Sequence of ...
db.set_sqlLogin(user, password, server, database)
db.set_sqlUser(user) db.set_sqlPassword(password)
def createBCPfile(): ''' # # Create bcp file # ''' print 'Creating %s.bcp...' % (table) bcpFile = open(outDir + '/%s.bcp' % (table), 'w') # delete existing entries db.sql('delete from %s where _Refs_key = %s' % (table, refsKey), None) # exclude all problem Molecular Segments # (those with at least one Sequence of ...
cmd = 'select o._Marker_key, o._Organism_key, o._OrthologOrganism_key, label = s.synonym ' + \
cmd = 'select distinct o._Marker_key, o._Organism_key, o._OrthologOrganism_key, label = s.synonym ' + \
def priority8(): # human synonyms of mouse orthologs print 'processing priority 8...%s' % mgi_utils.date() cmd = 'select distinct m._Marker_key, m2 = m2._Marker_key, m._Organism_key, _OrthologOrganism_key = m2._Organism_key ' + \ 'into #orthology1 ' + \ 'from MRK_Marker m, MRK_Marker m2, HMD_Homology h1, HMD_Homolog...
cmd = cmd + 'where s._Object_key = %s\n' % markerKey
cmd = cmd + 'and s._Object_key = %s\n' % markerKey
def priority8(): # human synonyms of mouse orthologs print 'processing priority 8...%s' % mgi_utils.date() cmd = 'select distinct m._Marker_key, m2 = m2._Marker_key, m._Organism_key, _OrthologOrganism_key = m2._Organism_key ' + \ 'into #orthology1 ' + \ 'from MRK_Marker m, MRK_Marker m2, HMD_Homology h1, HMD_Homolog...
cmd = 'select o._Marker_key, o._Organism_key, o._OrthologOrganism_key, label = s.synonym ' + \
cmd = 'select distinct o._Marker_key, o._Organism_key, o._OrthologOrganism_key, label = s.synonym ' + \
def priority9(): # rat synonyms of mouse orthologs print 'processing priority 9...%s' % mgi_utils.date() cmd = 'select distinct m._Marker_key, m2 = m2._Marker_key, m._Organism_key, _OrthologOrganism_key = m2._Organism_key ' + \ 'into #orthology2 ' + \ 'from MRK_Marker m, MRK_Marker m2, HMD_Homology h1, HMD_Homology ...
cmd = cmd + 'where s._Object_key = %s\n' % markerKey
cmd = cmd + 'and s._Object_key = %s\n' % markerKey
def priority9(): # rat synonyms of mouse orthologs print 'processing priority 9...%s' % mgi_utils.date() cmd = 'select distinct m._Marker_key, m2 = m2._Marker_key, m._Organism_key, _OrthologOrganism_key = m2._Organism_key ' + \ 'into #orthology2 ' + \ 'from MRK_Marker m, MRK_Marker m2, HMD_Homology h1, HMD_Homology ...
if markerKey is not None: cmd = cmd + 'and _Marker_key = %s\n' % markerKey
def priority11(): # human ortholog (symbol) print 'processing priority 11...%s' % mgi_utils.date()
if markerKey is not None: cmd = cmd + 'and _Marker_key = %s\n' % markerKey
def priority12(): # human ortholog (name) print 'processing priority 12...%s' % mgi_utils.date() cmd = 'select o.*, label = m.name, labelTypeName = s.commonName + " ortholog name" ' + \ 'from #orthology1 o, MRK_Marker m, MGI_Organism s ' + \ 'where o.m2 = m._Marker_key ' + \ 'and o._OrthologOrganism_key = s._Organis...
if markerKey is not None: cmd = cmd + 'and _Marker_key = %s\n' % markerKey
def priority13(): # rat ortholog (symbol) print 'processing priority 13...%s' % mgi_utils.date() cmd = 'select o.*, label = m.symbol, labelTypeName = s.commonName + " ortholog symbol" ' + \ 'from #orthology2 o, MRK_Marker m, MGI_Organism s ' + \ 'where o.m2 = m._Marker_key ' + \ 'and o._OrthologOrganism_key = s._Org...
cmd = 'select _Marker_key = s._Object_key, st._Organism_key, _OrthologOrganism_key = NULL, label = s.synonym ' + \
cmd = 'select distinct _Marker_key = s._Object_key, st._Organism_key, _OrthologOrganism_key = NULL, label = s.synonym ' + \
def priority10(): # mouse synonyms (similar, broad, narrow) print 'processing priority 10...%s' % mgi_utils.date() cmd = 'select _Marker_key = s._Object_key, st._Organism_key, _OrthologOrganism_key = NULL, label = s.synonym ' + \ 'from MGI_SynonymType st, MGI_Synonym s ' + \ 'where st._MGIType_key = 2 ' + \ 'and st....
cmd = 'select _Marker_key = s._Object_key, s._Organism_key, _OrthologOrganism_key = NULL, label = s.synonym ' + \
cmd = 'select _Marker_key = s._Object_key, st._Organism_key, _OrthologOrganism_key = NULL, label = s.synonym ' + \
def priority10(): # mouse synonyms (similar, broad, narrow) print 'processing priority 10...%s' % mgi_utils.date() cmd = 'select _Marker_key = s._Object_key, s._Organism_key, _OrthologOrganism_key = NULL, label = s.synonym ' + \ 'from MGI_SynonymType st, MGI_Synonym s ' + \ 'where st._MGIType_key = 2 ' + \ 'and st._...
for fileName in files: fileList.append(os.path.join(root, fileName))
for fileName in files: if guess_type(os.path.join(root,fileName))[0] in walFormats: fileList.append(os.path.join(root, fileName))
def makeWallpapersList(path): """ Do a wallpaper list: from directory, file with list and from image. """ walFormats = ['image/jpeg', 'image/png'] if os.path.isdir(path): fileList = [] for root, dirs, files in os.walk(path): for fileName in files: fileList.append(os.path.join(root, fileName)) return fileList if gues...
os.system(tool.replace('FILENAME', "'%s'" % options.file.replace("'","\'")))
os.system(tool.replace('FILENAME', "%s" % config['wallpapers'][config['currentWal']].replace("'","\\'").replace(" ","\\ ")))
def doAction(options, config): """ Do specified in options action and return modified config """ if options.external_tool: tool = options.external_tool else: try: tool = [tool for tool in config['tools'] if \ tool.split()[0] == (options.tool or config['defaultTool'])][0] except: raise ParseError, 'Cannot find specifie...
os.system(tool.replace('FILENAME', "'%s'" % config['wallpapers'][config['currentWal']].replace("'","\'")))
os.system(tool.replace('FILENAME', "%s" % config['wallpapers'][config['currentWal']].replace("'","\\'").replace(" ","\\ ")))
def doAction(options, config): """ Do specified in options action and return modified config """ if options.external_tool: tool = options.external_tool else: try: tool = [tool for tool in config['tools'] if \ tool.split()[0] == (options.tool or config['defaultTool'])][0] except: raise ParseError, 'Cannot find specifie...
if not os.path.exists(path):
if not os.path.exists(options.add):
def doAction(options, config): """ Do specified in options action and return modified config """ try: tool = [tool for tool in config['tools'] if \ tool.split()[0] == (options.tool or config['defaultTool'])][0] except: raise ParseError, 'Cannot find specified tool in database' if options.export: for wal in config['wa...
fileList = makeWallpapersList(path)
fileList = makeWallpapersList(options.add)
def doAction(options, config): """ Do specified in options action and return modified config """ try: tool = [tool for tool in config['tools'] if \ tool.split()[0] == (options.tool or config['defaultTool'])][0] except: raise ParseError, 'Cannot find specified tool in database' if options.export: for wal in config['wa...
'habak -i FILENAME -S',
'habak -hi FILENAME -mS',
def createConfiguration(): """ Create empty configuration. """ tools = ['hsetroot -fill FILENAME', 'habak -i FILENAME -S', 'Esetroot FILENAME'] try: defTool = [tool.split()[0] for tool in tools if not \ os.system('which %s &>/dev/null' % tool.split()[0])][0] except: raise ParseError, 'Cannot find any usable tool to s...
os.system(tool.replace('FILENAME', options.file))
os.system(tool.replace('FILENAME', "'%s'" % options.file.replace("'","\'")))
def doAction(options, config): """ Do specified in options action and return modified config """ if options.external_tool: tool = options.external_tool else: try: tool = [tool for tool in config['tools'] if \ tool.split()[0] == (options.tool or config['defaultTool'])][0] except: raise ParseError, 'Cannot find specifie...
os.system(tool.replace('FILENAME', config['wallpapers'][config['currentWal']]))
os.system(tool.replace('FILENAME', "'%s'" % config['wallpapers'][config['currentWal']].replace("'","\'")))
def doAction(options, config): """ Do specified in options action and return modified config """ if options.external_tool: tool = options.external_tool else: try: tool = [tool for tool in config['tools'] if \ tool.split()[0] == (options.tool or config['defaultTool'])][0] except: raise ParseError, 'Cannot find specifie...
self.NbrJobsSignal = Signal()
def __init__(self): """ """ self.__label = "Un moment..." self.startSignal = Signal() self.refreshSignal = Signal() self.finishSignal = Signal()
else: if os.path.splitext(File)[1] in config.Extensions: AlsoProcess+=1
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, max(1,len(List)))
self.NbrJobsSignal = Signal()
def __init__(self): """ """ self.__label = "Rangement photo" self.startSignal = Signal() self.refreshSignal = Signal() self.finishSignal = Signal()
if not os.path.isdir(config.SelectedDirectory): mkdir(config.SelectedDirectory)
if not os.path.isdir(SelectedDir): mkdir(SelectedDir)
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
for day in os.listdir(config.SelectedDirectory): for File in os.listdir(os.path.join(config.SelectedDirectory,day)):
for day in os.listdir(SelectedDir): for File in os.listdir(os.path.join(SelectedDir,day)):
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
if os.path.isdir(os.path.join(config.SelectedDirectory,day,File)): for ImageFile in os.listdir(os.path.join(config.SelectedDirectory,day,File)): src=os.path.join(config.SelectedDirectory,day,File,ImageFile) dst=os.path.join(config.SelectedDirectory,day,ImageFile)
if os.path.isdir(os.path.join(SelectedDir,day,File)): for ImageFile in os.listdir(os.path.join(SelectedDir,day,File)): src=os.path.join(SelectedDir,day,File,ImageFile) dst=os.path.join(SelectedDir,day,ImageFile)
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
dest=os.path.join(config.SelectedDirectory,File)
dest=os.path.join(SelectedDir,File)
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
dirs=os.listdir(config.SelectedDirectory)
dirs=os.listdir(SelectedDir)
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
pathday=os.path.join(config.SelectedDirectory,day)
pathday=os.path.join(SelectedDir,day)
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
self.pb.set_fraction(float(h+1)/self.__nbVal)
if h<self.__nbVal: self.pb.set_fraction(float(h+1)/self.__nbVal) else: self.pb.set_fraction(1.0)
def updateProgressBar(self,h,filename): """ Mise jour de la progressbar Dans le cas d'un toolkit, c'est ici qu'il faudra appeler le traitement des vnements. set the progress-bar to the given value with the given name @param h: current number of the file @type val: integer or float @param name: name of the current elem...
print "Gnration des vignettes pour %s "%filename
def ScaleImage(filename): """common processing for one image : create a subfolder "scaled" and "thumb" : """ print "Gnration des vignettes pour %s "%filename config=Config() rootdir=os.path.dirname(filename) scaledir=os.path.join(rootdir,config.ScaledImages["Suffix"]) thumbdir=os.path.join(rootdir,config.Thumbnails["Su...
def SplitIntoPages(pathday)
def SplitIntoPages(pathday):
def SplitIntoPages(pathday) """Split a directory (pathday) into pages of 20 images""" files=[] for i in os.listdir(pathday): if os.path.splitext(i)[1] in config.Extensions:files.append(i) files.sort() if len(files)>config.NbrPerPage: pages=1+(len(files)-1)/config.NbrPerPage for i in range(1, pages+1): folder=os.path....
for filename in daydir
for filename in daydir:
def SplitIntoPages(pathday) """Split a directory (pathday) into pages of 20 images""" files=[] for i in os.listdir(pathday): if os.path.splitext(i)[1] in config.Extensions:files.append(i) files.sort() if len(files)>config.NbrPerPage: pages=1+(len(files)-1)/config.NbrPerPage for i in range(1, pages+1): folder=os.path....
filename=os.path.join(pathday,PagePrefix+str(i),files[j])
filename=os.path.join(pathday,config.PagePrefix+str(i),files[j])
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
x,y=self.taille() return x-y
self.taille() return self.x-self.y
def larg(self): """width-height of a jpeg file""" x,y=self.taille() return x-y
return self.x,self.y
def taille(self): """width and height of a jpeg file""" self.LoadPIL() self.x,self.y=self.f.size return self.x,self.y
config=Config() Trashdir=os.path.join(config.DefaultRepository,config.TrashDirectory)
Trashdir=os.path.join(self.config.DefaultRepository,self.config.TrashDirectory)
def Trash(self): """Send the file to the trash folder""" config=Config() Trashdir=os.path.join(config.DefaultRepository,config.TrashDirectory) td=os.path.dirname(os.path.join(Trashdir,self.filename)) tf=os.path.join(Trashdir,self.filename) if not os.path.isdir(td): makedir(td) shutil.move(self.fn,os.path.join(Trashdir,...
x,y=self.taille() data["Resolution"]="%s x %s "%(x,y)
self.taille() data["Resolution"]="%s x %s "%(self.x,self.y)
def exif(self): """return exif data + title from the photo""" clef={ 'Image Make': 'Marque', 'Image Model': 'Modele', 'Image DateTime': 'Heure', 'EXIF Flash':'Flash', 'EXIF FocalLength': 'Focale', 'EXIF FNumber': 'Ouverture', 'EXIF ExposureTime' :'Vitesse', 'EXIF ISOSpeedRatings': 'Iso', 'EXIF ExposureBiasValue': 'Bias...
self.x,self.y=self.taille()
self.taille()
def show(self,Xsize=600,Ysize=600): """return a pixbuf to shows the image in a Gtk window""" self.x,self.y=self.taille() pixbuf = gtk.gdk.pixbuf_new_from_file(self.fn) if self.x>Xsize: RX=1.0*Xsize/self.x else : RX=1 if self.y>Ysize: RY=1.0*Ysize/self.y else : RY=1 R=min(RY,RX) if R<1: nx=int(R*self.x) ny=int(R*self.y)...
if self.x>Xsize: RX=1.0*Xsize/self.x else : RX=1 if self.y>Ysize: RY=1.0*Ysize/self.y else : RY=1 R=min(RY,RX)
R=min(float(Xsize)/self.x,float(Ysize)/self.y)
def show(self,Xsize=600,Ysize=600): """return a pixbuf to shows the image in a Gtk window""" self.x,self.y=self.taille() pixbuf = gtk.gdk.pixbuf_new_from_file(self.fn) if self.x>Xsize: RX=1.0*Xsize/self.x else : RX=1 if self.y>Ysize: RY=1.0*Ysize/self.y else : RY=1 R=min(RY,RX) if R<1: nx=int(R*self.x) ny=int(R*self.y)...
config=Config()
def ContrastMask(self,outfile): """Ceci est un filtre de debouchage de photographies, aussi appel masque de contraste, il permet de rattrapper une photo trop contrast, un contre jour, ... crit par Jrme Kieffer, avec l'aide de la liste python@aful, en particulier A. Fayolles et F. Mantegazza avril 2006 necessite numarra...
F.save(os.path.join(config.DefaultRepository,outfile),quality=90,progressive=True,Optimize=True)
F.save(os.path.join(self.config.DefaultRepository,outfile),quality=90,progressive=True,Optimize=True) os.chmod(os.path.join(self.config.DefaultRepository,outfile),self.config.DefaultFileMode)
def ContrastMask(self,outfile): """Ceci est un filtre de debouchage de photographies, aussi appel masque de contraste, il permet de rattrapper une photo trop contrast, un contre jour, ... crit par Jrme Kieffer, avec l'aide de la liste python@aful, en particulier A. Fayolles et F. Mantegazza avril 2006 necessite numarra...
self.startSignal.emit(self.__label, len(List))
self.startSignal.emit(self.__label, max(1,len(List)))
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
if (os.path.isdir(src)) and (os.path.split(src)[1] in [scaled,thumb]):
if (os.path.isdir(src)) and (os.path.split(src)[1] in [config.ScaledImages["Suffix"],config.Thumbnails["Suffix"]]):
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
class ModelProcessSelected: """Implemantation MVC de la procedure ProcessSelected""" def __init__(self): """ """ self.__label = "Un moment..." self.startSignal = Signal() self.refreshSignal = Signal() self.finishSignal = Signal() def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(L...
see aspn.activestate.com """ def __init__(self, f): self.f = f.im_func self.c = weakref.ref(f.im_self) def __call__(self, *args, **kwargs): if self.c() == None: return self.f(self.c(), *args, **kwargs)
# def start(self):
class ModelRangeTout: """Implemantation MVC de la procedure RangeTout moves all the JPEG files to a directory named from their day and with the name according to the time""" def __init__(self): """ """ self.__label = "Rangement photo" self.startSignal = Signal() self.refreshSignal = Signal() self.finishSignal = Signal...
def start(self,List): """ Lance les calculs """ self.startSignal.emit(self.__label, len(List))
def runcmd(args):
def runcmd(args, mode = Commands):
def runcmd(args): args = [ commands.mkarg(arg) for arg in args ] cmd = " ".join(args) # t = time.time() # print("Executing '%s'." % cmd) (exitstatus, output) = commands.getstatusoutput(cmd) if exitstatus != 0: raise SVKError(cmd, exitstatus >> 8, output) # print("'%s' executed in %s" % (cmd, time.time() - t)) return...
output = None
def runcmd(args): args = [ commands.mkarg(arg) for arg in args ] cmd = " ".join(args) # t = time.time() # print("Executing '%s'." % cmd) (exitstatus, output) = commands.getstatusoutput(cmd) if exitstatus != 0: raise SVKError(cmd, exitstatus >> 8, output) # print("'%s' executed in %s" % (cmd, time.time() - t)) return...
(exitstatus, output) = commands.getstatusoutput(cmd)
if mode == Commands: (exitstatus, output) = commands.getstatusoutput(cmd) exitstatus >>= 8 elif mode == System: exitstatus = os.system(cmd)
def runcmd(args): args = [ commands.mkarg(arg) for arg in args ] cmd = " ".join(args) # t = time.time() # print("Executing '%s'." % cmd) (exitstatus, output) = commands.getstatusoutput(cmd) if exitstatus != 0: raise SVKError(cmd, exitstatus >> 8, output) # print("'%s' executed in %s" % (cmd, time.time() - t)) return...
raise SVKError(cmd, exitstatus >> 8, output)
raise SVKError(cmd, exitstatus, output)
def runcmd(args): args = [ commands.mkarg(arg) for arg in args ] cmd = " ".join(args) # t = time.time() # print("Executing '%s'." % cmd) (exitstatus, output) = commands.getstatusoutput(cmd) if exitstatus != 0: raise SVKError(cmd, exitstatus >> 8, output) # print("'%s' executed in %s" % (cmd, time.time() - t)) return...
def getexternals(path): svnpath = findsvnpath(finddepotpath(path))
def findcopypath(path): info = runcmd([Config.svk, 'info', path]) infodict = {} for line in info.splitlines(): (key, value) = line.split(": ") infodict[key] = value return '/'+infodict['Copied From'].split(', ')[0] def getexternals(path, depotpath): if not depotpath: depotpath = finddepotpath(path) svnpath = findsvnpa...
def getexternals(path): svnpath = findsvnpath(finddepotpath(path)) def findexternals(arg, dirname, fnames): import re args = [ Config.svn, 'propget', 'svn:externals', re.sub("^%s" % path, svnpath, dirname) ] try: dirext = runcmd(args) except SVKError: return if dirext == '': return import re for line in re.split('[\n...
def handleexternals(path, handler):
def handleexternals(path, handler, depotpath):
def handleexternals(path, handler): extcache = [] toclist = gettocfiles(path) for toc in toclist: tocdir = os.path.dirname(toc) extdestdir = os.path.dirname(tocdir) externals = getexternals(path) for ext,upstream in externals: if upstream in extcache: continue mipath = None for url in mi.byvalue.keys(): i = upstream....
externals = getexternals(path)
externals = getexternals(tocdir, tocdir.replace(path, depotpath)) if not externals: continue
def handleexternals(path, handler): extcache = [] toclist = gettocfiles(path) for toc in toclist: tocdir = os.path.dirname(toc) extdestdir = os.path.dirname(tocdir) externals = getexternals(path) for ext,upstream in externals: if upstream in extcache: continue mipath = None for url in mi.byvalue.keys(): i = upstream....
return getlastpath('Copied From')
return getlastpath(path, 'Copied From')
def findcopypath(path): return getlastpath('Copied From')
return getlastpath('Merged From')
return getlastpath(path, 'Merged From')
def getlastmergepath(path): return getlastpath('Merged From')
import types
import types, re
def getsvkinfo(path): if not infos.get(path): import types info = runcmd([Config.svk, 'info', path]) infodict = {} for line in info.splitlines(): fields = line.split(": ") if len(fields) != 2: sys.__stderr__.write("Unexpected number of fields in line `%s', skipping." % line) continue key = fields[1] value = fields[2] ...
fields = line.split(": ") if len(fields) != 2: sys.__stderr__.write("Unexpected number of fields in line `%s', skipping." % line) continue key = fields[1] value = fields[2]
m = re.match('([^:]+): (.*)$', line) key = m.group(1) value = m.group(2)
def getsvkinfo(path): if not infos.get(path): import types info = runcmd([Config.svk, 'info', path]) infodict = {} for line in info.splitlines(): fields = line.split(": ") if len(fields) != 2: sys.__stderr__.write("Unexpected number of fields in line `%s', skipping." % line) continue key = fields[1] value = fields[2] ...
path = "notes/active/"
def __init__(self): path = "notes/active/" for note in os.listdir(path): if os.path.isfile(os.path.join(path,note)): self.noteList.append(self.loadNote(note))
if os.path.isfile(os.path.join(path,note)): self.noteList.append(self.loadNote(note))
filepath = os.path.join(path,note) if os.path.isfile(filepath): self.loadNote(filepath)
def __init__(self): path = "notes/active/" for note in os.listdir(path): if os.path.isfile(os.path.join(path,note)): self.noteList.append(self.loadNote(note))
note = cPickle.load(open("notes/active/%s" % file,"rb")) note.text = decompress(note.text)
note = cPickle.load(open(file,"rb")) note.setFilepath(file) note.setText(decompress(note.getText())) if note not in self.noteList: self.noteList.append(note)
def loadNote(self,file): note = cPickle.load(open("notes/active/%s" % file,"rb")) note.text = decompress(note.text) return note
if note not in self.noteList: self.noteList.append(note)
def saveNote(self,note): if note not in self.noteList: self.noteList.append(note)
note.text = compress(note.text)
self.removeNote(note) if note.getText() != "": note.setFilepath("") note.setText(compress(note.getText()))
def saveNote(self,note): if note not in self.noteList: self.noteList.append(note)
cFile = StringIO() cPickle.dump(note,cFile,-1) nFile = file("notes/active/%s" % md5.new(cFile.getvalue()).hexdigest(),"wb") nFile.write(cFile.getvalue()) nFile.close() cFile.close()
cFile = StringIO() cPickle.dump(note,cFile,-1)
def saveNote(self,note): if note not in self.noteList: self.noteList.append(note)
note.text = decompress(note.text)
filepath = os.path.join(path,md5.new(cFile.getvalue()).hexdigest()) nFile = file(filepath,"wb") nFile.write(cFile.getvalue()) nFile.close() cFile.close() note = self.loadNote(filepath)
def saveNote(self,note): if note not in self.noteList: self.noteList.append(note)
note.setText(decompress(note.getText()))
note.setText(unicode(decompress(note.getText()),'utf-8'))
def loadNote(self,file): note = cPickle.load(open(file,"rb")) note.setFilepath(file) note.setText(decompress(note.getText()))
note.setText(compress(note.getText()))
note.setText(compress(note.getText().encode('utf-8')))
def saveNote(self,note):
os._exit()
os._exit(0)
def run(self, result=None): if result is None: result = self.defaultTestResult() c2pread, c2pwrite = os.pipe() # fixme - error -> result # now fork pid = os.fork() if pid == 0: # Child # Close parent's pipe ends os.close(c2pread) # Dup fds for child os.dup2(c2pwrite, 1) # Close pipe fds. os.close(c2pwrite)
self.text.LoadFile(filename)
self.text.SetValue(open(filename).read())
def Open(self, filename): self.filename = filename self.text.LoadFile(filename)
recent.Append(ID_RECENT_FILES+i, f)
recent.Append(ID_RECENT_FILES+i, os.path.basename(f))
def InitMenu(self): menu = (('&File', (('&New', wx.ID_NEW, self.OnNew), ('&Open', wx.ID_OPEN, self.OnOpen), ('&Save', wx.ID_SAVE, self.OnSave), ('Save as...', wx.ID_SAVEAS, self.OnSaveAs), None, ('&Close', wx.ID_CLOSE, self.OnClose), ('Close all', wx.ID_CLOSE_ALL, self.OnCloseAll), ('E&xit', wx.ID_EXIT, self.OnExit))),...
self.Load(self.recent[evt.GetId()-ID_RECENT_FILES])
self.Load(self.recent[ID_RECENT_FILES-evt.GetId()-1])
def OnOpenRecent(self, evt): self.Load(self.recent[evt.GetId()-ID_RECENT_FILES])
if filename in self.recent: self.recent.remove(filename) self.recent.append(filename)
absname = os.path.abspath(filename) if absname in self.recent: self.recent.remove(absname) self.recent.append(absname)
def Load(self, filename): SrcFrame.create(self, filename) if filename in self.recent: self.recent.remove(filename) self.recent.append(filename)
pass
sel = self.book.GetSelection() if sel != -1: if self.book.GetPage(sel).text.CanRedo(): self.book.GetPage(sel).text.Redo() else: print 'No Redo available'
def OnRedo(self, evt): pass
self.clip = self.book.GetPage(sel).text.Copy(True)
self.clip = self.book.GetPage(sel).text.Cut()
def OnCut(self, evt): sel = self.book.GetSelection() if sel != -1: self.clip = self.book.GetPage(sel).text.Copy(True)
self.clip = self.book.GetPage(sel).text.Paste(self.clip)
self.clip = self.book.GetPage(sel).text.Paste()
def OnPaste(self, evt): sel = self.book.GetSelection() if sel != -1: self.clip = self.book.GetPage(sel).text.Paste(self.clip)
self.book.SetSelection(0)
if self.book.GetPageCount() > 0: self.book.SetSelection(0)
def ClosePage(self, index): if self.book.GetPage(index).text.IsModified(): return False else: success = self.book.DeletePage(index) self.book.SetSelection(0) return success
if s.is_dirty():
if self.__stores[s].is_dirty():
def is_dirty(self): for s in self.__stores: if s.is_dirty(): return 1 return 0
self.samenext.is_sensitive(1)
self.sameButton.set_sensitive(1)
def savenext(self, obj): try: self.save(obj) except NotValid: self.error("Data not valid") return UI.save_previous(self, item) self.samenext.is_sensitive(1) self.next(obj) self.saveable(self.stores.is_dirty())
self.next(obj)
self.savenext(obj)
def samenext(self, obj): item = UI.get_previous(self) self.title.entry.set_text(item.get_title(1)) self.__textview_set(self.desc, item.get_description(1)) self.next(obj)