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)

ZogG 2010-05-06 05:36

Re: work in progress: simple vertical sms app: vertsms
 
it would be nice to make longpress keys (for numbers for example if u press more than 2sec on button)

aspidites 2010-05-06 05:46

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

Originally Posted by ossipena (Post 645755)
now I only have to figure out how to get a rid from decimals with time.time().

Why not just int(time.time()) ?

Not sure what you are trying to do, but perhaps time.strftime() will save you some work?

ossipena 2010-05-06 10:12

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

Originally Posted by ZogG (Post 645777)
it would be nice to make longpress keys (for numbers for example if u press more than 2sec on button)

added to feature requests

http://wiki.maemo.org/VertSMS/Feature_requests

ossipena 2010-05-06 10:15

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

Originally Posted by aspidites (Post 645788)
Why not just int(time.time()) ?

Not sure what you are trying to do, but perhaps time.strftime() will save you some work?

int did the trick. should have guessed I missed the easiest way and went wrong with more complex operations ;)

i need linux time to string that is written to rtcom database.
time.time() seems to give xxxxxxxxxxx.xx by default and I had to get a rid from those decimals.

now I only need courage to write my string to db.

e: and figure out how to use quotation marks. is there any other options besides " & ' ?

MohammadAG 2010-05-06 16:57

Re: work in progress: simple vertical sms app: vertsms
 
Should I push the changes so far as v0.2?

kojacker 2010-05-06 17:05

Re: work in progress: simple vertical sms app: vertsms
 
Noticed an update to vertsms today and installed it, found I had the same issue in that only numbers with the country code added were sent. Seems to be a strange issue with some reporting this, some reporting the opposite. Numbers entered into the native SMS client both with and without country code send as expected. It's an odd issue.

If it persists through to the final release, i would be tempted to rewrite part of the coding to replace numbers added from contacts beginning "077" with a UK country coded version "+4477" before sending. (To use on my own handset obviously, I dont mean as a general feature request :) )

cb22 2010-05-06 17:57

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

Originally Posted by MohammadAG (Post 646715)
Should I push the changes so far as v0.2?

Just wondering, what is the current devel setup like? What is the correct place to get the latest version for development from, gitorious/vertsms?

ossipena 2010-05-06 18:42

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

Originally Posted by MohammadAG (Post 646715)
Should I push the changes so far as v0.2?

that can be done after I get saving messages working.

improvements are pretty minor so I see no point releasing new version.

kojacker: it is a issue with different numbers accepted by different carriers. I am investigating it after I get saving the messages working.

ossipena 2010-05-06 18:43

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

Originally Posted by cb22 (Post 646823)
Just wondering, what is the current devel setup like? What is the correct place to get the latest version for development from, gitorious/vertsms?

http://gitorious.org/vertsms

there are my and aspidites repositories.

aspidites 2010-05-06 18:56

Re: work in progress: simple vertical sms app: vertsms
 
@ossipena

If you are trying to write a quote mark without it messing up your code (EOF errorrs and what-not) you can escape them -- \' and \" respectively.

Alternatively, you can use:
Code:

#double quote
u"\u0022"
#single quote (apostrophe)
u"\u0027"

But that just seems overkill :P

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?

ossipena 2010-05-08 06:06

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

Originally Posted by aspidites (Post 648393)
and you are sure you were committing your transactions with sqlite3?

100% certain. my code wrote to table and immediately read it. then the new line was there but when i opened conversations -nothing.

it appears there must be a dbus signal emitted etc so using api seems to be the only choice....

aspidites 2010-05-08 06:26

Re: work in progress: simple vertical sms app: vertsms
 
@ossipena: so you ran conn.commit() after your conn.execute() statements and the changes still weren't saved to the database.... odd.

Good luck with ctypes and rtcom API.

[edit]
Just re-read your post. It's possible then that the db table is being written to, but for whatever reason they aren't recongized in conversations? Hmm...

cb22 2010-05-08 13:25

Re: work in progress: simple vertical sms app: vertsms
 
Making some progress with splitting the input handling from the GUI, as I said earlier... There's still a ton of stuff to do, but I've got predictive text actually working, and rather quickly too.

