Simple HTML Renderer / Browser?

R

Randy Kramer

I need a simple HTML renderer (to get started--eventually, I want to be able
to interface to the gecko, khtml, and possibly other renderers/browsers, but
for now I'm looking for something simple that won't be too hard for me (as a
Ruby newbie) to get working).

Suggestions?

Current Questions:

I have been doing some research and have some thoughts / questions:

* tkhtml () sounds like a possibility, but I don't know if there is a Ruby
interface to it--I 've been searching the web and reading up on Tk in Teach
Yourself Ruby in 21 Days and Programming Ruby. Anybody have any experience
with it (in Ruby).

* Programming Ruby says I can access a Tk widget by prefixing it with
Tk--is that all that has to be done (along with whatever you get with
'require Tk') or does that depend on someone having created a Ruby
"interface" specifically for tkhtml beforehand?

* If I use tkhtml I should name it something like Tktkhtml based on what
the book says? (Uncertain about the double tk and capitalization in
general.)

As I said, someday I'll want to use khtml (kde/qt) and gecko (Gtk) but I'm
afraid Gtk and qt would overwhelm me at this point. I'd like to stay in a
simpler (and lighter) GUI family, like Tk or Fox (at least I'm assuming they
are simpler and lighter).

Ideally, it would be nice to find a "cookbook" example, where I could copy
some code verbatim to get something working, then expand from there.

Simple rendering will do to start, for an application I'm envisioning, I'll
eventually want both multiple renderers and at least one full-fledged
browser.

Randy Kramer
 
L

Luke Graham

As I said, someday I'll want to use khtml (kde/qt) and gecko (Gtk) but I'm
afraid Gtk and qt would overwhelm me at this point. I'd like to stay in a
simpler (and lighter) GUI family, like Tk or Fox (at least I'm assuming they
are simpler and lighter).

Im hopelessly biased of course, but Qt really is very easy to learn.
I dont know much about the KDE layers on top of it but there
are Ruby wrappers for both. You probably already knew that tho.

Just remember the simple rhyme:
stay away from gtk
qt is a cutie

:D
 
A

Alexander Kellett

I need a simple HTML renderer (to get started--eventually, I want to
be able
to interface to the gecko, khtml, and possibly other
renderers/browsers, but
for now I'm looking for something simple that won't be too hard for me
(as a
Ruby newbie) to get working).

rendering a piece of html with korundum/khtml is a
matter of just a few lines. interested in the code?

Alex
 
A

Alexander Kellett

Alex,
Yes, please! ;-)

hehe :)

for a complex application using it see:
www.lypanov.net/websitedata/RubberDoc-0.2.7.tbz2
just extracting the basics i guess its something like:
require 'Korundum'
about = KDE::AboutData.new("one", "two", "three")
KDE::CmdLineArgs.init(1, ["RubberDoc"], about)
app = KDE::Application.new()
m = KDE::MainWindow.new
htmlview = KDE::HTMLPart.new m
htmlview.openURL KDE::URL.new("")

(untested, if there are any problems i think richard
will be able to help :) - i'm unable to test at the
moment for various reasons)

Alex
 
R

Randy Kramer

in the mean time if you get stuck

Yup!

