[PyQt] binary file viewer with textEdit (PyQt)
sandokan
xproch13 at seznam.cz
Tue Jun 22 18:59:08 BST 2010
Hi, hope you can help me. I am trying to view whole contents of binary file
(PE file) in Qt TextEdit widget but still running into some problems (speed
is the main problem). I have tried these two ways:
1) converting data using "codecs"
s = codecs.open(self.filename,'rb','mbcs').read()
self.ui.textEditAscii1.setPlainText(s)
- this kind of works but is very slow....it take 10+ seconds to open 2kB
file
- reading is quite fast but displaying using setPlainText is tooo lazy
- I have also tried to append file line by line which was even slower (hower
I could at least process waiting events so the gui was not stuck during the
file load) .....
- also zeros (00h) are not displayed at all (not even represented by a white
space)
2) displaying raw data which did not work at all:
file = open(fd.getOpenFileName(),'rb').read()
self.ui.textEditAscii1.setPlainText(file)
print file
- which prints file quite fine into console but displays only first ASCII
characters (actualy it displays "MZ" only) into textEdit widget
- using "self.ui.textEditAscii1.setPlainText(str(file))" did not change
anything
Do you guys have any hint how to display larger binary files (let say up to
10-20 MBs) in textEdit widget without waiting more than few seconds?
Thanks,
Tom
--
View this message in context: http://old.nabble.com/binary-file-viewer-with-textEdit-%28PyQt%29-tp28962175p28962175.html
Sent from the PyQt mailing list archive at Nabble.com.
More information about the PyQt
mailing list