Unfortunately, the way I'm doing things, it adds quite a considerable startup delay. (Basically, I load the word list into memory, then split it up into smaller lists according to the length of each word. This allows really fast lookups (no delay at all, just like a normal phone) at the expense of a longer startup time. I'm sure there is a better way of doing this, but it will work for now.

Also, backspacing doesn't work (yet) and the dictionary is unordered... Meaning that if you want "are" and type "2-7-3", you will actually get "ape". Not very helpful :)

On a related note, Gitorious is rather cool...

Repo's at http://gitorious.org/~cb22/vertsms/cb22-vertsms

Moolan 2010-05-08 13:48

Re: work in progress: simple vertical sms app: vertsms
 
Tapping quickly does not register the keys, is this a bug or hardware limitation

ossipena 2010-05-08 14:03

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

Originally Posted by Moolan (Post 649319)
Tapping quickly does not register the keys, is this a bug or hardware limitation

it probably is software limitation far beyond my reach. the app writes based to hildon button pressed -event. so not registering : button doesn't register the action so improvements should be done to hildon button I quess.

kylepsp 2010-05-08 14:08

Re: work in progress: simple vertical sms app: vertsms
 
In the phone app it works fine, so the software can handle it.

ossipena 2010-05-08 14:09

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

Originally Posted by aspidites (Post 648966)
@ossipena: so you ran conn.commit() after your conn.execute() statements and the changes still weren't saved to the database.... odd.

Good luck with ctypes and rtcom API.

[edit]
Just re-read your post. It's possible then that the db table is being written to, but for whatever reason they aren't recongized in conversations? Hmm...

good that you are so determined:

i had the commit but it had one frigging # in front of it ;)

now it appears to conversations. device gets real laggy but I'll put that and let people test it. if there are problems, I'll get back to api but now I am doing it via sqlite.

e: just pushed the version that stores the message to git. I'll inform mohammadag that he can make ver 0.2 from current source.

next challenge for me: implementing better backspace. I already have a way to do it, need only to customize variable names etc. after that probably sending to multiple contacts

mikec 2010-05-08 14:34

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

Originally Posted by ossipena (Post 649333)
it probably is software limitation far beyond my reach. the app writes based to hildon button pressed -event. so not registering : button doesn't register the action so improvements should be done to hildon button I quess.

Ossi I wonder if this is the same type of problem I had with Qt. ie fast double taps are interpreted as double click action in hildon.

see here

http://talk.maemo.org/showthread.php?t=52174

juven69 2010-05-08 15:25

Re: work in progress: simple vertical sms app: vertsms
 
SOMEONE HELP ME :((
how i can download that app,,
i can't find the download button :((
pleasseee
thank u

MohammadAG 2010-05-08 17:30

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

Originally Posted by juven69 (Post 649406)
SOMEONE HELP ME :((
how i can download that app,,
i can't find the download button :((
pleasseee
thank u

This is a development thread, refer to http://talk.maemo.org/showpost.php?p=643862&postcount=1

aspidites 2010-05-08 18:29

Re: work in progress: simple vertical sms app: vertsms
 
So continuing with my idea of modularizing the code, I have extracted the SMS classs and PyGObject class into their own modules inside a package called vertsms, and renamed vertsms.py to main.py. This has the following benefits:
  • Since main.py is shorter, it is easier to read*
  • It has allowed me to import my config system that I have written for ultimate-smash-friends
  • Having the forementioned config system means less things have to be hard-coded, and users have more options
  • I've also been able to adapt a plugin system from another project !

The last point is especially interesting albiet unfinished (I'm hoping to be done within the hour). What it means is that people that want to extend vertsms with features but either a) don't want to have to download the source from git, b) are still waiting to have their patches accepted or c) have wishes that only suit them can do so via a plugin.

I'm currently writing a plugin mount called KeyLayout. What does this mean? QWERTY layouts, or simple button arrangements are now possible. If I ever get this bad boy implemented fully, I'll post screenshots with accompanying plugin code (btw, which would just sit in a plugin directory of your choosing).

@ossipena: I can't help but think I'm over-stepping my bounds here. Should I just back off, or would these be welcome changes?

* my subjective opinion -- I do that a lot, huh?

MohammadAG 2010-05-08 18:48

Re: work in progress: simple vertical sms app: vertsms
 
I'll have my opinion on that post, but don't let it affect the decision.
"Modularizing" is indeed a good thing to do, it may also help users who're looking to improve the code/learn from it as an example to know where the should be looking. It also, as you said, shortens the main file.
I'd rename vertsms.py to vertsms_gui.py though (I think fMMS follows that way - and I like it best)
Importing modules when they're needed also reduces the resources needed to start the app.
It wouldn't affect packaging, some minor changes to the .desktop file, py_compilefiles currently runs on all *.py file so again it shouldn't matter.

Again, just my opinion :)

aspidites 2010-05-08 18:51

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

Originally Posted by MohammadAG (Post 649672)
I'd rename vertsms.py to vertsms_gui.py though (I think fMMS follows that way - and I like it best)
Again, just my opinion :)

Perhaps vertsms_gtk.py ? Nah, a lot of stuff is coupled tightly with gtk so vertsms_gui.py it is :-)

