def openKernel(self, device=None): """Open kernel specified by device or by current value of stdgraph""" device = self.getDevice(device) graphcap = getGraphcap() # In either of these 3 cases we want to create a new kernel. The last # is the most complex, and it needs to be revisited (when the Device # class is refactored) but suffice it to say we only want to compare # the dict for the device, not the "master dict". if None == self.lastDevice or \ device != self.lastDevice or \ graphcap[device].dict[device] != graphcap.get(self.lastDevice)[self.lastDevice]: self.flush() executable = graphcap[device]['kf'] if executable == 'cl': # open (persistent) interactive kernel if not self.interactiveKernel: if wutil.hasGraphics: import gwm self.interactiveKernel = gwm.getGraphicsWindowManager() else: self.interactiveKernel = GkiNull() self.stdgraph = self.interactiveKernel else: import gkiiraf self.stdgraph = gkiiraf.GkiIrafKernel(device) self.stdin = self.stdgraph.stdin self.stdout = self.stdgraph.stdout self.stderr = self.stdgraph.stderr self.lastDevice = device
def openKernel(self, device=None): """Open kernel specified by device or by current value of stdgraph""" device = self.getDevice(device) graphcap = getGraphcap() if graphcap[device] != graphcap.get(self.lastDevice): self.flush() executable = graphcap[device]['kf'] if executable == 'cl': # open (persistent) interactive kernel if not self.interactiveKernel: if wutil.hasGraphics: self.interactiveKernel = gwm.getGraphicsWindowManager() else: self.interactiveKernel = GkiNull() self.stdgraph = self.interactiveKernel else: self.stdgraph = gkiiraf.GkiIrafKernel(device) self.stdin = self.stdgraph.stdin self.stdout = self.stdgraph.stdout self.stderr = self.stdgraph.stderr self.lastDevice = device