comparison python/hexviewer.py @ 109:ad14c7c52589

Created qt property viewer
author Windel Bouwman
date Thu, 03 Jan 2013 18:33:29 +0100
parents 6a303f835c6d
children d38729d35c4d
comparison
equal deleted inserted replaced
108:8267ba1dbce3 109:ad14c7c52589
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 from PyQt4.QtCore import * 3 from PyQt4.QtCore import *
4 from PyQt4.QtGui import * 4 from PyQt4.QtGui import *
5 from qtpropertyviewer import QtPropertyViewer
5 import sys 6 import sys
6 import hexfile 7 import hexfile
7 8
8 class BinViewer(QWidget): 9 class BinViewer(QWidget):
9 """ 10 """
75 addMenuEntry("Open", fileMenu, self.openFile, QKeySequence(QKeySequence.Open)) 76 addMenuEntry("Open", fileMenu, self.openFile, QKeySequence(QKeySequence.Open))
76 def openFile(self): 77 def openFile(self):
77 filename = QFileDialog.getOpenFileName(self, "Open hex file...", "*.hex", "Intel hexfiles (*.hex)") 78 filename = QFileDialog.getOpenFileName(self, "Open hex file...", "*.hex", "Intel hexfiles (*.hex)")
78 if filename: 79 if filename:
79 h = hexfile.HexFile(filename) 80 h = hexfile.HexFile(filename)
81 @pyqtProperty(str)
82 def leetValue(self):
83 return '1337'
80 84
81 if __name__ == '__main__': 85 if __name__ == '__main__':
82 app = QApplication(sys.argv) 86 app = QApplication(sys.argv)
83 bv = BinViewMain() 87 bv = BinViewMain()
84 bv.show() 88 bv.show()
85 bv.bv.setHexFile(hexfile.HexFile('audio.hex')) 89 bv.bv.setHexFile(hexfile.HexFile('audio.hex'))
90 qpv = QtPropertyViewer()
91 qpv.propertyModel.InspectedWidget = bv
92 qpv.show()
86 app.exec_() 93 app.exec_()
87 94