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 ...@@ -5,13 +5,12 @@ Created on Mon Jan 28 11:10:01 2013
@author: Daniel @author: Daniel
""" """
import exceptions import exceptions
import pykat.gui.resources
import pykat import pykat
import pykat.gui.graphics
#from pykat.gui.graphics import *
from pykat.node_network 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) : class Component(object) :
def __init__(self, name): def __init__(self, name):
...@@ -172,8 +171,8 @@ class mirror(Component): ...@@ -172,8 +171,8 @@ class mirror(Component):
def getQGraphicsItem(self): def getQGraphicsItem(self):
if self._svgItem == None: if self._svgItem == None:
nodes = self.getNodes() nodes = self.getNodes()
self._svgItem = pykat.gui.graphics.ComponentQGraphicsItem(":/resources/mirror_flat.svg",self self._svgItem = pykat.gui.graphics.ComponentQGraphicsItem(":/resources/mirror_flat.svg", self ,[(-4,15,nodes[0]), (14,15,nodes[1])])
,[(-4,15,nodes[0]),(14,15,nodes[1])])
return self._svgItem return self._svgItem
......
...@@ -37,7 +37,9 @@ from pykat.node_network import NodeNetwork ...@@ -37,7 +37,9 @@ from pykat.node_network import NodeNetwork
from pykat.detectors import Detector from pykat.detectors import Detector
from pykat.components import Component from pykat.components import Component
from pykat.commands import Command, xaxis from pykat.commands import Command, xaxis
from pykat.gui.gui import openGUI from pykat.gui.gui import pyKatGUI
NO_GUI = False
class MissingFinesseEnvVar(Exception) : class MissingFinesseEnvVar(Exception) :
def __str__(self) : def __str__(self) :
...@@ -93,7 +95,7 @@ class kat(object): ...@@ -93,7 +95,7 @@ class kat(object):
self.__gui = None self.__gui = None
self.nodes = NodeNetwork(self) self.nodes = NodeNetwork(self)
self.__katexe = katexe self.__katexe = katexe
self.pykatgui = None
# Various # Various
self.__phase = None self.__phase = None
self.__maxtem = None self.__maxtem = None
...@@ -405,7 +407,15 @@ class kat(object): ...@@ -405,7 +407,15 @@ class kat(object):
return out return out
def openGUI(self): 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): def getComponents(self):
return self.__components.values() return self.__components.values()
......
...@@ -15,13 +15,6 @@ from pykat.gui.graphics import * ...@@ -15,13 +15,6 @@ from pykat.gui.graphics import *
import qt_gui import qt_gui
import functools import functools
def openGUI(kat):
app = QtGui.QApplication([""])
pykatgui = pyKatGUI(kat)
pykatgui.main()
app.exec_()
class pyKatGUI(QtGui.QMainWindow, qt_gui.Ui_MainWindow): class pyKatGUI(QtGui.QMainWindow, qt_gui.Ui_MainWindow):
def __init__(self, kat,parent=None): def __init__(self, kat,parent=None):
super(pyKatGUI, self).__init__(parent) super(pyKatGUI, self).__init__(parent)
......
Supports Markdown
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