def setUp(self): self.file, self.buff = random_file() self.doc = gtkhex.hex_document_new_from_file(self.file.name) f = open(self.file.name, 'rb') txt = f.read() f.close() if txt != self.buff: raise Exception('File consistency violated') assert self.doc is not None, 'Error in gtkhex.Document'
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import gtk import pango import gtkhex def fuffa(b, (v, i)): print "Deleting", i v.delete_autohighlight(i) print "Deleted?", i box = gtk.VBox() d = gtkhex.hex_document_new_from_file("examples/high.py") v = gtkhex.Hex(d) v.show_offsets(True) v.set_font("Monospace 9") idx = d.find_forward('def', 0) print idx print d.find_forward('def', idx + 3) i = v.insert_autohighlight('def', 'yellow') w = gtk.Window() w.add(box) btn = gtk.Button("Remove") btn.connect('clicked', fuffa, (v, i)) box.pack_start(v) box.pack_start(btn, False, False) w.show_all() gtk.main()
import pango import gtkhex def fuffa(b, (v, i)): print "Deleting", i v.delete_autohighlight(i) print "Deleted?", i f = open("gtkhex.so", "r") fc = f.read() f.close() box = gtk.VBox() d = gtkhex.hex_document_new_from_file("gtkhex.so") v = gtkhex.Hex(d) v.show_offsets(True) v.set_font("Monospace 9") i = v.insert_autohighlight('def', 'yellow') print type(v.get_byte(8)) print type(d.get_byte(8)) s = d.get_data(0, 20) print s, type(s), len(s) print s == fc[0:20] w = gtk.Window() w.add(box) btn = gtk.Button("Remove") btn.connect('clicked', fuffa, (v, i)) box.pack_start(v) box.pack_start(btn, False, False)
# # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import gtk import pango import gtkhex def fuffa(b, (v, i)): print "Deleting", i v.delete_autohighlight(i) print "Deleted?", i box = gtk.VBox() d = gtkhex.hex_document_new_from_file("examples/high.py") v = gtkhex.Hex(d) v.show_offsets(True) v.set_font("Monospace 9") i = v.insert_autohighlight('def', 'yellow') w = gtk.Window() w.add(box) btn = gtk.Button("Remove") btn.connect('clicked', fuffa, (v, i)) box.pack_start(v) box.pack_start(btn, False, False) w.show_all() gtk.main()
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import gtk import pango import gtkhex def fuffa(b, (v, i)): print "Deleting", i v.delete_autohighlight(i) print "Deleted?", i f = open("gtkhex.so", "r") fc = f.read() f.close() box = gtk.VBox() d = gtkhex.hex_document_new_from_file("gtkhex.so") v = gtkhex.Hex(d) v.show_offsets(True) v.set_font("Monospace 9") i = v.insert_autohighlight('def', 'yellow') print type(v.get_byte(8)) print type(d.get_byte(8)) s = d.get_data(0, 20) print s, type(s), len(s) print s == fc[0:20] w = gtk.Window() w.add(box) btn = gtk.Button("Remove") btn.connect('clicked', fuffa, (v, i)) box.pack_start(v) box.pack_start(btn, False, False)
def setUp(self): self.file, self.buff = random_file() self.doc = gtkhex.hex_document_new_from_file(self.file.name) self.wid = gtkhex.Hex(self.doc)