# 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 data dict)
  emitted after a project entry has been added
projectDataChanged(project data dict)
  emitted after a project entry has been changed
projectOpened(filename)
  emitted after the project has been opened
projectRemoved(project data dict)
  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.
__openMasterProject | Private slot to open the master 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, .e4m, .e5m) 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.
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.
getMasterProjectFile | Public method to get the filename of the master 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.
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
  reference to the project object (Project.Project)
parent
  parent widget (usually the ui object) (QWidget)
filename
  optional filename of a multi project file to open (string)

#### 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.__openMasterProject

__openMasterProject(reopen=True)

Private slot to open the master project.

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

#### MultiProject.__openRecent

__openRecent(act)

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

act
  reference to the action that triggered (QAction)

#### MultiProject.__readMultiProject

__readMultiProject(fn)

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

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

Return:
  flag indicating success

#### 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
  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

#### MultiProject.addEricActions

addEricActions(actions)

Public method to add actions to the list of actions.

actions
  list of actions (list of EricAction)

#### 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 (dict)
  dictionary containing the project data to be added

#### MultiProject.changeProjectProperties

changeProjectProperties(pro)

Public method to change the data of a project entry.

pro
  dictionary with the project data (string)

#### MultiProject.checkDirty

checkDirty()

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

Return:
  flag indicating whether this operation was successful (boolean)

#### MultiProject.clearRecent

clearRecent()

Public method to clear the recent multi projects menu.

#### MultiProject.closeMultiProject

closeMultiProject()

Public slot to close the current multi project.

Return:
  flag indicating success (boolean)

#### 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 (list of EricAction)

#### MultiProject.getCategories

getCategories()

Public method to get the list of defined categories.

Return:
  list of categories (list of string)

#### MultiProject.getDependantProjectFiles

getDependantProjectFiles()

Public method to get the filenames of the dependent projects.

Return:
  names of the dependent project files (list of strings)

#### MultiProject.getMasterProjectFile

getMasterProjectFile()

Public method to get the filename of the master project.

Return:
  name of the master project file (string)

#### MultiProject.getMenu

getMenu(menuName)

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

menuName
  name of the menu (string)

Return:
  reference to the requested menu (QMenu) or None

#### MultiProject.getMostRecent

getMostRecent()

Public method to get the most recently opened multiproject.

Return:
  path of the most recently opened multiproject (string)

#### MultiProject.getMultiProjectFile

getMultiProjectFile()

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

Return:
  path of the multi project file (string)

#### MultiProject.getMultiProjectPath

getMultiProjectPath()

Public method to get the multi project path.

Return:
  multi project path (string)

#### MultiProject.getProject

getProject(uid)

Public method to get a reference to a project entry.

uid (str)
  UID of the project to get

Return:
  dictionary containing the project data

Return Type:
  dict

#### MultiProject.getProjects

getProjects()

Public method to get all project entries.

Return:
  list of all project entries (list of dictionaries)

#### 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 (QMenu)

#### MultiProject.initToolbar

initToolbar(toolbarManager)

Public slot to initialize the multi project toolbar.

toolbarManager
  reference to a toolbar manager object (EricToolBarManager)

Return:
  the toolbar generated (QToolBar)

#### MultiProject.isDirty

isDirty()

Public method to return the dirty state.

Return:
  dirty state (boolean)

#### MultiProject.isOpen

isOpen()

Public method to return the opened state.

Return:
  open state (boolean)

#### MultiProject.openMultiProject

openMultiProject(fn=None, openMaster=True)

Public slot to open a multi project.

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

#### MultiProject.openProject

openProject(filename)

Public slot to open a project.

filename
  filename of the project file (string)

#### MultiProject.removeEricActions

removeEricActions(actions)

Public method to remove actions from the list of actions.

actions
  list of actions (list of EricAction)

#### 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
  dirty state (boolean)

Up