rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
for recClass in (MreWeap,MreActi,MreAlch,MreAppa,MreArmo,MreBook,MreClot,MreCont,MreCrea,MreDoor,MreFlor,MreFurn,MreIngr,MreKeym,MreLigh,MreMisc,MreNpc,MreQust,MreSgst,MreSlgm,): | for recClass in (MreWeap,MreActi,MreAlch,MreArmo,MreBook,MreCont,MreCrea,MreDoor,MreFlor,MreFurn,MreIngr,MreKeym,MreLigh,MreMisc,MreNpc,MreQust,MreTerm): | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self... |
self.longTypes = set(('WEAP','ACTI','ALCH','APPA','ARMO','BOOK','CLOT','CONT','CREA','DOOR','FLOR','FURN','INGR','KEYM','LIGH','MISC','NPC_','QUST','SGST','SLGM')) | self.longTypes = set(('WEAP','ACTI','ALCH','ARMO','BOOK','CONT','CREA','DOOR','FLOR','FURN','INGR','KEYM','LIGH','MISC','NPC_','QUST','TERM')) | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self... |
out.seek(-20,1) | out.seek(-recHeaderSize,1) | def copyPrev(size): ins.seek(-size,1) buff = ins.read(size) out.write(buff) |
MelStructA('WLST','Ii', 'Weather', (FID,'weather'), 'chance'), | MelStruct('WLST','IiI', 'Weather', (FID,'weather'), 'chance', (FID,'global')), | # def loadData(self,record,ins,type,size,readId): |
(self.folderCount,self.fileCount,lenFolderNames,lenFileNames,fileFlags,fileFlags2) = ins.unpack('6I',recHeaderSize) | (self.folderCount,self.fileCount,lenFolderNames,lenFileNames,fileFlags) = ins.unpack('5I',20) | def scan(self): """Reports on contents.""" ins = bolt.StructFile(self.path.s,'rb') #--Header ins.seek(4*4) (self.folderCount,self.fileCount,lenFolderNames,lenFileNames,fileFlags,fileFlags2) = ins.unpack('6I',recHeaderSize) #--FolderInfos (Initial) folderInfos = self.folderInfos = [] for index in range(self.folderCount)... |
('Fallout - Sounds.bsa',1138162634), | ('Fallout - Sound.bsa',1138162634), | def resetMTimes(self): """Reset dates of bsa files to 'correct' values.""" #--Fix the data of a few archive files bsaTimes = ( ('Fallout - MenuVoices.bsa',1138575220), ('Fallout - Meshes.bsa',1139433736), ('Fallout - Misc.bsa',1138660560), ('Fallout - Sounds.bsa',1138162634), ('Fallout - Textures.bsa',1138162934), ('Fa... |
if size == 102: | if size == 186: | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that... |
elif size == 86: unpacked = ins.unpack('11f3Bs3Bs3BsB3s6f2s',size,readId) elif size == 62: unpacked = ins.unpack('11f3Bs3Bs3BsB3s2s',size,readId) elif size == 42: unpacked = ins.unpack('10f2s',size,readId) | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that... | |
unpacked = ins.unpack('2s',size,readId) | record.damage = ins.unpack('H',size,readId) return else: raise "Unexpected size encountered for WATR subrecord: %s" % size def dumpData(self,record,out): out.packSub(self.subType,'H',record.damage) class MelWatrDnam(MelStruct): """Handle older trucated DNAM for WATR subrecord.""" def loadData(self,record,ins,type,size... | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that... |
MelString('TNAM','texture'), | MelString('FULL','full'), MelString('NNAM','texture'), | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that... |
MelWatrData('DATA', '11f3Bs3Bs3BsB3s10fH',('windVelocity',0.100), ('windDirection',90.0),('waveAmp',0.5),('waveFreq',1.0),('sunPower',50.0), ('reflectAmt',0.5),('fresnelAmt',0.0250),('xSpeed',0.0),('ySpeed',0.0), ('fogNear',27852.8),('fogFar',163840.0),('shallowRed',0),('shallowGreen',128), ('shallowBlue',128),('unused... | MelFid('XNAM','effect'), MelWatrData('DATA','10f3Bs3Bs3BsI32fH',('windVelocity',0.100),('windDirection',90.0), ('waveAmp',0.5),('waveFreq',1.0),('sunPower',50.0),('reflectAmt',0.5), ('fresnelAmt',0.0250),('unknown1',0.0),('fogNear',27852.8),('fogFar',163840.0), ('shallowRed',0),('shallowGreen',128),('shallowBlue',128),... | def loadData(self,record,ins,type,size,readId): if size == 102: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 86: #--Else 86 byte record (skips dispVelocity, #-- dispFalloff, dispDampner, dispSize, and damage #-- Two junk? bytes are tacked onto the end #-- Hex editing and the CS confirms that... |
(_('F Radroach Meat'), '%s '), (_('F. Radroach Meat'), '%s. '), (_('F - Radroach Meat'),'%s - '), (_('(F) Radroach Meat'),'(%s) '), | (_('F Radroach Meat'), '\x07\x07\x07\x07\x07%s '), (_('F. Radroach Meat'), '\x07\x07\x07\x07\x07%s. '), (_('F - Radroach Meat'),'\x07\x07\x07\x07\x07%s - '), (_('(F) Radroach Meat'),'\x07\x07\x07\x07\x07(%s) '), | def __init__(self): MultiTweakItem.__init__(self,_("Ingestibles"), _('Label ingestibles to sort by type. C: Chems, F: Food, S: Stimpack, A: Alcohol.'), 'ALCH', (_('F Radroach Meat'), '%s '), (_('F. Radroach Meat'), '%s. '), (_('F - Radroach Meat'),'%s - '), (_('(F) Radroach Meat'),'(%s) '), ) |
(_('S BB Gun'), '%s '), (_('S. BB Gun'), '%s. '), (_('S - BB Gun'),'%s - '), (_('(S) BB Gun'),'(%s) '), | (_('S BB Gun'), '\x07\x07%s '), (_('S. BB Gun'), '\x07\x07%s. '), (_('S - BB Gun'),'\x07\x07%s - '), (_('(S) BB Gun'),'\x07\x07(%s) '), | def __init__(self): MultiTweakItem.__init__(self,_("Weapons"), _('Label ammo and weapons to sort by type and damage.'), 'WEAP', (_('S BB Gun'), '%s '), (_('S. BB Gun'), '%s. '), (_('S - BB Gun'),'%s - '), (_('(S) BB Gun'),'(%s) '), ('----','----'), (_('S10 BB Gun'), '%s%02d '), (_('S10. BB Gun'), '%s%02d. '), (_('S10... |
(_('S10 BB Gun'), '%s%02d '), (_('S10. BB Gun'), '%s%02d. '), (_('S10 - BB Gun'),'%s%02d - '), (_('(S10) BB Gun'),'(%s%02d) '), | (_('S10 BB Gun'), '\x07\x07%s%02d '), (_('S10. BB Gun'), '\x07\x07%s%02d. '), (_('S10 - BB Gun'),'\x07\x07%s%02d - '), (_('(S10) BB Gun'),'\x07\x07(%s%02d) '), | def __init__(self): MultiTweakItem.__init__(self,_("Weapons"), _('Label ammo and weapons to sort by type and damage.'), 'WEAP', (_('S BB Gun'), '%s '), (_('S. BB Gun'), '%s. '), (_('S - BB Gun'),'%s - '), (_('(S) BB Gun'),'(%s) '), ('----','----'), (_('S10 BB Gun'), '%s%02d '), (_('S10. BB Gun'), '%s%02d. '), (_('S10... |
for blockType in ('WEAP',): | for blockType in ('AMMO','WEAP'): | def scanModFile(self,modFile,progress,patchFile): """Scans specified mod file to extract info. May add record to patch mod, but won't alter it.""" mapper = modFile.getLongMapper() #for blockType in ('AMMO','WEAP'): for blockType in ('WEAP',): modBlock = getattr(modFile,blockType) patchBlock = getattr(patchFile,blockTyp... |
ammoFormat = '\x07' for record in patchFile.AMMO.records: if not record.full: continue record.full = ammoFormat + record.full keep(record.fid) srcMod = record.fid[0] count[srcMod] = count.get(srcMod,0) + 1 | def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} format = self.choiceValues[self.chosen][0] showStat = '%02d' in format keep = patchFile.getKeeper() codes = getattr(patchFile,'weaponTags','BESMUTL') #ammoFormat = format.replace('%02d','',1) # for record in pa... | |
(_('A Naughty Nightwear'), '%s '), (_('A. Naughty Nightwear'), '%s. '), (_('A - Naughty Nightwear'),'%s - '), (_('(A) Naughty Nightwear'),'(%s) '), | (_('A Naughty Nightwear'), '\x07\x07\x07%s '), (_('A. Naughty Nightwear'), '\x07\x07\x07%s. '), (_('A - Naughty Nightwear'),'\x07\x07\x07%s - '), (_('(A) Naughty Nightwear'),'\x07\x07\x07(%s) '), | def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} format = self.choiceValues[self.chosen][0] showStat = '%02d' in format keep = patchFile.getKeeper() codes = getattr(patchFile,'weaponTags','BESMUTL') #ammoFormat = format.replace('%02d','',1) # for record in pa... |
(_('A01 Naughty Nightwear'), '%s%02d '), (_('A01. Naughty Nightwear'), '%s%02d. '), (_('A01 - Naughty Nightwear'),'%s%02d - '), (_('(A01) Naughty Nightwear'),'(%s%02d) '), | (_('A01 Naughty Nightwear'), '\x07\x07\x07%s%02d '), (_('A01. Naughty Nightwear'), '\x07\x07\x07%s%02d. '), (_('A01 - Naughty Nightwear'),'\x07\x07\x07%s%02d - '), (_('(A01) Naughty Nightwear'),'\x07\x07\x07(%s%02d) '), | def buildPatch(self,log,progress,patchFile): """Edits patch file as desired. Will write to log.""" count = {} format = self.choiceValues[self.chosen][0] showStat = '%02d' in format keep = patchFile.getKeeper() codes = getattr(patchFile,'weaponTags','BESMUTL') #ammoFormat = format.replace('%02d','',1) # for record in pa... |
for recClass in (MreCont,MreDoor,): | for recClass in (MreCont,MreDoor,MreTerm): | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self... |
'DEBR','EXPL','MGEF','SCPT','SPEL','SOUN','NPC_','WATR','TXST','ENCH','FLST','IPDS','STAT','')) | 'DEBR','EXPL','MGEF','SCPT','SPEL','SOUN','NPC_','WATR','TXST','ENCH','FLST','IPDS','STAT','NOTE','QUST')) | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self... |
patchFile.safeSave() | while True: try: patchFile.safeSave() except WindowsError: message = _("The patch cannot be written to (Data\\%s).\nIt might be locking by other processes.\nDo you want to retry or cancel?") % (patchName.s,) if balt.askWarning(self,fill(message,80),_("Couldn't write ")+patchName.s): continue raise break | def Execute(self,event=None): """Do the patch.""" self.EndModal(wx.ID_OK) patchName = self.patchInfo.name progress = balt.Progress(patchName.s,(' '*60+'\n')) try: #--Save configs patchConfigs = {'ImportedMods':set()} for patcher in self.patchers: patcher.saveConfig(patchConfigs) bosh.modInfos.table.setItem(patchName,'b... |
class MelSounSndd(MelStruct): """SNDD is an older version of SNDX. Allow it to read in, but not set defaults or write.""" | class MelSounSndx(MelStruct): """SNDX is a reduced version of SNDD. Allow it to read in, but not set defaults or write.""" | def dumpData(self,record,out): """Conditionally dumps data.""" if record.entryType == 7 and self.subType == 'RDMD': MelOptStruct.dumpData(self,record,out) |
record.staticAtten = 0 record.stopTime = 0 record.startTime = 0 | record.point0 = 0 record.point1 = 0 record.point2 = 0 record.point3 = 0 record.point4 = 0 record.reverb = 0 record.priority = 0 record.unknown = "\0"*8 | def loadData(self,record,ins,type,size,readId): MelStruct.loadData(self,record,ins,type,size,readId) record.staticAtten = 0 record.stopTime = 0 record.startTime = 0 |
MelSounSndd('SNDD','=2BbsH2s','minDistance', 'maxDistance', 'freqAdjustment', ('unused1',null1), (_flags,'flags'), ('unused2',null2)), MelOptStruct('SNDX','=2BbsH2sh2B',('minDistance',None), ('maxDistance',None), ('freqAdjustment',None), ('unused1',null1), (_flags,'flags',None), ('unused2',null2), ('staticAtten',None),... | MelOptStruct('SNDD','=2BbsIh2B6HI8s',('minDistance',None), ('maxDistance',None), ('freqAdjustment',None), ('unused1',null1), (_flags,'flags',None),('staticAtten',None),('stopTime',None),('startTime',None), ('point0',0),('point1',0),('point2',0),('point3',0),('point4',0),('reverb',0),('priority',0),'unknown'), MelSounSn... | def dumpData(self,record,out): return |
MelFid('SNAM','sound'), | MelGroup('destructable', MelBase('DEST','header'), MelStruct('DEST','IhH','health','count','flags'), MelGroups('stages', MelStruct('DSTD','=4B4I','health','index','damageStage','flags', 'selfDamagePerSecond',(FID,'explosion',None),(FID,'debris',None),'debrisCount'), MelString('DMDL','model'), MelBa... | def getEffectsSummary(self,mgef_school=None,mgef_name=None): """Return a text description of magic effects.""" mgef_school = mgef_school or bush.mgef_school mgef_name = mgef_name or bush.mgef_name buff = cStringIO.StringIO() avEffects = bush.actorValueEffects aValues = bush.actorValues buffWrite = buff.write if self.ef... |
MelStructs('DSTD','=4B4I','stages','health','index','damageStage', 'flags','selfDamagePerSecond',(FID,'explosion',None), (FID,'debris',None),'debrisCount'), MelBase('DSTF','footer'), | MelStruct('DEST','IhH','health','count','flags'), MelGroups('stages', MelStruct('DSTD','=4B4I','health','index','damageStage','flags', 'selfDamagePerSecond',(FID,'explosion',None),(FID,'debris',None),'debrisCount'), MelString('DMDL','model'), MelBase('DMDT','_dmdt'), MelBase('DSTF','footer'), ), | def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120... |
(4,'ingredients'), | (4,'foods'), (5,'chems'), (6,'stimpacks'), | def dumpData(self,record,out): if not record.flags.isInterior: MelOptStruct.dumpData(self,record,out) |
(8,'apparatus'), | def dumpData(self,record,out): if not record.flags.isInterior: MelOptStruct.dumpData(self,record,out) | |
(11,'spells'), (12,'magicItems'), | def dumpData(self,record,out): if not record.flags.isInterior: MelOptStruct.dumpData(self,record,out) | |
def loadData(self,record,ins,type,size,readId): if size == 52: MelStruct.loadData(self,record,ins,type,size,readId) return unpacked = ins.unpack('2iI7i2I',size,readId) unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,action in zip(self.attrs,unpacked,self.actions): if callable(actio... | def loadData(self,record,ins,type,size,readId): if size == 52: MelStruct.loadData(self,record,ins,type,size,readId) return #--Else 42 byte record (skips trainSkill, trainLevel,unused1... unpacked = ins.unpack('2iI7i2I',size,readId) unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,act... | |
MelClasData('DATA','2iI7i2IbB2s','primary1','primary2','specialization','major1','major2','major3','major4','major5','major6','major7',(_flags,'flags',0L),(aiService,'services',0L),('trainSkill',0),('trainLevel',0),('unused1',null2)), | MelClasData('DATA','4I2IbB2s','tagSkill1','tagSkill2','tagSkill3','tagSkill4',(_flags,'flags',0L),(aiService,'services',0L),('trainSkill',0),('trainLevel',0),('unused1',null2)), | def loadData(self,record,ins,type,size,readId): if size == 52: MelStruct.loadData(self,record,ins,type,size,readId) return #--Else 42 byte record (skips trainSkill, trainLevel,unused1... unpacked = ins.unpack('2iI7i2I',size,readId) unpacked += self.defaults[len(unpacked):] setter = record.__setattr__ for attr,value,act... |
out.write(rowFormat % (type,longid[0].s,longid[1],eid,name,sname)) | out.write(rowFormat % (type,longid[0].s,longid[1],eid,name.replace('"', '""'),sname.replace('"', '""'))) | def writeToText(self,textPath): """Exports type_id_name to specified text file.""" textPath = GPath(textPath) type_id_name = self.type_id_name type_id_sname = self.type_id_sname out = textPath.open('w') for type in sorted(type_id_name): if type in self.hasShortNameTypes: headFormat = '"%s","%s","%s","%s","%s","%s"\n' r... |
out.write(rowFormat % (type,longid[0].s,longid[1],eid,name)) | out.write(rowFormat % (type,longid[0].s,longid[1],eid,name.replace('"', '""'))) | def writeToText(self,textPath): """Exports type_id_name to specified text file.""" textPath = GPath(textPath) type_id_name = self.type_id_name type_id_sname = self.type_id_sname out = textPath.open('w') for type in sorted(type_id_name): if type in self.hasShortNameTypes: headFormat = '"%s","%s","%s","%s","%s","%s"\n' r... |
MelStructs('CNTO','Ii','items',(FID,'item'),'count'), | MelGroups('items', MelStruct('CNTO','Ii',(FID,'item',None),('count',1)), MelOptStruct('COED','IIf',(FID,'owner',None),(FID,'glob',None),('condition',1.0)), ), MelGroup('destructable', MelBase('DEST','header'), MelStruct('DEST','IhH','health','count','flags'), MelGroups('stages', MelStruct('DSTD','=4B4I','health','index... | # def loadData(self,record,ins,type,size,readId): |
MelString('DNAM','upperLayer'), | MelString('ANAM','layer2'), MelString('BNAM','layer3'), | def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120... |
MelStructA('NAM0','3Bs3Bs3Bs3Bs','colors','riseRed','riseGreen','riseBlue',('unused1',null1), | MelBase('LNAM','unknown1'), MelStruct('ONAM','4B','cloudSpeed0','cloudSpeed1','cloudSpeed3','cloudSpeed4'), MelBase('PNAM','_pnam'), MelStructA('NAM0','3Bs3Bs3Bs3Bs','colors', 'riseRed','riseGreen','riseBlue',('unused1',null1), | def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120... |
MelStruct('FNAM','4f','fogDayNear','fogDayFar','fogNightNear','fogNightFar'), MelStruct('HNAM','14f', 'eyeAdaptSpeed', 'blurRadius', 'blurPasses', 'emissiveMult', 'targetLum', 'upperLumClamp', 'brightScale', 'brightClamp', 'lumRampNoTex', 'lumRampMin', 'lumRampMax', 'sunlightDimmer', 'grassDimmer', 'treeDimmer'), | MelStruct('FNAM','6f','fogDayNear','fogDayFar','fogNightNear','fogNightFar','fogDayPower','fogNightPower'), MelBase('INAM','_inam'), | def loadData(self,record,ins,type,size,readId): if size == 136: MelStruct.loadData(self,record,ins,type,size,readId) return elif size == 124: #--Else 124 byte record (skips sightUsage, semiAutomaticFireDelayMin and semiAutomaticFireDelayMax... unpacked = ins.unpack('Iff4B5fI4BffII11fIIffI',size,readId) elif size == 120... |
recAttrs_class[recClass] = ('model','bodyParts','nift_p','bloodSprayPath','bloodDecalPath') | recAttrs_class[recClass] = ('model','bodyParts','nift_p','bodyPartData','impactDataset') | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self... |
recAttrs_class[recClass] = ('iconPath','model','effectShader','enchantEffect','light') | recAttrs_class[recClass] = ('iconPath','model','effectShader','objectDisplayShader','light') | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self... |
recAttrs_class[recClass] = ('imagespaceModifier','light','impactdataset','placedImpactObject') | recAttrs_class[recClass] = ('imageSpaceModifier','light','impactDataset','placedImpactObject') | def initPatchFile(self,patchFile,loadMods): """Prepare to handle specified patch mod. All functions are called after this.""" Patcher.initPatchFile(self,patchFile,loadMods) self.id_data = {} #--Names keyed by long fid. self.srcClasses = set() #--Record classes actually provided by src mods/files. self.sourceMods = self... |
rgb_str = 'rgb('+str(int(color_intensity))+',0,0)' return ImageColor.getrgb(rgb_str) | color_rgb = color_table[int(log_rebase)] return ImageColor.getrgb(color_table[int(log_rebase)]) | def getColor(hit_c): global hit_count_max global hit_count_min global hit_count_logmin global hit_count_logrange log_v = math.floor(math.log(hit_c)/math.log(2)) log_rebase = log_v - hit_count_logmin color_intensity=log_rebase*(255 / hit_count_logrange) rgb_str = 'rgb('+str(int(color_intensity))+',0,0)' return ImageCol... |
for y in range(10): | for y in range(BOTTOM_LEGEND_PX): | def getColor(hit_c): global hit_count_max global hit_count_min global hit_count_logmin global hit_count_logrange log_v = math.floor(math.log(hit_c)/math.log(2)) log_rebase = log_v - hit_count_logmin color_intensity=log_rebase*(255 / hit_count_logrange) rgb_str = 'rgb('+str(int(color_intensity))+',0,0)' return ImageCol... |
print 'NEW POST: %s: %s (%s)' % (entry.title, entry.link.replace("http://www.streetgeek.com.au/portal/modules.php?name=Forums&file=viewtopic&p=", "http://fj.streetgeek.com.au/"), feed) irc.action(CHANNEL, 'found a new post on %s: %s: %s' % (str(feed), str(entry.title.strip()), str(entry.link.strip().replace("http://www... | link = str(entry.link.replace("http://www.streetgeek.com.au/portal/modules.php?name=Forums&file=viewtopic&p=", "http://fj.streetgeek.com.au/")) print 'NEW POST: %s: %s (%s)' % (entry.title, link, feed) irc.action(CHANNEL, 'found a new post on %s: %s: %s' % (str(feed), str(entry.title), link)) | def announce_post(irc, feed, entry): global CHANNEL print 'NEW POST: %s: %s (%s)' % (entry.title, entry.link.replace("http://www.streetgeek.com.au/portal/modules.php?name=Forums&file=viewtopic&p=", "http://fj.streetgeek.com.au/"), feed) irc.action(CHANNEL, 'found a new post on %s: %s: %s' % (str(feed), str(entry.title.... |
message_buffer.append([event.nick, msg[:200], True]) | message_buffer.append([event.nick, event.text[:200], True]) | def handle_ctcp(event, match): global message_buffer, MAX_MESSAGES, CHANNEL if event.channel == CHANNEL: if event.args[0] == "ACTION": message_buffer.append([event.nick, msg[:200], True]) message_buffer = message_buffer[-MAX_MESSAGES:] return |
self.channels.remove(channel) | del self.channels[channel.name] | def cleanup(self): # do some cleanup tasks to free some memory # hopefully python's resource counter will properly detect the object as something # that can be disposed of to_delete = [] for channel in self.channels.values(): if len(channel.members) == 0: to_delete.append(channel) for channel in to_delete: self.channe... |
self.bind(self._welcome_join, RPL_WELCOME) | def start_channels(self, chans): self._startChannels = chans self.bind(self._welcome_join, RPL_WELCOME) | |
e = re.compile(parts[1], re.I) | e = re.compile(parts[1]) | def handle_pubmsg(connection, event): global message_buffer, MAX_MESSAGES, last_message nick = event.source().partition("!")[0] msg = event.arguments()[0] if msg.startswith('s/'): # handle regex parts = msg.split('/') # now flood protect! now = datetime.now() delta = now - last_message last_message = now if delta < ... |
self.textures.append(tex.name) | print(tex.name) texObj = texList.getTexture(tex.name) if(texObj != None): print(texObj.name + " " + texObj.fileName) self.textures.append(texObj.fileName) | def populate(self, obj, texList): self.name = obj.name.replace(".", "_") |
f.write("<MATERIAL NUMMAPS\"" + str(len(self.textures)) + "\">\n") | f.write("<MATERIAL NUMMAPS=\"" + str(len(self.textures)) + "\">\n") | def save(self, directory): |
self.textures = cal3dTextures() | def getModel(self): | |
return min(voltage_color_list, key=(lambda a: xyYnorm(a[1]))) | return min(voltage_color_list, key=(lambda a: xyYnorm(xyYdiff(a[1], target_color)))) | def findBestColor(measured_color_red, measured_color_green, measured_color_blue, target_color): """ findBestColor returns a color, which is nearest targetColor. * measured_color -- contains the measured colors for each channel * target_color """ voltage_color_list = [] voltage_color_list.extend( measured_color_red ) vo... |
conf.registerPlugin('PackageInfo', True) | PackageInfo = conf.registerPlugin('PackageInfo', True) | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
""" | """ % (release, release) | def makeSource(release): return """deb http://archive.ubuntu.com/ubuntu/ %s main restricted universe multiverse |
aptdir = something("Which directory should be used for the apt cache when looking up packages?", default=supybot.directories.data.dirize('aptdir')) | aptdir = something("Which directory should be used for the apt cache when looking up packages?", default=conf.supybot.directories.data.dirize('aptdir')) | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
while aptdir.beginswith('/var'): | while aptdir.startswith('/var'): | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
for release in default_dist: | try: os.makedirs(aptdir) except OSError: pass for release in default_dists: | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
fd = fileutils.open(filename) | fd = open(filename, 'wb') | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
release = "%s-%s" % sub filename = os.path.join(aptdir, "%s.list" % release) | sub_release = "%s-%s" % (release, sub) filename = os.path.join(aptdir, "%s.list" % sub_release) | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
fd.write(makeSource(release)) | fd.write(makeSource(sub_release)) | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
(e, o) = commands.getstatusoutput(update_apt) if e != 0: | if commands.getstatus(update_apt) != 0: | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
(e, o) = commands.statusoutput('which apt-file') if e != 0: | if commands.getstatusoutput('which apt-file') != 0: | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
(e, o) = commands.getstatusoutput(update_apt_file) if e != 0: | if commands.getstatusoutput(update_apt_file) != 0: | def anything(prompt, default=None): """Because supybot is pure fail""" from supybot.questions import expect return expect(prompt, [], default=default) |
ztc.installPackage(zopyx.imgmap) | ztc.installPackage(zopyx.tinymceplugins.imgmap) | def setUp(cls): fiveconfigure.debug_mode = True ztc.installPackage(zopyx.imgmap) fiveconfigure.debug_mode = False |
for anchor in soup.find('a'): | for anchor in soup.findAll('a'): | def __call__(self): |
result.append(dict(name=name, text=text)) return | result.append(dict(name=name, text=name)) return demjson.encode(result) | def __call__(self): |
def create_button(self, button_name): button = QPushButton(button_name) button.setFlat(True) button.setCheckable(True) button.clicked.connect(self.clickedButton) return button def update_label_buttons(self): label_vlayout = self.create_choice_list("Labels") self.label_buttongroup = QButtonGroup() for label_name in sel... | def __init__(self, parent=None): QWidget.__init__(self, parent) | |
self.hlayout.addLayout(label_vlayout) | self.hlayout.setAlignment(Qt.AlignLeft) self.hlayout.addWidget(self.label_button_list) | def update_label_buttons(self): label_vlayout = self.create_choice_list("Labels") self.label_buttongroup = QButtonGroup() for label_name in self.label_names: button = QPushButton(label_name) button.setFlat(True) button.setCheckable(True) button.clicked.connect(self.clickedLabelButton) label_vlayout.addWidget(button) se... |
print self.hlayout.parent() | def init_button_lists(self): for label_name in self.label_names: button = self.label_button_list.add_button(label_name) button.clicked.connect(self.clickedLabelButton) | def update_label_buttons(self): label_vlayout = self.create_choice_list("Labels") self.label_buttongroup = QButtonGroup() for label_name in self.label_names: button = QPushButton(label_name) button.setFlat(True) button.setCheckable(True) button.clicked.connect(self.clickedLabelButton) label_vlayout.addWidget(button) se... |
def update_buttons(self): layout = self.hlayout.takeAt(1) for button in self.property_buttons: button.hide() del button | for key, property_values in self.properties.iteritems(): if key in ["type", "class"]: continue button_list = ButtonListWidget(key) for value in property_values: button_list.add_button(value) button_list.hide() print key self.property_button_lists[key] = button_list self.hlayout.addWidget(button_list) | def update_buttons(self): layout = self.hlayout.takeAt(1) for button in self.property_buttons: button.hide() del button |
dynamic_hlayout = QHBoxLayout() self.property_buttons = [] if self.last_checked_label != None: for key in self.label_properties[self.last_checked_label].keys(): if key in ["type", "class"]: continue vlayout = self.create_choice_list(key) buttongroup = QButtonGroup() for value in self.properties[key]: button = self.cr... | def show_only_label_properties(self, label_name): print "sdf", self.property_button_lists for name, button_list in self.property_button_lists.iteritems(): if name in self.label_properties[label_name].keys(): button_list.show() else: button_list.hide() | def update_buttons(self): layout = self.hlayout.takeAt(1) for button in self.property_buttons: button.hide() del button |
return self.label_buttongroup.checkedButton() def create_choice_list(self, list_name, elements = []): vlayout = QVBoxLayout() vlayout.setSpacing(0) vlayout.addWidget(QLabel("<center><b>" + list_name + "</b></center>")) if len(elements) > 0: buttongroup = QButtonGroup() for element in elements: self.create_button(ele... | return self.label_button_list.get_checked_button() | def get_checked_label_button(self): return self.label_buttongroup.checkedButton() |
print label_name, self.last_checked_label | print "ButtonArea:", label_name, self.last_checked_label | def clickedLabelButton(self): button = self.get_checked_label_button() label_name = str(button.text()) if label_name != self.last_checked_label: print label_name, self.last_checked_label self.last_checked_label = label_name self.update_buttons() |
self.update_buttons() | self.show_only_label_properties(label_name) | def clickedLabelButton(self): button = self.get_checked_label_button() label_name = str(button.text()) if label_name != self.last_checked_label: print label_name, self.last_checked_label self.last_checked_label = label_name self.update_buttons() |
self.update_label_buttons() self.update_buttons() | self.init_button_lists() | def load(self, config_filepath): execfile(config_filepath) #if self.get_checked_label_button() == None: # if len(self.label_buttongroup.buttons()) != 0: # self.label_buttongroup.buttons()[0].setChecked(True) # #self.last_checked_label = str(self.get_checked_label_button().text()) self.update_label_buttons() s... |
print change | def itemChange(self, change, value): print change if change == QGraphicsItem.ItemScenePositionHasChanged: self.updateModel() return AnnotationGraphicsItem.itemChange(self, change, value) | |
print "updateModel (point)", self.data_ | def updateModel(self): if not self._delayedDirty(): self.data_['x'] = self.scenePos().x() self.data_['y'] = self.scenePos().y() print "updateModel (point)", self.data_ self.index().model().setData(self.index(), QVariant(self.data_), DataRole) | |
def __init__(self, scene, model=None): | def __init__(self, scene, mode=None): | def __init__(self, scene, model=None): self.scene_ = scene self.mode_ = None |
self.mode_ = None | self.mode_ = mode | def __init__(self, scene, model=None): self.scene_ = scene self.mode_ = None |
item = QGraphicsEllipseItem(QRectF(pos.x()-1, pos.y()-1, 2, 2)) self.scene().addItem(item) | ann = {'type': 'point', 'x': event.pos().x(), 'y': event.pos().y()} index.model().addAnnotation(index, ann) | def mousePressEvent(self, event, index): pos = event.scenePos() # TODO create it in the model instead item = QGraphicsEllipseItem(QRectF(pos.x()-1, pos.y()-1, 2, 2)) self.scene().addItem(item) |
def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) | def __init__(self, scene, mode=None): ItemInserter.__init__(self, scene, mode) | def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) self.current_item_ = None self.init_pos_ = None |
pos = event.scenePos() rect = QRectF(self.init_pos_.x(), self.init_pos_.y(), pos.x() - self.init_pos_.x(), pos.y() - self.init_pos_.y()) self.current_item_.setRect(rect.normalized()) | rect = QRectF(self.init_pos_, event.scenePos()).normalized() self.current_item_.setRect(rect) | def mouseMoveEvent(self, event, index): if self.current_item_ is not None: assert self.init_pos_ is not None pos = event.scenePos() rect = QRectF(self.init_pos_.x(), self.init_pos_.y(), pos.x() - self.init_pos_.x(), pos.y() - self.init_pos_.y()) self.current_item_.setRect(rect.normalized()) |
print "added rect:", self.current_item_ | def mouseReleaseEvent(self, event, index): if self.current_item_ is not None: if self.current_item_.rect().width() > 1 and \ self.current_item_.rect().height() > 1: # TODO commit to the model print "added rect:", self.current_item_ rect = self.current_item_.rect() ann = {'type': 'rect', 'x': rect.x(), 'y': rect.y(), 'w... | |
def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) | def __init__(self, scene, mode=None): ItemInserter.__init__(self, scene, mode) | def __init__(self, scene, model=None): ItemInserter.__init__(self, scene, model) self.current_item_ = None |
self.addItemInserter('point', PointItemInserter(self)) self.addItemInserter('rect', RectItemInserter(self)) self.addItemInserter('poly', PolygonItemInserter(self)) self.addItemInserter('polygon', PolygonItemInserter(self)) self.setMode({'type': 'rect'}) | self.addItemInserter('point', PointItemInserter(self)) self.addItemInserter('rect', RectItemInserter(self)) self.addItemInserter('ratiorect', FixedRatioRectItemInserter(self)) self.addItemInserter('poly', PolygonItemInserter(self)) self.addItemInserter('polygon', PolygonItemInserter(self)) self.se... | def __init__(self, parent=None): super(AnnotationScene, self).__init__(parent) |
if event.key() == ord('A'): index = self.currentIndex() if not index.isValid(): return self.model().addAnnotation(index, {'type':'beer', 'alc': '5.1', 'name': 'rothaus'}) if event.key() == ord('D'): index = self.currentIndex() if not index.isValid(): return self.model().removeAnnotation(index) | def keyPressEvent(self, event): ## handle deletions of items if event.key() == Qt.Key_Delete: index = self.currentIndex() if not index.isValid(): return parent = self.model().parent(index) self.model().removeRow(index.row(), parent) | |
self.setCurrentFileIndex(next_index) | self.setCurrentIndex(next_index) | def gotoNext(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentFileIndex(next_index) |
self.setCurrentFileIndex(next_index) | self.setCurrentIndex(next_index) | def gotoPrevious(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentFileIndex(next_index) |
next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentIndex(next_index) | prev_index = self.model_.getPreviousIndex(self.current_index_) self.setCurrentIndex(prev_index) | def gotoPrevious(self): # TODO move this to the scene if self.model_ is not None and self.current_index_ is not None: next_index = self.model_.getNextIndex(self.current_index_) self.setCurrentIndex(next_index) |
self.setFrameStyle(QFrame.NoFrame) | self.setStyleSheet("QFrame { border: 3px solid black }"); | def __init__(self, parent=None): QGraphicsView.__init__(self, parent) self.setRenderHint(QPainter.Antialiasing) self.setRenderHint(QPainter.TextAntialiasing) self.setFrameStyle(QFrame.NoFrame) |
self.setFrameStyle(QFrame.Panel) | self.setStyleSheet("QFrame { border: 3px solid red }"); | def activate(self): if not self.active_: self.active_ = True self.setFocus(Qt.OtherFocusReason) self.setFrameStyle(QFrame.Panel) self.update() |
self.setFrameStyle(QFrame.NoFrame) | self.setStyleSheet("QFrame { border: 3px solid black }"); | def deactivate(self): if self.active_: self.active_ = False self.clearFocus() self.setFrameStyle(QFrame.NoFrame) self.update() |
self.update() self.updateGeometry() | def update_buttons(self): layout = self.hlayout.takeAt(1) | |
def get_bands(bitwised_band): """Returns all the bitwised bands in ``bitwised_band``""" return [band for band in MM_NETWORK_BANDS if band & bitwised_band] | def set_bands(self, bands, current): | |
def set_prefs(self, prefs, current): | def set_prefs(self, modes, current): | def set_prefs(self, prefs, current): model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) |
for value in prefs: | for value in [MM_NETWORK_MODE_ANY] + get_network_modes(modes): | def set_prefs(self, prefs, current): model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT) |
if self.username is not None: | if self.username: | def save(self): props = { 'connection': { 'name': 'connection', 'id': self.name, 'type': 'gsm', 'uuid': self.uuid, 'autoconnect': self.autoconnect}, 'gsm': { 'name': 'gsm', 'number': '*99#', 'apn': self.apn.strip()}, 'ppp': { 'name': 'ppp', 'refuse-pap': True, 'refuse-chap': True, 'refuse-eap': True, 'refuse-mschap': T... |
if True: height = 420 GLADE_FILE = os.path.join(GLADE_DIR, "VMC-reduced.glade") else: height = WIN_HEIGHT GLADE_FILE = os.path.join(GLADE_DIR, "VMC.glade") | height = 420 GLADE_FILE = os.path.join(GLADE_DIR, "bcm.glade") | def __init__(self, ctrl): |
set_voucher_entry_view(ussd_voucher_update_response) | self.view.set_voucher_entry_view(ussd_voucher_update_response) | def check_voucher_update_response(self, ussd_voucher_update_response): device = self.model.get_device() # ok my job is to work out what happened after a credit voucher update message was sent. # we can have three possibilities, it was succesfull, the voucher code was wrong, or you tried with # an illegal number too ma... |
logger.info("INFO profile.py: model - save properties dictionary is: %s" %props ) | def save(self): | |
gprs_items = [item for item in self._get_month(offset) if item.is_gprs] | gprs_items = [item for item in self._get_month(offset) if item.is_gprs()] | def get_transferred_gprs(self, offset): # filter out all the items that respond True to "is_gprs" gprs_items = [item for item in self._get_month(offset) if item.is_gprs] # get a list with the total transferred for every item and sum them up result = sum((item.total() for item in gprs_items)) if offset == 0: result += s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.