src/eric7/QScintilla/Editor.py

branch
eric7
changeset 9517
d73c3a1e432b
parent 9482
a2bc06a54d9d
child 9535
8b5402794fb6
equal deleted inserted replaced
9516:0f023e61a9b5 9517:d73c3a1e432b
603 self.__initOnlineChangeTrace() 603 self.__initOnlineChangeTrace()
604 604
605 if ( 605 if (
606 self.fileName 606 self.fileName
607 and self.project.isOpen() 607 and self.project.isOpen()
608 and self.project.isProjectSource(self.fileName) 608 and self.project.isProjectCategory(self.fileName, "SOURCES")
609 ): 609 ):
610 self.project.projectPropertiesChanged.connect( 610 self.project.projectPropertiesChanged.connect(
611 self.__projectPropertiesChanged 611 self.__projectPropertiesChanged
612 ) 612 )
613 613
5714 """ 5714 """
5715 prEnable = False 5715 prEnable = False
5716 coEnable = False 5716 coEnable = False
5717 5717
5718 # first check if the file belongs to a project 5718 # first check if the file belongs to a project
5719 if self.project.isOpen() and self.project.isProjectSource(self.fileName): 5719 if self.project.isOpen() and self.project.isProjectCategory(
5720 self.fileName, "SOURCES"
5721 ):
5720 fn = self.project.getMainScript(True) 5722 fn = self.project.getMainScript(True)
5721 if fn is not None: 5723 if fn is not None:
5722 prEnable = self.project.isPy3Project() and bool( 5724 prEnable = self.project.isPy3Project() and bool(
5723 Utilities.getProfileFileNames(fn) 5725 Utilities.getProfileFileNames(fn)
5724 ) 5726 )
5754 def __showContextMenuGraphics(self): 5756 def __showContextMenuGraphics(self):
5755 """ 5757 """
5756 Private slot handling the aboutToShow signal of the diagrams context 5758 Private slot handling the aboutToShow signal of the diagrams context
5757 menu. 5759 menu.
5758 """ 5760 """
5759 if self.project.isOpen() and self.project.isProjectSource(self.fileName): 5761 if self.project.isOpen() and self.project.isProjectCategory(
5762 self.fileName, "SOURCES"
5763 ):
5760 self.applicationDiagramMenuAct.setEnabled(True) 5764 self.applicationDiagramMenuAct.setEnabled(True)
5761 else: 5765 else:
5762 self.applicationDiagramMenuAct.setEnabled(False) 5766 self.applicationDiagramMenuAct.setEnabled(False)
5763 5767
5764 self.showMenu.emit("Graphics", self.graphicsMenu, self) 5768 self.showMenu.emit("Graphics", self.graphicsMenu, self)
6138 # return the path of a previously used coverage file 6142 # return the path of a previously used coverage file
6139 return self.__coverageFile 6143 return self.__coverageFile
6140 6144
6141 # first check if the file belongs to a project and there is 6145 # first check if the file belongs to a project and there is
6142 # a project coverage file 6146 # a project coverage file
6143 if self.project.isOpen() and self.project.isProjectSource(self.fileName): 6147 if self.project.isOpen() and self.project.isProjectCategory(
6148 self.fileName, "SOURCES"
6149 ):
6144 pfn = self.project.getMainScript(True) 6150 pfn = self.project.getMainScript(True)
6145 if pfn is not None: 6151 if pfn is not None:
6146 files |= set(Utilities.getCoverageFileNames(pfn)) 6152 files |= set(Utilities.getCoverageFileNames(pfn))
6147 6153
6148 # now check, if there are coverage files belonging to ourselves 6154 # now check, if there are coverage files belonging to ourselves
6315 6321
6316 files = set() 6322 files = set()
6317 6323
6318 # first check if the file belongs to a project and there is 6324 # first check if the file belongs to a project and there is
6319 # a project profile file 6325 # a project profile file
6320 if self.project.isOpen() and self.project.isProjectSource(self.fileName): 6326 if self.project.isOpen() and self.project.isProjectCategory(
6327 self.fileName, "SOURCES"
6328 ):
6321 fn = self.project.getMainScript(True) 6329 fn = self.project.getMainScript(True)
6322 if fn is not None: 6330 if fn is not None:
6323 files |= set(Utilities.getProfileFileNames(fn)) 6331 files |= set(Utilities.getProfileFileNames(fn))
6324 6332
6325 # now check, if there are profile files belonging to ourselves 6333 # now check, if there are profile files belonging to ourselves
7905 7913
7906 def projectOpened(self): 7914 def projectOpened(self):
7907 """ 7915 """
7908 Public slot to handle the opening of a project. 7916 Public slot to handle the opening of a project.
7909 """ 7917 """
7910 if self.fileName and self.project.isProjectSource(self.fileName): 7918 if self.fileName and self.project.isProjectCategory(self.fileName, "SOURCES"):
7911 self.project.projectPropertiesChanged.connect( 7919 self.project.projectPropertiesChanged.connect(
7912 self.__projectPropertiesChanged 7920 self.__projectPropertiesChanged
7913 ) 7921 )
7914 self.setSpellingForProject() 7922 self.setSpellingForProject()
7915 7923
7978 to the current project. 7986 to the current project.
7979 """ 7987 """
7980 if ( 7988 if (
7981 self.fileName 7989 self.fileName
7982 and self.project.isOpen() 7990 and self.project.isOpen()
7983 and self.project.isProjectSource(self.fileName) 7991 and self.project.isProjectCategory(self.fileName, "SOURCES")
7984 ): 7992 ):
7985 pwl, pel = self.project.getProjectDictionaries() 7993 pwl, pel = self.project.getProjectDictionaries()
7986 self.__setSpellingLanguage( 7994 self.__setSpellingLanguage(
7987 self.project.getProjectSpellLanguage(), pwl=pwl, pel=pel 7995 self.project.getProjectSpellLanguage(), pwl=pwl, pel=pel
7988 ) 7996 )
9101 9109
9102 if not self.isModified() or self.saveFile(): 9110 if not self.isModified() or self.saveFile():
9103 withProject = ( 9111 withProject = (
9104 self.fileName 9112 self.fileName
9105 and self.project.isOpen() 9113 and self.project.isOpen()
9106 and self.project.isProjectSource(self.fileName) 9114 and self.project.isProjectCategory(self.fileName, "SOURCES")
9107 ) 9115 )
9108 dlg = BlackConfigurationDialog(withProject=withProject) 9116 dlg = BlackConfigurationDialog(withProject=withProject)
9109 if dlg.exec() == QDialog.DialogCode.Accepted: 9117 if dlg.exec() == QDialog.DialogCode.Accepted:
9110 config = dlg.getConfiguration() 9118 config = dlg.getConfiguration()
9111 9119
9137 9145
9138 if not self.isModified() or self.saveFile(): 9146 if not self.isModified() or self.saveFile():
9139 withProject = ( 9147 withProject = (
9140 self.fileName 9148 self.fileName
9141 and self.project.isOpen() 9149 and self.project.isOpen()
9142 and self.project.isProjectSource(self.fileName) 9150 and self.project.isProjectCategory(self.fileName, "SOURCES")
9143 ) 9151 )
9144 dlg = IsortConfigurationDialog(withProject=withProject) 9152 dlg = IsortConfigurationDialog(withProject=withProject)
9145 if dlg.exec() == QDialog.DialogCode.Accepted: 9153 if dlg.exec() == QDialog.DialogCode.Accepted:
9146 config = dlg.getConfiguration() 9154 config = dlg.getConfiguration()
9147 9155

eric ide

mercurial