From 3ab35f7f8dad3eb502bc2d1d5c62410e2edab7e9 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 15 Feb 2016 00:05:30 +0100 Subject: [PATCH] gui: get rid of pyqtgraph.LayoutWidget --- artiq/frontend/artiq_gui.py | 1 + artiq/gui/datasets.py | 2 +- artiq/gui/entries.py | 3 +-- artiq/gui/experiments.py | 5 ++--- artiq/gui/explorer.py | 2 +- artiq/gui/log.py | 4 ++-- artiq/gui/schedule.py | 1 - artiq/gui/shortcuts.py | 3 ++- artiq/gui/tools.py | 10 ++++++++++ 9 files changed, 20 insertions(+), 11 deletions(-) diff --git a/artiq/frontend/artiq_gui.py b/artiq/frontend/artiq_gui.py index f2dcaaf86..0789d78c1 100755 --- a/artiq/frontend/artiq_gui.py +++ b/artiq/frontend/artiq_gui.py @@ -7,6 +7,7 @@ import os import PyQt5 from quamash import QEventLoop, QtGui, QtCore, QtWidgets +import pyqtgraph from artiq import __artiq_dir__ as artiq_dir from artiq.tools import * diff --git a/artiq/gui/datasets.py b/artiq/gui/datasets.py index ac0c7d430..e9a49548e 100644 --- a/artiq/gui/datasets.py +++ b/artiq/gui/datasets.py @@ -4,9 +4,9 @@ from functools import partial import logging from quamash import QtGui, QtCore, QtWidgets -from pyqtgraph import LayoutWidget from artiq.tools import short_format +from artiq.gui.tools import LayoutWidget from artiq.gui.models import DictSyncTreeSepModel diff --git a/artiq/gui/entries.py b/artiq/gui/entries.py index f6b423404..6680d8d2d 100644 --- a/artiq/gui/entries.py +++ b/artiq/gui/entries.py @@ -2,9 +2,8 @@ import logging from collections import OrderedDict from quamash import QtGui, QtCore -from pyqtgraph import LayoutWidget -from artiq.gui.tools import disable_scroll_wheel +from artiq.gui.tools import LayoutWidget, disable_scroll_wheel logger = logging.getLogger(__name__) diff --git a/artiq/gui/experiments.py b/artiq/gui/experiments.py index 5536c30d3..f7db0bfbf 100644 --- a/artiq/gui/experiments.py +++ b/artiq/gui/experiments.py @@ -5,9 +5,8 @@ from collections import OrderedDict from quamash import QtGui, QtCore, QtWidgets -from pyqtgraph import LayoutWidget - -from artiq.gui.tools import log_level_to_name, QDockWidgetCloseDetect +from artiq.gui.tools import (LayoutWidget, log_level_to_name, + QDockWidgetCloseDetect) from artiq.gui.entries import argty_to_entry diff --git a/artiq/gui/explorer.py b/artiq/gui/explorer.py index b391b7f0e..249aa4272 100644 --- a/artiq/gui/explorer.py +++ b/artiq/gui/explorer.py @@ -3,8 +3,8 @@ import logging from functools import partial from quamash import QtGui, QtCore, QtWidgets -from pyqtgraph import LayoutWidget +from artiq.gui.tools import LayoutWidget from artiq.gui.models import DictSyncTreeSepModel diff --git a/artiq/gui/log.py b/artiq/gui/log.py index 005fe626d..72c702a25 100644 --- a/artiq/gui/log.py +++ b/artiq/gui/log.py @@ -5,9 +5,9 @@ import re from functools import partial from quamash import QtGui, QtCore, QtWidgets -from pyqtgraph import LayoutWidget -from artiq.gui.tools import log_level_to_name, QDockWidgetCloseDetect +from artiq.gui.tools import (LayoutWidget, log_level_to_name, + QDockWidgetCloseDetect) def _make_wrappable(row, width=30): diff --git a/artiq/gui/schedule.py b/artiq/gui/schedule.py index f43baf5ae..2f31a8dc6 100644 --- a/artiq/gui/schedule.py +++ b/artiq/gui/schedule.py @@ -3,7 +3,6 @@ import time from functools import partial from quamash import QtGui, QtCore, QtWidgets -from pyqtgraph import dockarea from artiq.gui.models import DictSyncModel from artiq.tools import elide diff --git a/artiq/gui/shortcuts.py b/artiq/gui/shortcuts.py index 9bc90c365..04284366f 100644 --- a/artiq/gui/shortcuts.py +++ b/artiq/gui/shortcuts.py @@ -2,7 +2,8 @@ import logging from functools import partial from quamash import QtGui, QtCore, QtWidgets -from pyqtgraph import LayoutWidget + +from artiq.gui.tools import LayoutWidget logger = logging.getLogger(__name__) diff --git a/artiq/gui/tools.py b/artiq/gui/tools.py index 414cf0ef8..f110264e5 100644 --- a/artiq/gui/tools.py +++ b/artiq/gui/tools.py @@ -35,3 +35,13 @@ class QDockWidgetCloseDetect(QtWidgets.QDockWidget): def closeEvent(self, event): self.sigClosed.emit() QtWidgets.QDockWidget.closeEvent(self, event) + + +class LayoutWidget(QtWidgets.QWidget): + def __init__(self, parent=None): + QtGui.QWidget.__init__(self, parent) + self.layout = QtGui.QGridLayout() + self.setLayout(self.layout) + + def addWidget(self, item, row=None, col=None, rowspan=1, colspan=1): + self.layout.addWidget(item, row, col, rowspan, colspan)