3365 |
3365 |
3366 The normalized name is the name of the main script prepended with |
3366 The normalized name is the name of the main script prepended with |
3367 the project path. |
3367 the project path. |
3368 |
3368 |
3369 @param normalized flag indicating a normalized filename is wanted |
3369 @param normalized flag indicating a normalized filename is wanted |
3370 (boolean) |
3370 @type bool |
3371 @return filename of the projects main script (string) |
3371 @return filename of the projects main script |
|
3372 @rtype str |
3372 """ |
3373 """ |
3373 if self.pdata["MAINSCRIPT"]: |
3374 if self.pdata["MAINSCRIPT"]: |
3374 if normalized: |
3375 if normalized: |
3375 return os.path.join(self.ppath, self.pdata["MAINSCRIPT"]) |
3376 return os.path.join(self.ppath, self.pdata["MAINSCRIPT"]) |
3376 else: |
3377 else: |
3377 return self.pdata["MAINSCRIPT"] |
3378 return self.pdata["MAINSCRIPT"] |
3378 else: |
3379 else: |
3379 return None |
3380 return "" |
3380 |
3381 |
3381 def getSources(self, normalized=False): |
3382 def getSources(self, normalized=False): |
3382 """ |
3383 """ |
3383 Public method to return the source script files. |
3384 Public method to return the source script files. |
3384 |
3385 |
3385 @param normalized flag indicating a normalized filename is wanted |
3386 @param normalized flag indicating a normalized filename is wanted |
3386 (boolean) |
3387 @type bool |
3387 @return list of the projects scripts (list of string) |
3388 @return list of the projects scripts |
|
3389 @rtype list of str |
3388 """ |
3390 """ |
3389 return self.getProjectFiles("SOURCES", normalized=normalized) |
3391 return self.getProjectFiles("SOURCES", normalized=normalized) |
3390 |
3392 |
3391 def getProjectFiles(self, fileType, normalized=False): |
3393 def getProjectFiles(self, fileType, normalized=False): |
3392 """ |
3394 """ |
5066 self.tr( |
5068 self.tr( |
5067 "There is no main script defined for the" |
5069 "There is no main script defined for the" |
5068 " current project. Aborting")) |
5070 " current project. Aborting")) |
5069 return |
5071 return |
5070 |
5072 |
5071 # determine name of coverage file to be used |
5073 files = Utilities.getCoverageFileNames(fn) |
5072 files = [] |
|
5073 for filename in [fn] + Utilities.getTestFileNames(fn): |
|
5074 basename = os.path.splitext(filename)[0] |
|
5075 f = "{0}.coverage".format(basename) |
|
5076 if os.path.isfile(f): |
|
5077 files.append(f) |
|
5078 |
|
5079 if files: |
5074 if files: |
5080 if len(files) > 1: |
5075 if len(files) > 1: |
5081 fn, ok = QInputDialog.getItem( |
5076 fn, ok = QInputDialog.getItem( |
5082 None, |
5077 None, |
5083 self.tr("Code Coverage"), |
5078 self.tr("Code Coverage"), |
5111 self.tr( |
5106 self.tr( |
5112 "There is no main script defined for the" |
5107 "There is no main script defined for the" |
5113 " current project. Aborting")) |
5108 " current project. Aborting")) |
5114 return |
5109 return |
5115 |
5110 |
5116 # determine name of profile file to be used |
5111 files = Utilities.getProfileFileNames(fn) |
5117 files = [] |
|
5118 for filename in [fn] + Utilities.getTestFileNames(fn): |
|
5119 basename = os.path.splitext(filename)[0] |
|
5120 f = "{0}.profile".format(basename) |
|
5121 if os.path.isfile(f): |
|
5122 files.append(f) |
|
5123 |
|
5124 if files: |
5112 if files: |
5125 if len(files) > 1: |
5113 if len(files) > 1: |
5126 fn, ok = QInputDialog.getItem( |
5114 fn, ok = QInputDialog.getItem( |
5127 None, |
5115 None, |
5128 self.tr("Profile Data"), |
5116 self.tr("Profile Data"), |
5144 def __showContextMenuShow(self): |
5132 def __showContextMenuShow(self): |
5145 """ |
5133 """ |
5146 Private slot called before the show menu is shown. |
5134 Private slot called before the show menu is shown. |
5147 """ |
5135 """ |
5148 fn = self.getMainScript(True) |
5136 fn = self.getMainScript(True) |
5149 if fn is not None: |
5137 if not fn: |
5150 filenames = [os.path.splitext(f)[0] |
5138 fn = self.getProjectPath() |
5151 for f in [fn] + Utilities.getTestFileNames(fn)] |
5139 |
5152 self.codeProfileAct.setEnabled(any([ |
5140 self.codeProfileAct.setEnabled( |
5153 os.path.isfile("{0}.profile".format(f)) |
5141 self.isPy3Project() and |
5154 for f in filenames |
5142 bool(Utilities.getProfileFileName(fn)) |
5155 ])) |
5143 ) |
5156 self.codeCoverageAct.setEnabled( |
5144 self.codeCoverageAct.setEnabled( |
5157 self.isPy3Project() and any([ |
5145 self.isPy3Project() and |
5158 os.path.isfile("{0}.coverage".format(f)) |
5146 bool(Utilities.getCoverageFileNames(fn)) |
5159 for f in filenames |
5147 ) |
5160 ]) |
|
5161 ) |
|
5162 else: |
|
5163 self.codeProfileAct.setEnabled(False) |
|
5164 self.codeCoverageAct.setEnabled(False) |
|
5165 |
5148 |
5166 self.showMenu.emit("Show", self.menuShow) |
5149 self.showMenu.emit("Show", self.menuShow) |
5167 |
5150 |
5168 ######################################################################### |
5151 ######################################################################### |
5169 ## Below is the interface to the diagrams |
5152 ## Below is the interface to the diagrams |