def setUp(self): self.app = QtGui.QApplication([]) QtGui.qApp = self.app icon = QtGui.QIcon(os.path.join(config.KEY_ICON_DIR,'moose_icon.png')) self.model = moose.loadModel('../../Demos/Genesis_files/acc68.g', '/acc68') self.app.setWindowIcon(icon) self.window = QtGui.QMainWindow() self.window.setWindowTitle('Test plot widget') self.mdiArea = QtGui.QMdiArea() self.window.setCentralWidget(self.mdiArea) self.widget = PlotWidget() self.widget.setDataRoot(self.model.path) self.mdiArea.addSubWindow(self.widget) self.window.show()
class PlotWidgetTests(unittest.TestCase): def setUp(self): self.app = QtGui.QApplication([]) QtGui.qApp = self.app icon = QtGui.QIcon(os.path.join(config.KEY_ICON_DIR,'moose_icon.png')) self.model = moose.loadModel('../../Demos/Genesis_files/acc68.g', '/acc68') self.app.setWindowIcon(icon) self.window = QtGui.QMainWindow() self.window.setWindowTitle('Test plot widget') self.mdiArea = QtGui.QMdiArea() self.window.setCentralWidget(self.mdiArea) self.widget = PlotWidget() self.widget.setDataRoot(self.model.path) self.mdiArea.addSubWindow(self.widget) self.window.show() def testPlotAllData(self): """Test plot function""" self.widget.plotAllData() def tearDown(self): self.app.exec_()