Styled text editor -- guidance sought

I'm about to build a utility to edit ConfigObj INI files (http://www.voidspace.org.uk/python/configobj.html). From a bit of research, it looks like StyledTextCtrl is the right control for editing the files themselves, since I'd like syntax highlighting, and maybe folding.

So, first question: does anyone know of a Scintilla "style sheet" for typical .ini files? Also, if there are examples of integrating such a thing into a wx app, that would be helpful.

Some of the configuration items in the .ini files take a string containing "snippets" of HTML. I'd like to provide a separate control to show the user how the HTML will look in the browser. HTMLWindow might be good enough, since they probably won't contain anything too sophisticated, and won't be terribly large. Are there any pitfalls I need to watch out for with HTMLWindow, or maybe better alternatives?

Thanks,

···

--
Don Dwiggins
Advanced Publishing Technology

Don,

I'm about to build a utility to edit ConfigObj INI files (http://www.voidspace.org.uk/python/configobj.html). From a bit of research, it looks like StyledTextCtrl is the right control for editing the files themselves, since I'd like syntax highlighting, and maybe folding.

You should check out Editra. It has code folding and line numbering built-in from what I can tell.

So, first question: does anyone know of a Scintilla "style sheet" for typical .ini files? Also, if there are examples of integrating such a thing into a wx app, that would be helpful.

Some of the configuration items in the .ini files take a string containing "snippets" of HTML. I'd like to provide a separate control to show the user how the HTML will look in the browser. HTMLWindow might be good enough, since they probably won't contain anything too sophisticated, and won't be terribly large. Are there any pitfalls I need to watch out for with HTMLWindow, or maybe better alternatives?

Thanks,

The HTMLWindow widget is pretty nice, but if you have any css, js or anything beyond basic html, it won't display it right. If you're on Windows, you can wrap Internet Explorer with wx. Otherwise, there's not much out there. I think the wxmozilla project is dead at the moment and the wx.Webkit project isn't ready for prime time as of yet.

Mike

I have no idea about wxSTC, but as for HTML:

Be careful of HTMLWindow. It’s not really – it seems to me – designed for HTML in the web-sense and especially not HTML a user may modify. Its extremely restrictive and doesn’t support a lot of /very/ basic stuff: it seems more designed for a way to encode a simple UI or “rich” control/frame really fast and easily then for true HTML/web usage.

You can use IE on Windows and WebKit on the Mac easily via:

html = “My HTML string

if html:

if sys.platform == “darwin”:

from wx import webkit

self._view = webkit.WebKitCtrl(self, -1)

self._view.PageSource = html

elif sys.platform == “win32”:

from wx.lib import iewin

self._view = iewin.IEHtmlWindow(self, -1)

self._view.LoadString(html)

There’s no unified interface between the two, unfortunately; but there’s much promise for wxWebKit in the future which will supposedly wrap webkit on both platforms as a sort of universal wx browser interface. In the not too distant future, one hop.es.

···

On Fri, Nov 7, 2008 at 9:17 AM, Don Dwiggins ddwiggins@advpubtech.com wrote:

I’m about to build a utility to edit ConfigObj INI files (http://www.voidspace.org.uk/python/configobj.html). From a bit of research, it looks like StyledTextCtrl is the right control for editing the files themselves, since I’d like syntax highlighting, and maybe folding.

So, first question: does anyone know of a Scintilla “style sheet” for typical .ini files? Also, if there are examples of integrating such a thing into a wx app, that would be helpful.

Some of the configuration items in the .ini files take a string containing “snippets” of HTML. I’d like to provide a separate control to show the user how the HTML will look in the browser. HTMLWindow might be good enough, since they probably won’t contain anything too sophisticated, and won’t be terribly large. Are there any pitfalls I need to watch out for with HTMLWindow, or maybe better alternatives?

Thanks,

Don Dwiggins

Advanced Publishing Technology


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Stephen Hansen
Development
Advanced Prepress Technology

shansen@advpubtech.com
(818) 748-9282

Mike, Stephen, thanks for the feedback. I think I'll go with HTMLWindow for now, at least. Using the demo to fetch some mostly-text pages showed that it can handle what I need reasonably well. Users of this utility will be creating generally small snippets of straigtforward HTML, maybe including an image tag or two, and I'd like to show them what it'll look like in the browser.

I still haven't found anything like a general .ini lexer that I can copy (let alone one for ConfigObj), and I've delved a bit into the mysteries of cobbling up a lexer for STC. There's not much documentation on the subject, and only a few simple examples. Looks like a bit of a steep learning curve, although it might not be too bad for the relatively simple structure I need to recognize.

···

--
Don Dwiggins
Advanced Publishing Technology

Don Dwiggins wrote:

I still haven't found anything like a general .ini lexer that I can copy (let alone one for ConfigObj),

Could Python's ConfigParser module help?

-Chris

···

--
Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception

Chris.Barker@noaa.gov

Christopher Barker wrote:

Don Dwiggins wrote:

I still haven't found anything like a general .ini lexer that I can copy (let alone one for ConfigObj),

Could Python's ConfigParser module help?

Well, no. I was speaking a bit loosely when I said ".ini lexer". I'm actually working with ConfigObj, which offers extended capabilities (and syntax) over ConfigParser; for example, I want to be able to highlight and fold comments, sections/subsections, and multi-line items.

Thanks for the thought, though...

···

--
Don Dwiggins
Advanced Publishing Technology