ossipena 2010-05-08 22:22

Re: work in progress: simple vertical sms app: vertsms
 
I am so close but no cigar.

how in the hell can I add
RTCOM_EL_EVENT_SET_FIELD
to RTComEl -object with python?!?
example in C
Code:

RTComElEvent *ev = rtcom_el_event_new ();
RTCOM_EL_EVENT_SET_FIELD (ev, service, “RTCOM_EL_SERVICE_SMS”);
RTCOM_EL_EVENT_SET_FIELD (ev, event_type, “RTCOM_EL_EVENTTYPE_SMS_INBOUND”);
RTCOM_EL_EVENT_SET_FIELD (ev, is_read, TRUE);
RTCOM_EL_EVENT_SET_FIELD (ev, local_uid, “ring/tel/ring”);
RTCOM_EL_EVENT_SET_FIELD (ev, remote_uid, “+123456”);
RTCOM_EL_EVENT_SET_FIELD (ev, start_time, time(NULL));
RTCOM_EL_EVENT_SET_FIELD (ev, remote_ebook_uid, 1);
RTCOM_EL_EVENT_SET_FIELD (ev, free_text, “Hello World”);

rtcom_el_add_event (el, ev, NULL);
rtcom_el_event_free (ev);

my python code
Code:

dbstring = rtcomm_eventlogger.rtcom_el_new()

dbstring.RTCOM_EL_EVENT_SET_FIELD (ev, service, “RTCOM_EL_SERVICE_SMS”)
rtcomm_eventlogger.RTCOM_EL_EVENT_SET_FIELD (ev, event_type, “RTCOM_EL_EVENTTYPE_SMS_INBOUND”)
rtcomm_eventlogger.RTCOM_EL_EVENT_SET_FIELD (ev, is_read, TRUE)
rtcomm_eventlogger.RTCOM_EL_EVENT_SET_FIELD(ev, local_uid, “ring/tel/ring”)
rtcomm_eventlogger.RTCOM_EL_EVENT_SET_FIELD(ev, remote_uid, number)
rtcomm_eventlogger.RTCOM_EL_EVENT_SET_FIELD (ev, start_time, time(NULL));
rtcomm_eventlogger.RTCOM_EL_EVENT_SET_FIELD (ev, remote_ebook_uid, 1);
rtcomm_eventlogger.RTCOM_EL_EVENT_SET_FIELD (ev, free_text, “Hello World”);

rtcomm_eventlogger.rtcom_el_add_event (el, dbstring, NULL);
rtcomm_eventlogger.rtcom_el_event_free (dbstring);

yes there is typo with rtcomm and no matter if I use rtcomm_eventlogger.RTCOM.... or
dbstring.RTCOM....

what am I doing wrong?!?

e: got a step further. error is now
AttributeError: /usr/lib/librtcom-eventlogger.so.0.0.0: undefined symbol: RTCOM_EL_EVENT_SET_FIELD

do I need something besides the eventlogger via ctypes?

