Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I know, that GNOME3 UI uses HTML and CSS elements for creating menus and windows. How can I write simple web-based application like some text-editor with own document-format and formatting tools written in JS? HTML widget, that saves documents to the file-system.

Main reason of this question - to create Text editor, with Markdown support...

GTK File Menu:

  • Open
  • Save as...

WebKit content:

<link rel="stylesheet"...>
<script src="..."></script>
<nav>...</nav>
<content>{opened file}</content>
share|improve this question
    
Try with bluefish :) if you really dont want to stick to Webkit –  bebojoor Apr 25 '12 at 9:21
add comment

1 Answer

It doesn't use HTML. It uses GTK, which itself uses a styling language based on CSS. However, you can use WebKit to provide the functionality you're after. For instance, the following program will give you a WebKit-based AskUbuntu-browser.

I wrote this in Python, but you can use JavaScript as well if you like. That's the great thing about GObject Introspection, from which we're importing GTK and WebKit. It works with most languages and the code will be very similar in JavaScript. And of course, just replace http://askubuntu.com with the location of your HTML-application.


#!/usr/bin/env python
from gi.repository import Gtk, WebKit

win = Gtk.Window()
win.set_title("AskUbuntu!")
web = WebKit.WebView()
web.open("http://askubuntu.com")
scroller = Gtk.ScrolledWindow()
win.add(scroller)
scroller.add(web)
win.show_all()
win.connect("destroy", Gtk.main_quit)
Gtk.main()
share|improve this answer
    
Ok, but how to open/save documents on file-system using this widget? –  iegik Apr 25 '12 at 9:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.