Skip to content

修复power-profiler在新版本pyqtgraph中的bug #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions power_profiler/power_profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,10 +187,10 @@ def stop(self):
self.wait(2)


class MainWindow(pg.QtGui.QMainWindow):
class MainWindow(pg.QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.setWindowIcon(self.style().standardIcon(pg.QtGui.QStyle.SP_MediaPlay))
self.setWindowIcon(self.style().standardIcon(pg.QtWidgets.QStyle.SP_MediaPlay))
self.setWindowTitle('Power Profiler')
self.resize(1200, 720)
self.widget = pg.PlotWidget()
Expand Down Expand Up @@ -290,7 +290,7 @@ def __init__(self):

# 🠈🠉🠊🠋←↑→↓⇇⇈⇉⇊
leftAction = pg.QtGui.QAction('←', self)
# leftAction.setIcon(self.style().standardIcon(pg.QtGui.QStyle.SP_ArrowLeft))
# leftAction.setIcon(self.style().standardIcon(pg.QtWidgets.QStyle.SP_ArrowLeft))
# leftAction.setShortcut(pg.QtGui.QKeySequence(pg.QtCore.Qt.Key_Left))
leftAction.triggered.connect(self.moveLeft)
self.toolbar.addAction(leftAction)
Expand All @@ -300,7 +300,7 @@ def __init__(self):
leftShortcut.activated.connect(self.moveLeft)

rightAction = pg.QtGui.QAction('→', self)
# rightAction.setIcon(self.style().standardIcon(pg.QtGui.QStyle.SP_ArrowRight))
# rightAction.setIcon(self.style().standardIcon(pg.QtWidgets.QStyle.SP_ArrowRight))
rightAction.setShortcut(pg.QtGui.QKeySequence(pg.QtCore.Qt.Key_Right))
rightAction.triggered.connect(self.moveRight)
self.toolbar.addAction(rightAction)
Expand All @@ -310,14 +310,14 @@ def __init__(self):
rightShortcut.activated.connect(self.moveRight)

upAction = pg.QtGui.QAction('↑', self)
# upAction.setIcon(self.style().standardIcon(pg.QtGui.QStyle.SP_ArrowUp))
# upAction.setIcon(self.style().standardIcon(pg.QtWidgets.QStyle.SP_ArrowUp))
upAction.setToolTip('Move Up (↑)')
upAction.setShortcut(pg.QtGui.QKeySequence(pg.QtCore.Qt.Key_Up))
upAction.triggered.connect(self.moveUp)
self.toolbar.addAction(upAction)

downAction = pg.QtGui.QAction('↓', self)
# downAction.setIcon(self.style().standardIcon(pg.QtGui.QStyle.SP_ArrowDown))
# downAction.setIcon(self.style().standardIcon(pg.QtWidgets.QStyle.SP_ArrowDown))
downAction.setToolTip('Move Down (↓)')
downAction.setShortcut(pg.QtGui.QKeySequence(pg.QtCore.Qt.Key_Down))
downAction.triggered.connect(self.moveDown)
Expand Down Expand Up @@ -388,10 +388,10 @@ def closeEvent(self, event):
def start(self, checked):
if checked:
self.probe.start()
self.setWindowIcon(self.style().standardIcon(pg.QtGui.QStyle.SP_MediaPlay))
self.setWindowIcon(self.style().standardIcon(pg.QtWidgets.QStyle.SP_MediaPlay))
else:
self.probe.stop()
self.setWindowIcon(self.style().standardIcon(pg.QtGui.QStyle.SP_MediaStop))
self.setWindowIcon(self.style().standardIcon(pg.QtWidgets.QStyle.SP_MediaStop))

def freeze(self, checked):
self.freezed = checked
Expand Down Expand Up @@ -480,16 +480,16 @@ def pin(self, checked):

def handle_error(self, error):
message = 'No device found' if error == 1 else 'Read failed'
flags = pg.QtGui.QMessageBox.Abort | pg.QtGui.QMessageBox.Retry
result = pg.QtGui.QMessageBox.critical(self, 'ERROR', message, flags)
if result == pg.QtGui.QMessageBox.Retry:
flags = pg.QtWidgets.QMessageBox.Abort | pg.QtWidgets.QMessageBox.Retry
result = pg.QtWidgets.QMessageBox.critical(self, 'ERROR', message, flags)
if result == pg.QtWidgets.QMessageBox.Retry:
self.probe.start()
else:
self.close()


def main():
app = pg.QtGui.QApplication(sys.argv)
app = pg.QtWidgets.QApplication(sys.argv)
window = MainWindow()
window.show()
sys.exit(app.exec_())
Expand Down