ccpn.framework package¶
Module Documentation here
Subpackages¶
- ccpn.framework.languages package
- ccpn.framework.lib package
- Subpackages
- ccpn.framework.lib.NTdb package
- ccpn.framework.lib.ccpnNef package
- Subpackages
- Submodules
- ccpn.framework.lib.ccpnNef.CcpnNefCommon module
- ccpn.framework.lib.ccpnNef.CcpnNefContent module
- ccpn.framework.lib.ccpnNef.CcpnNefHelper module
- ccpn.framework.lib.ccpnNef.CcpnNefImporter module
- ccpn.framework.lib.ccpnNef.CcpnNefIo module
- ccpn.framework.lib.ccpnNef.CcpnNefLogging module
- ccpn.framework.lib.ccpnNmrStarIo package
- Submodules
- ccpn.framework.lib.Plugin module
- ccpn.framework.lib.SvnRevision module
- ccpn.framework.lib.misc module
- Subpackages
- ccpn.framework.update package
Submodules¶
ccpn.framework.Application module¶
Module Documentation here
- class ccpn.framework.Application.ApplicationContainer(*args, **kwargs)[source]¶
Bases:
object
A singleton class used to register the application (eg AnalysisScreen) and properties defining the top objects application, project, current and mainWindow
- application = None¶
- property current¶
- None, immutable -
- property mainWindow¶
- None, immutable -
- property project¶
- None, immutable -
- class ccpn.framework.Application.Arguments(projectPath=None, **kwds)[source]¶
Bases:
object
Class for setting FrameWork input arguments directly
- debug = False¶
- debug2 = False¶
- debug3 = False¶
- interface = 'NoUi'¶
- language = 'English-UK'¶
- nologging = True¶
- projectPath = None¶
- skipUserPreferences = True¶
ccpn.framework.AutoBackup module¶
This file contains AutoBackup class
- class ccpn.framework.AutoBackup.AutoBackup(q, backupFunction, sleepTime=1)[source]¶
Bases:
threading.Thread
- run()[source]¶
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
ccpn.framework.Current module¶
- class ccpn.framework.Current.Current(project)[source]¶
Bases:
object
The current object gives access to the collection of active or selected objects and values.
Currently implemented:
chain (last selected chain); chains (all selected chains); chemicalShift (last selected chemicalShift); chemicalShifts (all selected chemicalShifts); chemicalShiftList (last selected chemicalShiftList); chemicalShiftLists (all selected chemicalShiftLists); collection (last selected collection); collections (all selected collections); dataTable (last selected dataTable); dataTables (all selected dataTables); integral (last selected integral); integrals (all selected integrals); multiplet (last selected multiplet); multiplets (all selected multiplets); nmrAtom (last selected nmrAtom); nmrAtoms (all selected nmrAtoms); nmrChain (last selected nmrChain); nmrChains (all selected nmrChains); nmrResidue (last selected nmrResidue); nmrResidues (all selected nmrResidues); peak (last selected peak); peaks (all selected peaks); residue (last selected residue); residues (all selected residues); restraint (last selected restraint); restraints (all selected restraints); sample (last selected sample); samples (all selected samples); spectrumGroup (last selected spectrumGroup); spectrumGroups (all selected spectrumGroups); spectrumHit (last selected spectrumHit); strip (last selected strip); substance (last selected substance); substances (all selected substances); violationTable (last selected violationTable); violationTables (all selected violationTables); _OldChemicalShift (last selected _OldChemicalShift); _oldChemicalShifts (all selected _oldChemicalShifts); axisCode (last selected axisCode); cursorPosition (last cursor cursorPosition - (posX,posY) tuple); guiTabl (last selected guiTabl, of any obj kind); macroFile (last selected macroFile, of any obj kind); macroFiles (last selected macroFiles, of any obj kind); pcaComponent (last selected pcaComponent, of any obj kind); pcaComponents (last selected pcaComponents, of any obj kind); position (last cursor position); positions (last cursor positions)
Use print(current) to get a list of attribute, value pairs’)
- addChain(value)¶
- addChemicalShift(value)¶
- addChemicalShiftList(value)¶
- addCollection(value)¶
- addDataTable(value)¶
- addIntegral(value)¶
- addMacroFile(value)¶
- addMultiplet(value)¶
- addNmrAtom(value)¶
- addNmrChain(value)¶
- addNmrResidue(value)¶
- addPcaComponent(value)¶
- addPeak(value)¶
- addPosition(value)¶
- addResidue(value)¶
- addRestraint(value)¶
- addSample(value)¶
- addSpectrumGroup(value)¶
- addSubstance(value)¶
- addViolationTable(value)¶
- add_OldChemicalShift(value)¶
- property axisCode¶
- None, mutable - Current axisCode
- property chain¶
- None, mutable - Current chain
- property chains¶
- None, mutable - Current chains
- property chemicalShift¶
- None, mutable - Current chemicalShift
- property chemicalShiftList¶
- None, mutable - Current chemicalShiftList
- property chemicalShiftLists¶
- None, mutable - Current chemicalShiftLists
- property chemicalShifts¶
- None, mutable - Current chemicalShifts
- className = 'Current'¶
- clearChains()¶
- clearChemicalShiftLists()¶
- clearChemicalShifts()¶
- clearCollections()¶
- clearDataTables()¶
- clearIntegrals()¶
- clearMacroFiles()¶
- clearMultiplets()¶
- clearNmrAtoms()¶
- clearNmrChains()¶
- clearNmrResidues()¶
- clearPcaComponents()¶
- clearPeaks()¶
- clearPositions()¶
- clearResidues()¶
- clearRestraints()¶
- clearSamples()¶
- clearSpectrumGroups()¶
- clearSubstances()¶
- clearViolationTables()¶
- clear_oldChemicalShifts()¶
- cls¶
alias of
ccpn.core._OldChemicalShift._OldChemicalShift
- property collection¶
- None, mutable - Current collection
- property collections¶
- None, mutable - Current collections
- property cursorPosition¶
- None, mutable - Current cursorPosition
- property dataTable¶
- None, mutable - Current dataTable
- property dataTables¶
- None, mutable - Current dataTables
- dd = {'docTemplate': 'last cursor %s'}¶
- field = 'positions'¶
- property guiTabl¶
- None, mutable - Current guiTabl
- property integral¶
- None, mutable - Current integral
- property integrals¶
- None, mutable - Current integrals
- ll = ['\nchain (last selected chain)', 'chains (all selected chains)', '\nchemicalShift (last selected chemicalShift)', 'chemicalShifts (all selected chemicalShifts)', '\nchemicalShiftList (last selected chemicalShiftList)', 'chemicalShiftLists (all selected chemicalShiftLists)', '\ncollection (last selected collection)', 'collections (all selected collections)', '\ndataTable (last selected dataTable)', 'dataTables (all selected dataTables)', '\nintegral (last selected integral)', 'integrals (all selected integrals)', '\nmultiplet (last selected multiplet)', 'multiplets (all selected multiplets)', '\nnmrAtom (last selected nmrAtom)', 'nmrAtoms (all selected nmrAtoms)', '\nnmrChain (last selected nmrChain)', 'nmrChains (all selected nmrChains)', '\nnmrResidue (last selected nmrResidue)', 'nmrResidues (all selected nmrResidues)', '\npeak (last selected peak)', 'peaks (all selected peaks)', '\nresidue (last selected residue)', 'residues (all selected residues)', '\nrestraint (last selected restraint)', 'restraints (all selected restraints)', '\nsample (last selected sample)', 'samples (all selected samples)', '\nspectrumGroup (last selected spectrumGroup)', 'spectrumGroups (all selected spectrumGroups)', '\nspectrumHit (last selected spectrumHit)', '\nstrip (last selected strip)', '\nsubstance (last selected substance)', 'substances (all selected substances)', '\nviolationTable (last selected violationTable)', 'violationTables (all selected violationTables)', '\n_OldChemicalShift (last selected _OldChemicalShift)', '_oldChemicalShifts (all selected _oldChemicalShifts)', '\naxisCode (last selected axisCode)', '\ncursorPosition (last cursor cursorPosition - (posX,posY) tuple)', '\nguiTabl (last selected guiTabl, of any obj kind)', '\nmacroFile (last selected macroFile, of any obj kind)', 'macroFiles (last selected macroFiles, of any obj kind)', '\npcaComponent (last selected pcaComponent, of any obj kind)', 'pcaComponents (last selected pcaComponents, of any obj kind)', '\nposition (last cursor position)', 'positions (last cursor positions)']¶
- property macroFile¶
- None, mutable - Current macroFile
- property macroFiles¶
- None, mutable - Current macroFiles
- property multiplet¶
- None, mutable - Current multiplet
- property multiplets¶
- None, mutable - Current multiplets
- property nmrAtom¶
- None, mutable - Current nmrAtom
- property nmrAtoms¶
- None, mutable - Current nmrAtoms
- property nmrChain¶
- None, mutable - Current nmrChain
- property nmrChains¶
- None, mutable - Current nmrChains
- property nmrResidue¶
- None, mutable - Current nmrResidue
- property nmrResidues¶
- None, mutable - Current nmrResidues
- property pcaComponent¶
- None, mutable - Current pcaComponent
- property pcaComponents¶
- None, mutable - Current pcaComponents
- property peak¶
- None, mutable - Current peak
- property peaks¶
- None, mutable - Current peaks
- property pid¶
- None, immutable -
- property position¶
- None, mutable - Current position
- property positions¶
- None, mutable - Current positions
- property project¶
- None, immutable - Project attached to current
- registerNotify(notify, field)[source]¶
Register notifier function ‘notify’ to be called on field ‘field’
Return notify
E.g. current.registerNotify(highlightSelectedPeaks, ‘peaks’) Where highlightSelectedPeaks is a function that takes a list of peaks as its only input
Notifiers are attached to the Current OBJECT, not to the class They are therefore removed when a new project is created/loaded Otherwise it is the responsibility of the adder to remove them when no longer relevant for which the notifier function object must be kept around. The function is attached to the field and is executed after the field value changes In practice this goes through the setter for (the equivalent of) Current.spectra The notifier function is passed the new value of the field as its only parameter. If you need a graphics object (e.g. a module) you must make and register a bound method on the module.
- removeChain(value)¶
- removeChemicalShift(value)¶
- removeChemicalShiftList(value)¶
- removeCollection(value)¶
- removeDataTable(value)¶
- removeIntegral(value)¶
- removeMacroFile(value)¶
- removeMultiplet(value)¶
- removeNmrAtom(value)¶
- removeNmrChain(value)¶
- removeNmrResidue(value)¶
- removePcaComponent(value)¶
- removePeak(value)¶
- removePosition(value)¶
- removeResidue(value)¶
- removeRestraint(value)¶
- removeSample(value)¶
- removeSpectrumGroup(value)¶
- removeSubstance(value)¶
- removeViolationTable(value)¶
- remove_OldChemicalShift(value)¶
- property residue¶
- None, mutable - Current residue
- property residues¶
- None, mutable - Current residues
- property restraint¶
- None, mutable - Current restraint
- property restraints¶
- None, mutable - Current restraints
- property sample¶
- None, mutable - Current sample
- property samples¶
- None, mutable - Current samples
- shortClassName = 'CU'¶
Short class name, for PID.
- property spectrumGroup¶
- None, mutable - Current spectrumGroup
- property spectrumGroups¶
- None, mutable - Current spectrumGroups
- property spectrumHit¶
- None, mutable - Current spectrumHit
- ss = 'positions'¶
- property state¶
- None, immutable - Returns a storable representation of current objs in a ordered Dict. Keys the class name, values: pids, float/int or Nones. [] for plural cases. Used to dump in json file to save a restore the state when opening/closing a project
- property strip¶
- None, mutable - Current strip
- property substance¶
- None, mutable - Current substance
- property substances¶
- None, mutable - Current substances
- property violationTable¶
- None, mutable - Current violationTable
- property violationTables¶
- None, mutable - Current violationTables
ccpn.framework.Framework module¶
- class ccpn.framework.Framework.Framework(args=<ccpn.framework.Application.Arguments object>)[source]¶
Bases:
ccpn.core.lib.Notifiers.NotifierBase
,ccpn.ui.gui.GuiBase.GuiBase
The Framework class is the base class for all applications.
- applicationName = None¶
- applicationVersion = None¶
- property archivesPath: ccpn.util.Path.Path¶
- ccpn.util.Path.Path, immutable - :return: the absolute path to the archives sub-directory of the current project
as a Path instance
- property current: ccpn.framework.Current.Current¶
- ccpn.framework.Current.Current, immutable - Current contains selected peaks, selected restraints, cursor position, etc. see Current.py for detailed descriptiom :return the Current object
- property dataPath: ccpn.util.Path.Path¶
- ccpn.util.Path.Path, immutable - :return: the absolute path to the data sub-directory of the current project
as a Path instance
- get(identifier)[source]¶
General method to obtain object (either gui or data) from identifier (pid, gid, obj-string) :param identifier: a Pid, Gid or string object identifier :return a Version-3 core data or graphics object
- getByGid(gid)[source]¶
Legacy; obtain graphics object from identifier (gid or obj-string) replaced by get(identifier). :param gid: a Gid or string object identifier :return a Version-3 graphics object
- getByPid(pid)[source]¶
Legacy; obtain data object from identifier (pid or obj-string) replaced by get(identifier). :param pid: a Pid or string object identifier :return a Version-3 core data object
- property hasGui: bool¶
- bool, immutable - :return True if application has a gui
- loadData(*paths, pathFilter=None) list [source]¶
Loads data from paths. Optionally filter for dataFormat(s) :param *paths: argument list of path’s (str or Path instances) :param pathFilter: keyword argument: list/tuple of dataFormat strings :returns list of loaded objects
- loadProject(path=None) ccpn.core.Project.Project [source]¶
Load project defined by path :return a Project instance
- loadSpectra(*paths) list [source]¶
Load all the spectra found in paths.
- Parameters
paths – list of paths
:return a list of Spectra instances
- property mainWindow¶
- None, immutable - :returns: MainWindow instance if application has a Gui or None otherwise
- makeStripPlotPopup(includePeakLists=True, includeNmrChains=True, includeNmrChainPullSelection=True)[source]¶
- newProject(name: str = 'default') ccpn.core.Project.Project [source]¶
Create new, empty project with name :return a Project instance
- property pipelinePath: ccpn.util.Path.Path¶
- ccpn.util.Path.Path, immutable - :return: the absolute path to the state/pipeline sub-directory of
the current project as a Path instance
- property pluginDataPath: ccpn.util.Path.Path¶
- ccpn.util.Path.Path, immutable - :return: the absolute path to the data/plugins sub-directory of the
current project as a Path instance
- property project: ccpn.core.Project.Project¶
- ccpn.core.Project.Project, immutable - :return currently active project
- restoreFromArchive(archivePath) ccpn.core.Project.Project [source]¶
Restore a project from archive path :return the restored project or None on error
- runMacro(macroFile: Optional[str] = None)[source]¶
Runs a macro if a macro is specified, or opens a dialog box for selection of a macro file and then runs the selected macro.
- saveProjectAs(newPath, overwrite: bool = False) bool [source]¶
Save project to newPath :param newPath: new path to save project (str | Path instance) :param overwrite: flag to indicate overwriting of existing path :return True if successful
- saveToArchive() ccpn.util.Path.Path [source]¶
Archive the project. :return location of the archive as a Path instance
- property scriptsPath: ccpn.util.Path.Path¶
- ccpn.util.Path.Path, immutable - :return: the absolute path to the script sub-directory of the current project
as a Path instance
- showChemicalShiftMapping(position: str = 'top', relativeTo: Optional[ccpn.ui.gui.modules.CcpnModule.CcpnModule] = None)[source]¶
- showChemicalShiftTable(position: str = 'bottom', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None, chemicalShiftList=None, selectFirstItem=False)[source]¶
Displays Chemical Shift table.
- showCollectionModule(position='bottom', relativeTo=None, collection=None, selectFirstItem=False)[source]¶
Displays Collection Module
- showDataTable(position='bottom', relativeTo=None, dataTable=None, selectFirstItem=False)[source]¶
Displays DataTable Table
- showIntegralTable(position: str = 'left', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None, integralList: ccpn.core.IntegralList.IntegralList = None, selectFirstItem=False)[source]¶
Displays integral table on left of main window with specified list selected.
- showMultipletTable(position: str = 'left', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None, multipletList: ccpn.core.MultipletList.MultipletList = None, selectFirstItem=False)[source]¶
Displays multipletList table on left of main window with specified list selected.
- showNmrResidueTable(position='bottom', relativeTo=None, nmrChain=None, selectFirstItem=False)[source]¶
Displays Nmr Residue Table
- showNotesEditor(position: str = 'bottom', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None, note=None, selectFirstItem=False)[source]¶
Displays Notes Editing Table
- showPeakTable(position: str = 'left', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None, peakList: ccpn.core.PeakList.PeakList = None, selectFirstItem=False)[source]¶
Displays Peak table on left of main window with specified list selected.
- showReferenceChemicalShifts(position='left', relativeTo=None)[source]¶
Displays Reference Chemical Shifts module.
- showResidueInformation(position: str = 'bottom', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None)[source]¶
Displays Residue Information module.
- showResidueTable(position='bottom', relativeTo=None, chain=None, selectFirstItem=False)[source]¶
Displays Residue Table
- showRestraintAnalysisTable(position: str = 'bottom', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None, peakList=None, selectFirstItem=False)[source]¶
Displays restraint analysis table.
- showRestraintTable(position: str = 'bottom', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None, restraintTable: ccpn.core.PeakList.PeakList = None, selectFirstItem=False)[source]¶
Displays Peak table on left of main window with specified list selected.
- showStructureTable(position='bottom', relativeTo=None, structureEnsemble=None, selectFirstItem=False)[source]¶
Displays Structure Table
- showValidateSpectraPopup(spectra=None, defaultSelected=None)[source]¶
Displays validate spectra popup.
- showViolationTable(position: str = 'bottom', relativeTo: ccpn.ui.gui.modules.CcpnModule.CcpnModule = None, violationTable: ccpn.core.PeakList.PeakList = None, selectFirstItem=False)[source]¶
Displays Peak table on left of main window with specified list selected.
- property spectraPath¶
- None, immutable - :return: the absolute path to the data sub-directory of the current project
as a Path instance
- property statePath: ccpn.util.Path.Path¶
- ccpn.util.Path.Path, immutable - :return: the absolute path to the state sub-directory of the current project
as a Path instance
- property tempMacrosPath: ccpn.util.Path.Path¶
- ccpn.util.Path.Path, immutable - :return: the absolute path to the ~/.ccpn/macros directory
as a Path instance
- class ccpn.framework.Framework.MyProgramme(args=<ccpn.framework.Application.Arguments object>)[source]¶
Bases:
ccpn.framework.Framework.Framework
My first app
- applicationName = 'CcpNmr'¶
- applicationVersion = '3.1.0.beta1'¶
ccpn.framework.PathsAndUrls module¶
This file contains path definitions and Url definitions
ccpn.framework.Preferences module¶
This file contains the Preference object and related methods;
- class ccpn.framework.Preferences.Preferences(*args, **kwargs)[source]¶
Bases:
ccpn.util.AttrDict.AttrDict
A singleton class to hold the preferences, implemented as a AttrDict-of-AttrDict-of-AttrDict
- dashes = '-----'¶
ccpn.framework.Translation module¶
Translation and translation dictionary handling
the application can import the translator instance for translation and use:
translator.setLanguage(language) translator.translate(text)
To silence the message, e.g. when initiating dynamical menus with recent files use: translator.setSilent() translator.setLoud()
To have both defaultLanguage and translated language: translator.setDebug(True)
there are translation dictionaries associated with this module for really common words like “Help”
ccpn.framework.Version module¶
Top level application version file
- class ccpn.framework.Version.VersionString(string: str, **kwds)[source]¶
Bases:
str
Version-string routines, adapted from path idea in: Python Cookbook, A. Martelli and D. Ascher (eds), O’Reilly 2002, pgs 140-142
A VersionString is a string with extra functionality. It consists of three non-empty and one optional substrings separated by a mandatory dot ‘.’ character:
majorVersion.minorVersion.microVersion[.release]
Examples: 3.0.4; 3.1.0.alpha
The isValid function checks for validity
The majorVersion, minorVersion, microVersion and release fields are available as properties.
A VersionString instance supports comparisons with either another VersionString instance or a suitable formatted string; e.g.
VersionString(‘3.1.0.alpha’) > VersionString(‘3.0.4’) yields True VersionString(‘3.1.0.alpha’) < ‘3.0.2’ yields False
- property asStr: str¶
- str, immutable - Convenience: return as string rather than object; allows to do things as obj.asPid.str rather then str(obj.asPid)
- property fields: tuple¶
- tuple, immutable - Return a tuple of the fields of self
- property majorVersion: str¶
- str, immutable - return majorVersion field of self
- property microVersion: str¶
- str, immutable - return microVersion field of self
- property minorVersion: str¶
- str, immutable - return minorVersion field of self
- property release: str¶
- str, immutable - return release field of self, or None if it does not exist
ccpn.framework.constants module¶
ccpn.framework.credits module¶
This module defines the code for creating the credits