ccpn.framework package

Module Documentation here

Submodules

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: 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); position (last cursor position); positions (last cursor positions); cursorPosition (last cursor position - (posX,posY) tuple); spectrumGroup (current spectrum); strip (selected strip)

Use print(current) to get a list of attribute, value pairs

addNmratom(value)
addNmrchain(value)
addNmrresidue(value)
addPeak(value)
addPosition(value)
clearNmratoms()
clearNmrchains()
clearNmrresidues()
clearPeaks()
clearPositions()
cursorPosition

- None, mutable - Current cursorPosition

nmrAtom

- None, mutable - Current nmrAtom

nmrAtoms

- None, mutable - Current nmrAtoms

nmrChain

- None, mutable - Current nmrChain

nmrChains

- None, mutable - Current nmrChains

nmrResidue

- None, mutable - Current nmrResidue

nmrResidues

- None, mutable - Current nmrResidues

peak

- None, mutable - Current peak

peaks

- None, mutable - Current peaks

position

- None, mutable - Current position

positions

- None, mutable - Current positions

project

- None, immutable - Project attached to current

registerNotify(notify, field)[source]
removeNmratom(value)
removeNmrchain(value)
removeNmrresidue(value)
removePeak(value)
removePosition(value)
spectrumGroup

- None, mutable - Current spectrumGroup

strip

- None, mutable - Current strip

unRegisterNotify(notify, field)[source]

Remove ‘current’ notifier

ccpn.framework.Current.noCap(string)[source]

return de-capitalised string

ccpn.framework.Framework module

class ccpn.framework.Framework.Arguments(projectPath=None, **kw)[source]

Bases: object

Class for setting FrameWork input arguments directly

interface = 'NoUi'
language = 'English-UK'
nologging = True
projectPath = None
skipUserPreferences = True
class ccpn.framework.Framework.Framework(applicationName, applicationVersion, args)[source]

Bases: object

The Framework class is the base class for all applications.

addApplicationMenuSpec(spec, position=3)[source]
addBlankDisplay(position='right', relativeTo=None)[source]
applyPreferences(project)[source]

Apply user preferences

NBNB project should be impliclt rather than a parameter (once reorganisation is finished)

archiveProject()[source]
clearLogFile()[source]
clearRecentMacros()[source]
clearRecentProjects()[source]
createNewProject()[source]
defineShortcut()[source]
defineUserShortcuts()[source]
displayProjectSummary()[source]
getByGid(gid)[source]
getByPid(pid)[source]
getPluginMenuItems()[source]
getStyleSheet(preferences=None)[source]
hideSequenceModule()[source]

Hides sequence module

initGraphics()[source]

Set up graphics system after loading

inspectMolecule()[source]
loadData(paths=None, text=None)[source]

Opens a file dialog box and loads data from selected file.

loadProject(path=None)[source]

Load project from path If not path then opens a file dialog box and loads project from selected file.

newMacroFromConsole()[source]

Displays macro editor with contents of python console inside.

newMacroFromLog()[source]

Displays macro editor with contents of the log.

