def __init__(self, parent=None, varDict=None): super(pyQTShell, self).__init__(None) #new new^2:changed from parent self.setAttribute(Qt.WA_DeleteOnClose) #new pyQTShell.Instances.add(self) #new self.ui = Ui_pyQTShell() self.ui.setupUi(self) self.parent = None self.varDict = {} if varDict: self.varDict = varDict if parent: self.parent = parent self.varDict = parent.localVars.getPubDict() #print parent.dialog_test parent.topPlot = self.ui #print parent.localVars.getPubDict().keys() #self.windowTitle = "Plot%d" % pyQTShell.NextId #self.setWindowTitle(self.windowTitle) pyQTShell.NextId += 1 self.xlist = {} #used just for reference self.__initLocalVars__() self.__addWidgets__()
def __init__(self, parent = None, varDict = None): super(pyQTShell, self).__init__(None)#new new^2:changed from parent self.setAttribute(Qt.WA_DeleteOnClose)#new pyQTShell.Instances.add(self)#new self.ui = Ui_pyQTShell() self.ui.setupUi(self) self.parent = None self.varDict = {} if varDict: self.varDict = varDict if parent: self.parent = parent self.varDict = parent.localVars.getPubDict() #print parent.dialog_test parent.topPlot = self.ui #print parent.localVars.getPubDict().keys() #self.windowTitle = "Plot%d" % pyQTShell.NextId #self.setWindowTitle(self.windowTitle) pyQTShell.NextId +=1 self.xlist = {}#used just for reference self.__initLocalVars__() self.__addWidgets__()
class pyQTShell(QWidget): NextId = 1 Instances = set() '''pyQTShell instance.''' def __init__(self, parent = None, varDict = None): super(pyQTShell, self).__init__(None)#new new^2:changed from parent self.setAttribute(Qt.WA_DeleteOnClose)#new pyQTShell.Instances.add(self)#new self.ui = Ui_pyQTShell() self.ui.setupUi(self) self.parent = None self.varDict = {} if varDict: self.varDict = varDict if parent: self.parent = parent self.varDict = parent.localVars.getPubDict() #print parent.dialog_test parent.topPlot = self.ui #print parent.localVars.getPubDict().keys() #self.windowTitle = "Plot%d" % pyQTShell.NextId #self.setWindowTitle(self.windowTitle) pyQTShell.NextId +=1 self.xlist = {}#used just for reference self.__initLocalVars__() self.__addWidgets__() def __addWidgets__(self): '''adds all of the custom widgets not specified in the .ui file''' #interpreter = Interpreter(self.localVars.__dict__)#original interpreter = Interpreter(self.varDict) #interpreter = Interpreter() shellClass = shell.get_shell_class() self.shell = shellClass(interpreter,parent=self.ui.pyDockWidget) self.shell.setObjectName("shell") self.ui.pyDockWidget.setWidget(self.shell) def __initLocalVars__(self): '''Initialization of variables All of those variables specified below will be avialable to the user ''' #self.localVars.setPubTypes(self.localVarTypes) self.varDict['__ghost__'] = [] #self.localVars['P'] = P self.varDict['N'] = N self.varDict['S'] = S @staticmethod def updateInstances(qobj): pyQTShell.Instances = set([window for window \ in pyQTShell.Instances if isAlive(window)]) def dict_value(self, dictionary): return dictionary.values()[0] def dict_key(self, dictionary): return dictionary.keys()[0]
class pyQTShell(QWidget): NextId = 1 Instances = set() '''pyQTShell instance.''' def __init__(self, parent=None, varDict=None): super(pyQTShell, self).__init__(None) #new new^2:changed from parent self.setAttribute(Qt.WA_DeleteOnClose) #new pyQTShell.Instances.add(self) #new self.ui = Ui_pyQTShell() self.ui.setupUi(self) self.parent = None self.varDict = {} if varDict: self.varDict = varDict if parent: self.parent = parent self.varDict = parent.localVars.getPubDict() #print parent.dialog_test parent.topPlot = self.ui #print parent.localVars.getPubDict().keys() #self.windowTitle = "Plot%d" % pyQTShell.NextId #self.setWindowTitle(self.windowTitle) pyQTShell.NextId += 1 self.xlist = {} #used just for reference self.__initLocalVars__() self.__addWidgets__() def __addWidgets__(self): '''adds all of the custom widgets not specified in the .ui file''' #interpreter = Interpreter(self.localVars.__dict__)#original interpreter = Interpreter(self.varDict) #interpreter = Interpreter() shellClass = shell.get_shell_class() self.shell = shellClass(interpreter, parent=self.ui.pyDockWidget) self.shell.setObjectName("shell") self.ui.pyDockWidget.setWidget(self.shell) def __initLocalVars__(self): '''Initialization of variables All of those variables specified below will be avialable to the user ''' #self.localVars.setPubTypes(self.localVarTypes) self.varDict['__ghost__'] = [] #self.localVars['P'] = P self.varDict['N'] = N self.varDict['S'] = S @staticmethod def updateInstances(qobj): pyQTShell.Instances = set([window for window \ in pyQTShell.Instances if isAlive(window)]) def dict_value(self, dictionary): return dictionary.values()[0] def dict_key(self, dictionary): return dictionary.keys()[0]