예제 #1
0
파일: testcase.py 프로젝트: nopper/pygtkhex
    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'
예제 #2
0
    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'
예제 #3
0
파일: find.py 프로젝트: nopper/pygtkhex
# 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()
예제 #4
0
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)
예제 #5
0
파일: high.py 프로젝트: nopper/pygtkhex
#
# 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()
예제 #6
0
파일: getbyte.py 프로젝트: nopper/pygtkhex
# 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)
예제 #7
0
파일: testcase.py 프로젝트: nopper/pygtkhex
 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)
예제 #8
0
 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)