Skip to content

Commit

Permalink
Fix sniffer for Qt5
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricp committed Sep 23, 2018
1 parent 8c1868e commit 4f1dafc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions sniffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
import time
import ecu
from uiutils import *
try:
try:
qt5 = True
import PyQt5.QtGui as gui
import PyQt5.QtCore as core
import PyQt5.QtWidgets as widgets
def utf8(string):
return string
except:
qt5 = False
import PyQt4.QtGui as gui
import PyQt4.QtGui as widgets
import PyQt4.QtCore as core
Expand Down Expand Up @@ -133,13 +135,16 @@ def change_frame(self):
self.table.setHorizontalHeaderLabels([_("Values")])

for i in range(0, len(self.names)):
item = gui.QTableWidgetItem(_("Waiting..."))
item = widgets.QTableWidgetItem(_("Waiting..."))
item.setFlags(item.flags() ^ core.Qt.ItemIsEditable)
self.table.setItem(i, 0, item)

self.table.resizeColumnsToContents()
self.table.resizeRowsToContents()
self.table.horizontalHeader().setResizeMode(0, widgets.QHeaderView.Stretch)
if not qt5:
self.table.horizontalHeader().setResizeMode(0, widgets.QHeaderView.Stretch)
else:
self.table.horizontalHeader().setSectionResizeMode(0, widgets.QHeaderView.Stretch)

def stopthread(self):
if self.snifferthread:
Expand Down

0 comments on commit 4f1dafc

Please sign in to comment.