I'm having trouble installing korundum (on Mandrake 10.0). I couldn't find an
rpm, so I downloaded the tar file (3.3.1). I was going to try the
standard ./configure, make, make install route, but ./configure doesn't
work--there are two configure files, configure.in.in and configure.in.bot.
Neither is executable. Autoconf 1.7 is not installed on Mandrake 10 (maybe
that's the problem??).

Also, kde is at 3.2.1 on Mandrake 10--which makes me wonder, will korundum
3.3.1 work with that?

I hope to have the Mandrake 10.1 disks in a week or so, maybe that will make
things easier (I don't have any plans/hope of updating kde 3.2 to 3.3. other
than by installing Mandrake 10.1 (I tried things like that back in the
Mandrake 6.1-7.2 days, it was just an exercise in frustration).

In the meantime (pending any helpful insights) I'll go back to trying to get
TkHTML to work (by finding a cookbook example).

regards,
Randy Kramer

PS: The tutorial looks helpful, but doesn't (AFAICS) address installing
korundum.
 
R

Randy Kramer

can you try make -f Makefile.cvs before configure?
we should make this more obvious in the documentation :)
a wiki would be a good path for installation docs i
think... i'll ask richard about this.

Thanks, that's helped--make has been chugging along for close to 3 hours now.
(Not quite like the good ol' Turbo Pascal days ;-)

I did have to upgrade autoconf and automake, but fortunately (for me), there
were RPMs on the Mandrake 10 install disks.

regards,
Randy Kramer
 
A

Alexander Kellett

next time use a distribution with a prebuilt package :)
(we simply don't have the man power to build these ourselves,
too many distributions too little time :( )
 
D

Detlef Reichl

Just remember the simple rhyme:
stay away from gtk
qt is a cutie
absolute bullshit...

Ruby-gtk+/gnome are very nice bindings to Gtk+ / GNOME wich provide
almost all widgets you need.

before you ever else write such things you'll take a look at the
advantages of the alternatives.

cheers
detlef
 
A

Alexander Kellett

Ruby-gtk+/gnome are very nice bindings to Gtk+ / GNOME wich provide
almost all widgets you need.

before you ever else write such things you'll take a look at the
advantages of the alternatives.

dear good sir.

it was a joke.
lighten up.

either that or i could get
started on about my experiences
with gtk :p
 
R

Randy Kramer

next time use a distribution with a prebuilt package :)
(we simply don't have the man power to build these ourselves,
too many distributions too little time :( )

Thanks:

Just wanted to come back and thank Alexander Kellet again for pointing me to
the Ruby/Qt/KDE tutorial at
http://developer.kde.org/language-bindings/ruby/kde3tutorial/index.html it is
very helpful. Thanks also to the authors of the tutorial . (So far I've
mostly just copied and pasted the code to run the examples, now I need to go
back and understand them. ;-)

Bugs:

I did run into a few bugs (iiuc) in the 9th example program
(http://developer.kde.org/language-bindings/ruby/kde3tutorial/p9.html):

* First of all, in the line:

"Original Developer/Mantainer"),"(e-mail address removed)",

the ) is not required (and it should be Maintainer)--this created the error
message:

bash-2.05b$ ./p9.rb:96: syntax error
"Original Developer/Mantainer"),"(e-mail address removed)",
^

(Caret doesn't show in proper place except in a fixed width font.)

* Even after fixing that line, I get the error:

kparts: ERROR: No such XML file /home/rhk/work/ruby/qt/p9ui.rc

I haven't spent much time looking for the problem, maybe it is a BKAC
error--maybe I am supposed to create that file?

I probably won't pursue this for a few days, so I thought I'd mention thosse
things.

Observations:

I am going to continue to look for some lighter weight HTML widgets. (I do
like the khtml rendering, and I like the signal / slot communication method
(vs. callbacks), but most of the widgets take 4 to 7 seconds to appear on my
screen. (Some of that may be general program startup overhead, maybe
creating a 2nd similar widget will not take nearly as long, but I would think
there are some lighter weight alternatives. All I have to do is find some
simple Ruby examples for using them.

regards,
Randy Kramer
 
A

Alexander Kellett

concealed at the bottom of
http://developer.kde.org/language-bindings/ruby/kde3tutorial/p9.html
is the following:
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="p9" version="1">
<MenuBar>
<Menu name="file"><text>&amp;File</text>
<Action name="set_default_page"/>
</Menu>
</MenuBar>
<ToolBar fullWidth="true" name="mainToolBar">
<Action name="add_to_bookmarks"/>
<Action name="back"/>
<Separator/>
<Action name="file_quit"/>
</ToolBar>
</kpartgui>
i suppose a tarball with the entire example
would be really useful for people that just
like looking at code :) (e.g, me ;))

i guess richard can commit the additional )
fix in the near future. i forgot my cvs
password :p

