Skip to content

Commit

Permalink
Use config for the colors and fix breaking tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexschw committed Dec 18, 2018
1 parent 8eebaa1 commit 5283444
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
8 changes: 8 additions & 0 deletions spyder/config/main.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@
'show_hscrollbar': True,
'visible_if_project_open': True
}),
('vcs',
{
'use_vcs_higlighting': True,
'color/untracked': "#ff0000",
'color/ignored': "#555555",
'color/modified': "#0099ff",
'color/added': "#00ff00",
}),
('explorer',
{
'enable': True,
Expand Down
7 changes: 4 additions & 3 deletions spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -1570,11 +1570,12 @@ def file_renamed_in_data_in_editorstack(self, editorstack_id_str,
for editorstack in self.editorstacks:
if str(id(editorstack)) != editorstack_id_str:
editorstack.rename_in_data(original_filename, filename)

@Slot(str, str)
def update_vcs_status(self, _, file):
path = osp.dirname(file)
self.projects.explorer.treewidget.fsmodel.setVCSState(path)
if self.projects is not None:
path = osp.dirname(file)
self.projects.explorer.treewidget.fsmodel.setVCSState(path)

#------ Handling editor windows
def setup_other_windows(self):
Expand Down
12 changes: 8 additions & 4 deletions spyder/plugins/explorer/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
QWidget)
# Local imports
from spyder.config.base import _, get_home_dir
from spyder.config.main import CONF
from spyder.py3compat import (str_lower, to_binary_string,
to_text_string)
from spyder.utils import icon_manager as ima
Expand Down Expand Up @@ -184,10 +185,13 @@ def icon(self, icontype_or_qfileinfo):
class ColorModel(QFileSystemModel):
"""FileSystemModel providing a color-code for different commit-status."""
def __init__(self, *args, **kwargs):
self.vcs_state = None
self.color_array = [QColor("#ff0000"), QColor("#555555"),
QColor("#0099ff"), QColor("#00ff00"),
QColor("#ffffff")]
self.vcs_state = []
normalstyle = CONF.get('appearance', 'selected') + '/normal'
self.color_array = [QColor(CONF.get('vcs', 'color/untracked')),
QColor(CONF.get('vcs', 'color/ignored')),
QColor(CONF.get('vcs', 'color/modified')),
QColor(CONF.get('vcs', 'color/added')),
QColor(CONF.get('appearance', normalstyle)[0])]
self.root_path = ''
super(ColorModel, self).__init__(*args, **kwargs)

Expand Down
5 changes: 2 additions & 3 deletions spyder/utils/vcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,9 @@ def get_vcs_status(path):
vcsst[fString[o:]] = index
return vcsst
else:
return None
return []
else:
return True
return
return []


def is_hg_installed():
Expand Down

0 comments on commit 5283444

Please sign in to comment.