Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove icons from tabs for the Editor and IPython Console #3356

Merged
merged 5 commits into from
Aug 22, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 2 additions & 9 deletions spyderlib/plugins/history.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
# Third party imports
from qtpy import PYQT5
from qtpy.QtCore import Signal, Slot
from qtpy.QtWidgets import (QFontDialog, QGroupBox, QHBoxLayout, QInputDialog,
QMenu, QToolButton, QVBoxLayout, QWidget)
from qtpy.QtWidgets import (QGroupBox, QHBoxLayout, QInputDialog, QMenu,
QToolButton, QVBoxLayout, QWidget)


# Local imports
Expand Down Expand Up @@ -78,7 +78,6 @@ def __init__(self, parent):

self.editors = []
self.filenames = []
self.icons = []
if PYQT5:
SpyderPluginWidget.__init__(self, parent, main = parent)
else:
Expand Down Expand Up @@ -203,11 +202,9 @@ def move_tab(self, index_from, index_to):
"""
filename = self.filenames.pop(index_from)
editor = self.editors.pop(index_from)
icon = self.icons.pop(index_from)

self.filenames.insert(index_to, filename)
self.editors.insert(index_to, editor)
self.icons.insert(index_to, icon)

#------ Public API ---------------------------------------------------------
def add_history(self, filename):
Expand All @@ -221,10 +218,8 @@ def add_history(self, filename):
editor = codeeditor.CodeEditor(self)
if osp.splitext(filename)[1] == '.py':
language = 'py'
icon = ima.icon('python')
else:
language = 'bat'
icon = ima.icon('cmdprompt')
editor.setup_editor(linenumbers=False, language=language,
scrollflagarea=False)
editor.focus_changed.connect(lambda: self.focus_changed.emit())
Expand All @@ -239,11 +234,9 @@ def add_history(self, filename):

self.editors.append(editor)
self.filenames.append(filename)
self.icons.append(icon)
index = self.tabwidget.addTab(editor, osp.basename(filename))
self.find_widget.set_editor(editor)
self.tabwidget.setTabToolTip(index, filename)
self.tabwidget.setTabIcon(index, icon)
self.tabwidget.setCurrentIndex(index)

def append_to_history(self, filename, command):
Expand Down
3 changes: 1 addition & 2 deletions spyderlib/plugins/ipythonconsole.py
Original file line number Diff line number Diff line change
Expand Up @@ -1160,8 +1160,7 @@ def get_shellwidget_by_kernelwidget_id(self, kernel_id):
def add_tab(self, widget, name):
"""Add tab"""
self.clients.append(widget)
index = self.tabwidget.addTab(widget, ima.icon('ipython_console'),
name)
index = self.tabwidget.addTab(widget, name)
self.tabwidget.setCurrentIndex(index)
if self.dockwidget and not self.ismaximized:
self.dockwidget.setVisible(True)
Expand Down
10 changes: 3 additions & 7 deletions spyderlib/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
from spyderlib.config.gui import (config_shortcut, fixed_shortcut,
RUN_CELL_SHORTCUT,
RUN_CELL_AND_ADVANCE_SHORTCUT)
from spyderlib.config.utils import get_edit_extensions
from spyderlib.py3compat import qbytearray_to_str, to_text_string, u
from spyderlib.utils import icon_manager as ima
from spyderlib.utils import (codeanalysis, encoding, sourcecode,
syntaxhighlighters)
from spyderlib.utils.qthelpers import (add_actions, create_action,
create_toolbutton, get_filetype_icon,
mimedata2url)
create_toolbutton, mimedata2url)
from spyderlib.widgets.editortools import OutlineExplorerWidget
from spyderlib.widgets.fileswitcher import FileSwitcher
from spyderlib.widgets.findreplace import FindReplace
Expand Down Expand Up @@ -978,8 +976,7 @@ def add_to_data(self, finfo, set_current):
self.data.sort(key=self.__get_sorting_func())
index = self.data.index(finfo)
fname, editor = finfo.filename, finfo.editor
self.tabs.insertTab(index, editor, get_filetype_icon(fname),
self.get_tab_text(fname))
self.tabs.insertTab(index, editor, self.get_tab_text(fname))
self.set_stack_title(index, False)
if set_current:
self.set_stack_index(index)
Expand All @@ -991,14 +988,13 @@ def __repopulate_stack(self):
self.tabs.blockSignals(True)
self.tabs.clear()
for finfo in self.data:
icon = get_filetype_icon(finfo.filename)
if finfo.newly_created:
is_modified = True
else:
is_modified = None
tab_text = self.get_tab_text(finfo.filename, is_modified)
tab_tip = self.get_tab_tip(finfo.filename)
index = self.tabs.addTab(finfo.editor, icon, tab_text)
index = self.tabs.addTab(finfo.editor, tab_text)
self.tabs.setTabToolTip(index, tab_tip)
self.tabs.blockSignals(False)
self.update_fileswitcher_dlg()
Expand Down
6 changes: 3 additions & 3 deletions spyderlib/widgets/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def __init__(self, parent, actions=None, menu=None,
corner_widgets[Qt.TopLeftCorner] += [self.browse_button]

self.set_corner_widgets(corner_widgets)

def update_browse_tabs_menu(self):
"""Update browse tabs menu"""
self.browse_tabs_menu.clear()
Expand All @@ -178,7 +178,7 @@ def update_browse_tabs_menu(self):
if offset <= 3:
# Common path is not a path but a drive letter...
offset = None

for index, text in enumerate(names):
tab_action = create_action(self, text[offset:],
icon=self.tabIcon(index),
Expand All @@ -187,7 +187,7 @@ def update_browse_tabs_menu(self):
tip=self.tabToolTip(index))
tab_action.setChecked(index == self.currentIndex())
self.browse_tabs_menu.addAction(tab_action)

def set_corner_widgets(self, corner_widgets):
"""
Set tabs corner widgets
Expand Down