ossipena 2010-05-08 22:36

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

Originally Posted by aspidites (Post 649652)
So continuing with my idea of modularizing the code, I have extracted the SMS classs and PyGObject class into their own modules inside a package called vertsms, and renamed vertsms.py to main.py. This has the following benefits:
  • Since main.py is shorter, it is easier to read*
  • It has allowed me to import my config system that I have written for ultimate-smash-friends
  • Having the forementioned config system means less things have to be hard-coded, and users have more options
  • I've also been able to adapt a plugin system from another project !

The last point is especially interesting albiet unfinished (I'm hoping to be done within the hour). What it means is that people that want to extend vertsms with features but either a) don't want to have to download the source from git, b) are still waiting to have their patches accepted or c) have wishes that only suit them can do so via a plugin.

I'm currently writing a plugin mount called KeyLayout. What does this mean? QWERTY layouts, or simple button arrangements are now possible. If I ever get this bad boy implemented fully, I'll post screenshots with accompanying plugin code (btw, which would just sit in a plugin directory of your choosing).

@ossipena: I can't help but think I'm over-stepping my bounds here. Should I just back off, or would these be welcome changes?

* my subjective opinion -- I do that a lot, huh?

just keep going!

the code was good for one file in released version 0.1
now it is so big jungle that I concidered splitting it myself.

I am trying to find time merging your contributions to master repo in near future.

aspidites 2010-05-08 22:39

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

Originally Posted by ossipena (Post 649849)
just keep going!

the code was good for one file in released version 0.1
now it is so big jungle that I concidered splitting it myself.

I am trying to find time merging your contributions to master repo in near future.

Hold off until I submit a request. I still need to backport your changes (conversation database, etc). Glad to hear I got your stamp of approval though :-)

qwerty12 2010-05-08 23:05

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

Originally Posted by ossipena (Post 649835)
how in the hell can I add
RTCOM_EL_EVENT_SET_FIELD
to RTComEl -object with python?!?

RTCOM_EL_EVENT_SET_FIELD isn't a function so it won't appear in any library - it's a macro that is processed and replaced in C apps by the preprocessor before it gets compiled.

event.h defines it thus:
Code:

#define RTCOM_EL_EVENT_SET_FIELD(ev, FIELD, value) \
    do {\
        (ev)->_mask |= _is_set_ ## FIELD; \
        (ev)->fld_ ## FIELD = value;\
    } while(0)

So, looking at the line "rtcomm_eventlogger.RTCOM_EL_EVENT_SET_FIELD (ev, is_read, TRUE)", you'd want to do, instead, something like:
ev._mask |= _is_set_is_read
ev.fld_is_read = True

Something like that anyway, I'm pretty **** at all this :)

P.S. Rtcomm-eventlogger source may help

Gah, after waking up: it's a struct, so you may need to define it in ctypes...

Hariainm 2010-05-08 23:44

Re: work in progress: simple vertical sms app: vertsms
 
why i can't type nothing in the address bar? adding a contact number with the "To" button works fine, but when i want to type the number in it, the app automatically writes in the main box? :-(

ossipena 2010-05-10 06:52

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

Originally Posted by Hariainm (Post 649895)
why i can't type nothing in the address bar? adding a contact number with the "To" button works fine, but when i want to type the number in it, the app automatically writes in the main box? :-(

because the whole portrait text input has been written from zero because there isn't any in N900/M5 by default. So in order to get the first version out asap, there is helluva compromises to be made.

will be fixed as soon as I merge major changes to my code etc..

InoHacker 2010-05-10 19:48

Re: work in progress: simple vertical sms app: vertsms
 
It maybe intresting somebody, for example russian user, here russian edition version for VertSms. Changes:
1. Russian number (ex. +7(code)1234567 and 8(code)1234567) work correctly.
2. Russian interface and ability to send messages to Russian
http://s04.radikal.ru/i177/1005/63/f7ccad7b9051.jpg

This post in this topic, because i develope this edition. If i mistake, i'am very sorry.

And i'am sorry for my bad english :eek:


All times are GMT. The time now is 20:52.

vBulletin® Version 3.8.8