Skip to content

Instantly share code, notes, and snippets.

@olofk
Created May 30, 2019 15:12
Show Gist options
  • Select an option

  • Save olofk/48e2d511290113c5075270ba48a71eb6 to your computer and use it in GitHub Desktop.

Select an option

Save olofk/48e2d511290113c5075270ba48a71eb6 to your computer and use it in GitHub Desktop.
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
import sys
win = Gtk.Window()
win.connect("destroy", Gtk.main_quit)
store = Gtk.ListStore(int, str, bool)
with open(sys.argv[1]) as f:
lastaddr = 0
for l in f.readlines():
if l == '\n':
continue
addr = 0
isaddr = False
parts = l[0:-1].split(':')
try:
addr = int(parts[0],16)
insn = parts[1].strip()
isaddr = True
except ValueError:
continue
if isaddr:
if addr < lastaddr:
break
lastaddr = addr
print('{:08x} {}'.format(addr, insn))
treeiter = store.append([addr, insn, True])
tree = Gtk.TreeView(store)
renderer = Gtk.CellRendererText()
column = Gtk.TreeViewColumn("Title", renderer, text=0)
tree.append_column(column)
column = Gtk.TreeViewColumn("Title", renderer, text=1)
tree.append_column(column)
win.add(tree)
win.show_all()
Gtk.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment