# eric7.MultiProject.MultiProject

Module implementing the multi project management functionality.

### Global Attributes

None

### Classes

MultiProject | Class implementing the project management functionality.

### Functions

None

## MultiProject

Class implementing the project management functionality.

### Signals

dirty(bool)
  emitted when the dirty state changes
multiProjectClosed()
  emitted after a multi project was closed
multiProjectOpened()
  emitted after a multi project file was read
multiProjectPropertiesChanged()
  emitted after the multi project properties were changed
newMultiProject()
  emitted after a new multi project was generated
projectAdded(project metadata)
  emitted after a project entry has been added
projectDataChanged(project metadata)
  emitted after a project entry has been changed
projectOpened(filename)
  emitted after the project has been opened
projectRemoved(project metadata)
  emitted after a project entry has been removed
showMenu(string, QMenu)
  emitted when a menu is about to be shown. The name of the menu and a reference to the menu are given.

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

MultiProject | Constructor
__checkFilesExist | Private method to check, if the files in a list exist.
__extractCategories | Private slot to extract the categories used in the project definitions.
__initData | Private method to initialize the multi project data part.
__loadRecent | Private method to load the recently opened multi project filenames.
__newMultiProject | Private slot to build a new multi project.
__openMainProject | Private slot to open the main project.
__openRecent | Private method to open a multi project from the list of rencently opened multi projects.
__readMultiProject | Private method to read in a multi project (.emj) file.
__saveRecent | Private method to save the list of recently opened filenames.
__showContextMenuRecent | Private method to set up the recent multi projects menu.
__showMenu | Private method to set up the multi project menu.
__showProperties | Private slot to display the properties dialog.
__syncRecent | Private method to synchronize the list of recently opened multi projects with the central store.
__writeMultiProject | Private method to save the multi project infos to a multi project file.
addEricActions | Public method to add actions to the list of actions.
addNewProject | Public slot used to add a new project to the multi-project.
addProject | Public method to add a project to the multi-project.
changeProjectProperties | Public method to change the data of a project entry.
checkDirty | Public method to check the dirty status and open a message window.
clearRecent | Public method to clear the recent multi projects menu.
clearRemovedProjects | Public slot to clear out all projects marked as removed.
closeMultiProject | Public slot to close the current multi project.
copyProject | Public method to copy the project with given UID on disk.
deleteProject | Public slot to delete project(s) from the multi project and disk.
getActions | Public method to get a list of all actions.
getCategories | Public method to get the list of defined categories.
getDependantProjectFiles | Public method to get the filenames of the dependent projects.
getMainProjectFile | Public method to get the filename of the main project.
getMenu | Public method to get a reference to the main menu or a submenu.
getMostRecent | Public method to get the most recently opened multiproject.
getMultiProjectFile | Public method to get the path of the multi project file.
getMultiProjectPath | Public method to get the multi project path.
getProject | Public method to get a reference to a project entry.
getProjects | Public method to get all project entries.
hasRemovedProjects | Public method to check for removed projects.
initActions | Public slot to initialize the multi project related actions.
initMenu | Public slot to initialize the multi project menu.
initToolbar | Public slot to initialize the multi project toolbar.
isDirty | Public method to return the dirty state.
isOpen | Public method to return the opened state.
openMultiProject | Public slot to open a multi project.
openProject | Public slot to open a project.
removeEricActions | Public method to remove actions from the list of actions.
removeProject | Public slot to remove a project from the multi project.
saveMultiProject | Public slot to save the current multi project.
saveMultiProjectAs | Public slot to save the current multi project to a different file.
setDirty | Public method to set the dirty state.

### Static Methods

None

#### MultiProject (Constructor)

MultiProject(project, parent=None, filename=None)

Constructor

project (Project.Project)
  reference to the project object
parent (QWidget)
  parent widget (usually the ui object)
filename (str)
  optional filename of a multi project file to open

#### MultiProject.__checkFilesExist

__checkFilesExist()

Private method to check, if the files in a list exist.

The project files are checked for existance in the filesystem. Non existant projects are removed from the list and the dirty state of the multi project is changed accordingly.

#### MultiProject.__extractCategories

__extractCategories()

Private slot to extract the categories used in the project definitions.

#### MultiProject.__initData

__initData()

Private method to initialize the multi project data part.

#### MultiProject.__loadRecent

__loadRecent()

Private method to load the recently opened multi project filenames.

#### MultiProject.__newMultiProject

__newMultiProject()

Private slot to build a new multi project.

This method displays the new multi project dialog and initializes the multi project object with the data entered.

#### MultiProject.__openMainProject

__openMainProject(reopen=True)

Private slot to open the main project.

reopen (bool)
  flag indicating, that the main project should be reopened, if it has been opened already

#### MultiProject.__openRecent

__openRecent(act)

Private method to open a multi project from the list of rencently opened multi projects.

act (QAction)
  reference to the action that triggered

#### MultiProject.__readMultiProject

__readMultiProject(fn)

Private method to read in a multi project (.emj) file.

fn (str)
  filename of the multi project file to be read

Return:
  flag indicating success

Return Type:
  bool

#### MultiProject.__saveRecent

__saveRecent()

Private method to save the list of recently opened filenames.

#### MultiProject.__showContextMenuRecent

__showContextMenuRecent()

Private method to set up the recent multi projects menu.

#### MultiProject.__showMenu

__showMenu()

Private method to set up the multi project menu.

#### MultiProject.__showProperties

__showProperties()

Private slot to display the properties dialog.

#### MultiProject.__syncRecent

__syncRecent()

Private method to synchronize the list of recently opened multi projects with the central store.

#### MultiProject.__writeMultiProject

__writeMultiProject(fn=None)

Private method to save the multi project infos to a multi project file.

fn (str)
  optional filename of the multi project file to be written. If fn is None, the filename stored in the multi project object is used. This is the 'save' action. If fn is given, this filename is used instead of the one in the multi project object. This is the 'save as' action.

Return:
  flag indicating success

Return Type:
  bool

#### MultiProject.addEricActions

addEricActions(actions)

Public method to add actions to the list of actions.

actions (list of EricAction)
  list of actions

#### MultiProject.addNewProject

addNewProject(startdir="", category="")

Public slot used to add a new project to the multi-project.

startdir (str)
  start directory for the selection dialog
category (str)
  category to be preset

#### MultiProject.addProject

addProject(project)

Public method to add a project to the multi-project.

project (MultiProjectProjectMeta)
  dictionary containing the project data to be added

#### MultiProject.changeProjectProperties

changeProjectProperties(pro)

Public method to change the data of a project entry.

pro (str)
  dictionary with the project data

#### MultiProject.checkDirty

checkDirty()

Public method to check the dirty status and open a message window.

Return:
  flag indicating whether this operation was successful

Return Type:
  bool

#### MultiProject.clearRecent

clearRecent()

Public method to clear the recent multi projects menu.

#### MultiProject.clearRemovedProjects

clearRemovedProjects()

Public slot to clear out all projects marked as removed.

#### MultiProject.closeMultiProject

closeMultiProject()

Public slot to close the current multi project.

Return:
  flag indicating success

Return Type:
  bool

#### MultiProject.copyProject

copyProject(uid)

Public method to copy the project with given UID on disk.

uid (str)
  UID of the project to copy

#### MultiProject.deleteProject

deleteProject(uid)

Public slot to delete project(s) from the multi project and disk.

uid (str)
  UID of the project to be removed from the multi project

#### MultiProject.getActions

getActions()

Public method to get a list of all actions.

Return:
  list of all actions

Return Type:
  list of EricAction

#### MultiProject.getCategories

getCategories()

Public method to get the list of defined categories.

Return:
  list of categories

Return Type:
  list of str

#### MultiProject.getDependantProjectFiles

getDependantProjectFiles()

Public method to get the filenames of the dependent projects.

Return:
  names of the dependent project files

Return Type:
  list of str

#### MultiProject.getMainProjectFile

getMainProjectFile()

Public method to get the filename of the main project.

Return:
  name of the main project file

Return Type:
  str

#### MultiProject.getMenu

getMenu(menuName)

Public method to get a reference to the main menu or a submenu.

menuName (str)
  name of the menu

Return:
  reference to the requested menu

Return Type:
  QMenu or None

#### MultiProject.getMostRecent

getMostRecent()

Public method to get the most recently opened multiproject.

Return:
  path of the most recently opened multiproject

Return Type:
  str

#### MultiProject.getMultiProjectFile

getMultiProjectFile()

Public method to get the path of the multi project file.

Return:
  path of the multi project file

Return Type:
  str

#### MultiProject.getMultiProjectPath

getMultiProjectPath()

Public method to get the multi project path.

Return:
  multi project path

Return Type:
  str

#### MultiProject.getProject

getProject(uid)

Public method to get a reference to a project entry.

uid (str)
  UID of the project to get

Return:
  project metadata

Return Type:
  MultiProjectProjectMeta

#### MultiProject.getProjects

getProjects()

Public method to get all project entries.

Return:
  list of all project entries

Return Type:
  list of MultiProjectProjectMeta

#### MultiProject.hasRemovedProjects

hasRemovedProjects()

Public method to check for removed projects.

Return:
  flag indicating the existence of a removed project

Return Type:
  bool

#### MultiProject.initActions

initActions()

Public slot to initialize the multi project related actions.

#### MultiProject.initMenu

initMenu()

Public slot to initialize the multi project menu.

Return:
  the menu generated

Return Type:
  QMenu

#### MultiProject.initToolbar

initToolbar(toolbarManager)

Public slot to initialize the multi project toolbar.

toolbarManager (EricToolBarManager)
  reference to a toolbar manager object

Return:
  the toolbar generated

Return Type:
  QToolBar

#### MultiProject.isDirty

isDirty()

Public method to return the dirty state.

Return:
  dirty state

Return Type:
  bool

#### MultiProject.isOpen

isOpen()

Public method to return the opened state.

Return:
  open state

Return Type:
  bool

#### MultiProject.openMultiProject

openMultiProject(fn=None, openMain=True)

Public slot to open a multi project.

fn (str)
  optional filename of the multi project file to be read
openMain (bool)
  flag indicating, that the main project should be opened depending on the configuration

#### MultiProject.openProject

openProject(filename)

Public slot to open a project.

filename (str)
  filename of the project file

#### MultiProject.removeEricActions

removeEricActions(actions)

Public method to remove actions from the list of actions.

actions (list of EricAction)
  list of actions

#### MultiProject.removeProject

removeProject(uid)

Public slot to remove a project from the multi project.

uid (str)
  UID of the project to be removed from the multi project

#### MultiProject.saveMultiProject

saveMultiProject()

Public slot to save the current multi project.

Return:
  flag indicating success

Return Type:
  bool

#### MultiProject.saveMultiProjectAs

saveMultiProjectAs()

Public slot to save the current multi project to a different file.

Return:
  flag indicating success

Return Type:
  bool

#### MultiProject.setDirty

setDirty(b)

Public method to set the dirty state.

It emits the signal dirty(int).

b (bool)
  dirty state

Up