From 86fbe41b61f16fc8a0313314d39193aa5e24d362 Mon Sep 17 00:00:00 2001 From: Daniel Brown <ddb@star.sr.bham.ac.uk> Date: Sat, 1 Nov 2014 11:27:06 +0000 Subject: [PATCH] missing node network gui check --- pykat/node_network.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/pykat/node_network.py b/pykat/node_network.py index ea1509b..b1bb13a 100644 --- a/pykat/node_network.py +++ b/pykat/node_network.py @@ -4,9 +4,14 @@ Created on Sun Jan 27 10:02:41 2013 @author: Daniel """ -import exceptions -import pykat.gui.graphics + +from pykat import USE_GUI, NoGUIException + +if USE_GUI: + import pykat.gui.graphics + import pykat.exceptions as pkex + from pykat.components import Component from pykat.detectors import BaseDetector as Detector from pykat.utilities.optics.gaussian_beams import beam_param @@ -543,6 +548,9 @@ class Node(object): self._item.scene().removeItem(self._item) def getQGraphicsItem(self,dx=0,dy=0,nsize=8,parent=None): + if not USE_GUI: + raise NoGUIException + if self._item == None: self._item = pykat.gui.graphics.NodeQGraphicItem(self, dx,dy, -- GitLab