On Oct 26, 3:23 pm, "Edward K. Ream" <edream...@gmail.com> wrote:
> Glad I asked. Your approach looks much better than what I was > thinking of. I'll look forward to it. > > In the meantime, I need a workaround, so I may do an utter hack in > setEditorColors, with the understanding that it will soon be replaced. Done at rev 4665. Actually, it's not a bad fix for the particular problem. Here's how it works: code that wants to set a particular part of a widget's style sheet calls:: g.app.gui.update_style_sheet(w,key,value) where w is the widget whose stylesheet is to be changed, key is unique to the method (or group of methods), and value is the new version of the stylesheet **for the particular key** to be added. Examples:: # In setEditorColors. sheet = 'background-color: %s; color: %s' % (bg,fg) g.app.gui.update_style_sheet(obj,'colors',sheet) # In add_border. sheet = "border: %spx solid %s" % (c.focus_border_width,c.focus_border_color) self.update_style_sheet(w,'border',sheet) # In remove_border. sheet = "border: %spx solid white" % (c.focus_border_width) self.update_style_sheet(w,'border',sheet) So add_border and remove_border work together because they use the same 'border' key. g.app.gui.update_style_sheet is straightforward: it injects a Python dict called leo_stylesheet_dict into the widget, and computes the total stylesheet as follows:: # Step one: update the dict. d = hasattr(w,'leo_styles_dict') and w.leo_styles_dict or {} d[key] = value w.leo_styles_dict = d # Step two: update the stylesheet. aList = [d.get(key) for key in list(d.keys())] s = ';'.join(aList) w.setStyleSheet(s) That's it. This is plenty good enough until Terry's work is ready. Terry, feel free to use or ignore this code as you like. Edward -- You received this message because you are subscribed to the Google Groups "leo-editor" group. To post to this group, send email to leo-editor@googlegroups.com. To unsubscribe from this group, send email to leo-editor+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/leo-editor?hl=en.