MultiProject/MultiProject.py

changeset 2404
cba0ff902c2b
parent 2337
ba67938138b9
child 2525
8b507a9a2d40
child 2992
dbdf27746da5
equal deleted inserted replaced
2403:e3d7a861547c 2404:cba0ff902c2b
12 from PyQt4.QtCore import pyqtSignal, Qt, QFileInfo, QFile, QIODevice, QObject 12 from PyQt4.QtCore import pyqtSignal, Qt, QFileInfo, QFile, QIODevice, QObject
13 from PyQt4.QtGui import QMenu, QApplication, QDialog, QCursor, QToolBar 13 from PyQt4.QtGui import QMenu, QApplication, QDialog, QCursor, QToolBar
14 14
15 from Globals import recentNameMultiProject 15 from Globals import recentNameMultiProject
16 16
17 from .PropertiesDialog import PropertiesDialog
18 from .AddProjectDialog import AddProjectDialog
19
20 from E5Gui.E5Action import E5Action, createActionGroup 17 from E5Gui.E5Action import E5Action, createActionGroup
21 from E5Gui import E5FileDialog, E5MessageBox 18 from E5Gui import E5FileDialog, E5MessageBox
22
23 from E5XML.MultiProjectReader import MultiProjectReader
24 from E5XML.MultiProjectWriter import MultiProjectWriter
25 19
26 import UI.PixmapCache 20 import UI.PixmapCache
27 21
28 import Preferences 22 import Preferences
29 import Utilities 23 import Utilities
197 @param fn filename of the multi project file to be read (string) 191 @param fn filename of the multi project file to be read (string)
198 @return flag indicating success 192 @return flag indicating success
199 """ 193 """
200 f = QFile(fn) 194 f = QFile(fn)
201 if f.open(QIODevice.ReadOnly): 195 if f.open(QIODevice.ReadOnly):
196 from E5XML.MultiProjectReader import MultiProjectReader
202 reader = MultiProjectReader(f, self) 197 reader = MultiProjectReader(f, self)
203 reader.readXML() 198 reader.readXML()
204 f.close() 199 f.close()
205 if reader.hasError(): 200 if reader.hasError():
206 return False 201 return False
239 if fn is None: 234 if fn is None:
240 fn = self.pfile 235 fn = self.pfile
241 236
242 f = QFile(fn) 237 f = QFile(fn)
243 if f.open(QIODevice.WriteOnly): 238 if f.open(QIODevice.WriteOnly):
239 from E5XML.MultiProjectWriter import MultiProjectWriter
244 MultiProjectWriter(f, self, os.path.splitext(os.path.basename(fn))[0])\ 240 MultiProjectWriter(f, self, os.path.splitext(os.path.basename(fn))[0])\
245 .writeXML() 241 .writeXML()
246 res = True 242 res = True
247 else: 243 else:
248 E5MessageBox.critical(self.ui, 244 E5MessageBox.critical(self.ui,
266 """ 262 """
267 Public slot used to add files to the project. 263 Public slot used to add files to the project.
268 264
269 @param startdir start directory for the selection dialog (string) 265 @param startdir start directory for the selection dialog (string)
270 """ 266 """
267 from .AddProjectDialog import AddProjectDialog
271 if not startdir: 268 if not startdir:
272 startdir = self.ppath 269 startdir = self.ppath
273 if not startdir: 270 if not startdir:
274 startdir = Preferences.getMultiProject("Workspace") 271 startdir = Preferences.getMultiProject("Workspace")
275 dlg = AddProjectDialog(self.ui, startdir=startdir) 272 dlg = AddProjectDialog(self.ui, startdir=startdir)
369 the multi project object with the data entered. 366 the multi project object with the data entered.
370 """ 367 """
371 if not self.checkDirty(): 368 if not self.checkDirty():
372 return 369 return
373 370
371 from .PropertiesDialog import PropertiesDialog
374 dlg = PropertiesDialog(self, True) 372 dlg = PropertiesDialog(self, True)
375 if dlg.exec_() == QDialog.Accepted: 373 if dlg.exec_() == QDialog.Accepted:
376 self.closeMultiProject() 374 self.closeMultiProject()
377 dlg.storeData() 375 dlg.storeData()
378 self.opened = True 376 self.opened = True
385 383
386 def __showProperties(self): 384 def __showProperties(self):
387 """ 385 """
388 Private slot to display the properties dialog. 386 Private slot to display the properties dialog.
389 """ 387 """
388 from .PropertiesDialog import PropertiesDialog
390 dlg = PropertiesDialog(self, False) 389 dlg = PropertiesDialog(self, False)
391 if dlg.exec_() == QDialog.Accepted: 390 if dlg.exec_() == QDialog.Accepted:
392 dlg.storeData() 391 dlg.storeData()
393 self.setDirty(True) 392 self.setDirty(True)
394 self.multiProjectPropertiesChanged.emit() 393 self.multiProjectPropertiesChanged.emit()

eric ide

mercurial