Example #1
0
def drawFile(fpath):
    global width, height, widthBar, fsize, img, draw

    parsed = kshelp.parseFpath(fpath)

    depth = kshelp.getDepth(parsed)
    width = widthBar * depth
    img = Image.new('RGB', (width, height))
    draw = ImageDraw.Draw(img)
    fsize = os.path.getsize(fpath)
    draw.rectangle([(0, 0), (width, height)], fill=(0xC0, 0xC0, 0xC0))
    #draw.text((5,height-16), fpath, fill=(0,0,0))

    coverage(parsed, 0, True)

    img.save("/tmp/tmp.png")
    os.system('open /tmp/tmp.png')
Example #2
0
#!/usr/bin/env python

# parse the file, drop into IPYTHON

import sys
assert sys.version_info[0] == 3
import types

import kaitaistruct
import kshelp

import IPython

#------------------------------------------------------------------------------
# main
#------------------------------------------------------------------------------

if __name__ == '__main__':
	assert len(sys.argv) == 2

	fpath = sys.argv[1]

	parsed = kshelp.parseFpath(fpath)
	kshelp.exercise(parsed)
	#IPython.embed()
	IPython.embed(using=False)

Example #3
0
                             "modified",
                             callback_tree_modified,
                             weak_args=[self.listbox, self.footer])

    def main(self):
        """Run the program."""

        self.loop = urwid.MainLoop(self.view,
                                   self.palette,
                                   unhandled_input=self.unhandled_input)
        self.loop.run()

    def unhandled_input(self, k):
        if k in ('q', 'Q'):
            raise urwid.ExitMainLoop()


#------------------------------------------------------------------------------
# main
#------------------------------------------------------------------------------

if __name__ == '__main__':
    assert len(sys.argv) == 3
    (filterLevel, fpath) = (sys.argv[1], sys.argv[2])

    filterLevel = int(filterLevel)
    ksobj = kshelp.parseFpath(fpath)
    ktb = KaitaiTreeBrowser(ksobj)
    ktb.main()
    #dumpDict(treeDict, 0)