def read(self, reader): infoChunks = self.new(ChunkList, reader) properties = None for chunk in infoChunks.items: loader = chunk.loader klass = loader.__class__ if klass is ObjectName: self.name = loader.value elif klass is ObjectHeader: self.handle = loader.handle self.objectType = loader.objectType self.flags = loader.flags inkEffect = loader.inkEffect self.transparent = byteflag.getFlag(inkEffect, 28) self.antialias = byteflag.getFlag(inkEffect, 29) self.inkEffect = inkEffect & 0xFFFF self.inkEffectValue = loader.inkEffectParameter elif klass is ObjectProperties: properties = loader elif klass is ObjectEffects: self.shaderId = loader.id self.items = loader.items else: print chunk.getName(), chunk.id properties.load(self.objectType) self.properties = properties
def loadItems(self, reader): items = self.items while True: newItem = AppMenuItem(reader) items.append(newItem) if byteflag.getFlag(newItem.flags, 4):# if bit 4 is set self.loadItems(reader) # load inner items? if byteflag.getFlag(newItem.flags, 7): break
def loadItems(self, reader): items = self.items while True: newItem = AppMenuItem(reader) items.append(newItem) if byteflag.getFlag(newItem.flags, 4): # if bit 4 is set self.loadItems(reader) # load inner items? if byteflag.getFlag(newItem.flags, 7): break
def write(self, reader): reader.writeShort(self.flags) if not byteflag.getFlag(self.flags, 4): reader.writeShort(self.id) name = self.name if self.mnemonic is not None: name = name.replace(self.mnemonic, '&' + self.mnemonic) reader.writeUnicodeString(name)
def read(self, reader): mnemonic = None flags = reader.readShort() if not byteflag.getFlag(flags, 4): # if bit 4 is not set, read id self.id = reader.readShort() name = reader.readUnicodeString() for index in range(len(name)): if name[index] == '&': mnemonic = name[index+1].upper() name.replace('&', '') self.name = name self.mnemonic = mnemonic self.flags = flags
def read(self, reader): mnemonic = None flags = reader.readShort() if not byteflag.getFlag(flags, 4): # if bit 4 is not set, read id self.id = reader.readShort() name = reader.readUnicodeString() for index in range(len(name)): if name[index] == '&': mnemonic = name[index + 1].upper() name.replace('&', '') self.name = name self.mnemonic = mnemonic self.flags = flags
def read(self, reader): size = reader.readInt(True) self.width = reader.readShort(True) self.height = reader.readShort(True) self.player = reader.readShort(True) self.displayType = reader.readShort(True) self.flags = reader.readShort() self.inverse = byteflag.getFlag(self.flags, 8) if self.displayType == HIDDEN: pass elif self.displayType in (NUMBERS, ANIMATION): self.frames = [reader.readShort() for _ in xrange(reader.readShort(True))] elif self.displayType in (VERTICAL_BAR, HORIZONTAL_BAR): self.shape = self.new(Shape, reader)
def read(self, reader): size = reader.readInt(True) self.width = reader.readShort(True) self.height = reader.readShort(True) self.player = reader.readShort(True) self.displayType = reader.readShort(True) self.flags = reader.readShort() self.inverse = byteflag.getFlag(self.flags, 8) if self.displayType == HIDDEN: pass elif self.displayType in (NUMBERS, ANIMATION): self.frames = [ reader.readShort() for _ in xrange(reader.readShort(True)) ] elif self.displayType in (VERTICAL_BAR, HORIZONTAL_BAR): self.shape = self.new(Shape, reader)