#! /usr/bin/python
def get_news_tuple():
items =(("New Web Page: 30/06/05","Finally a decent web page for GtkBook project",""),
("Widget a Day: 28/06/05","Muthu has started to write 1 widget-a-day, to complete, the GtkBook project, see $URL for more news"," http://advogato.org/person/gnumuthu/diary.html?start=6"),
("Wiki: June 2005","A community workspace at GNOME project: $URL",
"http://live.gnome.org/GtkBook/")
);
return items
def get_header_string():
return """
GtkBook: Free documentation for GTK+
""" + get_title_link_string()
def get_title_link_string():
title_links = ( ("Home","index.html"),
("Links","links.html"),
("Download","download.html"),
("License","license.html"),
("News","news.html"),
("Contribute","contribute.html"),
("Feedback","feedback.html"),
("Contact","contact.html"),
("About","about.html"),
("TodaysWidget","widgetaday.html")
)
datastring="
"
datastring=datastring+""
for link in title_links:
datastring=datastring+""+link[0]+" | "
datastring=datastring+ "
"
datastring=datastring+"
"
return datastring
def get_footer_string():
images=(("GNU project","gnome-emacs.png","www.gnu.org"),
("GTK+ project","gtk-logo-rgb.png","www.gtk.org"),
("GNOME project","gnome-logo-icon-transparent.png","www.gnome.org"),
("Linux","gnome-term-linux2.png","www.kernel.org"),
("Inkscape","inky.png","www.inkscape.org"),
("Creative Commons","./deed_002.gif","creativecommons.org"));
imgdir = "./images/"
imgstr=""
nextrow="
"
for image in images:
imgstr=imgstr+"\n"
nextrow=nextrow+" | "+image[0]+" | "
imgstr=imgstr+""
imgstr=imgstr+"\n"
nextrow=nextrow+"
\n"
imgstr=imgstr+"\n"
imgstr=imgstr+nextrow;
footstr="""© GtkBook team, 2005. Please mirror the site as you wish. Graphics, content may also be freely used under Creative Commons License. |
License
\n
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
|
"""
return "
\n"+footstr+"\n\n"
def get_index_page():
news=get_news_tuple()[0];
nstr="News Flash:
"+news[0]+":"+news[1].replace("$URL","[See NEWS section]")
datastring=nstr + """
Start contributing to our Widget a Day section.
- Table of Contents Contents
- Widget Status Widget
The GtkBook is an ambitious project that aims to create
new useable and world class documentation for the Gtk
tool kit, in code as well as concepts.
Its is aimed to be useful to the hacker as well as
the novice in their attempt to master the nuances
of the Gtk toolkit to develop better free-software
faster and easier.
The documents are to be written in simple
english and are expected to be translated to many languages
as soon as the project nears initial release stages.
Gtk is still the most under-documented toolkit thats patronized
widely and rightly at that. Its the initial learning curve
that we target in this book and we have to overcome for
any serious programmer to contribute to the Gtk world.
|
"""
return datastring
def get_links_page():
links=(("License","creativecommons.org/licenses/by-sa/2.5/"),
("HomePage","gtkbook.sf.net"),
("GTK Project","www.gtk.org"),
("Mailing Lists Sign Up","www.freelists.org/list/gtk-book"),
("Mailing Lists Archive","www.freelists.org/archives/gtk-book"),
)
datastring=""
datastring=datastring+ ""
for link in links:
datastring=datastring+"- "+link[0]+"
"
datastring=datastring+"
"
return datastring
def get_download_page():
downloads=(("GtkBook [old, Tarball]","./GtkBook.tar.gz"),
("Gtk TextView tutorial","./archives/gtktext-0.3.tar.gz"),
("Image processing Guide [HTML tarball]","./improc.tgz"),
("Image processing Guide [PDF]","./improc.pdf"),
("Image processing Guide [Browsable]","./improc/index.html"),
("Example Code for Image Processing","./colors.tgz"),
("Source code of website generation s/w","./generate.py"),
("Source code of GtkBook logo ","./images/banner.svg"),
)
datastring=""
datastring=datastring+ ""
for link in downloads:
datastring=datastring+"- "+link[0]+"
"
datastring=datastring+"
"
return datastring
def get_license_page():
lstr="""
- Please read this license page carefully, before you can reuse the code,
documentation, and this work in general.
- Please be very careful while
reusing code, from this Book, as we have taken parts of it from GPL'ed
programs, and other free licenses, which are applicable to the code.
-
The rest of the code, is however under public domain and indicated.
License
Creative Commons
Attribution-ShareAlike 2.5
You are free:
- to copy, distribute, display, and perform the work
- to make derivative works
- to make commercial use of the work
Under the following conditions:
| Attribution. You must attribute the work in the manner specified by the author or licensor. |
| Share Alike.
If you alter, transform, or build upon this work, you may distribute
the resulting work only under a license identical to this one. |
- For any reuse or distribution, you must make clear to others the license terms of this work.
- Any of these conditions can be waived if you get permission from the copyright holder.
Your fair use and other rights are in no way affected by the above.
This is a human-readable summary of the Legal Code (the full license).
Learn how to distribute your work using this license
|
We are using the creative commons license, with share and
share alike policy.
You can find the exact license here:
License
Programs
Parts of the example code, which are taken from other free software
programs, are being distributed under the same license, of the original
program, we have taken the code from. eg: In GPL programs, used as examples,
we make that code reuseable under GPL terms only. Such code and license
will be explicitly indicated.
The rest of the code/examples in the GtkBook will be released in
public domain. This will also be indicated explicitly.
Before using ambiguously licensed/license not mentioned,
code/exmples in your programs, that you will/will-not publish,
please ask before using/re-using the code.
Code, Images, Text
All these Code, Images, Text, with exceptions noted above, may be
distributed under the Creative Commons License shown above.
"""
datastring=lstr
return datastring
def get_news_page():
#add news items to top.
items=get_news_tuple()
data=""
for item in items:
data=data+"- "+item[0]+"
"
data=data+item[1].replace("$URL","URL")+" "
data=data+"
"
datastring="News Page"+data
return datastring
def get_contribute_page():
cstr="""
General Guidelines
You are mostly a programmer, artist or a technical writer
thinking if you must join this project. This page exists
to help you understand in what capacity you can best help
the GtkBook project, and be a part of the winning team.
You can contribute to this project, in any of the following roles,
Once you have decided how to contribute, doing the actual stuff
is rather easy.
Joining the Project
- Join the mailing lists: Click Here
- Post a message introduing yourself, your background [optional], and in what
way you will help the project.
- Downloads the latest documentation code from this and start working.
- Once you have something substantial, please postit back to the mailing lists, a;
- You have made it! your first contribution to GtkBook has been made!
Thats how its supposed to work.
Now what are you waiting for? Get to work. For Us!
"""
datastring=" Contribute, Join us
"+cstr
return datastring
def get_feedback_page():
fstr="""
Yes! We are interested in hearing what you have to say!
- Did you like this project?
- Do you have any suggstions, on how to do things?
- Did you read Contribute section ?
- Do you have an unanwered question?
Fell free to contact us.
Please mail Muthiah Annamalai at gnumuthu-at-users-dot-sf-dot-net
"""
datastring="Give feedback
"+fstr
return datastring
def get_contact_page():
cstr="""
If you are an Editor of some magazine, publisher,
and want to publish
extracts, or publish whole work of the GtkBook team,
then please contact us,
Fell free to write to us.
mail Muthiah Annamalai at gnumuthu-at-users-dot-sf-dot-net"""
datastring="Contact GtkBook Team"+cstr
return datastring
def get_about_page():
datastring="""I am Muthiah Annamalai, from India.
Im a GTK+/GNOME hacker, with small contributions
to projects in GNOME, like Gedit, Inkscape, EOG,
and Zenity. I also happen to be the project leader,
and primary author of GtkBook
Motivations
Like most other Free software projects, GtkBook was started
to scratch onself's itch.
- Qt & KDE have *Amazing* documents . see docs.kde.org,
www.trolltech.com, and all those amazing sites out there.
- So do our rivals M$. msdn.m$.com, Apple developer.apple.com.
- GTK+ can do with some comprehensive documentation.
Presently no one stop place. GtkMM docs are great. DevHelp,
too tries to patch up GNOME with Qt.
Still focus on GNOME is, look into source code, rather than
give more documentation.
- GNOME + ISV, MONO +ISV, MONO-GTK#, GTK is future toolkit for *NIX.
Moreover lots of people use GTK+ on MAC, and WINDOWS plaforms.
- Gtk is simple, plain, fast and easy: iff you understand the basics.
We will make GTK+ the toolkit of choice for newbies.
- Lets give them a fight, KDE, Qt, M$, Apple, Java, Sun et-al,
lets write amazing docs, too. World class toolkit, now with
World class documentation.
|
I had in mind, for the past one year or so,
a book on GTK+, title A Journey through GTK+.
In fact I've started work on this, and made a
community project at http://gtkbook.sf.net.
Its very much a work in progress after one of conception, starting June 2004.
Previous examples of my work include an exposition
on GdkPixbuf, titled Image processing with GTK+
may be found here.
Im also the author of GTK bindings to GNU Octave,
at Octave-GTK"""
return datastring
def get_widgetaday_page():
widgets = [i.strip() for i in open("widgetaday").readlines()];
srcpath="./archives/"
wstr="
"
for widget in widgets:
wstr=wstr+"- "+widget+" "+widget+",
download tarball "+widget+" "
wstr=wstr+"
"
datastr="Widget of the Day
"+wstr
return datastr
def generate():
pages = ( (get_index_page,"index.html",),
(get_links_page,"links.html"),
(get_download_page,"download.html"),
(get_license_page,"license.html"),
(get_news_page,"news.html"),
(get_contribute_page,"contribute.html"),
(get_feedback_page,"feedback.html"),
(get_contact_page,"contact.html"),
(get_about_page,"about.html"),
(get_widgetaday_page,"widgetaday.html")
)
header=get_header_string();
footer=get_footer_string();
for page in pages:
import string
print "Generating "+page[1]+"..."
fp=open(page[1],"w")
fp.write(header+"\n")
fp.write(page[0]()+"\n")
fp.write(footer+"\n")
fp.close()
print "\nCompleted "
return
if __name__ == "__main__":
generate()