maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   work in progress: simple vertical sms app: vertsms (https://talk.maemo.org/showthread.php?t=51635)

ossipena 2010-05-06 19:02

Re: work in progress: simple vertical sms app: vertsms
 
I solved the problem already. but now a question:

how can I write None (not a string) to a table?!?

when I read the os created table, there is such value and I am unable to write such to the table.

and I am a bit unsure if outside writes are possible: at least my otherwise except the None similar string write to db gets erased :(

e: damn it appears you should not touch the db manually. found an api for it though but it seems pretty complicated.

aspidites 2010-05-06 19:52

Re: work in progress: simple vertical sms app: vertsms
 
@ossipena, to answer your original question:
You should write "Null" to the database. I worked a lot with the sqlite3 module in my old project. (don't let the pyqt code scare you, most of the code deals specifically with plain ole python: database.py

aspidites 2010-05-07 08:08

Re: work in progress: simple vertical sms app: vertsms
 
So I finally refactored everyting into multiple classes in my branch. It's either a drastic improvement or a drastic disaster.

While everything is now separated into 4 classes located in a single file, they could technically e separated into 4 files now :-).

original version
my version

Not official, and I may end up scrapping it, but I thought I'd see what everyone else thought.

Haus3r 2010-05-07 08:31

Re: work in progress: simple vertical sms app: vertsms
 
This is great :) Just reading through this thread made me - once more - aware of how great this idea of open source is and that everybody can get evolved!

Keep it up guys, this looks VERY promising!

PS: ...And will solve my problem of single-handedly texting my mates while on the loo :) Great!

cb22 2010-05-07 10:16

Re: work in progress: simple vertical sms app: vertsms
 
Quote:

Originally Posted by aspidites (Post 647598)
So I finally refactored everyting into multiple classes in my branch. It's either a drastic improvement or a drastic disaster.

Awesome, I was thinking about doing this... Getting much more "pythonic" now... After my test today, I think I'll play around with abstracting away the button pressing from the handling of input, etc. That should allow a nice clean way to have T9 and be able to switch between predictive / non-predictive.

On a side note, I hacked my T9 support in... It was rather slow, as expected, but it was just a proof of concept. I'm going to look at creating a database with all the words in, and seeing what the speed of that is like vs a flat file. Should be much faster.

sygys 2010-05-07 10:35

Re: work in progress: simple vertical sms app: vertsms
 
Loose the virtual keyboard override when enabled its highly anoying when switching from number to text and back. also you need directional keys

ossipena 2010-05-07 10:44

Re: work in progress: simple vertical sms app: vertsms
 
does someone know better place to search for rtcom eventlogger than http://docs.huihoo.com/maemo/5.0/eventlogger/

http://maemo.org/api_refs/5.0/5.0-final/eventlogger/

I have everything I need to write but how to write?

e: how does one say this in python:
Code:

static RTComElEvent *
event_new_full (time_t t)
{
    RTComElEvent *ev;

    ev = rtcom_el_event_new();
    g_return_val_if_fail (ev != NULL, NULL);

    /* Setting everything here for testing purposes, but usually
    * you wouldn't need to. */
    /* FIXME: RTComElEvent structure:
    * 1) OMG, it's full of string IDs that want to be quarks or enums;
    * 2) it's painful to care about string member ownership.
    */
    RTCOM_EL_EVENT_SET_FIELD(ev, service, g_strdup (SERVICE));
    RTCOM_EL_EVENT_SET_FIELD(ev, event_type, g_strdup (EVENT_TYPE));
    RTCOM_EL_EVENT_SET_FIELD(ev, start_time, t);
    RTCOM_EL_EVENT_SET_FIELD(ev, end_time, t);
    RTCOM_EL_EVENT_SET_FIELD(ev, flags, FLAGS);
    RTCOM_EL_EVENT_SET_FIELD(ev, bytes_sent, BYTES_SENT);
    RTCOM_EL_EVENT_SET_FIELD(ev, bytes_received, BYTES_RECEIVED);
    RTCOM_EL_EVENT_SET_FIELD(ev, local_uid, g_strdup (LOCAL_UID));
    RTCOM_EL_EVENT_SET_FIELD(ev, local_name, g_strdup (LOCAL_NAME));
    RTCOM_EL_EVENT_SET_FIELD(ev, remote_uid, g_strdup (REMOTE_UID));
    RTCOM_EL_EVENT_SET_FIELD(ev, remote_name, g_strdup (REMOTE_NAME));
    RTCOM_EL_EVENT_SET_FIELD(ev, channel, g_strdup (CHANNEL));
    RTCOM_EL_EVENT_SET_FIELD(ev, free_text, g_strdup (FREE_TEXT));

    return ev;
}


aspidites 2010-05-07 13:44

Re: work in progress: simple vertical sms app: vertsms
 
@ossipena: There aren't any python bindings, so you would have to use ctypes like you did for osso.abook, which I think would be a waste of time. I think it would be faster to just use sqlite3

[strike]I might have a go at a snippet once I get back from working out and school[/code]

There is no way I'm touching that database. The schema looks overly complicated and while it's obvious what a lot of the fields are for, it is not so obvious when they should be written to. The rtcom API looks sloppy at best*

* just my opinion...perhaps a bias against gobject, gtk, etc.

ossipena 2010-05-07 17:53

Re: work in progress: simple vertical sms app: vertsms
 
only problem is that the rows written by sqlite gets deleted almost immediately. so I have to use the api via ctypes. I managed to pull all necessary info from el.db so I know exactly what to write and where. but lack knowledge how.

now I only need to know how to use the event_new_full from above with python after binding the rtcom-event.so with ctypes.

I'll try to implement improved backspace then and hope someone knows how to get rtcom-events stuff working.

aspidites 2010-05-07 18:13

Re: work in progress: simple vertical sms app: vertsms
 
and you are sure you were committing your transactions with sqlite3?


All times are GMT. The time now is 16:15.

vBulletin® Version 3.8.8