strange that its so slow. my 2000-ish line
application (rubberdoc) only takes a second
or so to start here. widget creation should
be basically instantaneous. (note, i don't
have a fast computer)

did u just try running once? second time load
should be *much* faster. the bindings library is
fairly big unfortunately as its the only way
to allow for subclassing as gcc doesn't provide
anything useful :(

qt also has a rich text view. subset html.
not sure if thats useful enough :)

see:
http://doc.trolltech.com/3.3/qtextbrowser.html

Alex
 
R

Randy Kramer


Ahh, thanks, that's (part of) what I needed! (more below)
i suppose a tarball with the entire example
would be really useful for people that just
like looking at code :) (e.g, me ;))

Yes, that would be helpful, or additionally/alternatively, make it a little
more obvious in the text that you must also create file p9ui.rc. I had
skimmed the text, but even reading it more carefully after knowing I have to
do that, I'm not sure it would be clear to someone reading it for the first
time. Maybe a note at/near the top of the page like, "To run this example
you must create two files, ... and also for full effect, you must run an
instance of p8 as well." (starting it first, iirc, or does it matter?)

More comments (as always ;-)

* I feel like I must apologize again for not having thoroughly studied this
tutorial, but it seems like the concepts demonstrated here will meet a lot of
my needs, so I've tentatively moved on to figuring out how to "parse" TWiki
markup.

* For the sake of completeness, it seems there is still an error (or
another EBKAC)--p7 and p8 work fine together as a pair, but p8 and p9
don't--from p9 I can save bookmarks to p8, but choosing a bookmark in p8 does
not cause it to be loaded in p9.

* Which reminds me to thank everyone responsible for these tutorials
again--they are helpful and demonstrate some useful functionality of the type
I need! Part of what I intend is to have a "supervisory" window that knows
what "pages" are open in any number of "subsidiary" windows. I'm fairly
certain the signals and slots mechanism will make that fairly easy to do.
(Note though that the subsidiary windows will all be independent "instances",
so a crash or closure of one will not close any of the others.)

I guess what that part of what I'm trying to say is that not only is the
tutorial a good way to start learning how to use Korundum and (Ruby)Qt (??),
it is a good demonstration of some of the power of Qt!
strange that its so slow. my 2000-ish line
application (rubberdoc) only takes a second
or so to start here. widget creation should
be basically instantaneous. (note, i don't
have a fast computer)

There is no significant improvement for opening the same program
(experimenting with p8 and p9) a 2nd time (after closing it). Also, I tried
opening the same program a 2nd time when it is already open. It won't open a
2nd copy (does this mean the programs are somehow singletons--something else
for me to learn), but it still takes a significant amount of time (3-4
seconds) for the "focus" to shift to the already open instance.

Just to try to put the 3 to 6 seconds in context, perhaps some of this is
because I have a heck of a lot of things loaded (kmail, konsole with 6
"sessions", epiphany with ~10 tabs, 3 instances of konqueror with a total of
~35 - 40 tabs, top, samba (etc.), 5 instances of Nedit, 4 instances of gjots)
and not all that much memory and swap space: 384 KB of RAM (all this MB can
handle), ~1 GB of swap (often up to half in use, and (aside) I do notice a
general slowdown when over half of my swap starts being used), and a 500 MHz
processor. (But, this is the environment the program will typically run in
(for me).)
qt also has a rich text view. subset html.
not sure if thats useful enough :)

see:
http://doc.trolltech.com/3.3/qtextbrowser.html

That's good to know!

regards,
Randy Kramer
 
R

Randy Kramer

How long does it take to open a roughly equivalent pure-C Qt program?

Well I'm not sure how to judge, so I tried the following:

konsole ~3 seconds
konqueror ~6 seconds
kedit ~4.5 seconds
kwrite ~5 seconds

for comparison:

nedit ~2 seconds

Retrying p7, p8, and p9

p7 ~5.5 seconds
p8 ~5.5 seconds
p9 ~6 seconds

Randy Kramer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top