diff --git a/docs/source/release/v5.1.0/ui.rst b/docs/source/release/v5.1.0/ui.rst index f54c0b9bf1b1fcfc515e9208e63ff8a7b360b5a6..70d20e76c38dfdb4c2c7f27a39a72da78115b811 100644 --- a/docs/source/release/v5.1.0/ui.rst +++ b/docs/source/release/v5.1.0/ui.rst @@ -19,6 +19,7 @@ See :doc:`mantidplot`. MantidWorkbench --------------- +- Fixed new tab names not incrementing correctly on KDE display environments (i.e. KUbuntu). See :doc:`mantidworkbench`. diff --git a/qt/python/mantidqt/widgets/codeeditor/multifileinterpreter.py b/qt/python/mantidqt/widgets/codeeditor/multifileinterpreter.py index 3def7f5f9db1b9594cad38d07b5942a111b6530e..b3188d316469410523145a6d4e9ae85fa4c35d15 100644 --- a/qt/python/mantidqt/widgets/codeeditor/multifileinterpreter.py +++ b/qt/python/mantidqt/widgets/codeeditor/multifileinterpreter.py @@ -69,7 +69,7 @@ class MultiPythonFileInterpreter(QWidget): if filename is None: title = NEW_TAB_TITLE i = 1 - while title in self.tab_titles: + while title in self.stripped_tab_titles: title = "{} ({})".format(NEW_TAB_TITLE, i) i += 1 return title, title @@ -77,8 +77,13 @@ class MultiPythonFileInterpreter(QWidget): return osp.basename(filename), filename @property - def tab_titles(self): - return [self._tabs.tabText(i).rstrip('*') for i in range(self.editor_count)] + def stripped_tab_titles(self): + tab_text = [self._tabs.tabText(i) for i in range(self.editor_count)] + tab_text = [txt.rstrip('*') for txt in tab_text] + # Some DEs (such as KDE) will automatically assign keyboard shortcuts using the Qt & annotation + # see Qt Docs - qtabwidget#addTab + tab_text = [txt.replace('&', '') for txt in tab_text] + return tab_text def closeEvent(self, event): self.deleteLater()