5066 self.tr( |
5066 self.tr( |
5067 "There is no main script defined for the" |
5067 "There is no main script defined for the" |
5068 " current project. Aborting")) |
5068 " current project. Aborting")) |
5069 return |
5069 return |
5070 |
5070 |
5071 tfn = Utilities.getTestFileName(fn) |
|
5072 basename = os.path.splitext(fn)[0] |
|
5073 tbasename = os.path.splitext(tfn)[0] |
|
5074 |
|
5075 # determine name of coverage file to be used |
5071 # determine name of coverage file to be used |
5076 files = [] |
5072 files = [] |
5077 f = "{0}.coverage".format(basename) |
5073 for filename in [fn] + Utilities.getTestFileNames(fn): |
5078 tf = "{0}.coverage".format(tbasename) |
5074 basename = os.path.splitext(filename)[0] |
5079 if os.path.isfile(f): |
5075 f = "{0}.coverage".format(basename) |
5080 files.append(f) |
5076 if os.path.isfile(f): |
5081 if os.path.isfile(tf): |
5077 files.append(f) |
5082 files.append(tf) |
|
5083 |
5078 |
5084 if files: |
5079 if files: |
5085 if len(files) > 1: |
5080 if len(files) > 1: |
5086 fn, ok = QInputDialog.getItem( |
5081 fn, ok = QInputDialog.getItem( |
5087 None, |
5082 None, |
5116 self.tr( |
5111 self.tr( |
5117 "There is no main script defined for the" |
5112 "There is no main script defined for the" |
5118 " current project. Aborting")) |
5113 " current project. Aborting")) |
5119 return |
5114 return |
5120 |
5115 |
5121 tfn = Utilities.getTestFileName(fn) |
|
5122 basename = os.path.splitext(fn)[0] |
|
5123 tbasename = os.path.splitext(tfn)[0] |
|
5124 |
|
5125 # determine name of profile file to be used |
5116 # determine name of profile file to be used |
5126 files = [] |
5117 files = [] |
5127 f = "{0}.profile".format(basename) |
5118 for filename in [fn] + Utilities.getTestFileNames(fn): |
5128 tf = "{0}.profile".format(tbasename) |
5119 basename = os.path.splitext(filename)[0] |
5129 if os.path.isfile(f): |
5120 f = "{0}.profile".format(basename) |
5130 files.append(f) |
5121 if os.path.isfile(f): |
5131 if os.path.isfile(tf): |
5122 files.append(f) |
5132 files.append(tf) |
|
5133 |
5123 |
5134 if files: |
5124 if files: |
5135 if len(files) > 1: |
5125 if len(files) > 1: |
5136 fn, ok = QInputDialog.getItem( |
5126 fn, ok = QInputDialog.getItem( |
5137 None, |
5127 None, |
5155 """ |
5145 """ |
5156 Private slot called before the show menu is shown. |
5146 Private slot called before the show menu is shown. |
5157 """ |
5147 """ |
5158 fn = self.getMainScript(True) |
5148 fn = self.getMainScript(True) |
5159 if fn is not None: |
5149 if fn is not None: |
5160 tfn = Utilities.getTestFileName(fn) |
5150 filenames = [os.path.splitext(f)[0] |
5161 basename = os.path.splitext(fn)[0] |
5151 for f in [fn] + Utilities.getTestFileNames(fn)] |
5162 tbasename = os.path.splitext(tfn)[0] |
5152 self.codeProfileAct.setEnabled(any([ |
5163 self.codeProfileAct.setEnabled( |
5153 os.path.isfile("{0}.profile".format(f)) |
5164 os.path.isfile("{0}.profile".format(basename)) or |
5154 for f in filenames |
5165 os.path.isfile("{0}.profile".format(tbasename))) |
5155 ])) |
5166 self.codeCoverageAct.setEnabled( |
5156 self.codeCoverageAct.setEnabled( |
5167 self.isPy3Project() and |
5157 self.isPy3Project() and any([ |
5168 (os.path.isfile("{0}.coverage".format(basename)) or |
5158 os.path.isfile("{0}.coverage".format(f)) |
5169 os.path.isfile("{0}.coverage".format(tbasename)))) |
5159 for f in filenames |
|
5160 ]) |
|
5161 ) |
5170 else: |
5162 else: |
5171 self.codeProfileAct.setEnabled(False) |
5163 self.codeProfileAct.setEnabled(False) |
5172 self.codeCoverageAct.setEnabled(False) |
5164 self.codeCoverageAct.setEnabled(False) |
5173 |
5165 |
5174 self.showMenu.emit("Show", self.menuShow) |
5166 self.showMenu.emit("Show", self.menuShow) |