newProject(name='default')[source]
openProject(path=None)[source]
printToFile(spectrumDisplay=None)[source]
redo()[source]
resetZoom()[source]
restoreBackup()[source]
runMacro(macroFile: 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.

saveBackup()[source]
saveLogFile()[source]
saveProject(newPath=None, createFallback=True, overwriteExisting=True) → bool[source]

Save project to newPath and return True if successful

saveProjectAs()[source]

Opens save Project as dialog box and saves project to path specified in the file dialog.

setupMenus()[source]

Setup the menu specification.

The menus are specified by a list of lists (actually, an iterable of iterables, but the term ‘list’ will be used here to mean any iterable). Framework provides 7 menus: Project, Spectrum, Molecules, View, Macro, Plugins, Help. If you want to create your own menu in a subclass of Framework, you need to create a list in the style described below, then call self.addApplicationMenuSpec and pass in your menu specification list.

Menu specification lists are composed of two items, the first being a string which is the menu’s title, the second is a list of sub-menu items. Each item can be zero, two or three items long. A zero-length list indicates a separator. If the list is length two and the second item is a list, then it specifies a sub-menu in a recursive manner. If the list is length two and the second item is callable, it specifies a menu action with the first item specifying the label and the second the callable that is triggered when the menu item is selected. If the list is length three, it is treated as a menu item specification, with the third item a list of keyword, value pairs.

The examples below may make this more clear…

Create a menu called ‘Test’ with two items and a separator:

- Test |- Item One |- —— |- Item Two

Where clicking on ‘Item One’ calls method self.itemOneMethod and clicking on ‘Item Two’ calls self.itemTwoMethod

def setupMenus(self):
menuSpec = (‘Test’, [(‘Item One’, self.itemOneMethod),
(), (‘Item Two’, self.itemTwoMethod),

]

self.addApplicationMenuSpec(menuSpec)

More complicated menus are possible. For example, to create the following menu

- Test |- Item A ia |- —— |- Submenu B |- Item B1 |- Item B2 |- Item C id

where Item A can be activated using the two-key shortcut ‘ia’, Submenu B contains two static menu items, B1 and B2 Submenu item B2 is checkable, but not checked by default Item C is disabled by default and has a shortcut of ‘ic’

def setupMenus(self):
subMenuSpecB = [(‘Item B1’, self.itemB1),
(‘Item B2’, self.itemB2, [(‘checkable’, True),
(‘checked’, False)])

]

menuSpec = (‘Test’, [(‘Item A’, self.itemA, [(‘shortcut’, ‘ia’)]),

(), (‘Submenu B’, subMenuB), (‘Item C’, self.itemA, [(‘shortcut’, ‘ic’),

(‘enabled’, False)]),

]

self.addApplicationMenuSpec(menuSpec)

If we’re using the PyQt GUI, we can get the Qt action representing Item B2 somewhere in our code (for example, to change the checked status,) via:

action = application.ui.mainWindow.getMenuAction(‘Test->Submenu B->Item B2’) action.setChecked(True)

To see how to add items dynamically, see clearRecentProjects in this class and _fillRecentProjectsMenu in GuiMainWindow

showAboutCcpn()[source]
showAboutPopup()[source]
showApplicationPreferences()[source]

Displays Application Preferences Popup.

showAtomSelector(position: str = 'bottom', relativeTo: ccpn.ui.gui.widgets.Module.CcpnModule = None)[source]

Displays Atom Selector.

showBackboneTutorial()[source]
showBackupPopup()[source]
showBeginnersTutorial()[source]
showCcpnLicense()[source]
showChemicalShiftTable(position: str = 'bottom', relativeTo: ccpn.ui.gui.widgets.Module.CcpnModule = None)[source]

Displays Chemical Shift table.

showCodeInspectionPopup()[source]
showCommandHelp()[source]
showExperimentTypePopup()[source]

Displays experiment type popup.

showFeedbackPopup()[source]
showIntegrationModule(position: str = 'bottom', relativeTo: ccpn.ui.gui.widgets.Module.CcpnModule = None)[source]
showIssuesList()[source]
showLicense()[source]
showMacroEditor()[source]

Displays macro editor.

showMoleculePopup()[source]

Displays sequence creation popup.

showNmrResidueTable(position='bottom', relativeTo=None)[source]

Displays Nmr Residue Table

showParassignSetup()[source]
showPeakPickPopup()[source]

Displays Peak Picking Popup.

showPeakTable(position: str = 'left', relativeTo: ccpn.ui.gui.widgets.Module.CcpnModule = None, selectedList: ccpn.core.PeakList.PeakList = None)[source]

Displays Peak table on left of main window with specified list selected.

showProjectionPopup()[source]
showRefChemicalShifts()[source]

Displays Reference Chemical Shifts module.

showSequenceGraph(position: str = 'bottom', relativeTo: ccpn.ui.gui.widgets.Module.CcpnModule = None)[source]

Displays assigner at the bottom of the screen, relative to another module if nextTo is specified.

showSequenceModule(position='top', relativeTo=None)[source]

Displays Sequence Module at the top of the screen.

showShortcuts()[source]
showSpectrumGroupsPopup()[source]
showSubmitMacroPopup()[source]
showUpdatePopup()[source]
showVersion3Documentation()[source]

Displays CCPN wrapper documentation in a module.

start()[source]

Start the program execution

startMacroRecord()[source]

Displays macro editor with additional buttons for recording a macro.

toggleConsole()[source]

Toggles whether python console is displayed at bottom of the main window.

togglePhaseConsole()[source]
toggleSequenceModule()[source]

Toggles whether Sequence Module is displayed or not

toggleToolbar()[source]
undo()[source]
ccpn.framework.Framework.defineProgramArguments()[source]

Define the arguments of the program return argparse instance

ccpn.framework.Framework.getFramework(projectPath=None, **kw)[source]
ccpn.framework.Framework.getPreferences(skipUserPreferences=False, defaultPath=None, userPath=None)[source]
ccpn.framework.Framework.getSaveDirectory(preferences=None)[source]

Opens save Project as dialog box and gets directory specified in the file dialog.

ccpn.framework.Framework.printCreditsText(fp, programName, version)[source]

Initial text to terminal

ccpn.framework.PathsAndUrls module

This file contains path definitions and Url definitions

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.Translation.getTranslator(language)[source]

ccpn.framework.Version module

Top level application version file