Package diffpy :: Package pdfgui :: Package control :: Module pdfguicontrol :: Class PDFGuiControl
[hide private]
[frames] | no frames]

Class PDFGuiControl

source code

PDFGuiControl holds all the data GUI needs to access or change
It has a container of Calculation and Fitting instances.
Each Calculation and Fitting has a unique name.



Nested Classes [hide private]
  QueueManager
Instance Methods [hide private]
 
__init__(self, gui=None)
initialize...
source code
 
reset(self)
clean up for a new project
source code
 
startQueue(self)
start queue manager
source code
 
checkQueue(self)
find next fitting in the queue and start it
source code
 
enqueue(self, fits, enter=True)
enqueue or dequeue fittings...
source code
 
close(self, force=True)
close a project...
source code
 
exit(self)
exit when program finished...
source code
 
newFitting(self, name, position=None)
insert a new instance of Fitting...
source code
 
newCalculation(self, targetID, name, position=None)
insert a new instance of Calculation to a Fitting...
source code
 
newStructure(self, targetID, name, position=None)
add blank structure to a Fitting...
source code
 
loadStructure(self, targetID, filename, name=None, position=None)
add blank structure to a Fitting...
source code
 
loadDataset(self, targetID, filename, name=None, position=None)
load Dataset from a file to a Fitting...
source code
 
add(self, ID, position=None)
add fitting/calculation to internal list...
source code
 
__findOwner(self, ID)
find where the ID belongs...
source code
 
rename(self, ID, new_name)
rename Fitting, Calculation, Dataset or Structure...
source code
 
remove(self, ID)
remove Fitting, Calculation, Dataset or Structure...
source code
 
index(self, ID)
return position index of an object in its owner list...
source code
 
copy(self, src)
copy src object...
source code
 
paste(self, dup, target=None, new_name=None, position=None)
paste copied object to target under new_name, the default new_name...
source code
 
importPdffit2Script(self, scriptfile, args=[])
add fits and calculations from pdffit2 script...
source code
 
load(self, projfile)
load project from projfile.
source code
 
save(self, projfile=None)
Save project to projfile, default projfile is self.projfile This method first writes to a temporary file and only when successful, it overwrites projfile with the temporary file content.
source code
 
plot(self, xItem, yItems, Ids, shift=1.0, dry=False)
Make a 2D plot...
source code
 
start(self, IDlist)
execute Calculations and Fittings in IDlist.
source code
 
stop(self)
stop all Fittings...
source code
 
setHost(self, hostCfg)
set the host machine to be used for fitting hostCfg -- configuration dictionary of remote host.
source code
 
getHost(self)
get current host to be used.
source code
 
__validateType(self, targetID)
check if targetID is a Fitting class
source code
 
redirectStdout(self)
Redirect standard out.
source code
 
getEngineOutput(self)
Get the output from the engine.
source code
Method Details [hide private]

__init__(self, gui=None)
(Constructor)

source code 
initialize

gui: main panel of GUI

enqueue(self, fits, enter=True)

source code 
enqueue or dequeue fittings

fits -- list of fittings to be queued/dequeued
enter -- True to queue, False to dequeue

close(self, force=True)

source code 
close a project

force -- if exit forciably

exit(self)

source code 
exit when program finished
        

newFitting(self, name, position=None)

source code 
insert a new instance of Fitting

name      --  unique name for this Fitting
position  --  where Fitting is inserted, default is last place

return: Fitting reference

newCalculation(self, targetID, name, position=None)

source code 
insert a new instance of Calculation to a Fitting

targetID  --  reference to Fitting
name      --  unique name for this Calculation
position  --  where Calculation is inserted, default is last place

return: Calculation reference

newStructure(self, targetID, name, position=None)

source code 
add blank structure to a Fitting

targetID  --  reference to Fitting
name      --  name of the new Structure
position  --  where the structure is to be inserted, default is last

return: Structure reference

loadStructure(self, targetID, filename, name=None, position=None)

source code 
add blank structure to a Fitting

targetID  --  reference to Fitting
name      --  name of the new Structure, default is file basename

return: Structure reference

loadDataset(self, targetID, filename, name=None, position=None)

source code 
load Dataset from a file to a Fitting

targetID  --  reference to Fitting
name      --  name of the new Dataset, default is file basename
position  --  where the dataset is to be inserted, default is last

return: Dataset reference

add(self, ID, position=None)

source code 
add fitting/calculation to internal list

Id -- reference to the object to be inserted
position  --  where the object is to be inserted, default is last

__findOwner(self, ID)

source code 
find where the ID belongs

ID -- object which can be Fitting,Calculation,FitDataSet or FitStructure
return: a PDFList holding that object

rename(self, ID, new_name)

source code 
rename Fitting, Calculation, Dataset or Structure
identified by ID

ID:       reference to the object to be renamed
new_name: new name to be given to the object

remove(self, ID)

source code 
remove Fitting, Calculation, Dataset or Structure
identified by ID

ID:     reference to the object to be removed
return: removed object

index(self, ID)

source code 
return position index of an object in its owner list

ID  --  ID of object
return: index

copy(self, src)

source code 
copy src object

src -- reference to the source object
return: reference to the copy

paste(self, dup, target=None, new_name=None, position=None)

source code 
paste copied object to target under new_name, the default new_name
will be name of src

dup -- reference to the copied object
target -- target object where the copy should be inserted
new_name -- new name to be given to the copy
position -- where in the target object should the copy be inserted

return: reference to the pasted object

importPdffit2Script(self, scriptfile, args=[])

source code 
add fits and calculations from pdffit2 script

scriptfile -- path to old pdffit2 script
args       -- optional arguments passed to scriptfile

returns list of imported fits

load(self, projfile)

source code 
load project from projfile.

projfile -- a zip file of everything

save(self, projfile=None)

source code 
Save project to projfile, default projfile is self.projfile

This method first writes to a temporary file and only when
successful, it overwrites projfile with the temporary file content.
These steps prevent corruption of existing projects should
something go wrong in the middle of save.  As an added benefit,
all permissions and ownership flags in an existing projfile
are preserved.

plot(self, xItem, yItems, Ids, shift=1.0, dry=False)

source code 
Make a 2D plot

xItem --  x data item name
yItems -- list of y data item names
Ids --    Objects where y data items are taken from
shift -- y displacement for each curve
dry -- not a real plot, only check if plot is valid

stop(self)

source code 
stop all Fittings
        

setHost(self, hostCfg)

source code 
set the host machine to be used for fitting

hostCfg -- configuration dictionary of remote host. If it is blank or None,
           self.host will be set to None.

getHost(self)

source code 
get current host to be used. It can be None if we choose
localhost

return value: proxy instance

redirectStdout(self)

source code 
Redirect standard out.

This redirect engine output to cStringIO if not done yet.