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 ...@@ -4,7 +4,7 @@ import re
import keyword import keyword
from Tkinter import * from Tkinter import *
from Delegator import Delegator from Delegator import Delegator
from IdleConf import idleconf from configHandler import idleConf
#$ event <<toggle-auto-coloring>> #$ event <<toggle-auto-coloring>>
#$ win <Control-slash> #$ win <Control-slash>
...@@ -53,19 +53,21 @@ class ColorDelegator(Delegator): ...@@ -53,19 +53,21 @@ class ColorDelegator(Delegator):
apply(self.tag_configure, (tag,), cnf) apply(self.tag_configure, (tag,), cnf)
self.tag_raise('sel') self.tag_raise('sel')
cconf = idleconf.getsection('Colors') theme = idleConf.GetOption('main','Theme','name')
tagdefs = { tagdefs = {
"COMMENT": cconf.getcolor("comment"), "COMMENT": idleConf.GetHighlight(theme, "comment"),
"KEYWORD": cconf.getcolor("keyword"), "KEYWORD": idleConf.GetHighlight(theme, "keyword"),
"STRING": cconf.getcolor("string"), "STRING": idleConf.GetHighlight(theme, "string"),
"DEFINITION": cconf.getcolor("definition"), "DEFINITION": idleConf.GetHighlight(theme, "definition"),
"SYNC": cconf.getcolor("sync"), "SYNC": idleConf.GetHighlight(theme, "sync"),
"TODO": cconf.getcolor("todo"), "TODO": idleConf.GetHighlight(theme, "todo"),
"BREAK": cconf.getcolor("break"), "BREAK": idleConf.GetHighlight(theme, "break"),
# The following is used by ReplaceDialog: # The following is used by ReplaceDialog:
"hit": cconf.getcolor("hit"), "hit": idleConf.GetHighlight(theme, "hit"),
} }
print tagdefs
def insert(self, index, chars, tags=None): def insert(self, index, chars, tags=None):
index = self.index(index) index = self.index(index)
......
This diff is collapsed.
...@@ -49,14 +49,6 @@ class IdleConfParser(ConfigParser): ...@@ -49,14 +49,6 @@ class IdleConfParser(ConfigParser):
else: #return a default value else: #return a default value
return [] 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): def Load(self):
""" """
Load the configuration file from disk Load the configuration file from disk
...@@ -160,7 +152,12 @@ class IdleConf: ...@@ -160,7 +152,12 @@ class IdleConf:
return cfgParser.sections() 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): def GetTheme(self, name=None):
""" """
Gets the requested theme or returns a final fallback theme in case 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