Commit e16d94b7 authored by Steven M. Gava's avatar Steven M. Gava

more work to support new config system

parent dedbe255
......@@ -4,7 +4,7 @@ import re
import keyword
from Tkinter import *
from Delegator import Delegator
from IdleConf import idleconf
from configHandler import idleConf
#$ event <<toggle-auto-coloring>>
#$ win <Control-slash>
......@@ -53,19 +53,21 @@ class ColorDelegator(Delegator):
apply(self.tag_configure, (tag,), cnf)
self.tag_raise('sel')
cconf = idleconf.getsection('Colors')
theme = idleConf.GetOption('main','Theme','name')
tagdefs = {
"COMMENT": cconf.getcolor("comment"),
"KEYWORD": cconf.getcolor("keyword"),
"STRING": cconf.getcolor("string"),
"DEFINITION": cconf.getcolor("definition"),
"SYNC": cconf.getcolor("sync"),
"TODO": cconf.getcolor("todo"),
"BREAK": cconf.getcolor("break"),
"COMMENT": idleConf.GetHighlight(theme, "comment"),
"KEYWORD": idleConf.GetHighlight(theme, "keyword"),
"STRING": idleConf.GetHighlight(theme, "string"),
"DEFINITION": idleConf.GetHighlight(theme, "definition"),
"SYNC": idleConf.GetHighlight(theme, "sync"),
"TODO": idleConf.GetHighlight(theme, "todo"),
"BREAK": idleConf.GetHighlight(theme, "break"),
# The following is used by ReplaceDialog:
"hit": cconf.getcolor("hit"),
"hit": idleConf.GetHighlight(theme, "hit"),
}
print tagdefs
def insert(self, index, chars, tags=None):
index = self.index(index)
......
This diff is collapsed.
......@@ -49,14 +49,6 @@ class IdleConfParser(ConfigParser):
else: #return a default value
return []
def GetHighlight(self, theme, element):
fore = self.Get(theme, element + "-foreground")
back = self.Get(theme, element + "-background")
style = self.Ge(theme, element + "-fontStyle", default='')
return {"fg": fore,
"bg": back,
"fStyle": style}
def Load(self):
"""
Load the configuration file from disk
......@@ -160,7 +152,12 @@ class IdleConf:
return cfgParser.sections()
def GetHighlight(self, theme, element):
fore = self.GetOption('highlight', theme, element + "-foreground")
back = self.GetOption('highlight', theme, element + "-background")
return {"foreground": fore,
"background": back}
def GetTheme(self, name=None):
"""
Gets the requested theme or returns a final fallback theme in case
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment