13 from E5Gui.E5Application import e5App |
13 from E5Gui.E5Application import e5App |
14 |
14 |
15 from .AddProjectDialog import AddProjectDialog |
15 from .AddProjectDialog import AddProjectDialog |
16 |
16 |
17 import UI.PixmapCache |
17 import UI.PixmapCache |
|
18 |
18 |
19 |
19 class MultiProjectBrowser(QListWidget): |
20 class MultiProjectBrowser(QListWidget): |
20 """ |
21 """ |
21 Class implementing the multi project browser. |
22 Class implementing the multi project browser. |
22 """ |
23 """ |
23 def __init__(self, multiProject, parent = None): |
24 def __init__(self, multiProject, parent=None): |
24 """ |
25 """ |
25 Constructor |
26 Constructor |
26 |
27 |
27 @param project reference to the multi project object |
28 @param project reference to the multi project object |
28 @param parent parent widget (QWidget) |
29 @param parent parent widget (QWidget) |
106 def __projectOpened(self, projectfile): |
107 def __projectOpened(self, projectfile): |
107 """ |
108 """ |
108 Private slot to handle the opening of a project. |
109 Private slot to handle the opening of a project. |
109 """ |
110 """ |
110 project = { |
111 project = { |
111 'name' : "", |
112 'name': "", |
112 'file' : projectfile, |
113 'file': projectfile, |
113 'master' : False, |
114 'master': False, |
114 'description' : "", |
115 'description': "", |
115 } |
116 } |
116 row = self.__findProjectItem(project) |
117 row = self.__findProjectItem(project) |
117 if row > -1: |
118 if row > -1: |
118 self.item(row).setSelected(True) |
119 self.item(row).setSelected(True) |
119 |
120 |
127 if itm is None: |
128 if itm is None: |
128 self.__backMenu.popup(self.mapToGlobal(coord)) |
129 self.__backMenu.popup(self.mapToGlobal(coord)) |
129 else: |
130 else: |
130 self.__menu.popup(self.mapToGlobal(coord)) |
131 self.__menu.popup(self.mapToGlobal(coord)) |
131 |
132 |
132 def __openItem(self, itm = None): |
133 def __openItem(self, itm=None): |
133 """ |
134 """ |
134 Private slot to open a project. |
135 Private slot to open a project. |
135 |
136 |
136 @param itm reference to the project item to be opened (QListWidgetItem) |
137 @param itm reference to the project item to be opened (QListWidgetItem) |
137 """ |
138 """ |
207 if itm is not None: |
208 if itm is not None: |
208 filename = itm.data(Qt.UserRole) |
209 filename = itm.data(Qt.UserRole) |
209 if filename: |
210 if filename: |
210 project = self.multiProject.getProject(filename) |
211 project = self.multiProject.getProject(filename) |
211 if project is not None: |
212 if project is not None: |
212 dlg = AddProjectDialog(self, project = project) |
213 dlg = AddProjectDialog(self, project=project) |
213 if dlg.exec_() == QDialog.Accepted: |
214 if dlg.exec_() == QDialog.Accepted: |
214 name, filename, isMaster, description = dlg.getData() |
215 name, filename, isMaster, description = dlg.getData() |
215 project = { |
216 project = { |
216 'name' : name, |
217 'name': name, |
217 'file' : filename, |
218 'file': filename, |
218 'master' : isMaster, |
219 'master': isMaster, |
219 'description' : description, |
220 'description': description, |
220 } |
221 } |
221 self.multiProject.changeProjectProperties(project) |
222 self.multiProject.changeProjectProperties(project) |
222 |
223 |
223 def __createPopupMenu(self): |
224 def __createPopupMenu(self): |
224 """ |
225 """ |