Commit 1e342a36 authored by Daniel Brown's avatar Daniel Brown
Browse files

fixing gui problems

parent 14d52205
......@@ -5,13 +5,12 @@ Created on Mon Jan 28 11:10:01 2013
@author: Daniel
"""
import exceptions
import pykat.gui.resources
import pykat
import pykat.gui.graphics
#from pykat.gui.graphics import *
from pykat.node_network import *
#from PyQt4.QtGui import *
#from PyQt4.Qt import *
import pykat.gui.resources
import pykat.gui.graphics
from pykat.gui.graphics import *
class Component(object) :
def __init__(self, name):
......@@ -172,8 +171,8 @@ class mirror(Component):
def getQGraphicsItem(self):
if self._svgItem == None:
nodes = self.getNodes()
self._svgItem = pykat.gui.graphics.ComponentQGraphicsItem(":/resources/mirror_flat.svg",self
,[(-4,15,nodes[0]),(14,15,nodes[1])])
self._svgItem = pykat.gui.graphics.ComponentQGraphicsItem(":/resources/mirror_flat.svg", self ,[(-4,15,nodes[0]), (14,15,nodes[1])])
return self._svgItem
......
......@@ -37,7 +37,9 @@ from pykat.node_network import NodeNetwork
from pykat.detectors import Detector
from pykat.components import Component
from pykat.commands import Command, xaxis
from pykat.gui.gui import openGUI
from pykat.gui.gui import pyKatGUI
NO_GUI = False
class MissingFinesseEnvVar(Exception) :
def __str__(self) :
......@@ -93,7 +95,7 @@ class kat(object):
self.__gui = None
self.nodes = NodeNetwork(self)
self.__katexe = katexe
self.pykatgui = None
# Various
self.__phase = None
self.__maxtem = None
......@@ -405,7 +407,15 @@ class kat(object):
return out
def openGUI(self):
self.__gui = openGUI(self)
if NO_GUI:
print "No PyQt4 module was installed so cannot open a GUI"
else:
if self.pykatgui == None:
#self.app = QtGui.QApplication([""])
self.pykatgui = pyKatGUI(self)
self.pykatgui.main()
else:
self.pykatgui.show()
def getComponents(self):
return self.__components.values()
......
......@@ -15,13 +15,6 @@ from pykat.gui.graphics import *
import qt_gui
import functools
def openGUI(kat):
app = QtGui.QApplication([""])
pykatgui = pyKatGUI(kat)
pykatgui.main()
app.exec_()
class pyKatGUI(QtGui.QMainWindow, qt_gui.Ui_MainWindow):
def __init__(self, kat,parent=None):
super(pyKatGUI, self).__init__(parent)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment