PDA

View Full Version : simple application for n800


henk
2007-06-17, 06:57
I want to develop a small application which conectes to some site for nokia n800 on maemo platform. like a button to start the conection process and some kind of text area to display the content of the site.

pls give me some help.

rgds,
henk

fpp
2007-06-17, 08:48
That should be easy enough in Python : look at TahitiBob's launcher app, you can probably reuse 90% of it to do what you want.

konttori
2007-06-17, 10:00
It will take about this much code in python, oh, and adding a text area (or whatever you need):


import os,urllib,time,string

urladdress="http://www.cnn.com"
urladdress=urllib.urlencode(urladdress)
print "opening" + urladdress

try:
sock = urllib.urlopen(urladdress)
htmlSource = sock.read()
except:
print "unable to get socket"
print sys.exc_info()[0]

henk
2007-06-17, 11:35
It will take about this much code in python, oh, and adding a text area (or whatever you need):


import os,urllib,time,string

urladdress="http://www.cnn.com"
urladdress=urllib.urlencode(urladdress)
print "opening" + urladdress

try:
sock = urllib.urlopen(urladdress)
htmlSource = sock.read()
except:
print "unable to get socket"
print sys.exc_info()[0]



yes right but I am specified to use maemo platform. curentely i have installed maemo 3.1 on Debian. and this thing was kind of urgent.

any help will be apriciated
henk

fpp
2007-06-17, 15:46
Well, Python runs just fine under Maemo, it is even packaged by the good folks at INdT and comes ready-to-use with pyGTK and pyGame. You can use either of these to make a GUI for your app, or make it HTML and show it in the browser.

henk
2007-06-19, 10:35
Well, Python runs just fine under Maemo, it is even packaged by the good folks at INdT and comes ready-to-use with pyGTK and pyGame. You can use either of these to make a GUI for your app, or make it HTML and show it in the browser.

yes but for some spesifc reason can any one help me to get the code in a format like the following ?

#include <hildon-widgets/hildon-color-selector.h>
#include <hildon-widgets/hildon-color-button.h>
#include <hildon-widgets/hildon-program.h>
#include <gtk/gtk.h>

/* Application UI data struct */
typedef struct _AppData AppData;
struct _AppData {
HildonProgram *program;
HildonWindow *window;
};

void color_button_clicked(GtkWidget * widget, gpointer data)
{
GdkColor *new_color = NULL;
g_object_get(widget, "color", &new_color, NULL);
}

void ui_show_color_selector(GtkWidget * widget, AppData * appdata)
{
GdkColor *current_color;
const GdkColor *new_color;
GtkWidget *selector;
gint result;

/* Create new color selector (needs access to HildonWindow!) */

selector = hildon_color_selector_new(GTK_WINDOW(appdata->window));

/* Set the current selected color to selector */
hildon_color_selector_set_color(HILDON_COLOR_SELEC TOR(selector),
current_color);

/* Show dialog */
result = gtk_dialog_run(GTK_DIALOG(selector));

/* Wait for user to select OK or Cancel */
switch (result) {
case GTK_RESPONSE_OK:

/* Get the current selected color from selector */
new_color = hildon_color_selector_get_color
(HILDON_COLOR_SELECTOR(selector));

/* Now the new color is in 'new_color' variable */
/* Use it however suitable for the application */

gtk_widget_destroy(selector);
break;

default:
........................................
...............................................


this is just part of a color selector program

tanks for any help

konttori
2007-06-19, 11:25
that is c code, and you need to start digging at c code examples on the web. Try googling for such examples. If you want to make a simple program, you really should reconsider using python. And if you absolutely need to use c, try googling around for a suitable code example.