def __init__(self, name): """initialize name -- component name """ from diffpy.pdfgui.control.pdflist import PDFList PDFComponent.__init__(self, name) self.datasets = PDFList() self.strucs = PDFList() self.calcs = PDFList() # self.metadata is created but not pickled only for the purpose # of plotting. It holds common metadata from all its datasets self.metadata = {} # controlCenter is the reference to global PDFGuiControl object from diffpy.pdfgui.control.pdfguicontrol import pdfguicontrol self.controlCenter = pdfguicontrol()
def __init__(self, name=None): """initialize name -- name of plot """ if name is None: name = 'Plot [%i]' % Plotter.__plotWindowNumber PDFComponent.__init__(self, name) import threading self.lock = threading.RLock() self.curves = [] self.window = None self.isShown = False from diffpy.pdfgui.control.pdfguicontrol import pdfguicontrol self.controlCenter = pdfguicontrol() # add some flavor by starting with random style import random self.symbolStyleIndex = random.randint(0, 100) self.lineStyleIndex = random.randint(0, 100) return
def __init__(self, name=None): """initialize name -- name of plot """ if name is None: name = 'Plot [%i]' % Plotter.__plotWindowNumber PDFComponent.__init__(self, name) import threading self.lock = threading.RLock() self.curves = [] self.window = None self.isShown = False from diffpy.pdfgui.control.pdfguicontrol import pdfguicontrol self.controlCenter = pdfguicontrol() # add some flavor by starting with random style import random self.symbolStyleIndex = random.randint(0,100) self.lineStyleIndex = random.randint(0,100) return
def __findLinkedFitting(self): """Private search for linked Fitting by name and by representation. Should be called only when initial value is linked to another Fitting. Updates self.__initial and self.__fitrepr. returns reference to Fitting when found or None """ # Check to see if the fit name has a ':' in it isplit = self.__initial.split(':') try: srcidx = int(isplit[-1]) fitname = (':'.join(isplit[:-1]))[1:] except ValueError: fitname = self.__initial[1:] srcidx = self.idx self.__initial += ":%i" % srcidx from diffpy.pdfgui.control.pdfguicontrol import pdfguicontrol fits = pdfguicontrol().fits fitnames = [f.name for f in fits] fitrepres = [repr(f) for f in fits] # first find linked fitting by name if fitname in fitnames: idx = fitnames.index(fitname) self.__fitrepr = fitrepres[idx] ref = fits[idx] # if not found by name, look up by representation elif self.__fitrepr in fitrepres: idx = fitrepres.index(self.__fitrepr) self.__initial = "=%s:%i" % (fitnames[idx], srcidx) ref = fits[idx] # here self.__initial was not found, but let it pass # maybe the linked fitting will be defined later else: self.__fitrepr = None ref = None return ref
def __findLinkedFitting(self): """Private search for linked Fitting by name and by representation. Should be called only when initial value is linked to another Fitting. Updates self.__initial and self.__fitrepr. returns reference to Fitting when found or None """ # Check to see if the fit name has a ':' in it isplit = self.__initial.split(':') try: srcidx = int(isplit[-1]) fitname = (':'.join(isplit[:-1]))[1:] except ValueError: fitname = self.__initial[1:] srcidx = self.idx self.__initial += ":%i" % srcidx from diffpy.pdfgui.control.pdfguicontrol import pdfguicontrol fits = pdfguicontrol().fits fitnames = [ f.name for f in fits ] fitrepres = [ repr(f) for f in fits ] # first find linked fitting by name if fitname in fitnames: idx = fitnames.index(fitname) self.__fitrepr = fitrepres[idx] ref = fits[idx] # if not found by name, look up by representation elif self.__fitrepr in fitrepres: idx = fitrepres.index(self.__fitrepr) self.__initial = "=%s:%i" % (fitnames[idx], srcidx) ref = fits[idx] # here self.__initial was not found, but let it pass # maybe the linked fitting will be defined later else: self.__fitrepr = None ref = None return ref