2010-03-11 68 views
3

看看Stani's Python IDE,它肯定捆綁了大量有用的功能。除了它不讓我做自定義語法着色。Stani的python編輯器 - 更改語法着色

從作者的網站將q &答:

「 - 改變顏色,不支持,除非你手動編輯SM/WXP/stc.py」

所以我嘗試簽出編碼我自己在尋求完美的全功能IDE。

stc.py文件似乎是作者對Robin Dunn的wxPython原始代碼的修改。埋在所有事件處理中似乎是決定各種語法顏色的代碼。

我想要做的就是將背景顏色改爲黑色,將黑色文本改爲白色,如果在這兩種新顏色下還有其他東西出現,我就是一個快樂的編碼器。

有沒有人試過嗎?由於

編輯:約441〜

def SetStyles(self) 

的線是那些線了嗎?

編輯^ 2:有人能夠找到光標閃爍顏色設置以及?或者是有點「更」硬編碼?

編輯^ 3:到目前爲止,在函數SetStyles中修改行-441的十六進制顏色值。

def SetStyles(self): 
    # anti-aliasing 
    if hasattr(self,'SetUseAntiAliasing'): 
     self.SetUseAntiAliasing(True) 

    #INDICATOR STYLES FOR ERRORS (self.errorMark) 
    self.IndicatorSetStyle(2, wx_stc.STC_INDIC_SQUIGGLE) 
    self.IndicatorSetForeground(2, wx.RED) 

    #import dialogs.stcStyleEditor 
    if 1:#dialogs.stcStyleEditor.SetStyles(self, self.config): 
     self.StyleSetSpec(wx_stc.STC_P_DEFAULT, "face:%(mono)s,fore:#B0B0B0,size:%(size)d" % self.faces) 
     self.StyleClearAll() 

     # Global default styles for all languages B0B0B0= gray 
     self.StyleSetSpec(wx_stc.STC_STYLE_DEFAULT,  "face:%(mono)s,fore:#B0B0B0,back:#00000,size:%(size)d" % self.faces) 
     self.StyleSetSpec(wx_stc.STC_STYLE_LINENUMBER, "back:#C0C0C0,face:%(mono)s,size:%(size)d" % self.faces) 
     self.StyleSetSpec(wx_stc.STC_STYLE_CONTROLCHAR, "face:%(mono)s,fore:#B0B0B0" % self.faces) 
     self.StyleSetSpec(wx_stc.STC_STYLE_BRACELIGHT, "fore:#B0B0B0,back:#0000FF,bold") 
     self.StyleSetSpec(wx_stc.STC_STYLE_BRACEBAD, "fore:#B0B0B0,back:#FF0000,bold") 

     # Python styles 
     # White space 
     self.StyleSetSpec(wx_stc.STC_P_DEFAULT, "face:%(mono)s,fore:#000000,back:#000000,size:%(size)d" % self.faces) 
     # Comment 
     self.StyleSetSpec(wx_stc.STC_P_COMMENTLINE, "face:%(mono)s,fore:#F70909,back:#000000,italic,size:%(size)d" % self.faces) 
     # Number 
     self.StyleSetSpec(wx_stc.STC_P_NUMBER, "face:%(mono)s,fore:#FFFFFF,size:%(size)d" % self.faces) 
     # String 
     self.StyleSetSpec(wx_stc.STC_P_STRING, "face:%(mono)s,fore:#34C640,size:%(size)d" % self.faces) 
     # Single quoted string 
     self.StyleSetSpec(wx_stc.STC_P_CHARACTER, "face:%(mono)s,fore:#43AB4E,size:%(size)d" % self.faces) 
     # Keyword (Class, def, etc.) 
     self.StyleSetSpec(wx_stc.STC_P_WORD, "face:%(mono)s,fore:#FF9100,bold,size:%(size)d" % self.faces) 
     # Triple quotes 
     self.StyleSetSpec(wx_stc.STC_P_TRIPLE, "face:%(mono)s,fore:#7F0000,size:%(size)d" % self.faces) 
     # Triple double quotes 
     self.StyleSetSpec(wx_stc.STC_P_TRIPLEDOUBLE, "face:%(mono)s,fore:#7F0000,size:%(size)d" % self.faces) 
     # Class name definition (Name of the class) 
     self.StyleSetSpec(wx_stc.STC_P_CLASSNAME, "face:%(mono)s,fore:#00AEFF,bold,size:%(size)d" % self.faces) 
     # Function or method name definition (bright blue = #0011FF) 
     self.StyleSetSpec(wx_stc.STC_P_DEFNAME, "face:%(mono)s,fore:#FFFF00,bold,size:%(size)d" % self.faces) 
     # Operators (+ - /) 
     self.StyleSetSpec(wx_stc.STC_P_OPERATOR, "face:%(mono)s,fore:#FFFFFF,bold,size:%(size)d" % self.faces) 
     # Identifiers (this was all the same color - > self.SetTopWindow(self.frame)) 
     self.StyleSetSpec(wx_stc.STC_P_IDENTIFIER, "fore:#FFFFFF") 
     # Comment-blocks 
     self.StyleSetSpec(wx_stc.STC_P_COMMENTBLOCK, "face:%(mono)s,fore:#990000,back:#C0C0C0,italic,size:%(size)d" % self.faces) 
     # End of line where string is not closed 
     self.StyleSetSpec(wx_stc.STC_P_STRINGEOL, "face:%(mono)s,fore:#B1CCB0,face:%(mono)s,back:#E0C0E0,eol,size:%(size)d" % self.faces) 

這使用黑色背景並將其他顏色更改爲更亮。

問題尚存:

1.類標識符(「自我」,「類名」等)有顏色後的文字相同,但原來這就是如何一個「」是,不要認爲這是可以改變的(輕鬆,無論如何) 2.鼠標光標位置標記(閃爍的「|」)仍然是黑色的,在新的背景中變得不可見。 3.此應用程序是否支持鼠標懸停變量,並具有變量起源的描述?(如在pyscripter中)?

回答

0

我上面提到的代碼基本上解決了這個問題,所以我會解決這個問題。