Skip to content
Snippets Groups Projects
Commit d3cb3bf1 authored by David Fairbrother's avatar David Fairbrother
Browse files

Re #28445 Create new tab names correctly on KDE

Creates new tab names correctly on non-GNOME enrionvments for Ubuntu.
KDE automatically binds keyboard shortcuts, which Qt represents with &x
(where x is the shortcut). This breaks the name lookup as &New != New in
"New Tab".

We now strip out these characters when looking up the names fixing the
names not incrementing correctly.
parent d90e135d
No related branches found
No related tags found
No related merge requests found
......@@ -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`.
......
......@@ -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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment