Project/Project.py

changeset 2427
46481fe988d2
parent 2408
dc3a7c9d8f6e
child 2440
9a2d05a2f6d2
equal deleted inserted replaced
2426:da76c71624de 2427:46481fe988d2
17 import re 17 import re
18 18
19 from PyQt4.QtCore import QFile, QFileInfo, pyqtSignal, QCryptographicHash, QIODevice, \ 19 from PyQt4.QtCore import QFile, QFileInfo, pyqtSignal, QCryptographicHash, QIODevice, \
20 QByteArray, QObject, Qt 20 QByteArray, QObject, Qt
21 from PyQt4.QtGui import QCursor, QLineEdit, QToolBar, QDialog, QInputDialog, \ 21 from PyQt4.QtGui import QCursor, QLineEdit, QToolBar, QDialog, QInputDialog, \
22 QApplication, QMenu 22 QApplication, QMenu, QAction
23 23
24 from E5Gui.E5Application import e5App 24 from E5Gui.E5Application import e5App
25 from E5Gui import E5FileDialog, E5MessageBox 25 from E5Gui import E5FileDialog, E5MessageBox
26 26
27 from Globals import recentNameProject 27 from Globals import recentNameProject
803 E5MessageBox.critical(self.ui, 803 E5MessageBox.critical(self.ui,
804 self.trUtf8("Save user project properties"), 804 self.trUtf8("Save user project properties"),
805 self.trUtf8("<p>The user specific project properties file <b>{0}</b>" 805 self.trUtf8("<p>The user specific project properties file <b>{0}</b>"
806 " could not be written.</p>").format(fn)) 806 " could not be written.</p>").format(fn))
807 807
808 def __showContextMenuSession(self):
809 """
810 Private slot called before the Session menu is shown.
811 """
812 enable = True
813 if self.pfile is None:
814 enable = False
815 else:
816 fn, ext = os.path.splitext(os.path.basename(self.pfile))
817 fn = os.path.join(self.getProjectManagementDir(),
818 '{0}.e4s'.format(fn))
819 enable = os.path.exists(fn)
820 self.sessActGrp.findChild(QAction, "project_load_session").setEnabled(enable)
821 self.sessActGrp.findChild(QAction, "project_delete_session").setEnabled(enable)
822
823
808 def __readSession(self, quiet=False, indicator=""): 824 def __readSession(self, quiet=False, indicator=""):
809 """ 825 """
810 Private method to read in the project session file (.e4s) 826 Private method to read in the project session file (.e4s)
811 827
812 @param quiet flag indicating quiet operations. 828 @param quiet flag indicating quiet operations.
936 return 952 return
937 953
938 from E5XML.TasksWriter import TasksWriter 954 from E5XML.TasksWriter import TasksWriter
939 TasksWriter(f, True, os.path.splitext(os.path.basename(fn))[0]).writeXML() 955 TasksWriter(f, True, os.path.splitext(os.path.basename(fn))[0]).writeXML()
940 f.close() 956 f.close()
957
958 def __showContextMenuDebugger(self):
959 """
960 Private slot called before the Debugger menu is shown.
961 """
962 enable = True
963 if self.pfile is None:
964 enable = False
965 else:
966 fn, ext = os.path.splitext(os.path.basename(self.pfile))
967 fn = os.path.join(self.getProjectManagementDir(),
968 '{0}.e4d'.format(fn))
969 enable = os.path.exists(fn)
970 self.dbgActGrp.findChild(QAction, "project_debugger_properties_load")\
971 .setEnabled(enable)
972 self.dbgActGrp.findChild(QAction, "project_debugger_properties_delete")\
973 .setEnabled(enable)
941 974
942 def __readDebugProperties(self, quiet=False): 975 def __readDebugProperties(self, quiet=False):
943 """ 976 """
944 Private method to read in the project debugger properties file (.e4d) 977 Private method to read in the project debugger properties file (.e4d)
945 978
3481 self.checksMenu.aboutToShow.connect(self.__showContextMenuChecks) 3514 self.checksMenu.aboutToShow.connect(self.__showContextMenuChecks)
3482 self.menuShow.aboutToShow.connect(self.__showContextMenuShow) 3515 self.menuShow.aboutToShow.connect(self.__showContextMenuShow)
3483 self.graphicsMenu.aboutToShow.connect(self.__showContextMenuGraphics) 3516 self.graphicsMenu.aboutToShow.connect(self.__showContextMenuGraphics)
3484 self.apidocMenu.aboutToShow.connect(self.__showContextMenuApiDoc) 3517 self.apidocMenu.aboutToShow.connect(self.__showContextMenuApiDoc)
3485 self.packagersMenu.aboutToShow.connect(self.__showContextMenuPackagers) 3518 self.packagersMenu.aboutToShow.connect(self.__showContextMenuPackagers)
3519 self.sessionMenu.aboutToShow.connect(self.__showContextMenuSession)
3520 self.debuggerMenu.aboutToShow.connect(self.__showContextMenuDebugger)
3486 menu.aboutToShow.connect(self.__showMenu) 3521 menu.aboutToShow.connect(self.__showMenu)
3487 3522
3488 # build the show menu 3523 # build the show menu
3489 self.menuShow.setTearOffEnabled(True) 3524 self.menuShow.setTearOffEnabled(True)
3490 self.menuShow.addAction(self.codeMetricsAct) 3525 self.menuShow.addAction(self.codeMetricsAct)

eric ide

mercurial